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

$lt and $lte queries using 'NaN' trigger invalid bounds asserts

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.7.0
    • Affects Version/s: 2.6.0, 2.6.1-rc0
    • Component/s: Querying
    • None
    • Major Change
    • ALL
    • Hide
      db.nan.drop();
      db.nan.ensureIndex({a:1});
      db.nan.find({a: {$lte: NaN}});
      
      Show
      db.nan.drop(); db.nan.ensureIndex({a:1}); db.nan.find({a: {$lte: NaN}});

      Querying for '$lte: NaN' or '$lt: NaN' with an indexed field results in an invalid bounds assert. The assert is not triggered when querying against an unindexed field or when using $gt or $gte.

      Server output:

      2014-04-28T12:21:20.423-0400 [conn1] [QLOG] INVALID BOUNDS: field #0['a']: [-inf.0, nan.0]
      kp = { a: 1.0 }
      scanDir = 1
      2014-04-28T12:21:20.423-0400 [conn1] test.nan Assertion failure 0 src/mongo/db/query/index_bounds_builder.cpp 852
      2014-04-28T12:21:20.426-0400 [conn1] test.nan 0x100793f19 0x10073f09b 0x10072c733 0x100416beb 0x10043f601 0x1004409b7 0x100451bea 0x10040707b 0x1004057ac 0x1004244a8 0x1002cb98a 0x10000dd37 0x10074d641 0x1007cde21 0x7fff93d8b772 0x7fff93d781a1 
       /Users/kk/code/mongo/mongo/./mongod(_ZN5mongo15printStackTraceERSo+0x39) [0x100793f19]
       /Users/kk/code/mongo/mongo/./mongod(_ZN5mongo10logContextEPKc+0x9b) [0x10073f09b]
       /Users/kk/code/mongo/mongo/./mongod(_ZN5mongo12verifyFailedEPKcS1_j+0x1b3) [0x10072c733]
       /Users/kk/code/mongo/mongo/./mongod(_ZN5mongo18IndexBoundsBuilder11alignBoundsEPNS_11IndexBoundsERKNS_7BSONObjEi+0x46b) [0x100416beb]
       /Users/kk/code/mongo/mongo/./mongod(_ZN5mongo18QueryPlannerAccess14finishLeafNodeEPNS_17QuerySolutionNodeERKNS_10IndexEntryE+0x211) [0x10043f601]
       /Users/kk/code/mongo/mongo/./mongod(_ZN5mongo18QueryPlannerAccess22buildIndexedDataAccessERKNS_14CanonicalQueryEPNS_15MatchExpressionEbRKSt6vectorINS_10IndexEntryESaIS7_EE+0xe7) [0x1004409b7]
       /Users/kk/code/mongo/mongo/./mongod(_ZN5mongo12QueryPlanner4planERKNS_14CanonicalQueryERKNS_18QueryPlannerParamsEPSt6vectorIPNS_13QuerySolutionESaIS9_EE+0x31aa) [0x100451bea]
       /Users/kk/code/mongo/mongo/./mongod(_ZN5mongo19getRunnerAlwaysPlanEPNS_10CollectionEPNS_14CanonicalQueryERKNS_18QueryPlannerParamsEPPNS_6RunnerE+0x6b) [0x10040707b]
       /Users/kk/code/mongo/mongo/./mongod(_ZN5mongo9getRunnerEPNS_10CollectionEPNS_14CanonicalQueryEPPNS_6RunnerEm+0x90c) [0x1004057ac]
       /Users/kk/code/mongo/mongo/./mongod(_ZN5mongo11newRunQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_+0x788) [0x1004244a8]
       /Users/kk/code/mongo/mongo/./mongod(_ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE+0x68a) [0x1002cb98a]
       /Users/kk/code/mongo/mongo/./mongod(_ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE+0xb7) [0x10000dd37]
       /Users/kk/code/mongo/mongo/./mongod(_ZN5mongo17PortMessageServer17handleIncomingMsgEPv+0x391) [0x10074d641]
       /Users/kk/code/mongo/mongo/./mongod(thread_proxy+0xb1) [0x1007cde21]
       /usr/lib/system/libsystem_c.dylib(_pthread_start+0x147) [0x7fff93d8b772]
       /usr/lib/system/libsystem_c.dylib(thread_start+0xd) [0x7fff93d781a1]
      2014-04-28T12:21:20.427-0400 [conn1] assertion 0 assertion src/mongo/db/query/index_bounds_builder.cpp:852 ns:test.nan query:{ a: { $lte: nan.0 } }
      

      Version: 1f83b5f5e3ad400fe2de0e7427548cb21a05d751

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            kamran.khan Kamran K.
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: