Skip to content
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

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

Open
bensheldon opened this issue May 16, 2024 · 2 comments

Comments

@bensheldon
Copy link

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.

@frederikspang
Copy link

We're seeing the exact same problems - As if rbtracr cannot Connect while puma thread is sleeping/awaiting requests.
When running with ab while tracing, it worked 99% of the time.

Maybe Multi-process/multi-threaded only - I don't recall seeing the same issue locally.

For context - this was inside a container in kubernetes. Not sure it matters.

@smathieu
Copy link

We're also seeing the same issue with Puma 6.4.2. I'm seeing this both locally (MacOS) & on Heroku.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants