Skip to content

Puma problems: "pid is not listening for messages", "process already being traced?, "Address already in use - bind(2) for /tmp/rbtrace-47445.sock (Errno::EADDRINUSE)" #97

@bensheldon

Description

@bensheldon

Apologies that this is slightly duplicative of #56, #87, but I figured I would share all of the issues that I'm experiencing when using rbtrace specifically with Puma. Maybe fixed by #86 but I'm unable to successfully build that (probably a me problem).

When booting Puma in single mode (e.g. no separate workers, one process), and in Development mode. All of these are using the command:

rbtrace --pid=<PID> --timeout=60 --eval true

First attempt:

  • I try to connect via rbtrace before Puma receives its first web request, I receive Error: argument --pid (pid is not listening for messages, did you require "rbtrace").
  • Then, if I make a web request, and then connect via rbtrace I get: Error: argument --pid (process already being traced?)
  • Then, if I connect via rbtrace and then immediately reload the browser multiple times, I get: *** process 54112 is already being traced (54398 != 54484)
  • And then I try to connect again and get
    /Users/bensheldon/.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/gems/rbtrace-0.5.1/lib/rbtrace/rbtracer.rb:48:in `bind': Address already in use - bind(2) for /tmp/rbtrace-56790.sock (Errno::EADDRINUSE)
    	from /Users/bensheldon/.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/gems/rbtrace-0.5.1/lib/rbtrace/rbtracer.rb:48:in `initialize'
    	from /Users/bensheldon/.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/gems/rbtrace-0.5.1/lib/rbtrace/cli.rb:428:in `new'
    	from /Users/bensheldon/.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/gems/rbtrace-0.5.1/lib/rbtrace/cli.rb:428:in `run'
    	from /Users/bensheldon/.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/gems/rbtrace-0.5.1/bin/rbtrace:5:in `<top (required)>'
    	from /Users/bensheldon/.rbenv/versions/3.3.1/bin/rbtrace:25:in `load'
    	from /Users/bensheldon/.rbenv/versions/3.3.1/bin/rbtrace:25:in `<main>'
    
  • At this point, there is no receovery without restarting the process.

Trying a second time:

  • I first make a web request to Puma after starting the process
  • I run try to connect with rbtrace while also hammering Browser Refresh and get Error: argument --pid (pid is not listening for messages, did you require "rbtrace"`).
  • I try again to connect, while also hammering Browser Refresh... *** attached to process 54900 🎉
  • ....it hangs for that 60 second timeout.... *** timed out waiting for eval response ☹️

Trying a third time:

  • In this case, I try to connect while also continuously hammering Browser Refresh:

    *** attached to process 54900
    >> true
    => true
    *** detached from process 54900
    

🎉 🎉 🎉

Observation: For reasons I don't know, the Puma process requires continual web requests to allow it to be connected to, and to subsequently complete and detach. Otherwise it gets left in a bad state that prevents further connections without restarting the process.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions