[SERVER-8645] verify assertion on attempt to query against a geo haystack indexed field Created: 21/Feb/13  Updated: 07/Dec/15  Resolved: 07/Dec/15

Status: Closed
Project: Core Server
Component/s: Geo
Affects Version/s: 2.0.8, 2.2.2, 2.3.2
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Aaron Staple Assignee: Unassigned
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

Attempting a non haystack query against a field indexed by a haystack index triggers a verify assertion.

Test

c = db.c;
c.drop();
c.ensureIndex( { pos : "geoHaystack", type : 1 }, { bucketSize : 1 } );
printjson( c.find( { pos:4 } ).explain( true ) );

Result

Wed Feb 20 16:42:36.140 [conn2]  test.c Assertion failure 0 src/mongo/db/geo/haystack.cpp 178
0x1064cbc55 0x10648f16b 0x10646d829 0x105f75e1a 0x10617c21e 0x106198f09 0x10619b8f7 0x10619bc34 0x10607d7bd 0x106082a3d 0x105fdd94b 0x105fe11d4 0x105be52bf 0x1064b0910 0x1064aeee1 0x1064aef46 0x1064aef81 0x106541439 0x7fff8514f8bf 0x7fff85152b75 
 0   mongod                              0x00000001064cbc55 _ZN5mongo15printStackTraceERSo + 37
 1   mongod                              0x000000010648f16b _ZN5mongo10logContextEPKc + 123
 2   mongod                              0x000000010646d829 _ZN5mongo12verifyFailedEPKcS1_j + 409
 3   mongod                              0x0000000105f75e1a _ZNK5mongo22GeoHaystackSearchIndex9newCursorERKNS_7BSONObjES3_i + 78
 4   mongod                              0x000000010617c21e _ZNK5mongo9QueryPlan9newCursorERKNS_7DiskLocEb + 364
 5   mongod                              0x0000000106198f09 _ZN5mongo15CursorGenerator16singlePlanCursorEv + 573
 6   mongod                              0x000000010619b8f7 _ZN5mongo15CursorGenerator8generateEv + 161
 7   mongod                              0x000000010619bc34 _ZN5mongo25NamespaceDetailsTransient9getCursorERKNS_10StringDataERKNS_7BSONObjES6_RKNS_24QueryPlanSelectionPolicyERKN5boost10shared_ptrIKNS_11ParsedQueryEEEbPNS_16QueryPlanSummaryE + 188
 8   mongod                              0x000000010607d7bd _ZN5mongo23queryWithQueryOptimizerEiRKSsRKNS_7BSONObjERNS_5CurOpES4_S4_RKN5boost10shared_ptrINS_11ParsedQueryEEES4_RKNS_12ChunkVersionERNS7_10scoped_ptrINS_25PageFaultRetryableSectionEEERNSG_INS_19NoPageFaultsAllowedEEERNS_7MessageE + 605
 9   mongod                              0x0000000106082a3d _ZN5mongo8runQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_ + 7453
 10  mongod                              0x0000000105fdd94b _ZN5mongoL13receivedQueryERNS_6ClientERNS_10DbResponseERNS_7MessageE + 1131
 11  mongod                              0x0000000105fe11d4 _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE + 1060
 12  mongod                              0x0000000105be52bf _ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE + 261
 13  mongod                              0x00000001064b0910 _ZN5mongo17PortMessageServer17handleIncomingMsgEPv + 2384
 14  mongod                              0x00000001064aeee1 _ZN5boost3_bi5list1INS0_5valueIPN5mongo17PortMessageServer22HandleIncomingMsgParamEEEEclIPvPFSA_SA_ENS0_5list0EEET_NS0_4typeISE_EERT0_RT1_l + 79
 15  mongod                              0x00000001064aef46 _ZN5boost3_bi6bind_tIPvPFS2_S2_ENS0_5list1INS0_5valueIPN5mongo17PortMessageServer22HandleIncomingMsgParamEEEEEEclEv + 82
 16  mongod                              0x00000001064aef81 _ZN5boost6detail11thread_dataINS_3_bi6bind_tIPvPFS4_S4_ENS2_5list1INS2_5valueIPN5mongo17PortMessageServer22HandleIncomingMsgParamEEEEEEEE3runEv + 37
 17  mongod                              0x0000000106541439 thread_proxy + 169
 18  libsystem_c.dylib                   0x00007fff8514f8bf _pthread_start + 335
 19  libsystem_c.dylib                   0x00007fff85152b75 thread_start + 13
Wed Feb 20 16:42:36.178 [conn2] assertion 0 assertion src/mongo/db/geo/haystack.cpp:178 ns:test.c query:{ query: { pos: 4.0 }, $explain: true }
Wed Feb 20 16:42:36.178 [conn2] problem detected during query over test.c : { $err: "assertion src/mongo/db/geo/haystack.cpp:178" }



 Comments   
Comment by David Storch [ 07/Dec/15 ]

The test case no longer triggers this assertion against recent versions of the server. This was likely fixed as part of improvements to geospatial search and the query engine during the 2.5 or 2.7 development cycles. Closing as Gone Away.

Comment by Robert Stewart [ 30/Apr/13 ]

What makes this issue a little more annoying is that the assertion happens if you query on the non-location key, as well.

I've got an index where the key is:

"key" : {
	"loc" : "geoHaystack",
	"pm" : 1
}

and a simple query on pm fails.

> db.priceables_6.find({pm: 6757})
error: { "$err" : "assertion src/mongo/db/geo/haystack.cpp:178" }

The only way I can now query on the second part of this key is to include it in another index in such a way that my queries use the other index.

Generated at Thu Feb 08 03:17:59 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.