Skip to content

Commit 5481079

Browse files
committed
Keep wk_lock held during step commands to prevent worker ping-pong
When multiple independent workers share the well-known lock, releasing it on step/next/finish allowed a sibling worker to grab the lock before the stepping worker could re-enter its subsession. This caused the user to need 2 next commands to actually advance — the first one would inadvertently drive the other worker. Only release wk_lock on :continue, which is expected to run for an extended period. Step commands hold the lock so the same worker immediately re-enters without yielding.
1 parent 20f70ea commit 5481079

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/debug/session.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1806,7 +1806,9 @@ def get_thread_client th = Thread.current
18061806
DEBUGGER__.debug{ "Leave subsession" }
18071807
bp_sync_publish # publish breakpoint changes to other processes
18081808
@process_group.unlock
1809-
@process_group.unlock_wk_lock
1809+
# Keep wk_lock held during step commands so the same worker
1810+
# re-enters the subsession without yielding to a sibling.
1811+
@process_group.unlock_wk_lock if type == :continue
18101812
restart_all_threads
18111813
else
18121814
DEBUGGER__.debug{ "Leave subsession (nested #{@subsession_stack.size})" }

0 commit comments

Comments
 (0)