[CDRIVER-2100] SegFault in 1.6.1 when 'dispose cursor' after doing a find on a $or or $and query Created: 27/Mar/17 Updated: 28/Mar/17 Resolved: 28/Mar/17 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | libbson, libmongoc |
| Affects Version/s: | 1.6.1 |
| Fix Version/s: | 1.6.1 |
| Type: | Bug | Priority: | Critical - P2 |
| Reporter: | Kent Lendrum | Assignee: | A. Jesse Jiryu Davis |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | Bug, driver | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Linux, CentOS |
||
| Issue Links: |
|
||||||||
| Description |
|
I'm experiencing a segfault, whenever I do a query which involves a $or or $and. If I do a 'count()', then it's returning the correct number of records, but when I do a 'find', then I get a segfault when attempting to dispose the returned cursor. LastError returns NoError. Sample logging; , { "token" : "ALL" } ] } Below is the code aspect for form this query. If I do a simpler query: eg. { "sequence": { "$gt": 123456 }} then working as expected. It's only when I try something like: { "$or" : [ { or { "$and" : [ { The query is valid as far as I can tell - returning a 'count' of records in mongoc and also in MongoHub (for OS X) -------------------------------------------
Aspects of Mongo class that is called
|
| Comments |
| Comment by A. Jesse Jiryu Davis [ 28/Mar/17 ] |
|
Thanks Kent, when I run similar code on my system, with empty strings as keys, I can't reproduce the crash. |
| Comment by Kent Lendrum [ 27/Mar/17 ] |
|
Hi, Sorry - I don't know the answer to that. I'm using a mixture of C / C++ on a Linux Machine running latest version of CentOS. In my project, I'm including: #include <mongoc.h> I downloaded the 'mongo-c-driver-1.6.1.tar.gz Unzipped, ./configure, make and finally make install. I then compiled my project, pointing to the compiled projects. during initialisation, I print the MONGOC_VERSION_S to console, and it reports 1.6.1 Does this answer your question ? Kent. |
| Comment by A. Jesse Jiryu Davis [ 27/Mar/17 ] |
|
Thanks, was it |
| Comment by Kent Lendrum [ 27/Mar/17 ] |
|
Hi, Okay - after submitting this request - I managed to resolve it. This morning, I've played some more and have managed to track the issue down to the way I created the BSON Document. So, I believe there are two issues here: 1) Using a bson_append_document_begin with a "" tag, causes the 'Find' to break. 2) After executing a 'find' with a Empty key in the BSON, the 'mongo_cursor_destroy' causes a 'SIGSEGV' Let me know if you need more information. thanks Kent. --------------------------------- Then, when I do the 'Find', I get: However - if I do this: Then, when I do the Find, I get: Interestingly - when I do a 'Count' - then I don't get an issue. It's only if I do a 'Find' that I then get the error. After I received this error - if I then called 'mongoc_cursor_destroy' it would cause a 'SIGSEGV' ---------------------------------------------------------------------------------------------------------------------- |
| Comment by A. Jesse Jiryu Davis [ 27/Mar/17 ] |
|
Hi, I'm not able to debug your C++ program, but if you can reproduce this bug using only C code and the C Driver then we can diagnose it. |