[SERVER-13122] sort stage must ensure validity of key even when sorting parallel arrays Created: 10/Mar/14 Updated: 11/Jul/16 Resolved: 11/Mar/14 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 2.5.5 |
| Fix Version/s: | 2.6.0-rc2 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Steve Duan | Assignee: | hari.khalsa@10gen.com |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
ubuntu |
||
| Operating System: | Linux |
| Participants: |
| Description |
|
I got this assert when doing query and sort. Its random but always show up once a while. My code was doing the following in a loop for testing, I have around 300 documents in my collection:
And I got the following assert once a while:
|
| Comments |
| Comment by Githook User [ 11/Mar/14 ] | |||||||||||||||||||||||||||
|
Author: {u'username': u'hkhalsa', u'name': u'Hari Khalsa', u'email': u'hkhalsa@10gen.com'}Message: | |||||||||||||||||||||||||||
| Comment by hari.khalsa@10gen.com [ 11/Mar/14 ] | |||||||||||||||||||||||||||
|
sduan Thanks for the bug report! A fix and a test are forthcoming. | |||||||||||||||||||||||||||
| Comment by Steve Duan [ 11/Mar/14 ] | |||||||||||||||||||||||||||
|
Thanks for the reply. The collections I used are just some randomly generated documents for testing. Yes there are more than one of the A, B and C fields were arrays. | |||||||||||||||||||||||||||
| Comment by Mathias Stearn [ 10/Mar/14 ] | |||||||||||||||||||||||||||
|
It looks like it is an issue with this function: https://github.com/mongodb/mongo/blob/r2.6.0-rc1/src/mongo/db/exec/sort.cpp#L149-196. In some cases it tries to sort by the whole object rather than errorring out. This can lead to the failure you observed when we try to compare these objects since they are larger than the sort key since the comparison function assumes that the objects to be compared have the same keys as the sort key: https://github.com/mongodb/mongo/blob/r2.6.0-rc1/src/mongo/db/jsobj.cpp#L553. This ticket has now been scheduled for rc2, however, it is likely that the outcome will be that this will still error, but with a more accurate error message. Would it be possible to get a copy of a collection that you are seeing this with, or at least a few objects? In particular, it would be nice to know if more than one of the A, B and C fields will ever be an array. | |||||||||||||||||||||||||||
| Comment by Steve Duan [ 10/Mar/14 ] | |||||||||||||||||||||||||||
|
Thanks, here are some log from mongodb.log:
| |||||||||||||||||||||||||||
| Comment by Andy Schwerin [ 10/Mar/14 ] | |||||||||||||||||||||||||||
|
sduan, when this error occurs, you should also get entries in the server log referencing bsonobjiterator.h. If you can attach logs containing those messages, it will help us diagnose the failure. Also, you might consider running the newest release candidate of MongoDB 2.6, 2.6.0-rc1, available for download in the development release section of http://www.mongodb.org/downloads. There have been numerous stability enhancements, though I don't particularly know of one that involved bsonobjiterator. | |||||||||||||||||||||||||||
| Comment by Steve Duan [ 10/Mar/14 ] | |||||||||||||||||||||||||||
|
I'm using the 2.5.5 version of mongo server Thank you very much! | |||||||||||||||||||||||||||
| Comment by Bernie Hackett [ 10/Mar/14 ] | |||||||||||||||||||||||||||
|
Hi, That error message is from the server itself. What version of MongoDB are you using? |