From: Eric Wong <bofh@yhbt.net>
To: unicorn-public@yhbt.net
Subject: [PATCH] http_server: remove close_sockets_on_exec
Date: Wed, 1 Mar 2023 21:50:38 +0000 [thread overview]
Message-ID: <20230301215038.2693561-1-bofh@yhbt.net> (raw)
This has been irrelevant since Ruby 1.9.0+, actually.
---
lib/unicorn/http_server.rb | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index 3416808..0ba24d8 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -446,11 +446,6 @@ def reexec
Dir.chdir(START_CTX[:cwd])
cmd = [ START_CTX[0] ].concat(START_CTX[:argv])
- # avoid leaking FDs we don't know about, but let before_exec
- # unset FD_CLOEXEC, if anything else in the app eventually
- # relies on FD inheritence.
- close_sockets_on_exec(listener_fds)
-
# exec(command, hash) works in at least 1.9.1+, but will only be
# required in 1.9.4/2.0.0 at earliest.
cmd << listener_fds
@@ -472,8 +467,6 @@ def worker_spawn(worker)
worker_info = [worker.nr, worker.to_io.fileno, worker.master.fileno]
env['UNICORN_WORKER'] = worker_info.join(',')
- close_sockets_on_exec(listener_fds)
-
Process.spawn(env, START_CTX[0], *START_CTX[:argv], listener_fds)
end
@@ -486,15 +479,6 @@ def listener_sockets
listener_fds
end
- def close_sockets_on_exec(sockets)
- (3..1024).each do |io|
- next if sockets.include?(io)
- io = IO.for_fd(io) rescue next
- io.autoclose = false
- io.close_on_exec = true
- end
- end
-
# forcibly terminate all workers that haven't checked in in timeout seconds. The timeout is implemented using an unlinked File
def murder_lazy_workers
next_sleep = @timeout - 1
reply other threads:[~2023-03-01 21:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://yhbt.net/unicorn/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230301215038.2693561-1-bofh@yhbt.net \
--to=bofh@yhbt.net \
--cc=unicorn-public@yhbt.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhbt.net/unicorn.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).