1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Do not remove pre-existing socket after USR2+TERM (#2816) (#2817)

The issue was that inherited socket was added to the @unix_paths list even if it was pre-existing.
Test added.

Closed #2816.
This commit is contained in:
Vitalii Khustochka 2022-02-20 08:27:57 -06:00 committed by GitHub
parent bdbd46ebbc
commit eb59ed00d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 1 deletions

View file

@ -189,7 +189,7 @@ module Puma
end
if fd = @inherited_fds.delete(str)
@unix_paths << path unless abstract
@unix_paths << path unless abstract || File.exist?(path)
io = inherit_unix_listener path, fd
log_writer.log "* Inherited #{str}"
elsif sock = @activated_sockets.delete([ :unix, path ]) ||

View file

@ -43,6 +43,26 @@ class TestIntegrationCluster < TestIntegration
end
end
def test_pre_existing_unix_stop_after_restart
skip_unless :unix
File.open(@bind_path, mode: 'wb') { |f| f.puts 'pre existing' }
cli_server "-w #{workers} -q test/rackup/sleep_step.ru", unix: :unix
connection = connect(nil, unix: true)
restart_server connection
connect(nil, unix: true)
stop_server
assert File.exist?(@bind_path)
ensure
if UNIX_SKT_EXIST
File.unlink @bind_path if File.exist? @bind_path
end
end
def test_siginfo_thread_print
skip_unless_signal_exist? :INFO