[SERVER-3012] JS "out of memory" should recover more gracefully Created: 28/Apr/11 Updated: 12/Jul/16 Resolved: 06/Mar/12 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | JavaScript |
| Affects Version/s: | None |
| Fix Version/s: | 2.1.1 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Kyle Banker | Assignee: | Antoine Girbal |
| Resolution: | Done | Votes: | 2 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Operating System: | ALL | ||||||||||||
| Participants: | |||||||||||||
| Description |
|
Once you get an "out of memory" error, the JavaScript runtime becomes unusable. // Add this to system.js } } // Then execute this: |
| Comments |
| Comment by auto [ 06/Mar/12 ] |
|
Author: {u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}Message: |
| Comment by auto [ 06/Mar/12 ] |
|
Author: {u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}Message: |
| Comment by Antoine Girbal [ 06/Mar/12 ] |
|
behavior is now correct on both SM and V8. |
| Comment by auto [ 06/Mar/12 ] |
|
Author: {u'login': u'agirbal', u'email': u'antoine@10gen.com', u'name': u'agirbal'}Message: |
| Comment by auto [ 13/Oct/11 ] |
|
Author: {u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}Message: - |
| Comment by auto [ 07/Oct/11 ] |
|
Author: {u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}Message: - |
| Comment by auto [ 29/Sep/11 ] |
|
Author: {u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}Message: -
|
| Comment by Antoine Girbal [ 29/Sep/11 ] |
|
V8 turns out to be a pain. #
Even after throwing out all contexts and calling GC. A thread states that it is very unreliable to try to recover from out of mem |
| Comment by Antoine Girbal [ 26/Sep/11 ] |
|
code will now destroy JS context and any idle contexts. |
| Comment by Eliot Horowitz (Inactive) [ 26/Sep/11 ] |
|
Once there is a GC - destroying that context would make a lot of sense. |
| Comment by Antoine Girbal [ 26/Sep/11 ] |
|
We cant do too much to help if someone is using over the mem limit by setting global variables. |
| Comment by Antoine Girbal [ 26/Sep/11 ] |
|
The reason why the engine seems unusable is that the variable a/b/c in your function are global and so they stay around even after the out of mem. PRIMARY> db.system.js.save({ "_id" : "f1", "value" : function ... } } |
| Comment by auto [ 15/Aug/11 ] |
|
Author: {u'login': u'agirbal', u'name': u'Antoine Girbal', u'email': u'antoine@10gen.com'}Message: - |
| Comment by auto [ 24/May/11 ] |
|
Author: {u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}Message: |
| Comment by Paul Harvey [ 24/May/11 ] |
|
Cool, I will try this ASAP. I wonder if it would be possible to add some -vvvv[..] debug output which could help us track down possible problems in our JS. I have no idea at all how SM (or other JS engines) work their memory management, but perhaps seeing messages about GC activity or heap/stack size increases would be helpful... I only ask because, we've already reviewed our JS (I think Sven is still going over it), and we've hammered this thing in testing and can't reproduce the fault until it's put into production. So I'm afraid we need some production runtime info to get this debugged.. |
| Comment by Antoine Girbal [ 24/May/11 ] |
|
Note that JS has not become unusable in my tests. I think we should increase SM limit quite a bit because many ppl have reported OOM with JS. |
| Comment by Antoine Girbal [ 24/May/11 ] |
|
thanks for the easily reproducible issue. In engine_spidermonkey.cpp: Then your eval can go way further > db.eval("f1(1000000)") |
| Comment by Paul Harvey [ 23/May/11 ] |
|
I filed |