Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-7794

mongod terminates on invalid s2d query

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.3.2
    • Affects Version/s: None
    • Component/s: Geo
    • None
    • ALL

      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
      

        1. geo_s2edgecases.js
          39 kB
          Ian Whalen

            Assignee:
            hari.khalsa@10gen.com hari.khalsa@10gen.com
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: