ruby / debug

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

Cannot attach docker container with `debugger` while `pry.binding` can #1013

Closed eggplants closed 1 year ago

eggplants commented 1 year ago

Your environment

Describe the bug

I tried to set breakpoint within Rails constroller:

class FooController < ApplicationController
  def create
    ...
    debugger
  end
end

And then I ran docker compose up and sent request to the method with curl. After launching debugger, I couldn't attach to the container process running rails service by docker attach bar-web-1.

Interestingly, I then installed pry-byebug and replaced debugger with pry.binding and was able to attach without problems.

No one else seemed to have this problem on the web, so I could be doing something wrong.

To Reproduce TBD

Expected behavior User must be able to attach with docker attach even if degug gem's debugger is launched.

Additional context TBD

ko1 commented 1 year ago

I have no idea about it. Have you verified that debugger method is invoked?

eggplants commented 1 year ago

Yes. The debug gem's debugger has shown in docker console when runtime ruby has reached the debugger line.

ko1 commented 1 year ago

Let me clear the repro process.

Questions:

Thanks, Koichi

eggplants commented 1 year ago

Thank you. I'll create MRE code soon.