Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Problem with attaching web browser remote debugger to app running in docker container

Offen
#901 1 Kommentar 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@ono-max arbeitet bereits daran.

Seit 07.3.2023.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Beschreibung

Your environment

  • ruby -v: 3.2.1
  • rdbg -v: 1.7.1

Describe the bug

Hit problem with remote debugger with web browser

Error:

web-1  | ["DEBUGGER Exception: /usr/local/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/thread_client.rb:1233",
web-1  |  #<NoMethodError: undefined method `[]=' for nil:NilClass>,
web-1  |  ["/usr/local/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/server_cdp.rb:1283:in `block in variable'",
web-1  |   "/usr/local/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/server_cdp.rb:1281:in `each'",
web-1  |   "/usr/local/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/server_cdp.rb:1281:in `each_with_index'",
web-1  |   "/usr/local/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/server_cdp.rb:1281:in `variable'",
web-1  |   "/usr/local/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/server_cdp.rb:1097:in `block in process_cdp'",
web-1  |   "/usr/local/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/server_cdp.rb:1095:in `map'",
web-1  |   "/usr/local/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/server_cdp.rb:1095:in `process_cdp'",
web-1  |   "/usr/local/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/thread_client.rb:1224:in `wait_next_action_'",
web-1  |   "/usr/local/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/thread_client.rb:856:in `wait_next_action'",
web-1  |   "/usr/local/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/thread_client.rb:320:in `suspend'",
web-1  |   "/usr/local/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/thread_client.rb:358:in `block in step_tp'",

I'm running app in docker container (running app in localhost is not an option), thus I setup host/port and path setup so that I was able to attach debugger from web browser to container. When stepping through code it however, it gets often this error, which then breaks app & debugger connection.

Also paths seem to pose a bit problem, which I worker around via creating symlink in host machine filesystem, matching directory structure inside container, and mounted source directory from that symlink into web browser, instead of actual directory in file system. Reason being that web browser seems to send absolute path to file system when setting break point, while inside container sources are at "/app" (in localhost "/home/myaccount/....")

To Reproduce

  1. have app running in container
  2. do necessary 0.0.0.0:5555 debug port redirection from docker compose to localhost (port 5555 forwarded to host os side)
  3. launch app
  4. connect web browser debugger to app running in container
  5. set some breakpoint
  6. do relecant things to trigger breakpoint
  7. step through code
    => that "undefined method `[]=' for nil:NilClass" will happen sooner or later

Expected behavior

Not to have internal error in debugger

Additional context
"app stack" to understand debugging context, in case it affects problem.

image

Vorherrschende Sprache
Ruby
Sterne
1.3k
Forks
146
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus ruby/debug

Alle Issues in ruby/debug

Ähnliche Issues

Weitere Issues zu Ruby

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.