Skip to content

Commit

Permalink
Avoid locking all threads on debugger suspension (#16)
Browse files Browse the repository at this point in the history
This commit stops locking all threads during suspension, which may prevent
users from investigating threading problem. But it's still better than
freezing the process just by running a ActiveRecord query, or doing
anything that calls `Timeout.timeout`.

History around this issue:

1. It originally was reported in Shopify/team-ruby-dx#724,
   and we reported it upstream too.
1. We introduced 1e0f45c as a workaround.
1. Upstream proposed a solution to fix the query evaluation case by restarting
   threads before evaluating console/DAP input. So the above commit was
   reverted.
1. However, the process could still hang if `Timeout.timeout` is called:
     1. During a suspension
     2. And outside of input evaluation
   An example is typing Arrow-up in the console as `reline` calls `Timeout.timeout`
   underneath.
1. So we need to reintroduce the workaround until we can find a better
   with the upstream maintainer.
  • Loading branch information
st0012 authored Apr 20, 2023
1 parent 7a05281 commit f1a45a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/debug/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1698,7 +1698,7 @@ def get_thread_client th = Thread.current
DEBUGGER__.debug{ "Enter subsession (nested #{@subsession_stack.size})" }
else
DEBUGGER__.debug{ "Enter subsession" }
stop_all_threads
# stop_all_threads
@process_group.lock
end

Expand Down

0 comments on commit f1a45a9

Please sign in to comment.