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

Assertion failure when building haystack index on a field with an empty array

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.7.8
    • Affects Version/s: 2.4.10, 2.6.4, 2.7.5
    • Component/s: Geo
    • ALL
    • Hide
      var t = db.geo_assert;
      t.drop();
      
      t.insert({loc: []});
      t.ensureIndex({loc: 'geoHaystack', z: 1}, {bucketSize: 0.7});
      
      Show
      var t = db.geo_assert; t.drop(); t.insert({loc: []}); t.ensureIndex({loc: 'geoHaystack', z: 1}, {bucketSize: 0.7});

      A haystack index will fail to build if a document in your collection contains a location field that consists of an empty array.

      Shell session:

      > var t = db.geo_assert;
      > t.drop();
      false
      > 
      > t.insert({loc: []});
      WriteResult({ "nInserted" : 1 })
      > t.ensureIndex({loc: 'geoHaystack', z: 1}, {bucketSize: 0.7});
      {
      	"createdCollectionAutomatically" : false,
      	"numIndexesBefore" : 1,
      	"errmsg" : "exception: assertion src/mongo/bson/bsonobjiterator.h:92",
      	"code" : 0,
      	"ok" : 0
      }
      

      Backtrace:

      2014-08-19T21:44:39.345-0400 I          [conn1] Assertion failure _pos <= _theend src/mongo/bson/bsonobjiterator.h 92
      2014-08-19T21:44:39.348-0400 I          [conn1] 
       0x1006cdb4f 0x100683e3e 0x100674721 0x10026f982 0x1002585de 0x100100446 0x100100ab0 0x100125d18 0x1001a8ff7 0x1001a9cc0 0x1001aab13 0x10039615e 0x1002825d5 0x100006427 0x100693639 0x100701c75 0x7fff8d021899 0x7fff8d02172a 0x7fff8d025fc9
      ----- BEGIN BACKTRACE -----
      {"backtrace":[{"b":"100000000","o":"6CDB4F"},{"b":"100000000","o":"683E3E"},{"b":"100000000","o":"674721"},{"b":"100000000","o":"26F982"},{"b":"100000000","o":"2585DE"},{"b":"100000000","o":"100446"},{"b":"100000000","o":"100AB0"},{"b":"100000000","o":"125D18"},{"b":"100000000","o":"1A8FF7"},{"b":"100000000","o":"1A9CC0"},{"b":"100000000","o":"1AAB13"},{"b":"100000000","o":"39615E"},{"b":"100000000","o":"2825D5"},{"b":"100000000","o":"6427"},{"b":"100000000","o":"693639"},{"b":"100000000","o":"701C75"},{"b":"7FFF8D020000","o":"1899"},{"b":"7FFF8D020000","o":"172A"},{"b":"7FFF8D020000","o":"5FC9"}],"processInfo":{ "mongodbVersion" : "2.7.5", "gitVersion" : "2966c35b20416d55c3d481e5f254a9befb1b2338", "uname" : { "sysname" : "Darwin", "release" : "13.2.0", "version" : "Darwin Kernel Version 13.2.0: Thu Apr 17 23:03:13 PDT 2014; root:xnu-2422.100.13~1/RELEASE_X86_64", "machine" : "x86_64" }, "somap" : [ { "path" : "/Users/kk/versions/mongodb-osx-x86_64-2.7.5/bin/mongod", "machType" : 2, "b" : "100000000", "buildId" : "E6E5F5B5D5743FC285848356E6CEF626" }, { "path" : "/usr/lib/libSystem.B.dylib", "machType" : 6, "b" : "7FFF8713E000", "buildId" : "E303F2F8A8CF3DF384B3F2D0EE41CCF6" }, { "path" : "/usr/lib/libstdc++.6.dylib", "machType" : 6, "b" : "7FFF8721D000", "buildId" : "0241E6A4136833BE950BD0A175C41F54" }, { "path" : "/usr/lib/system/libcache.dylib", "machType" : 6, "b" : "7FFF8FA81000", "buildId" : "BDC1E65B72A13DA3A57CB23159CAAD0B" }, { "path" : "/usr/lib/system/libcommonCrypto.dylib", "machType" : 6, "b" : "7FFF93890000", "buildId" : "8C4F0CA0389C3EDCB155E62DD2187E1D" }, { "path" : "/usr/lib/system/libcompiler_rt.dylib", "machType" : 6, "b" : "7FFF878E5000", "buildId" : "4CD916B21B17362AB403EF24A1DAC141" }, { "path" : "/usr/lib/system/libcopyfile.dylib", "machType" : 6, "b" : "7FFF8C30A000", "buildId" : "5A881779D0D63029B371E3021C2DDA5E" }, { "path" : "/usr/lib/system/libcorecrypto.dylib", "machType" : 6, "b" : "7FFF8E2F8000", "buildId" : "F3973C2814B63006BB2B00DD7F09ABC7" }, { "path" : "/usr/lib/system/libdispatch.dylib", "machType" : 6, "b" : "7FFF9102C000", "buildId" : "C4E4A18D3C3B3C9C8709A4270D998DE7" }, { "path" : "/usr/lib/system/libdyld.dylib", "machType" : 6, "b" : "7FFF9246B000", "buildId" : "7C9EC3B7DDE333FF953F4067C743951D" }, { "path" : "/usr/lib/system/libkeymgr.dylib", "machType" : 6, "b" : "7FFF93063000", "buildId" : "3AA8D85DCF003BD3A5A0E28E1A32A6D8" }, { "path" : "/usr/lib/system/liblaunch.dylib", "machType" : 6, "b" : "7FFF8A8B5000", "buildId" : "38D1AB2CA476385F8EA87AB604CA1F89" }, { "path" : "/usr/lib/system/libmacho.dylib", "machType" : 6, "b" : "7FFF878DF000", "buildId" : "1D2910DFC0363A82A3FD44FF73B5FF9B" }, { "path" : "/usr/lib/system/libquarantine.dylib", "machType" : 6, "b" : "7FFF88265000", "buildId" : "7A1A2BCBC03D3A25BFA43E569B2D2C38" }, { "path" : "/usr/lib/system/libremovefile.dylib", "machType" : 6, "b" : "7FFF92853000", "buildId" : "3543F917928E3DB2A2F47AB73B4970EF" }, { "path" : "/usr/lib/system/libsystem_asl.dylib", "machType" : 6, "b" : "7FFF93D3E000", "buildId" : "655FB34352CF3E2FB14DBEBF5AAEF94D" }, { "path" : "/usr/lib/system/libsystem_blocks.dylib", "machType" : 6, "b" : "7FFF8C2A6000", "buildId" : "FB856CD12AEA39078E9B1E54B6827F82" }, { "path" : "/usr/lib/system/libsystem_c.dylib", "machType" : 6, "b" : "7FFF9246F000", "buildId" : "6FD3A4004BB23B95B90CBE6E9D0D78FA" }, { "path" : "/usr/lib/system/libsystem_configuration.dylib", "machType" : 6, "b" : "7FFF876AA000", "buildId" : "4998CB6A9D54390A9F575D1AC53C135C" }, { "path" : "/usr/lib/system/libsystem_dnssd.dylib", "machType" : 6, "b" : "7FFF92079000", "buildId" : "A0B7CF19D9F233D48107A62184C9066E" }, { "path" : "/usr/lib/system/libsystem_info.dylib", "machType" : 6, "b" : "7FFF878B7000", "buildId" : "7D41A156D2853849A2C3C04ADE797D98" }, { "path" : "/usr/lib/system/libsystem_kernel.dylib", "machType" : 6, "b" : "7FFF885A6000", "buildId" : "498AEBD741943CF2AA16D5D03FFBD8C0" }, { "path" : "/usr/lib/system/libsystem_m.dylib", "machType" : 6, "b" : "7FFF8D028000", "buildId" : "B7F0E2E4277733FCA787D6430B630D54" }, { "path" : "/usr/lib/system/libsystem_malloc.dylib", "machType" : 6, "b" : "7FFF93874000", "buildId" : "A695B4E438E9332EA77229D31E3F1385" }, { "path" : "/usr/lib/system/libsystem_network.dylib", "machType" : 6, "b" : "7FFF91BF7000", "buildId" : "8B1E1F1DA5CC3BAE8B1EABC84337A364" }, { "path" : "/usr/lib/system/libsystem_notify.dylib", "machType" : 6, "b" : "7FFF8C2A8000", "buildId" : "52571EC3689437E4946E064B021ED44E" }, { "path" : "/usr/lib/system/libsystem_platform.dylib", "machType" : 6, "b" : "7FFF9386D000", "buildId" : "3C3D3DA832B9324398ECD89B9A1670B3" }, { "path" : "/usr/lib/system/libsystem_pthread.dylib", "machType" : 6, "b" : "7FFF8D020000", "buildId" : "AB498556B555310E9041F67EC9E00E2C" }, { "path" : "/usr/lib/system/libsystem_sandbox.dylib", "machType" : 6, "b" : "7FFF88417000", "buildId" : "B46E4040A8C63EBC91F8F1CB01106614" }, { "path" : "/usr/lib/system/libsystem_stats.dylib", "machType" : 6, "b" : "7FFF8A1F6000", "buildId" : "4E51D5B092A03D0DB90E495A1ED3E391" }, { "path" : "/usr/lib/system/libunc.dylib", "machType" : 6, "b" : "7FFF8BB62000", "buildId" : "62682455186236FE8A047A6B91256438" }, { "path" : "/usr/lib/system/libunwind.dylib", "machType" : 6, "b" : "7FFF92823000", "buildId" : "78DCC3582FC1302EB3950155B47CB547" }, { "path" : "/usr/lib/system/libxpc.dylib", "machType" : 6, "b" : "7FFF88581000", "buildId" : "AB40CD57F4543FD4B41563B3C0D5C624" }, { "path" : "/usr/lib/libobjc.A.dylib", "machType" : 6, "b" : "7FFF87D2A000", "buildId" : "AD7FD984271E30F4A3616B20319EC73B" }, { "path" : "/usr/lib/libauto.dylib", "machType" : 6, "b" : "7FFF914DA000", "buildId" : "F45C36E8B6063886B5B1B6745E757CA8" }, { "path" : "/usr/lib/libc++abi.dylib", "machType" : 6, "b" : "7FFF87869000", "buildId" : "21A807D367323455B77F743E9F916DF0" }, { "path" : "/usr/lib/libc++.1.dylib", "machType" : 6, "b" : "7FFF8E20D000", "buildId" : "4F68DFC5207739A8A449CAC5FDEE7BDE" }, { "path" : "/usr/lib/libDiagnosticMessagesClient.dylib", "machType" : 6, "b" : "7FFF8FFA7000", "buildId" : "4CDB0F7BC0AF3424BC39495696F0DB1E" } ] }}
       mongod(_ZN5mongo15printStackTraceERSo+0x2F) [0x1006cdb4f]
       mongod(_ZN5mongo10logContextEPKc+0xAE) [0x100683e3e]
       mongod(_ZN5mongo12verifyFailedEPKcS1_j+0x131) [0x100674721]
       mongod(_ZN5mongo21ExpressionKeysPrivate15getHaystackKeysERKNS_7BSONObjERKSsRKSt6vectorISsSaISsEEdPSt3setIS1_NS_10BSONObjCmpESaIS1_EE+0x16C) [0x10026f982]
       mongod(_ZN5mongo26BtreeBasedBulkAccessMethod6insertEPNS_16OperationContextERKNS_7BSONObjERKNS_7DiskLocERKNS_19InsertDeleteOptionsEPx+0x3C) [0x1002585de]
       mongod(_ZN5mongo15MultiIndexBlock6insertERKNS_7BSONObjERKNS_7DiskLocE+0x74) [0x100100446]
       mongod(_ZN5mongo15MultiIndexBlock30insertAllDocumentsInCollectionEPSt3setINS_7DiskLocESt4lessIS2_ESaIS2_EE+0x1C6) [0x100100ab0]
       mongod(_ZN5mongo14CmdCreateIndex3runEPNS_16OperationContextERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb+0x1062) [0x100125d18]
       mongod(_ZN5mongo12_execCommandEPNS_16OperationContextEPNS_7CommandERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb+0x37) [0x1001a8ff7]
       mongod(_ZN5mongo7Command11execCommandEPNS_16OperationContextEPS0_RNS_6ClientEiPKcRNS_7BSONObjERNS_14BSONObjBuilderEb+0xA14) [0x1001a9cc0]
       mongod(_ZN5mongo12_runCommandsEPNS_16OperationContextEPKcRNS_7BSONObjERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi+0x5B3) [0x1001aab13]
       mongod(_ZN5mongo11newRunQueryEPNS_16OperationContextERNS_7MessageERNS_12QueryMessageERNS_5CurOpES3_+0x6DE) [0x10039615e]
       mongod(_ZN5mongo16assembleResponseEPNS_16OperationContextERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE+0x1AC5) [0x1002825d5]
       mongod(_ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE+0x127) [0x100006427]
       mongod(_ZN5mongo17PortMessageServer17handleIncomingMsgEPv+0x689) [0x100693639]
       mongod(thread_proxy+0xE5) [0x100701c75]
       libsystem_pthread.dylib(_pthread_body+0x8A) [0x7fff8d021899]
       libsystem_pthread.dylib(_pthread_struct_init+0x0) [0x7fff8d02172a]
       libsystem_pthread.dylib(thread_start+0xD) [0x7fff8d025fc9]
      -----  END BACKTRACE  -----
      

            Assignee:
            greg_10gen Greg Studer
            Reporter:
            kamran.khan Kamran K.
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: