Created attachment 515155 [details] Fix for the bug Description of problem: When querying any collection on the mongodb dbshell, the client hangs inside javascript attribute enumeration code. Version-Release number of selected component (if applicable): mongodb-1.8.2-4.fc16.x86_64 mongodb-server-1.8.2-4.fc16.x86_64 js-1.8.5-7.fc16.x86_64 How reproducible: Always Steps to Reproduce: $ gdb --args mongo mydb GNU gdb (GDB) Fedora (7.3.50.20110722-1.fc16) Copyright (C) 2011 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-redhat-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /usr/bin/mongo...Reading symbols from /usr/lib/debug/usr/bin/mongo.debug...done. done. (gdb) r Starting program: /usr/bin/mongo somedb [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". MongoDB shell version: 1.8.2 [New Thread 0x7ffff53d8700 (LWP 14017)] connecting to: somedb [New Thread 0x7ffff45ff700 (LWP 14018)] > [Thread 0x7ffff45ff700 (LWP 14018) exited] db.foo.find() > db.foo.insert({}) > db.foo.find() ####### mongo hangs here, pressed Ctrl+C Program received signal SIGINT, Interrupt. 0x00000000004ea10d in mongo::bson_enumerate (cx=0x7e00d0, obj=0x7ffff464f558, enum_op=JSENUMERATE_NEXT, statep=0x7fffffffcad0, idp=0x7fffffffcae0) at scripting/engine_spidermonkey.cpp:760 760 JSBool bson_enumerate( JSContext *cx, JSObject *obj, JSIterateOp enum_op, jsval *statep, jsid *idp ) { Missing separate debuginfos, use: debuginfo-install ncurses-libs-5.9-2.20110716.fc16.x86_64 nspr-4.8.8-4.fc16.x86_64 (gdb) (gdb) n 762 BSONHolder * o = GETHOLDER( cx , obj ); (gdb) 764 if ( enum_op == JSENUMERATE_INIT ) { (gdb) 777 BSONFieldIterator * it = (BSONFieldIterator*)JSVAL_TO_PRIVATE( *statep ); (gdb) 778 if ( ! it ) { (gdb) 791 *statep = 0; (gdb) 793 return JS_TRUE; (gdb) 804 } (gdb) Snapshot (cx=0x7e00d0, obj=0x7ffff464f558, flags=1, props=0x7fffffffcc50) at jsiter.cpp:317 317 if (!pobj->enumerate(cx, JSENUMERATE_NEXT, &state, &id)) (gdb) 319 if (state.isNull()) (gdb) 321 if (!Enumerate(cx, obj, pobj, id, true, false, flags, ht, props)) (gdb) 317 if (!pobj->enumerate(cx, JSENUMERATE_NEXT, &state, &id)) (gdb) 319 if (state.isNull()) (gdb) 321 if (!Enumerate(cx, obj, pobj, id, true, false, flags, ht, props)) (gdb) 317 if (!pobj->enumerate(cx, JSENUMERATE_NEXT, &state, &id)) (gdb) 319 if (state.isNull()) (gdb) 321 if (!Enumerate(cx, obj, pobj, id, true, false, flags, ht, props)) (gdb) 317 if (!pobj->enumerate(cx, JSENUMERATE_NEXT, &state, &id)) (gdb) 319 if (state.isNull()) (gdb) 321 if (!Enumerate(cx, obj, pobj, id, true, false, flags, ht, props)) (gdb) 317 if (!pobj->enumerate(cx, JSENUMERATE_NEXT, &state, &id)) (gdb) s enumerate (idp=0x7fffffffcae0, statep=0x7fffffffcad0, iterop=JSENUMERATE_NEXT, cx=0x7e00d0, this=0x7ffff464f558) at jsobj.h:1257 1257 js::NewEnumerateOp op = getOps()->enumerate; (gdb) s 1258 return (op ? op : js_Enumerate)(cx, this, iterop, statep, idp); (gdb) s 1257 js::NewEnumerateOp op = getOps()->enumerate; (gdb) s 1258 return (op ? op : js_Enumerate)(cx, this, iterop, statep, idp); (gdb) s js_Enumerate (cx=0x7e00d0, obj=0x7ffff464f558, enum_op=JSENUMERATE_NEXT, statep=0x7fffffffcad0, idp=0x7fffffffcae0) at jsobj.cpp:6027 6027 { (gdb) s 6651 } (gdb) s 6031 if (clasp->flags & JSCLASS_NEW_ENUMERATE) { (gdb) s 6030 JSEnumerateOp enumerate = clasp->enumerate; (gdb) s 6031 if (clasp->flags & JSCLASS_NEW_ENUMERATE) { (gdb) s 6033 return ((NewEnumerateOp) enumerate)(cx, obj, enum_op, statep, idp); (gdb) s 6043 } (gdb) s 6033 return ((NewEnumerateOp) enumerate)(cx, obj, enum_op, statep, idp); (gdb) s mongo::bson_enumerate (cx=0x7e00d0, obj=0x7ffff464f558, enum_op=JSENUMERATE_NEXT, statep=0x7fffffffcad0, idp=0x7fffffffcae0) at scripting/engine_spidermonkey.cpp:760 760 JSBool bson_enumerate( JSContext *cx, JSObject *obj, JSIterateOp enum_op, jsval *statep, jsid *idp ) { (gdb) n 762 BSONHolder * o = GETHOLDER( cx , obj ); (gdb) n 764 if ( enum_op == JSENUMERATE_INIT ) { (gdb) n 777 BSONFieldIterator * it = (BSONFieldIterator*)JSVAL_TO_PRIVATE( *statep ); (gdb) n 778 if ( ! it ) { (gdb) n 791 *statep = 0; (gdb) n 793 return JS_TRUE; (gdb) p statep $1 = (jsval *) 0x7fffffffcad0 (gdb) p *statep $2 = 0 (gdb) --------------------- I didn't report this upstream yet because I still have to find a way to build mongodb from git without errors (maybe I'm just missing some config option to use the right flags).
(In reply to comment #0) > I didn't report this upstream yet because I still have to find a way to build > mongodb from git without errors (maybe I'm just missing some config option to > use the right flags). I just noticed that patch to make engine_spidermonkey.cpp build on Rawhide (mongodb-src-r1.8.2-js.patch) is really large, so I guess it would be useless to submit the fix for this upstream without submitting all the other changes first.
mongodb-1.8.2-6.fc16 has been submitted as an update for Fedora 16. https://admin.fedoraproject.org/updates/mongodb-1.8.2-6.fc16
Eduardo, Thanks for the patch. I tested it out here and it seems to work as advertised, so I've built it into rawhide and F-16. As far as pushing it upstream, I agree. Upstream mongo currently fails to build on F-16/rawhide for the same reason the package build was failing. So it will need something like that entire mongodb-1.8.2-src-js.patch. Next week I'll propose it upstream and see what they have to say about it.
The version in F15 seems also affected by this issue.
Oh, I didn't even think of that, but that is probably the case. I'll look at fixing it for F-15 as well.
Robin, I submitted an update to F-15 for mongodb, which I believe should fix the problem. If you have a chance, please test out: https://admin.fedoraproject.org/updates/mongodb-1.8.0-4.fc15, and give karma so I can get that into updates. Thanks, Chris Lalancette
Package mongodb-1.8.2-6.fc16: * should fix your issue, * was pushed to the Fedora 16 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing mongodb-1.8.2-6.fc16' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/mongodb-1.8.2-6.fc16 then log in and leave karma (feedback).
mongodb-1.8.2-6.fc16 has been pushed to the Fedora 16 stable repository. If problems still persist, please make note of it in this bug report.