diff --git a/lib/puma/binder.rb b/lib/puma/binder.rb index 6880242044..bacd02e58e 100644 --- a/lib/puma/binder.rb +++ b/lib/puma/binder.rb @@ -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 @@ -431,6 +423,10 @@ def close_listeners end end + def close_unix_paths + @unix_paths.each { |up| File.unlink(up) if File.exist? up } + end + def redirects_for_restart redirects = {:close_others => true} @listeners.each_with_index do |(l, io), i| diff --git a/lib/puma/cluster.rb b/lib/puma/cluster.rb index b09d395124..01d951ce75 100644 --- a/lib/puma/cluster.rb +++ b/lib/puma/cluster.rb @@ -527,6 +527,7 @@ def run @suicide_pipe.close read.close @wakeup.close + @launcher.close_binder_unix_paths end end diff --git a/lib/puma/launcher.rb b/lib/puma/launcher.rb index bc74c4431a..27d665c0a1 100644 --- a/lib/puma/launcher.rb +++ b/lib/puma/launcher.rb @@ -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 diff --git a/lib/puma/single.rb b/lib/puma/single.rb index a1673a8eb7..1b5a56e760 100644 --- a/lib/puma/single.rb +++ b/lib/puma/single.rb @@ -118,6 +118,7 @@ def run rescue Interrupt # Swallow it end + @launcher.close_binder_unix_paths end end end