I have a rails application in which I use foreman to start my rails and sidekiq servers. Since foreman doesn't interact well with regular byebug (you can't see the prompt as you type), I have set up remote debugging for both my rails and sidekiq servers. This works perfectly for the rails server, but when I connect to the byebug server for the sidekiq server, I get the following:
$ bundle exec byebug -R localhost:58501
Connecting to byebug server localhost:58501...
Connected.
(byebug:ctrl)
And I'm unable to catch any byebug breakpoints.
According to the documentation, the (byebug:ctrl) prompt means that the program has terminated normally (https://github.com/deivid-rodriguez/byebug/blob/master/GUIDE.md), but sidekiq is running jobs just fine.
Is there something incorrect in my configuration, or is sidekiq just not compatible with byebug's remote debugging?
Procfile:
sidekiq: bundle exec sidekiq
rails: rails server
config/initializers/byebug.rb:
if Rails.env.development?
require 'byebug'
def find_available_port
server = TCPServer.new(nil, 0)
server.addr[1]
ensure
server.close if server
end
port = find_available_port
puts "Starting remote debugger..."
Byebug.start_server 'localhost', port
puts "Remote debugger on port #{port}"
end
Note that when I don't use remote debugging, byebug functions fine with sidekiq (although in foreman I can't see the prompt as I type).
Also note that I've tried using Byebug.wait_connection = true
before Byebug.start_server
, but I have the same issue.