Crash in the js shell when using runProgram several times

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Minor - P4
    • None
    • Affects Version/s: 2.0.4
    • Component/s: Shell
    • None
    • Environment:
      Ubuntu Precise
    • Linux
    • Hide

      In the mongo shell :

      for (var i = 0; i< 1000; i++) {
      run("echo", "test");
      }

      Show
      In the mongo shell : for (var i = 0; i< 1000; i++) { run("echo", "test"); }
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      When using runProgram or run several times, for example with this script :

      for (var i = 0; i< 1000; i++) {
      run("echo", "test");
      }

      the shell crashes with this error :
      Tue Dec 3 17:31:04 Assertion failure pipe( pipeEnds ) != -1 shell/shell_utils.cpp 431
      0x47884f 0x491d13 0x493aa9 0x48a89a 0x485e24 0x4d53f0 0x5237cc 0x50decd 0x5237cc 0x51741c 0x5231b9 0x4e3d8a 0x4e3e12 0x4e3e8e 0x4df627 0x475086 0x46ccee 0x7fab2f5fe76d 0x46f7d9
      mongo(_ZN5mongo15printStackTraceERSo+0x1f) [0x47884f]
      mongo(_ZN5mongo12sayDbContextEPKc+0xc3) [0x491d13]
      mongo(_ZN5mongo8assertedEPKcS1_j+0xf9) [0x493aa9]
      mongo() [0x48a89a]
      mongo(_ZN5mongo10shellUtils10RunProgramERKNS_7BSONObjEPv+0x24) [0x485e24]
      mongo(ZN5mongo13native_helperEP9JSContextP8JSObjectjPlS4+0x480) [0x4d53f0]
      mongo(js_Invoke+0x4bc) [0x5237cc]
      mongo() [0x50decd]
      mongo(js_Invoke+0x4bc) [0x5237cc]
      mongo(js_Interpret+0x121c) [0x51741c]
      mongo(js_Execute+0x269) [0x5231b9]
      mongo(JS_EvaluateUCScriptForPrincipals+0x6a) [0x4e3d8a]
      mongo(JS_EvaluateUCScript+0x22) [0x4e3e12]
      mongo(JS_EvaluateScript+0x6e) [0x4e3e8e]
      mongo(_ZN5mongo7SMScope4execERKNS_10StringDataERKSsbbbi+0x107) [0x4df627]
      mongo(_Z5_mainiPPc+0x1a96) [0x475086]
      mongo(main+0x1e) [0x46ccee]
      /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7fab2f5fe76d]
      mongo() [0x46f7d9]
      Tue Dec 3 17:31:04 Error: assertion shell/shell_utils.cpp:431 (anon):1
      Tue Dec 3 17:31:04 Socket say send() errno:32 Broken pipe 10.0.1.172:27017

      It could look like the pipe that is open when runing the program isn't released. Eventually, when too many pipes are open, the pipe creation fails.

      This links http://www.tldp.org/LDP/lpg/node11.html says each process should close the end of the pipe it doesn't use...

      I've looked a little bit at the code, and it seems there are no differences in the pipe management in master and in 2.0.x. I don't have the means run the test case in the master.

      Hope it helps,

      Alexandre

            Assignee:
            Ramon Fernandez Marina
            Reporter:
            Alexandre [X]
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: