[SERVER-11937] Crash in the js shell when using runProgram several times Created: 03/Dec/13  Updated: 10/Dec/14  Resolved: 23/Jun/14

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 2.0.4
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Alexandre [X] Assignee: Ramon Fernandez Marina
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu Precise


Operating System: Linux
Steps To Reproduce:

In the mongo shell :

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

Participants:

 Description   

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



 Comments   
Comment by Ramon Fernandez Marina [ 23/Jun/14 ]

Understood – thanks for letting us know Lexman.

Comment by Alexandre [X] [ 23/Jun/14 ]

Hello, we've juste upgraded to 2.4... Anyway the bug wasn't an issue any more for us because we moved some code from shell to Java.

Thanks for the follow-up !

You can consider this bug solved.

Comment by Ramon Fernandez Marina [ 20/Jun/14 ]

Lexman, is this still an issue for you? I checked more recent versions of MongoDB, like 2.4.10 and 2.6.3, and this issue has been fixed. If you're still running into this problem, is updating to 2.4 or 2.6 a possibility for you?

Generated at Thu Feb 08 03:27:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.