-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
Prevent stdio deadlock in forked children #79522
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The test
|
ansibot
added
WIP
This issue/PR is a work in progress. Nevertheless it was shared for getting input from peers.
affects_2.15
bug
This issue/PR relates to a bug.
needs_triage
Needs a first human triage before being processed.
labels
Dec 2, 2022
nitzmahone
force-pushed
the
fork_safe_stdio
branch
2 times, most recently
from
December 4, 2022 01:50
0bf86db
to
729222a
Compare
nitzmahone
changed the title
Add integration tests for stdio deadlock
Prevent stdio deadlock in forked children
Dec 5, 2022
nitzmahone
removed
the
needs_triage
Needs a first human triage before being processed.
label
Dec 5, 2022
sivel
reviewed
Dec 5, 2022
sivel
reviewed
Dec 5, 2022
ansibot
added
test
This PR relates to tests.
needs_revision
This PR fails CI tests or a maintainer has requested a review/revision of the PR.
and removed
WIP
This issue/PR is a work in progress. Nevertheless it was shared for getting input from peers.
needs_revision
This PR fails CI tests or a maintainer has requested a review/revision of the PR.
labels
Dec 5, 2022
The test
|
ansibot
added
the
needs_revision
This PR fails CI tests or a maintainer has requested a review/revision of the PR.
label
Dec 6, 2022
* demonstrates the underlying issue behind ansible/ansible-runner#1164
* 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 * monkeypatch 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
* patch with something that looks more "real" to avoid warning messages in import sanity (thanks sivel!)
A sanity skip line is needed for the vendored file, like this one: ansible/test/sanity/ignore.txt Line 133 in 80d2f8d
|
nitzmahone
force-pushed
the
fork_safe_stdio
branch
from
December 6, 2022 02:47
0ca11c4
to
8df24a3
Compare
ansibot
removed
the
needs_revision
This PR fails CI tests or a maintainer has requested a review/revision of the PR.
label
Dec 6, 2022
* works with pty wrapper script * still skipping macos since timeout is missing
nitzmahone
force-pushed
the
fork_safe_stdio
branch
from
December 6, 2022 03:54
2509dbf
to
0ccb293
Compare
nitzmahone
added a commit
to nitzmahone/ansible
that referenced
this pull request
Dec 6, 2022
* 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)
anweshadas
pushed a commit
to anweshadas/ansible
that referenced
this pull request
Dec 6, 2022
* 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
nitzmahone
added a commit
that referenced
this pull request
Dec 6, 2022
* 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)
netbsd-srcmastr
pushed a commit
to NetBSD/pkgsrc
that referenced
this pull request
Dec 8, 2022
v2.14.1 ======= Minor Changes ------------- - ansible-test - Improve consistency of executed ``pylint`` commands by making the plugins ordered. Bugfixes -------- - Fixes leftover _valid_attrs usage. - ansible-galaxy - make initial call to Galaxy server on-demand only when installing, getting info about, and listing roles. - copy module will no longer move 'non files' set as src when remote_src=true. - display - reduce risk of post-fork output deadlocks (ansible/ansible#79522) - jinja2_native: preserve quotes in strings (ansible/ansible#79083) - updated error messages to include 'acl' and not just mode changes when failing to set required permissions on remote.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SUMMARY
fork()
operationISSUE TYPE
COMPONENT NAME
display.py
ADDITIONAL INFORMATION