Skip to content

Unexpected child debugging session when starting remote debuggee with RUBYOPT=-rdebug/* #663

@st0012

Description

@st0012

Describe the bug

Some criteria for this issue:

  1. Use RUBYOPT=-rdebug/open to load the debugger in remote mode.
  2. The program runs another Ruby process like system("bundle exec rake")

When the above happens at the same time, it'll trigger double debugging sessions. I recorded a video to demo this:

2022-06-26.12.27.14.mov

This is annoying because the second session starts independently and hangs the program, until we connect to and disable it.

And this can happens to Rails apps.

I'm not sure it's at fault of the debugger as that's how ENV vars are passed to child processes. But perhaps we can do something from the debugger to prevent it?

To Reproduce

bar.rb

puts "bar"

target.rb

result = `ruby bar.rb`

puts(result)

terminal1

RUBYOPT=-rdebug/open ruby -Ilib target.rb

terminal2

rdbg -A

Expected behavior

The second process shouldn't start a debugging session.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions