[SERVER-3060] db.artworks.findOne("genome.genes.Color.$gt", 0) terminates shell Created: 07/May/11 Updated: 15/Aug/12 Resolved: 03/Jun/12 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 1.8.1, 2.0.0, 2.1.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Daniel Doubrovkine | Assignee: | Tad Marshall |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
1.8.1, Ubuntu Linux |
||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Operating System: | Linux | ||||||||
| Participants: | |||||||||
| Description |
|
Running this (invalid) query: db.artworks.findOne("genome.genes.Color.$gt", 0) terminates the shell.
|
| Comments |
| Comment by Tad Marshall [ 03/Jun/12 ] |
|
This was fixed by catching all C++ exceptions in engine_spidermonkey.cpp and sm_db.cpp. |
| Comment by Antoine Girbal [ 03/Nov/11 ] |
|
Tad, thanks for help. |
| Comment by Tad Marshall [ 26/Oct/11 ] |
|
Just for fun, I looked at this one and found out what was happening. An exception is thrown in scripting\engine_spidermonkey.cpp (because the 0 is not an object) and this transfers control all the way back to shell/dbshell.cpp, leaving SpiderMonkey in a bad state. I uploaded a fix to my fork for the mongo_find() routine that this example hits, but the same problems exists in mongo_update, mongo_insert, and mongo_remove and perhaps other routines. You can look at my fix if you want, but it's just putting the sensitive calls inside try/catch. My branch: https://github.com/tadmarshall/mongo/tree/SERVER-3060-partial-fix The commit: https://github.com/tadmarshall/mongo/commit/ca10f4ecf1a6129911f7d3d4dc26be28fa8f6b9b I won't issue a pull request unless you want me to, this bug is Antoine's to handle as he pleases. There may well be a better way to fix it, I don't know. I'm sorry if looking at it is poor form, but I was curious. |
| Comment by Antoine Girbal [ 12/Oct/11 ] |
|
Testing with mongo 2.0. > db.foo.findOne() Now testing with master branch, this time it gets an exception > db.foo.findOne("genome.genes.Color.$gt", 0) Tue Oct 11 20:56:45 0x5dc8bb 0x5d69cb 0x7f9b4a5a6d80 0x68cb5e 0x6d9409 0x6d7079 0x665da7 0x666082 0x667058 0x666ff1 0x666ee2 0x659f4d 0x5d9d2b 0x5dab0c 0x7f9b4a591eff 0x5d4be9 |