mitogen: Only close stdio file descriptors that were open at process startup - #1268
Merged
Conversation
This eliminates the need for ansible_facts to be gathered before become_unpriv_available can be referenced.
…ed`) Required by Ansible 12 (ansible-core-2.19). refs mitogen-hq#1298
…ybook This makes the behaviour more consistent across jobs that run with `mitogen_linear` or plain `linear`.
The Van_* GitHub Actions jobs (corresponding to Tox factor strategy_linear, environment variable ANSIBLE_STRATEGY=linear) were failing inside Mitogen modules, which they should not touch. The jobs are intended as a cross validation of the test suite, they should only fail if Ansible itself has a problem.
Simplifies matching a failed test to the play/task.
Some tests have been seen deadlocked. They continued running for an hour+, until the default Github timeout. Linux timeout higher than macOS because the Linux jobs run more tests.
There should be no behaviour change.
Makes it more obvious and easier to find where stdin, stdout, and stderr file descriptors are being interacted with.
…startup File descriptors 0, 1, and 2 are usually stdin, stdout, stderr; but not always. If a process is started without one of these then the first descriptor allocated by the process opening a file or socket will be allocated an fd <= STDERR_FILENO. This isn't common, but it does occur, e.g. Windows GUI apps started without being connected to a console, controller side plugins run under Ansible 12 (ansible-core 2.19). In such cases the corresponding sys attribute (e.g. sys.stderr) will be None. refs mitogen-hq#1258 See also - https://docs.python.org/3/library/sys.html#sys.__stdin__ - https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_12.html#porting-guide-for-v12-0-0a1 - ansible/ansible#82770 - python/typeshed#11778 - https://gist.github.com/moreati/034fef45f73d809d9411a8a63eca34d6
The repr() of file objects is more self descriptive, and includes the fd.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
File descriptors 0, 1, and 2 are usually stdin, stdout, stderr; but not always. If a process is started without one of these then the first descriptor allocated by the process opening a file or socket will be allocated an fd <= STDERR_FILENO. This isn't common, but it does occur, e.g. Windows GUI apps started without being connected to a console, controller side plugins run under Ansible 12 (ansible-core 2.19).
In such cases the corresponding sys attribute (e.g.
sys.stderr) will beNone.This PR is in preparation of Ansible 12 (ansible-core 2.19). During development Mitogen was hanging or closing the connection early with ansible-core 2.19.0a and 2.19.0b releases. The cause was Mitogen incorrectly closing its own sockets and pipes, because they had an fd <= 3.
See #1258, #1259
See also
sysstandard streams can beNonepython/typeshed#11778