Skip to content

First breakpoint is skipped on a remote development environment #900

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
andyw8 opened this issue Feb 17, 2023 · 2 comments · Fixed by #920
Closed

First breakpoint is skipped on a remote development environment #900

andyw8 opened this issue Feb 17, 2023 · 2 comments · Fixed by #920
Labels
bug Something isn't working

Comments

@andyw8
Copy link
Contributor

andyw8 commented Feb 17, 2023

Describe the bug

Breakpoint skipped when running on a remote development environment

To Reproduce

  1. Go to https://github.com/github/codespaces-rails to start with a new Rails app.

  2. Choose Use This Template -> Open in a Codespace

  3. Create the following in .vscode/launch.json

       {
        // Use IntelliSense to learn about possible attributes.
        // Hover to view descriptions of existing attributes.
        // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
        "version": "0.2.0",
        "configurations": [
          {
            "type": "rdbg",
            "name": "Run the current file with rdbg",
            "useBundler": true,
            "request": "launch",
            "command": "ruby",
            "script": "${file}",
          },
        ]
    }
  4. Create the following in test.rb.

    a=1
    binding.b
    binding.b
  5. Ensure v0.1.0 of the vscode-rdbg extension is installed.

  6. Switch to test.rb and choose "Run the current file with rdbg". Observe that it correctly stops at the first breakpoint.

  7. Stop the debugger.

  8. Add sleep 1 on a new line after a=1

  9. Choose "Run the current file with rdbg" again.

  10. Observe that it incorrectly skips the first breakpoint and stops at the second.

Your environment

  • ruby -v: ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-linux]
  • rdbg -v: rdbg 1.7.1

Expected behavior

It should stop at the first breakpoint.

@andyw8 andyw8 changed the title First breakpoint is skipped when running via bin/rails runner on a remote development environment First breakpoint is skipped Feb 17, 2023
@andyw8 andyw8 changed the title First breakpoint is skipped First breakpoint is skipped on a remote development environment Feb 22, 2023
@andyw8
Copy link
Contributor Author

andyw8 commented Feb 23, 2023

Some further findings on this:

It seems like a race condition. If I add sleep 0.1 before this line:

DEBUGGER__.debug{ "readline: #{msg.inspect}" }

then it stops at the first breakpoint.

I'm wondering if could relate to #131

Also:

  • It doesn't occur when useTerminal is enabled.

(cc @st0012)

@andyw8
Copy link
Contributor Author

andyw8 commented Feb 23, 2023

Additionally, if I set this to false, it seems to illustrate that it does stop on the first breakpoint, but immediately continues.

[1, 4] in /workspaces/codespaces-rails/test.rb
     1| a = 1
     2| sleep 1
=>   3| binding.b
     4| binding.b
=>#0	<main> at /workspaces/codespaces-rails/test.rb:3
(rdbg:#debugger) eval $stdout.sync=true
[1, 4] in /workspaces/codespaces-rails/test.rb
     1| a = 1
     2| sleep 1
     3| binding.b
=>   4| binding.b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants