The debugger command doesn't seem to work when using multiple threads at the same time.
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start by running the reproduced Ruby program with require "debug", two threads, and debugger statements. Trace how the debugger handles simultaneous thread breakpoints and local-variable evaluation; the fix is complete when each breakpoint reports the matching local variable and continue resumes execution without hanging.
Written by the indexing model from the issue text.
Description
Your environment
ruby -v: 3.2.2rdbg -v: 1.8.0
Describe the bug
Doesn't seem to work well with multithreaded debugger statements. The program does not print out expected local variables and seems to hang forever after last continue statement.
To Reproduce
Given the following ruby code:
require "debug"
thr1 = Thread.new {
hello = "world"
debugger
puts hello
}
thr2 = Thread.new {
hello = "hello"
debugger
puts hello
}
thr1.join
thr2.join
The first time I reach a breakpoint it shows me in the hello = "hello" block. When I type out hello though it than jumps me to hello = "world" block. After typing out hello a second time, it prints out the string "hello" instead of "world". If I type continue it hangs forever after that. If I run the program without the debugger statements it doesn't hang.
Expected behavior
I would expect debugger to be somewhat threadsafe. Obviously debugger cannot necessarily control the order of these two debuggers. The second debug statement may execute first but I'd expect that the breakpoint would match the local variable and I'd expect typing continue would than make the program keep running and go to the next debugger statement or terminate the program if no more debugger statements.
- Dominant language
- Ruby
- Stars
- 1.3k
- Forks
- 146
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ruby/debug
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Support exceptionOptions in setExceptionBreakpoints to catch arbitrary exception classes via DAP Open
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
notch8/utk_knapsack#148 ·
-
feature
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
betagouv/acces-cible#722 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
foobara/empty-ruby-project-generator#10 · 2 comments ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100