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

lib: Attach stdout to child only if --log=stdout and stdout FD is a tty (backport #16738) #16966

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Oct 1, 2024

We've faced with a regression after we moved from frr 8.5 to a newer versions (9.0, 9.1, 10.0, 10.1).

In our automation we start frr from python code using subprocess like this:

subprocess.run(
    ["/usr/lib/frr/frrinit.sh", "start"],
    stdout=subprocess.PIPE,
    stderr=subprocess.PIPE,
)

This call hangs in poll() for stdout FD indefinitely and frrinit.sh hangs in zombie state unless we kill subprocess.run() call.
If we remove stdout capturing from subprocess.run() call (make associated to stdout FD a tty FD), things go well and process terminates correctly with no hangs and zombies.
This commit fixes this situation where stdout of a process started in a daemon mode was attached to a calling process regardless of presence --log option.

If this patch is acceptable, it's worth backporting down to 9.0 branch, where the initial commit 4d28aea appeared.


This is an automatic backport of pull request #16738 done by Mergify.

Prior to this commit stdout of a process started in a daemon mode was
attached to a calling process.
As a result a calling process hung for infinity.

Signed-off-by: Vladislav Odintsov <vlodintsov@k2.cloud>
(cherry picked from commit 0e3c5e8)
@frrbot frrbot bot added the libfrr label Oct 1, 2024
@donaldsharp donaldsharp merged commit 934b41e into stable/9.1 Oct 1, 2024
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants