ruby on rails - ByeBug remote won't hit breakpoints with Unicorn -


i launch unicorn through foreman, debugger prompt swallowed. i've had luck debugger gem in past connecting remote debugger.

we're upgrade ruby 2.1.2 which, understand it, not compatible debugger.

i've changed remote debugger code use byebug:

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 "remote debugger on port #{port}" byebug.start_server('localhost', port) 

once unicorn started, can connect byebug:

$ byebug -r localhost:54623 connecting byebug server localhost:54623 connected. 

but code littered byebug calls, , never trigger breakpoint in remote debugger. pages block on load when debugger not remote load when connected remotely.

the unicorn file specifies 1 worker, i'm reasonably sure that's not it:

require file.dirname(__file__)+'/application'  if rails.env.development?   worker_processes 1   timeout_override = env['webserver_timeout_override']   timeout integer(timeout_override || 3600)   if timeout_override     puts "development: using webserver_timeout_override of #{timeout_override} seconds"   end else   worker_processes integer(env['web_concurrency'] || 3)   timeout 25 end  preload_app true  before_fork |server, worker|    signal.trap 'term'     puts 'unicorn master intercepting term , sending myself quit instead'     process.kill 'quit', process.pid   end    defined?(activerecord::base) ,       activerecord::base.connection.disconnect! end  after_fork |server, worker|    signal.trap 'term'     puts 'unicorn worker intercepting term , doing nothing. wait master send quit'   end    defined?(activerecord::base) ,       activerecord::base.establish_connection end 

any ideas appreciated.

i think missed 1 simple setting: byebug.wait_connection = true

change this

port = find_available_port puts "remote debugger on port #{port}" byebug.start_server('localhost', port) 

to this

port = find_available_port puts "remote debugger on port #{port}" byebug.wait_connection = true byebug.start_server('localhost', port) 

this should magic. hope helps.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -