Skip to content

Commit 2d0a1fb

Browse files
committed
Release wk_lock on continue, hold during step commands
The "never release" approach caused hangs when long-lived worker processes held the lock after continuing past a debugger statement — other workers waiting for the lock would block forever. Release the lock on :continue so other workers can proceed. Hold it during step/next/finish so the same worker re-enters the subsession without ping-ponging to a sibling.
1 parent 9f325e4 commit 2d0a1fb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/debug/session.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,9 +1804,10 @@ def get_thread_client th = Thread.current
18041804
DEBUGGER__.debug{ "Leave subsession" }
18051805
bp_sync_publish # publish breakpoint changes to other processes
18061806
@process_group.unlock
1807-
# Never release wk_lock here — the current worker keeps exclusive
1808-
# debugger access until its session ends. Other workers queue up.
1809-
# The kernel releases flock automatically on process exit.
1807+
# Keep wk_lock held during step commands so the same worker
1808+
# re-enters the subsession without yielding to a sibling.
1809+
# Release on :continue so long-lived workers don't starve others.
1810+
@process_group.unlock_wk_lock if type == :continue
18101811
restart_all_threads
18111812
else
18121813
DEBUGGER__.debug{ "Leave subsession (nested #{@subsession_stack.size})" }

0 commit comments

Comments
 (0)