-
Notifications
You must be signed in to change notification settings - Fork 83
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
Server Mode #145
Server Mode #145
Conversation
5975142
to
92d12d9
Compare
Anything I can do to get this PR merged in? @denofevil @mkrauskopf |
@dlanileonardo great addition, I'm using ruby-debug-ide from your repo until it gets merged. By the way, what is your workflow for rails debugging with docker? I'm using
|
@paulodeleo |
@ViugiNick that is what I'm already doing, and the whole point of this PR is to have a way to avoid making the server wait for a connection and be able to connect whenever you want, witch What I would also like to do is to be able to freely disconnect / reconnect the debugger without killing the server process. Much like the As I recently switched to VS Code and discovered |
Hi @paulodeleo, I'm Using the branch feature/debugger of my fork vscode-ruby, because the repository owner vscode-ruby did not accepeted my request, anyway how can you observed the both don't accept my PR, so i think devs are too pround 😡, because that way the Workflow of the dev would look perfect as it should be. In this branch, the debugger works exactly as u need it. Just put feature/debugger branch in
My extension to Debug like a Boss 😎 and vscode-ruby 🤐 official to write code and lint. Sorry for delay. 🙏🏻 |
@dlanileonardo I'm getting this error when trying to start debugging with
Any idea of what is wrong? |
Any news on this? What are the blockers preventing this from getting merged? |
@@ -136,11 +136,13 @@ def regexp | |||
end | |||
|
|||
def execute | |||
Debugger.require_multiprocess |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't it already required by this moment?
|
||
if options.attach_mode | ||
Debugger.require_multiprocess |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to require it here?
@@ -90,6 +90,8 @@ def process_commands | |||
end | |||
end | |||
rescue ::Exception | |||
# Workaround to Disconnect in Paused State | |||
return @interface.command_queue << "finish" if $!.message === 'closed stream' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's better to return after logging the error and backtrace
@dlanileonardo @jamesmosier @paulodeleo @Eusebius1920 I don't fully understand what the difference between this approach and just disabling all breakpoints, keeping the debug session running. I'd like to note that if you initially launched the application with debugging, ruby virtual machine handlers will be installed for it(here ruby-debug-ide/lib/ruby-debug-ide.rb Line 100 in 235f8fa
mute breakpoints functionality.
|
@ViugiNick I am using ruby-debug-ide with visual studio code and there your abilities and hotkeys change if there is an active deugging session (to better suit your needs in such situations). So I prefer having my debug-session running (always) and just attaching to the debugger (with visual-studio-code) if I really want to debug somewhere. If I start the ruby-debug-ide then I have to attach to it quickly and disconnect everytime to get the ruby-application up and running (so that I can re-attach later, when I need it). Otherwise ruby-debug-ide will just wait for a first connect and the ruby-application never gets started. This is kind of annoying, that you have to attach just as a formality each time you start the debugger. Always running in debug-mode in visual studio code is not ideal either as it switches on purpose to the mentioned debug-mode when you connect to a debugger. In the current setting I have two realistic settings:
|
I guess this wants to achieve exactly the same: |
My use case is this: As a team we have a rails server running in Docker and not everyone uses vscode and not everyone wants to run ruby-debug. Therefore I wanted to have opt-in functionality for those of us who want to start up the rails server via docker, connect/disconnect the debugger, or not run it at all. Either way not a huge deal, I understand the limitations/hesitations with this and my closed PR. Thanks for your work on the extension! |
@jamesmosier But after all, in order to connect to the debug server, you still need to initially run the debug command, and not just the rails server. In other words, your command line will be different from a command line of people who are not going to debug the application. Maybe you need something like that https://www.jetbrains.com/help/ruby/attaching-to-process.html |
@ViugiNick When use Docker and Compose to development, and you have micro services with a lot of dependency's, restarting and alternate Instance Work and Instance Debug is a waste of time. With this PR, you server just run and you can use application debugging or not, the server listening debug port and you can attach it in anytime. Example: docker-compose.yml mysql: ...
frontend: ...
depends_on:
- api
- backend
- cable
api:
depends_on:
- mysql
...
command: bundle exec bundle exec rdebug-ide --evaluation-timeout 10 --server-mode --host 0.0.0.0 --port 1231 -- bin/rails s -P /app/tmp/pids/api.pid -p 3000 -b 0.0.0.0
sidekiq:
depends_on:
- cable
- mysql
...
command: bundle exec bundle exec rdebug-ide --evaluation-timeout 10 --server-mode --host 0.0.0.0 --port 1231 -- bin/rails s -P /app/tmp/pids/sidekiq.pid -p 3000 -b 0.0.0.0
cable:
- api
...
command: bundle exec bundle exec rdebug-ide --evaluation-timeout 10 --server-mode --host 0.0.0.0 --port 1231 -- bin/rails s -P /app/tmp/pids/cable.pid -p 3000 -b 0.0.0.0 In this example, today (without server mode) i needed change my docker-compose.yml for every debug or work instance in cable, sidekiq or api , this cause a restart of frontend unnecessarily. |
@dlanileonardo Why can't you just mute breakpoints and use the same docker-compose.yml? |
@dlanileonardo With such technique you can switch back to debugging just by unmuting them without reconnecting to debug session (as I mentioned here #145 (comment)) |
@ViugiNick The problem is I need to connect every instance to this work, and open 3 windows vscode and connect it in cable, sidekiq and api. |
I guess the whole Pullrequest essentially boils down to this single line of code (or even only the the second half): ruby-debug-ide/lib/ruby-debug-ide.rb Line 103 in 57f4243
(Can you confirm this @dlanileonardo ?) Is this adding so much complexity that it can become a burder that you have to drag along in further development (This is not meant to sound sarcastic but a serious question to those who know the internals of this project. I have no idea who this project internally works in any detail) If not the discussion appears really unnecessary to me. I am not happy with the naming ( |
@dlanileonardo There are some unresolved comments in review. |
Could we please just merge this now? Just as a side note...it's just a flag/option. Nobody is forced to use it. I also don't understand this discussion. I have a hard time understanding the current short comings though. I want to connect or disconnect to a debug server session without
This is especially annoying in multi-server local dev setups with docker-compose. I hope there's a way to have this PR merged. |
@iggycoder As you can see, there are a number of comments for this PR, thats why we don't merge it for now. |
@ViugiNick Overlooked that. sorry. |
6d12ed9
to
73c4185
Compare
The PR enable a server-mode option with doesn't wait for connection to start webserver, it's very sux when you are working with microservices, start a docker container justo to debug.
With this PR you can start rails and work, debugging when you want.
Is good to Docker an Vscode. 😉