[SERVER-7794] mongod terminates on invalid s2d query Created: 29/Nov/12  Updated: 11/Jul/16  Resolved: 07/Dec/12

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

Type: Bug Priority: Major - P3
Reporter: Aaron Staple Assignee: hari.khalsa@10gen.com
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File geo_s2edgecases.js    
Operating System: ALL
Participants:

 Description   

It looks like the s2index.cpp code throws "new UserException" while most mongo code like uasserted() throws "UserException" and the higher level try/catch block for each operation cannot handle the former.

Test

c = db.c;
c.drop();
 
c.ensureIndex( { loc:'s2d', x:1 } );
c.save( { loc:[ 0, 0 ] } );
 
// Should uassert instead of causing process to terminate.
c.count( { loc:{ $foo:[ 0, 0 ] } } );

Output

./mongod --help for help and startup options
Thu Nov 29 02:47:50.836 [initandlisten] MongoDB starting : pid=23157 port=27017 dbpath=/data/db/ 64-bit host=fedora
Thu Nov 29 02:47:50.836 [initandlisten]
Thu Nov 29 02:47:50.836 [initandlisten] ** NOTE: This is a development version (2.3.2-pre-) of MongoDB.
Thu Nov 29 02:47:50.836 [initandlisten] **       Not recommended for production.
Thu Nov 29 02:47:50.836 [initandlisten]
Thu Nov 29 02:47:50.836 [initandlisten] db version v2.3.2-pre-, pdfile version 4.5
Thu Nov 29 02:47:50.837 [initandlisten] git version: e4ee5568d96dc08115b88c1d91fbdc07fadd3bf0
Thu Nov 29 02:47:50.837 [initandlisten] build info: Linux fedora 3.3.4-5.fc17.x86_64 #1 SMP Mon May 7 17:29:34 UTC 2012 x86_64 BOOST_LIB_VERSION=1_49
Thu Nov 29 02:47:50.837 [initandlisten] options: {}
Thu Nov 29 02:47:50.855 [initandlisten] journal dir=/data/db/journal
Thu Nov 29 02:47:50.855 [initandlisten] recover : no journal files present, no recovery needed
Thu Nov 29 02:47:50.964 [initandlisten] waiting for connections on port 27017
Thu Nov 29 02:47:50.965 [websvr] admin web console waiting for connections on port 28017
Thu Nov 29 02:47:56.955 [initandlisten] connection accepted from 127.0.0.1:47405 #1 (1 connection now open)
Thu Nov 29 02:47:56.970 [conn1] CMD: drop test.c
Thu Nov 29 02:47:56.988 [conn1] build index test.c { _id: 1 }
Thu Nov 29 02:47:56.990 [conn1] build index done.  scanned 0 total records. 0.001 secs
Thu Nov 29 02:47:56.990 [conn1] info: creating collection test.c on add index
Thu Nov 29 02:47:56.990 [conn1] build index test.c { loc: "s2d", x: 1.0 }
Thu Nov 29 02:47:56.992 [conn1] build index done.  scanned 0 total records. 0.001 secs
Thu Nov 29 02:47:57.015 [conn1] end connection 127.0.0.1:47405 (0 connections now open)
Thu Nov 29 02:48:38.491 [initandlisten] connection accepted from 127.0.0.1:47406 #2 (1 connection now open)
Thu Nov 29 02:48:38.506 [conn2] CMD: drop test.c
Thu Nov 29 02:48:38.525 [conn2] build index test.c { _id: 1 }
Thu Nov 29 02:48:38.527 [conn2] build index done.  scanned 0 total records. 0.001 secs
Thu Nov 29 02:48:38.527 [conn2] info: creating collection test.c on add index
Thu Nov 29 02:48:38.527 [conn2] build index test.c { loc: "s2d", x: 1.0 }
Thu Nov 29 02:48:38.529 [conn2] build index done.  scanned 0 total records. 0.001 secs
Thu Nov 29 02:48:38.545 [conn2] Uncaught exception, terminating
Thu Nov 29 02:48:38.545 dbexit:
Thu Nov 29 02:48:38.545 [conn2] shutdown: going to close listening sockets...
Thu Nov 29 02:48:38.545 [conn2] closing listening socket: 7
Thu Nov 29 02:48:38.545 [conn2] closing listening socket: 9
Thu Nov 29 02:48:38.545 [conn2] closing listening socket: 11
Thu Nov 29 02:48:38.545 [conn2] removing socket file: /tmp/mongodb-27017.sock
Thu Nov 29 02:48:38.545 [conn2] shutdown: going to flush diaglog...
Thu Nov 29 02:48:38.545 [conn2] shutdown: going to close sockets...
Thu Nov 29 02:48:38.545 [conn2] shutdown: waiting for fs preallocator...
Thu Nov 29 02:48:38.545 [conn2] shutdown: lock for final commit...
Thu Nov 29 02:48:38.545 [conn2] shutdown: final commit...
Thu Nov 29 02:48:38.550 [conn2] shutdown: closing all files...
Thu Nov 29 02:48:38.552 [conn2] closeAllFiles() finished
Thu Nov 29 02:48:38.553 [conn2] journalCleanup...
Thu Nov 29 02:48:38.553 [conn2] removeJournalFiles
Thu Nov 29 02:48:38.553 [initandlisten] now exiting
Thu Nov 29 02:48:38.554 dbexit: ; exiting immediately



 Comments   
Comment by auto [ 03/Dec/12 ]

Author:

{u'date': u'2012-12-03T21:11:48Z', u'email': u'hkhalsa@10gen.com', u'name': u'Hari Khalsa'}

Message: SERVER-7794 fix drem impl for windows
Branch: master
https://github.com/mongodb/mongo/commit/420779efd584347fceaf4cc074d7614bf6581654

Comment by Ian Whalen (Inactive) [ 03/Dec/12 ]

latest change appears to be causing an issue on Solaris + Windows:

http://buildlogs.mongodb.org/Solaris-SmartOS%2064-bit/builds/596/test/js/geo_s2edgecases.js (attached)
http://buildbot.mongodb.org/builders/Solaris-SmartOS%2064-bit/builds/596/steps/test_8/logs/stdio
http://buildbot.mongodb.org/builders/Windows%2064-bit/builds/5294/steps/test/logs/stdio
etc.

Comment by auto [ 02/Dec/12 ]

Author:

{u'date': u'2012-12-01T13:45:11Z', u'email': u'hkhalsa@10gen.com', u'name': u'Hari Khalsa'}

Message: SERVER-7794 fix non-string non-geo keys and empty keys for 2dsphere
Branch: master
https://github.com/mongodb/mongo/commit/470d82e7bf89fb9b8bd8f369999a0d5dace122e1

Comment by auto [ 29/Nov/12 ]

Author:

{u'date': u'2012-11-29T19:31:06Z', u'email': u'hkhalsa@10gen.com', u'name': u'Hari Khalsa'}

Message: SERVER-7794 change throw to uasserted
Branch: master
https://github.com/mongodb/mongo/commit/9947386a0c734cbf775384946a45e362f80ca477

Comment by auto [ 29/Nov/12 ]

Author:

{u'date': u'2012-11-29T16:26:12Z', u'email': u'hkhalsa@10gen.com', u'name': u'Hari Khalsa'}

Message: SERVER-7794 don't freeze if no points in s2 near search
Branch: master
https://github.com/mongodb/mongo/commit/7c3744cdeff14a8073e27a8127a3d5154326fd63

Comment by auto [ 29/Nov/12 ]

Author:

{u'date': u'2012-11-29T03:45:13Z', u'email': u'hkhalsa@10gen.com', u'name': u'Hari Khalsa'}

Message: SERVER-7794 don't crash mongod when s2 gets bad input
Branch: master
https://github.com/mongodb/mongo/commit/f14a9e79cf5f9b09dec4758d2d2032ddf47373a3

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