Unix Socket file not being cleared after graceful shutdown
tiredenzo opened this issue · comments
Describe the bug
The Unix socket file is not being removed from the file system after a graceful shutdown, which prevents puma from restarting
Puma config:
# Change to match your CPU core count
workers 2
# Min and Max threads per worker
threads 1, 4
app_dir = File.expand_path("../..", __FILE__)
shared_dir = "#{app_dir}/shared"
# Default to production
app_env = ENV['APP_ENV'] || "production"
environment app_env
# Set up socket location
bind "unix://#{shared_dir}/sockets/puma.sock"
# Logging
# stdout_redirect "#{shared_dir}/log/puma.stdout.log", "#{shared_dir}/log/puma.stderr.log", true
# Set master PID and state locations
pidfile "#{shared_dir}/pids/puma.pid"
state_path "#{shared_dir}/pids/puma.state"
activate_control_app
To Reproduce
run twice (Ctrl + C or kill TERM and re-run)
bundle exec puma -C config/puma.rb
This behavior appeared after the release of Puma 5.3.0
, it works fine with 5.2.2
https://github.com/puma/puma/compare/v5.2.2..v5.3.0
Expected behavior
The socket file should be removed after a graceful shutdown
Desktop (please complete the following information):
- OS: [Linux]
- Puma Version [5.2.3 up to 6.2.2]
Can't repro. Tried with 5.6.5 and master, using both a config file and -b
from the CLI. If the file exists before starting Puma, it will leave the file intact. If it doesn't, it will remove it.
Could something be stopping removal of the file? Not.sure...
Sadly I don't have time to dig more into that.
I need to ship this code, I am not paid for it. It's volunteering work.
I will try on the next project that has the same setup to see what's wrong.
I have a docker setup with osx it may come from here. In that case, the issue might not come from Puma.
Thanks
It's volunteering work.
As it is with my work with Puma. Can't speak for the other maintainers, but I suspect the same.
Below is output from one terminal, started Puma 5.6.5 in another.
$ cat /tmp/puma.sock
cat: /tmp/puma.sock: No such file or directory
$ # start Puma in another terminal
$ cat /tmp/puma.sock
cat: /tmp/puma.sock: No such device or address
$ kill -s TERM 46593 # Stop Puma
$ cat /tmp/puma.sock
cat: /tmp/puma.sock: No such file or directory
Thank you for your work on this project I didn't mean to be disrespectful.
I should have known better ;)
Since I was already reviewing the test suite, test is covered by:
puma/test/test_integration_cluster.rb
Lines 94 to 97 in dfd33df
The leads to code in the teardown, @bind_path
is an instance variable assigned to the path of a unix bind/listener, when used.
puma/test/helpers/integration.rb
Lines 45 to 48 in dfd33df
Or, this is covered in the test suite, but like alot of large test suites, it may be easier to run console code rather than finding it in the test suite.
I should have known better ;)
No problem. We've all had those kind of days.
At present, I can't run macOS locally. Also, our CI has had issues with macOS file operations, and the same code runs just fine with Ubuntu...
Thanks
I will dig into that in the next project