From: Eric Wong <bofh@yhbt.net>
To: unicorn-public@yhbt.net
Subject: [PATCH] test/test_helper: only unlink redirected logs from parent
Date: Fri, 12 Mar 2021 22:08:46 -0400 [thread overview]
Message-ID: <20210313020846.16192-1-bofh@yhbt.net> (raw)
We don't want at_exit firing in child processes and never wanted
it. This is apparently a long standing bug in the tests that
only started causing test_worker_dies_on_dead_master failures
for me. I assume it's only showing up now for me due to kernel
scheduler changes, since I've been using the same 4-core CPU for
~11 years, now.
---
test/test_helper.rb | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 974d2f2..ba5ef16 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -42,6 +42,7 @@
def redirect_test_io
orig_err = STDERR.dup
orig_out = STDOUT.dup
+ rdr_pid = $$
new_out = File.open("test_stdout.#$$.log", "a")
new_err = File.open("test_stderr.#$$.log", "a")
new_out.sync = new_err.sync = true
@@ -59,8 +60,10 @@ def redirect_test_io
STDERR.sync = STDOUT.sync = true
at_exit do
- File.unlink(new_out.path) rescue nil
- File.unlink(new_err.path) rescue nil
+ if rdr_pid == $$
+ File.unlink(new_out.path) rescue nil
+ File.unlink(new_err.path) rescue nil
+ end
end
begin
reply other threads:[~2021-03-13 2:08 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=20210313020846.16192-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).