Repository navigation
src: wake pending web locks when workers exit - #67305
fatihguzeldev wants to merge 2 commits into
Conversation
wake requests left pending after worker cleanup. register granted locks under the queue mutex to prevent concurrent exclusive grants, and keep target environments alive until wakeups are queued. add regression tests for worker exits and exclusive lock ownership. Fixes: nodejs#67216 Signed-off-by: Fatih Güzel <fatihguzeldev@gmail.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #67305 +/- ##
==========================================
+ Coverage 90.69% 90.74% +0.05%
==========================================
Files 797 801 +4
Lines 279612 280992 +1380
Branches 53789 54271 +482
==========================================
+ Hits 253584 254980 +1396
+ Misses 16298 16186 -112
- Partials 9730 9826 +96
🚀 New features to boost your workflow:
|
| pending_queue_.erase(queue_iter); | ||
| if (!grantable_request->steal()) { | ||
| // Reserve the lock before another Environment can process the queue. | ||
| granted_lock = grant_lock(*grantable_request); |
There was a problem hiding this comment.
Since granted_lock is now inserted into held_locks_ up front here (and on line 461 for steal), any early return below before the settlement handlers run or are attached (e.g. CreateLockInfoObject failing, callback->Call(...) throwing synchronously, or promise->Then(...) failing) will leave granted_lock stuck in held_locks_ for as long as env stays alive and permanently block that lock name.
Could we guard granted_lock with an OnScopeLeave rollback that removes it from held_locks_ unless the handler attachment / synchronous release succeeds?
There was a problem hiding this comment.
thanks, rudolf. i added the rollback and a regression test.
release the reserved lock if the callback throws or its settlement handlers cannot be attached. wake waiters and resume queue processing so other ready requests can proceed. Signed-off-by: Fatih Güzel <fatihguzeldev@gmail.com>
when a worker exits, its locks are removed but other requests can stay
pending until another lock request processes the queue.
wake remaining waiters during cleanup. reserve granted locks under the
queue mutex to prevent concurrent exclusive grants, and protect target
environments while queuing wakeups.
Fixes: #67216