-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
child_process helper: fix stderr blocking for discard case. fix #2609 #2649
Conversation
reopen with IO::NULL is not correct way to discard message. Need to specify IO::NULL when launch process. Signed-off-by: Masahiro Nakagawa <[email protected]>
Timeout.timeout(TEST_DEADLOCK_TIMEOUT) do | ||
ran = false | ||
# lots of stderr message should not be blocked and message should not be printed in test. | ||
cmd = "ruby -e 'while !STDIN.eof? && line = STDIN.readline; STDERR.puts line.chomp * 1000; STDOUT.puts line.chomp; STDOUT.flush rescue nil; end'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure but it needs to callSTDERR.flush
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
STDERR writes lots of data so no flush call is not critical.
end | ||
sleep TEST_WAIT_INTERVAL_FOR_BLOCK_RUNNING until m.locked? || ran | ||
m.lock | ||
m.unlock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mutex#unlock should be called in ensure
context for safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch.
@@ -281,7 +282,7 @@ def child_process_execute_once( | |||
stderrio.set_encoding(external_encoding, internal_encoding, encoding_options) | |||
stderrio_in_use = true | |||
else | |||
stderrio.reopen(IO::NULL) if stderrio && stderrio == :discard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checking, This was a bug, right? stderrio
cannot be a :discard
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. This is typo.
Signed-off-by: Masahiro Nakagawa <[email protected]>
child_process helper: fix stderr blocking for discard case. fix #2609 Signed-off-by: Masahiro Nakagawa <[email protected]>
Signed-off-by: Masahiro Nakagawa [email protected]
Which issue(s) this PR fixes:
Fixes #2609
What this PR does / why we need it:
reopen with IO::NULL is not correct way to discard message.
It replaces ruby side IO object, not process. Thanks nurse-san!
Need to specify IO::NULL when launch the process.
Docs Changes:
No need
Release Note:
Same as title