[SERVER-4191] killOp cannot interrupt v8 javascript loop Created: 02/Nov/11 Updated: 11/Jul/16 Resolved: 11/Nov/11 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | JavaScript |
| Affects Version/s: | None |
| Fix Version/s: | 2.1.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Greg Studer | Assignee: | Antoine Girbal |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Ubuntu 10.10 x86_64, libv8-2.2.18 |
||
| Issue Links: |
|
||||||||
| Operating System: | ALL | ||||||||
| Participants: | |||||||||
| Description |
|
On my machine, killop.js does not end queries with a "while( 1 ) { ; }" where clause - the shell hangs for a long period of time. Seems like the root of the problem is the v8::Locker l; mutex in V8ScriptEngine::interrupt(). As far as I can tell, this never yields when there's other javascript executing. If this is expected behavior (or difficult to fix), the test case should probably be modified - adding a sleep( 1 ) to the loop allows the operation to be killed. Observed this generally through many versions of mongodb. |
| Comments |
| Comment by auto [ 11/Nov/11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}Message: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by auto [ 11/Nov/11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}Message: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Antoine Girbal [ 10/Nov/11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I switch the v8 code to use isolates to try out. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Antoine Girbal [ 10/Nov/11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This was the problem in question, raised by aaron a while back | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Antoine Girbal [ 10/Nov/11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
actually looks like the issue is somewhere else. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Antoine Girbal [ 10/Nov/11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Issue may be due to a "bug" in v8. In the end, this may not be a blocker, because few people will run empty loops. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Antoine Girbal [ 09/Nov/11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ok thanks just tried again on buildbot and it does fail frequently, so I am able to test. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Greg Studer [ 09/Nov/11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Actually the first command seems to terminate after a few secs, the second does not. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Greg Studer [ 09/Nov/11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Attached a sample run on my machine - the first command terminates after two minutes or so, the second never terminates after 7-8 mins so I ctrl-c'd. When cleaning up, the running operation still seemed to hang the mongo instance, another ctrl-c was necessary. Still seems like a timing issue, though the preemption did allow the first command to terminate. Tested twice more, the first command didn't terminate and I gave up.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Antoine Girbal [ 09/Nov/11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
just logged to buildbot and tested killop.js there. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by auto [ 07/Nov/11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}Message: - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Antoine Girbal [ 05/Nov/11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
yes killop.js always passes for me, at least I ran it 100 times in a row with no error.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Greg Studer [ 04/Nov/11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@antoine - btw, happy to test any patches you create, if you can't reproduce on your machine. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Eliot Horowitz (Inactive) [ 04/Nov/11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The v8 builder is inf. looping - so something is wrong. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Greg Studer [ 04/Nov/11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Yeah, never kills for me currently, but I vaguely recall it working sometimes. I'm on a pretty powerful desktop at work, just fyi. I assume the killop.js test case works for you? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Antoine Girbal [ 03/Nov/11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
If I start: " }) I am able to kill it fine. The delay is probably due to the v8 scheduler, we could shorten preemption if we feel like it's too long. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Antoine Girbal [ 03/Nov/11 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
in theory the interrupt() only grabs a v8::Locker which is preemptive. |