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

unlink UNIXSocket files, fix Binder#close #1970

Merged
merged 1 commit into from Sep 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 4 additions & 8 deletions lib/puma/binder.rb
Expand Up @@ -50,14 +50,6 @@ def env(sock)

def close
@ios.each { |i| i.close }
@unix_paths.each do |i|
# Errno::ENOENT is intermittently raised
begin
unix_socket = UNIXSocket.new i
unix_socket.close
rescue Errno::ENOENT
end
end
end

def import_from_env
Expand Down Expand Up @@ -431,6 +423,10 @@ def close_listeners
end
end

def close_unix_paths
@unix_paths.each { |up| File.unlink(up) if File.exist? up }
nateberkopec marked this conversation as resolved.
Show resolved Hide resolved
end

def redirects_for_restart
redirects = {:close_others => true}
@listeners.each_with_index do |(l, io), i|
Expand Down
1 change: 1 addition & 0 deletions lib/puma/cluster.rb
Expand Up @@ -527,6 +527,7 @@ def run
@suicide_pipe.close
read.close
@wakeup.close
@launcher.close_binder_unix_paths
end
end

Expand Down
4 changes: 4 additions & 0 deletions lib/puma/launcher.rb
Expand Up @@ -220,6 +220,10 @@ def close_binder_listeners
@binder.close_listeners
end

def close_binder_unix_paths
@binder.close_unix_paths
end

private

def reload_worker_directory
Expand Down
1 change: 1 addition & 0 deletions lib/puma/single.rb
Expand Up @@ -118,6 +118,7 @@ def run
rescue Interrupt
# Swallow it
end
@launcher.close_binder_unix_paths
end
end
end