Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Feature request: Debug multiple Ruby processes at once #126

Closed

Description

@benglewis

Your environment

  • vscode-ruby version:
  • Ruby version:
  • VS Code version:
  • Operating System:
  • Hardware (optional):

Make sure you have ruby, ruby-debug-ide and ruby-debug-basex19 installed before submitting your issue -- thank you !

Expected behavior

I should be able to launch multiple Ruby debug processes at once, e.g. we'd like to be able to debug Rails, Sidekiq and ActionCable.

If I get a few spare minutes in the next few weeks, I may open a pull request to do this.

Actual behavior

The Ruby-Debug-IDE is always connecting to port 1234, so launching more than one Ruby process with the debugger fails.

Steps to reproduce the problem

Try to debug multiple Ruby processes at once.

I'm new to Visual Studio Code, so I'll see if I can figure out how to add this feature to the extension in the next few weeks :)

Activity

  1. brunocechet commented on Mar 23, 2017

    @brunocechet

    +1

  2. rebornix commented on Apr 17, 2017

    @rebornix
    Member

    @ukblewis thanks for your feedback and this is a valid feature request. I'll say it is not too difficult to implement :) It consists of two parts

    Let me know if you are still interested in contributing to it :) Previously this project is kind of dead as I'm busy with other stuff but now I'll spend time on it every week if possible.

  3. benglewis commented on Apr 17, 2017

    @benglewis
    Author

    Hi @rebornix ,

    I've made some attempt to start this - see my open pull request that let's you manually assign ports. But I'm struggling to get the tests to pass - it seems like it's not related to my code - so if you could help with that, that'd be awesome! :)

    Thank you!

  4. rebornix commented on Apr 17, 2017

    @rebornix
    Member

    @ukblewis I left comments in your PR and they are real easy fix :) It looks good to me, I'll merge it once you update.

  5. benglewis commented on Apr 20, 2017

    @benglewis
    Author

    Thank you @rebornix :) Super excited to try this out!

  6. mlavandero commented on Jul 13, 2017

    @mlavandero

    Where's the PR? On what version will this be out?

  7. benglewis commented on Jul 13, 2017

    @benglewis
    Author

    PR #148 fixes an issue I encountered after my original PR that added this feature. It is merged into master, it's just a matter of when @rebornix decides to trigger a new release.

  8. senhalil commented on Mar 4, 2019

    @senhalil

    Hi @benglewis I am trying to debug an application with two processes (a server and a worker). I am using the following launch.json file (as explained in the link @rebornix gave in #126 (comment))

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Workers",
                "type": "Ruby",
                "request": "launch",
                "cwd": "${workspaceRoot}",
                "program": "/home/username/.rbenv/versions/2.1.8/bin/rake",
                "useBundler": true,
                "env": {
                    "COUNT": "5",
                    "QUEUE": "*"
                },
                "args": ["resque:workers"]
            },
            {
                "name": "Server",
                "type": "Ruby",
                "request": "launch",
                "cwd": "${workspaceRoot}",
                "program": "/home/username/.rbenv/versions/2.1.8/bin/rake",
                "useBundler": true,
                "args": ["server"]
            }
        ],
    
        "compounds": [
            {
                "name": "Server/Workers",
                "configurations": ["Server", "Workers"]
            }
        ]
    }
    

    However, I get the following error (either in Server side or Worker side) when I run the Server/Workers compound config:

    Fatal exception in DebugThread loop: Address already in use - bind(2) for "127.0.0.1" port 1234

    Do I do something incorrectly?

  9. quintinm-dev commented on Jun 6, 2020

    @quintinm-dev

    @senhalil were you able to figure this out? Also getting the same issue.

  10. senhalil commented on Jun 8, 2020

    @senhalil

    @qmuncaster nope. Shortly after my message, I stopped trying to use vscode for debugging and started using byebug

  11. fwolff commented on Jun 18, 2020

    @fwolff

    @senhalil, @qmuncaster: you can configure two distinct "debuggerPort"s.

    Here is a working launch.json (provided you started a Redis server first for Sidekiq):

    {
        // 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": [
            {
                "name": "Server",
                "type": "Ruby",
                "request": "launch",
                "program": "${workspaceRoot}/bin/rails",
                "args": [
                    "server"
                ],
                "debuggerPort": "1234"
            },
            {
                "name": "Sidekiq",
                "type": "Ruby",
                "request": "launch",
                "program": "${workspaceRoot}/bin/sidekiq",
                "args": [
                    "-C",
                    "${workspaceRoot}/config/sidekiq.yml"
                ],
                "debuggerPort": "1235"
            }
        ],
        "compounds": [
            {
                "name": "Server + Sidekiq",
                "configurations": ["Server", "Sidekiq"]
            }
        ]
    }
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestAdds currently unsupported functionality

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions