There are a few cases where a "native" JavaScript function implemented in scripting/engine_spidermonkey.cpp or scripting/sm_db.cpp will throw an exception. An example (currently) is the native_print() function which calls Convertor::toString() which can throw an exception. If this exception isn't caught before control passes out through SpiderMonkey then SpiderMonkey is left in a corrupted state and attempts to use JavaScript after this, even to display the shell's prompt, will generate access violations (segfaults).
We need to use try/catch around any exceptions that can be thrown within engine_spidermonkey.cpp and return normally (usually with JS_FALSE) so that SpiderMonkey can maintain its state properly.
- is depended on by
-
SERVER-5796 HexData undocumented, crashy
- Closed
- is duplicated by
-
SERVER-3060 db.artworks.findOne("genome.genes.Color.$gt", 0) terminates shell
- Closed
-
SERVER-4913 prevent process segv crash in javascript when a document has some bad string value
- Closed
-
SERVER-5482 array access attempt after a find failure puts shell in an unusable state
- Closed
- related to
-
SERVER-5967 unhandled exception: boost::filesystem::create_directory: Permission denied: "/data/shardA"
- Closed
-
SERVER-1613 shell abends on bad UTF8
- Closed