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

child_process helper: fix stderr blocking for discard case. fix #2609 #2649

Merged
merged 2 commits into from
Oct 15, 2019

Conversation

repeatedly
Copy link
Member

@repeatedly repeatedly commented Oct 11, 2019

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

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]>
@repeatedly repeatedly added the bug Something isn't working label Oct 11, 2019
@repeatedly repeatedly requested a review from ganmacs October 11, 2019 14:18
@repeatedly repeatedly self-assigned this Oct 11, 2019
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'"
Copy link
Member

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?

Copy link
Member Author

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
Copy link
Member

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.

Copy link
Member Author

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
Copy link
Member

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.

Copy link
Member Author

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]>
@repeatedly repeatedly merged commit 48ed651 into master Oct 15, 2019
@repeatedly repeatedly deleted the fix-child_process-stderr branch October 15, 2019 07:15
repeatedly added a commit that referenced this pull request Oct 25, 2019
child_process helper: fix stderr blocking for discard case. fix #2609
Signed-off-by: Masahiro Nakagawa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Writing to stderr from out_exec_filter plugin, blocks
2 participants