[SERVER-1762] deadlock between db mutex and js mutex Created: 09/Sep/10 Updated: 29/Aug/11 Resolved: 17/Mar/11 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | JavaScript |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Aaron Staple | Assignee: | Eliot Horowitz (Inactive) |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Operating System: | ALL | ||||||||
| Participants: | |||||||||
| Description |
|
There is a reachable deadlock condition between the db mutex and js mutex, which has been seen in v8 ( To fix, all javascript calls from c++ must occur while a db mutex is held. In the diagnosed case, javascript calls within MRState::MRState() were made without a db mutex. These calls held the v8 mutex and requested the db mutex, while a concurrent db.eval held the db mutex and requested the v8 mutex. |
| Comments |
| Comment by Eliot Horowitz (Inactive) [ 17/Mar/11 ] |
|
Switching to v8 |
| Comment by Eliot Horowitz (Inactive) [ 03/Jan/11 ] |
|
If we switch to v8 may not have to worry. |
| Comment by auto [ 13/Sep/10 ] |
|
Author: {'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}Message: |
| Comment by Aaron Staple [ 09/Sep/10 ] |
|
Yeah we can fix it that way too, and I should have thought of and mentioned that. I was just thinking that it might be easier to ensure correct behavior by getting a db mutex before doing anything with js than it would be to check the various callbacks in the js implementations to see if they need a db lock. But obviously if anything time consuming is going to happen in js it would be best to do it without the db lock when that's possible. Right now the v8 implementation does unlock for the major db operations (this is what allows concurrent threads in the shell). It looks like it was not unlocking for loadStored(), which puts variables inside the system.js namespace, and I think this is what was triggering |
| Comment by auto [ 09/Sep/10 ] |
|
Author: {'login': 'astaple', 'name': 'Aaron', 'email': 'aaron@10gen.com'}Message: |
| Comment by Eliot Horowitz (Inactive) [ 09/Sep/10 ] |
|
This is definitely true for spidermonkey. For v8 - can't we handle inside v8? If so - can you fix v8 and then re-assign to me? |