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

Race condition in CurOp constructor (<=3.0 only)

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.0.9
    • Affects Version/s: None
    • Component/s: Concurrency
    • None
    • Fully Compatible
    • ALL
    • Integration F (02/01/16)

      CurOp adds itself to the Client's stack before it has finished initializing itself without any locking. This was fixed for 3.2 and later by a refactoring: https://github.com/mongodb/mongo/commit/22e46bcc813a09d62f45f0779188930ee8d31b9a#diff-56ff68d4399e2a442469697b45f014c4R233.

      One of the many ways this can manifest is the following error when a user (or test) runs db.currentOp():

      2016-01-13T22:43:41.142+0000 I -        [conn64] Assertion: 16141:cannot translate opcode -1094795586
      2016-01-13T22:43:41.147+0000 I CONTROL  [conn64] 
       0x911865 0x27a703a 0x260c7b0 0x25cf74d 0x25cf283 0xe19a6b 0x1124dba 0x112bf3f 0x144dd0a 0x97390e 0x264abac 0x7fca077d9182 0x7fca065a647d
      ----- BEGIN BACKTRACE -----
      {"backtrace":[{"b":"400000","o":"511865","s":"__interceptor_backtrace"},{"b":"400000","o":"23A703A","s":"_ZN5mongo15printStackTraceERSo"},{"b":"400000","o":"220C7B0","s":"_ZN5mongo10logContextEPKc"},{"b":"400000","o":"21CF74D","s":"_ZN5mongo11msgassertedEiPKc"},{"b":"400000","o":"21CF283"},{"b":"400000","o":"A19A6B","s":"_ZN5mongo10opToStringEi"},{"b":"400000","o":"D24DBA","s":"_ZN5mongo5CurOp11reportStateEPNS_14BSONObjBuilderE"},{"b":"400000","o":"D2BF3F","s":"_ZN5mongo9inProgCmdEPNS_16OperationContextERNS_7MessageERNS_10DbResponseE"},{"b":"400000","o":"104DD0A","s":"_ZN5mongo16assembleResponseEPNS_16OperationContextERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE"},{"b":"400000","o":"57390E","s":"_ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE"},{"b":"400000","o":"224ABAC","s":"_ZN5mongo17PortMessageServer17handleIncomingMsgEPv"},{"b":"7FCA077D1000","o":"8182"},{"b":"7FCA064AC000","o":"FA47D","s":"clone"}],"processInfo":{ "mongodbVersion" : "3.0.8-34-g1d26b77", "gitVersion" : "1d26b77d115eb39f03dffbdbaccf10e696cd4fe3", "uname" : { "sysname" : "Linux", "release" : "3.13.0-24-generic", "version" : "#46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014", "machine" : "x86_64" }, "somap" : [ { "elfType" : 2, "b" : "400000", "buildId" : "954327E0FFBECC6B5B3F1E375EEA85DDFF4B635F" }, { "b" : "7FFFA986F000", "elfType" : 3, "buildId" : "6755FAD2CADACDF1667E5B57FF1EDFC28DD1C976" }, { "b" : "7FCA079EF000", "path" : "/lib/x86_64-linux-gnu/libm.so.6", "elfType" : 3, "buildId" : "1D76B71E905CB867B27CEF230FCB20F01A3178F5" }, { "b" : "7FCA077D1000", "path" : "/lib/x86_64-linux-gnu/libpthread.so.0", "elfType" : 3, "buildId" : "9318E8AF0BFBE444731BB0461202EF57F7C39542" }, { "b" : "7FCA07572000", "path" : "/lib/x86_64-linux-gnu/libssl.so.1.0.0", "elfType" : 3, "buildId" : "D08DD65F97859C71BB2CBBF1043BD968EFE18AAD" }, { "b" : "7FCA07197000", "path" : "/lib/x86_64-linux-gnu/libcrypto.so.1.0.0", "elfType" : 3, "buildId" : "F86FA9FB4ECEB4E06B40DBDF761A4172B70A4229" }, { "b" : "7FCA06F8F000", "path" : "/lib/x86_64-linux-gnu/librt.so.1", "elfType" : 3, "buildId" : "92FCF41EFE012D6186E31A59AD05BDBB487769AB" }, { "b" : "7FCA06D8B000", "path" : "/lib/x86_64-linux-gnu/libdl.so.2", "elfType" : 3, "buildId" : "C1AE4CB7195D337A77A3C689051DABAA3980CA0C" }, { "b" : "7FCA06A87000", "path" : "/usr/lib/x86_64-linux-gnu/libstdc++.so.6", "elfType" : 3, "buildId" : "4BF6F7ADD8244AD86008E6BF40D90F8873892197" }, { "b" : "7FCA06871000", "path" : "/lib/x86_64-linux-gnu/libgcc_s.so.1", "elfType" : 3, "buildId" : "8D0AA71411580EE6C08809695C3984769F25725B" }, { "b" : "7FCA064AC000", "path" : "/lib/x86_64-linux-gnu/libc.so.6", "elfType" : 3, "buildId" : "30C94DC66A1FE95180C3D68D2B89E576D5AE213C" }, { "b" : "7FCA07CF5000", "path" : "/lib64/ld-linux-x86-64.so.2", "elfType" : 3, "buildId" : "9F00581AB3C73E3AEA35995A0C50D24D59A01D47" } ] }}
       mongod(__interceptor_backtrace+0x55) [0x911865]
       mongod(_ZN5mongo15printStackTraceERSo+0x11A) [0x27a703a]
       mongod(_ZN5mongo10logContextEPKc+0x2D0) [0x260c7b0]
       mongod(_ZN5mongo11msgassertedEiPKc+0x4BD) [0x25cf74d]
       mongod(+0x21CF283) [0x25cf283]
       mongod(_ZN5mongo10opToStringEi+0x4EB) [0xe19a6b]
       mongod(_ZN5mongo5CurOp11reportStateEPNS_14BSONObjBuilderE+0xC6A) [0x1124dba]
       mongod(_ZN5mongo9inProgCmdEPNS_16OperationContextERNS_7MessageERNS_10DbResponseE+0x1C8F) [0x112bf3f]
       mongod(_ZN5mongo16assembleResponseEPNS_16OperationContextERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE+0x135A) [0x144dd0a]
       mongod(_ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE+0x3DE) [0x97390e]
       mongod(_ZN5mongo17PortMessageServer17handleIncomingMsgEPv+0xAFC) [0x264abac]
       libpthread.so.0(+0x8182) [0x7fca077d9182]
       libc.so.6(clone+0x6D) [0x7fca065a647d]
      -----  END BACKTRACE  -----
      

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            mathias@mongodb.com Mathias Stearn
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: