You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mitogen/docs
Alex Willmer 85d6046f2f mitogen: Fix non-blocking IO errors in first stage of bootstrap
When /etc/sudoers has log_output (or similar) enabled the process spawned by
`ctx.sudo()` via `mitogen.parent.Connection.start_child()` receives a stdin
that is in non-blocking mode. The immediate symptom is that `os.openfd(0,
...).read(n)` sometimes returns `None`, causing the first stage to raise an
unhandled TypeError.

The fix (for now) is to use `select.select()` in a while loop to read stdin.
This increases the command size slightly, but I think it's a reasonable
tradeoff until/unless the cause is more fully understood.

All CI tests are now run with sudoers log_output enabled, in order to catch
regressions. `first_stage_test.CommandLineTest` has been amended, because it
relied on implementation details of the bootstrap process that are no longer
true.

Before
```
SSH command size: 755
Preamble (mitogen.core + econtext) size: 18227 (17.80KiB)

                        Original           Minimized           Compressed
mitogen.core         152218 148.7KiB  68437 66.8KiB 45.0%  18124 17.7KiB 11.9%
mitogen.parent        98853  96.5KiB  51103 49.9KiB 51.7%  12881 12.6KiB 13.0%
mitogen.fork           8445   8.2KiB   4139  4.0KiB 49.0%   1652  1.6KiB 19.6%
mitogen.ssh           10827  10.6KiB   6893  6.7KiB 63.7%   2099  2.0KiB 19.4%
mitogen.sudo          12089  11.8KiB   5924  5.8KiB 49.0%   2249  2.2KiB 18.6%
mitogen.select        12325  12.0KiB   2929  2.9KiB 23.8%    964  0.9KiB  7.8%
mitogen.service       41581  40.6KiB  22398 21.9KiB 53.9%   5847  5.7KiB 14.1%
mitogen.fakessh       15767  15.4KiB   8149  8.0KiB 51.7%   2676  2.6KiB 17.0%
mitogen.master        55317  54.0KiB  28846 28.2KiB 52.1%   7528  7.4KiB 13.6%
```

After
```
SSH command size: 798
Preamble (mitogen.core + econtext) size: 18227 (17.80KiB)

                        Original           Minimized           Compressed
mitogen.core         152218 148.7KiB  68437 66.8KiB 45.0%  18124 17.7KiB 11.9%
mitogen.parent        98944  96.6KiB  51180 50.0KiB 51.7%  12910 12.6KiB 13.0%
mitogen.fork           8445   8.2KiB   4139  4.0KiB 49.0%   1652  1.6KiB 19.6%
mitogen.ssh           10827  10.6KiB   6893  6.7KiB 63.7%   2099  2.0KiB 19.4%
mitogen.sudo          12089  11.8KiB   5924  5.8KiB 49.0%   2249  2.2KiB 18.6%
mitogen.select        12325  12.0KiB   2929  2.9KiB 23.8%    964  0.9KiB  7.8%
mitogen.service       41581  40.6KiB  22398 21.9KiB 53.9%   5847  5.7KiB 14.1%
mitogen.fakessh       15767  15.4KiB   8149  8.0KiB 51.7%   2676  2.6KiB 17.0%
mitogen.master        55317  54.0KiB  28846 28.2KiB 52.1%   7528  7.4KiB 13.6%
```
3 months ago
..
_static docs: remove a little more top margin wastage 7 years ago
_templates docs: Remove piwik analytics hooks from website 1 year ago
images issue #505: docs: add new detail graph for one scenario. 7 years ago
.gitignore docs: fix intensely annoying _prefix, 2 years later. 8 years ago
Makefile docs: get rid of autobuild remnant 7 years ago
ansible_detailed.rst Update missing host key checking argument in docs/ansible_detailed.rst 5 months ago
api.rst Add podman connection support 4 years ago
changelog.rst mitogen: Fix non-blocking IO errors in first stage of bootstrap 3 months ago
conf.py docs: Fix website download link when there is a pre-release 6 months ago
contributors.rst docs: Add changelog, credits for connection_loader__get fixes 11 months ago
domainrefs.py docs: add domainrefs plugin to make link aliases everywhere \o/ 6 years ago
examples.rst Replace os.system() with subprocess.check_call() 4 years ago
getting_started.rst Fix for sample in doc 6 years ago
howitworks.rst trivia: Fix trailing whitespace 1 year ago
index.rst docs: Update external URLs (e.g. dw/mitogen -> mitogen-hq/mitogen) 2 years ago
internals.rst Merge devel/290 @ 79b979ec8544ef5d8620c64068d4a42fabf50415 6 years ago
netlify.toml docs: Fix "No module named 'imghdr'" when building website 11 months ago
pickle-substitutes.ods docs: First round of Pickle-likes survey 8 years ago
requirements.txt docs: Fix generation of static website 2 years ago
services.rst issue #589: ensure real FileService/PushFileService are in the docs 7 years ago
toc.rst docs: reorder chapters 6 years ago