ruby / debug

Debugging functionality for Ruby
BSD 2-Clause "Simplified" License
1.14k stars 127 forks source link

Prevent backtrace from hanging if objects in the backtrace use Thread in inspect #1038

Closed vinistock closed 11 months ago

vinistock commented 12 months ago

Description

In https://github.com/ruby/debug/commit/3255b7124a0abe20c780f5ae7fba11c3ff690de3, many commands were changed to unfreeze threads to prevent the debugger from hanging. However, the same can occur when running backtrace.

Under the hood, it invokes inspect, which may trigger Active Record queries, which could be gated by a timeout thread - ultimately causing the debugger to hang forever.

This PR just ensures that threads are restarted for the backtrace command, so that we never get into a situation where the debugger is stuck.