vscode-ruby-debug
vscode-ruby-debug copied to clipboard
Exit code 1
Just gave it a try. At first it worked. I just wanted to run it again after I changed something in the code and ever since I get "Debugger exited without connecting (exit code 1)". I tried restarting vscode, but no avail.
Any idea what error code 1 is?
There is no output in any of the terminals. I don't use bundler.
The most common cause of exit code 1 is that the program couldn't be found. If you're using something like rvm or rbenv, is it possible you switched to a version of Ruby that doesn't have the gem installed?
I'll try to debug it a bit more, but I don't use rvm or rbenv. I just have stock ruby installed with pacman on arch, then all needed gems installed globally with gem install
as root. I'm trying to debug a ruby script that is in a gem like directory, with a bin script that loads the rest of the app with require_relative
. I tried putting the scripts path as an absolute path rather than a ${workspaceRoot}
relative, but that didn't fix it.
Would it be the debugger program that couldn't be found? I will do a reboot, since I did an system upgrade since, but yesterday i literally just changed a debug statement in the code and since it wouldn't work anymore, so I'm a bit puzzled.
Ok, I figured a workaround. There is a lingering readapt
process. When I kill that with the system monitor, I can launch debug again.
This is probably unrelated, but I do get an error in the debug console:\
#<Thread:0x0000557647b1f478 /usr/lib/ruby/gems/2.7.0/gems/backport-1.1.2/lib/backport/client.rb:101 run> terminated with exception (report_on_exception is true):
/usr/lib/ruby/gems/2.7.0/gems/readapt-1.0.0/lib/readapt/output.rb:20:in `to_json': "\\xC3" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
from /usr/lib/ruby/gems/2.7.0/gems/readapt-1.0.0/lib/readapt/output.rb:20:in `send_event'
from /usr/lib/ruby/gems/2.7.0/gems/readapt-1.0.0/lib/readapt/output.rb:8:in `receiving'
from /usr/lib/ruby/gems/2.7.0/gems/backport-1.1.2/lib/backport/client.rb:63:in `tick'
from /usr/lib/ruby/gems/2.7.0/gems/backport-1.1.2/lib/backport/server/stdio.rb:18:in `update'
from /usr/lib/ruby/2.7.0/observer.rb:197:in `block in notify_observers'
from /usr/lib/ruby/2.7.0/observer.rb:196:in `each'
from /usr/lib/ruby/2.7.0/observer.rb:196:in `notify_observers'
from /usr/lib/ruby/gems/2.7.0/gems/backport-1.1.2/lib/backport/client.rb:121:in `read_input'
from /usr/lib/ruby/gems/2.7.0/gems/backport-1.1.2/lib/backport/client.rb:102:in `block in run_input_thread'
Don't really know where it's coming from, as all of my source files are valid UTF-8. My default locale is en_US.UTF-8
. It doesn't keep me from debugging, but it might cause the process to linger?
Yeah, that could be the problem. If it's making the server adapter hang, it might stop the process from exiting properly. Thanks for tracking it down. I'll look into it.
Ran into the same situation. When something fails and readapt
hangs, then it does exit 1 and should be killed through the terminal to work again.
Happened to me too, lost around an hour till I found this thread - thanks guys for the solution!
@najamelan Thanks a lot!! Worked for me!
I'm having the same issue, but only on GitHub Codespaces. Everything works fine at first, but restarting or stopping then starting the debug session results in either an exit code 1 error or the debug session briefly starting but Rails/Puma complaining about an existing server.pid
file.
Locally, using the Remote - Containers extension, restarting debug sessions works fine.
Okay, I figured out the problem with Codespaces. It looks like something with how auto-forwarded ports does not play well with Readapt's TCP server. Turning off automatic port forwarding fixes the issue:
// settings.json
{
"remote.autoForwardPorts": false
}
@najamelan ran into the same problem. Thanks for the solution.