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

[2.14] Prevent stdio deadlock in forked children (#79522) #79539

Merged
merged 1 commit into from
Dec 6, 2022

Conversation

nitzmahone
Copy link
Member

SUMMARY
  • background threads writing to stdout/stderr can cause children to deadlock if a thread in the parent holds the internal lock on the BufferedWriter wrapper
  • prevent writes to std handles during fork by monkeypatching stdout/stderr during display startup to require a mutex lock with fork(); this ensures no background threads can hold the lock during a fork operation
  • add integration test that fails reliably on Linux without this fix

(cherry picked from commit 1424484)

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

display.py

ADDITIONAL INFORMATION

* background threads writing to stdout/stderr can cause children to deadlock if a thread in the parent holds the internal lock on the BufferedWriter wrapper
* prevent writes to std handles during fork by monkeypatching stdout/stderr during display startup to require a mutex lock with fork(); this ensures no background threads can hold the lock during a fork operation
* add integration test that fails reliably on Linux without this fix

(cherry picked from commit 1424484)
@nitzmahone nitzmahone closed this Dec 6, 2022
@nitzmahone nitzmahone reopened this Dec 6, 2022
@ansibot ansibot added affects_2.14 backport This PR does not target the devel branch. bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. test This PR relates to tests. labels Dec 6, 2022
@nitzmahone nitzmahone removed the needs_triage Needs a first human triage before being processed. label Dec 6, 2022
@nitzmahone nitzmahone merged commit 047affb into ansible:stable-2.14 Dec 6, 2022
@ansible ansible locked and limited conversation to collaborators Dec 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.14 backport This PR does not target the devel branch. bug This issue/PR relates to a bug. test This PR relates to tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants