[SERVER-19713] verify() failure when specifying $minDistance or $maxDistance without geoNear operator Created: 02/Aug/15  Updated: 19/Sep/15  Resolved: 06/Aug/15

Status: Closed
Project: Core Server
Component/s: Geo, Querying
Affects Version/s: 2.6.0
Fix Version/s: 3.1.7

Type: Bug Priority: Major - P3
Reporter: Kamran K. Assignee: Qingyang Chen
Resolution: Done Votes: 0
Labels: 32qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-19783 Query parser does not correctly handl... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

This bug has been present since at least 2.6.10. It's not reproducible with 2.4.12.

Repro script:

var t = db.geo_verify_failure;
t.drop();
 
// Create the namespace with an insert
t.insert({a: 1});
// There's an assertion failure with $minDistance too
t.find({a: {$maxDistance: {}}}).itcount();


Server output:

Assertion failure BSONObj::opNEAR == type src/mongo/db/matcher/expression_parser_geo.cpp 66


Backtrace:

#0  0x00007ffff6fa020b in raise (sig=5) at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:37
#1  0x000000000239a84e in mongo::breakpoint () at src/mongo/util/debugger.cpp:58
#2  0x000000000238aae5 in mongo::verifyFailed (expr=0x2e23317 "BSONObj::opNEAR == type", file=0x2e232e8 "src/mongo/db/matcher/expression_parser_geo.cpp", line=66) at src/mongo/util/assert_util.cpp:140
#3  0x0000000001dbc396 in mongo::expressionParserGeoCallbackReal (name=0x7fffb4005f89 "a", type=21, section=...) at src/mongo/db/matcher/expression_parser_geo.cpp:66
#4  0x0000000001dbb441 in std::_Function_handler<mongo::StatusWith<std::unique_ptr<mongo::MatchExpression, std::default_delete<mongo::MatchExpression> > > (char const*, int, mongo::BSONObj const&), mongo::StatusWith<std::unique_ptr<mongo::MatchExpression, std::default_delete<mongo::MatchExpression> > > (*)(char const*, int, mongo::BSONObj const&)>::_M_invoke(std::_Any_data const&, char const*, int, mongo::BSONObj const&) (__functor=..., __args#0=0x7fffb4005f89 "a", __args#1=21, __args#2=...) at /usr/include/c++/4.8/functional:2057
#5  0x0000000001db6593 in std::function<mongo::StatusWith<std::unique_ptr<mongo::MatchExpression, std::default_delete<mongo::MatchExpression> > > (char const*, int, mongo::BSONObj const&)>::operator()(char const*, int, mongo::BSONObj const&) const (this=0x3970da0 <mongo::expressionParserGeoCallback>, __args#0=0x7fffb4005f89 "a", __args#1=21, __args#2=...) at /usr/include/c++/4.8/functional:2471
#6  0x0000000001dafa5c in mongo::MatchExpressionParser::_parseSub (this=0x7ffff43f66e0, name=0x7fffb4005f89 "a", sub=..., root=0x7fffb4004400, level=2) at src/mongo/db/matcher/expression_parser.cpp:427
#7  0x0000000001daf042 in mongo::MatchExpressionParser::_parse (this=0x7ffff43f66e0, obj=..., level=1) at src/mongo/db/matcher/expression_parser.cpp:363
#8  0x0000000001b2d0fa in mongo::MatchExpressionParser::parse (obj=..., whereCallback=...) at src/mongo/db/matcher/expression_parser.h:70
#9  0x0000000001e9e711 in mongo::CanonicalQuery::canonicalize (lpq=0x7fffb40042f0, whereCallback=...) at src/mongo/db/query/canonical_query.cpp:218
#10 0x0000000001e9e63d in mongo::CanonicalQuery::canonicalize (qm=..., whereCallback=...) at src/mongo/db/query/canonical_query.cpp:208
#11 0x0000000001eae2f3 in mongo::runQuery (txn=0x7ffff43f7690, q=..., nss=..., result=...) at src/mongo/db/query/find.cpp:494
#12 0x0000000001d8b449 in mongo::receivedQuery (txn=0x7ffff43f7690, nss=..., c=..., dbResponse=..., m=...) at src/mongo/db/instance.cpp:377
#13 0x0000000001d8bd84 in mongo::assembleResponse (txn=0x7ffff43f7690, m=..., dbresponse=..., remote=...) at src/mongo/db/instance.cpp:505
#14 0x0000000001a2bc0d in mongo::MyMessageHandler::process (this=0x3a3ee20, m=..., port=0x39f6af0) at src/mongo/db/db.cpp:165
#15 0x00000000023ad2e3 in mongo::PortMessageServer::handleIncomingMsg (arg=0x39f6af0) at src/mongo/util/net/message_server_port.cpp:229
#16 0x00007ffff6f98182 in start_thread (arg=0x7ffff43f8700) at pthread_create.c:312
#17 0x00007ffff6cc547d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111


Version: 928a5cf91c162ec0c56f32658454a7193de70509



 Comments   
Comment by Githook User [ 06/Aug/15 ]

Author:

{u'username': u'coollog', u'name': u'Qingyang Chen', u'email': u'qingyang.chen@10gen.com'}

Message: SERVER-19713 $maxDistance should not be able to take a BSONObj
Branch: master
https://github.com/mongodb/mongo/commit/826bdb4c161faf9ac28592cb5b70554251a2dc86

Comment by David Storch [ 06/Aug/15 ]

Affects all 2.6.x and 3.0.x versions.

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