Skip to content

Commit 2b05f22

Browse files
committed
Merge remote-tracking branch 'origin/v028'
* origin/v028: Bump version for release. docs: update Changelog for 0.2.8. issue #627: add test and tweak Reaper behaviour. docs: lots more changelog concision docs: changelog concision docs: more changelog tweaks docs: reorder chapters docs: versionless <title> docs: update supported Ansible version, mention unsupported features docs: changelog fixes/tweaks issue #590: update Changelog.
2 parents a3f4eb6 + c82112a commit 2b05f22

File tree

7 files changed

+180
-103
lines changed

7 files changed

+180
-103
lines changed

docs/ansible_detailed.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ Testimonials
140140
Noteworthy Differences
141141
----------------------
142142

143-
* Ansible 2.3-2.7 are supported along with Python 2.6, 2.7, 3.6 and 3.7. Verify
143+
* Ansible 2.3-2.8 are supported along with Python 2.6, 2.7, 3.6 and 3.7. Verify
144144
your installation is running one of these versions by checking ``ansible
145145
--version`` output.
146146

@@ -164,6 +164,12 @@ Noteworthy Differences
164164
- initech_app
165165
- y2k_fix
166166
167+
* Ansible 2.8 `interpreter discovery
168+
<https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html>`_
169+
and `become plugins
170+
<https://docs.ansible.com/ansible/latest/plugins/become.html>`_ are not yet
171+
supported.
172+
167173
* The ``doas``, ``su`` and ``sudo`` become methods are available. File bugs to
168174
register interest in more.
169175

docs/changelog.rst

Lines changed: 108 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -15,61 +15,65 @@ Release Notes
1515
</style>
1616

1717

18-
v0.2.8 (unreleased)
18+
v0.2.9 (unreleased)
1919
-------------------
2020

2121
To avail of fixes in an unreleased version, please download a ZIP file
2222
`directly from GitHub <https://github.com/dw/mitogen/>`_.
2323

24+
*(no changes)*
25+
26+
27+
v0.2.8 (2019-08-18)
28+
-------------------
29+
30+
This release includes Ansible 2.8 and SELinux support, fixes for two deadlocks,
31+
and major internal design overhauls in preparation for future functionality.
32+
33+
2434
Enhancements
2535
~~~~~~~~~~~~
2636

2737
* :gh:issue:`556`,
28-
:gh:issue:`587`: Ansible 2.8 is partially
29-
supported. `Become plugins
38+
:gh:issue:`587`: Ansible 2.8 is supported. `Become plugins
3039
<https://docs.ansible.com/ansible/latest/plugins/become.html>`_ and
3140
`interpreter discovery
3241
<https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html>`_
3342
are not yet handled.
3443

35-
* :gh:issue:`419`, :gh:issue:`470`, file descriptor usage during large runs is
36-
halved, as it is no longer necessary to manage read and write sides
37-
distinctly in order to work around a design problem.
44+
* :gh:issue:`419`, :gh:issue:`470`, file descriptor usage is approximately
45+
halved, as it is no longer necessary to separately manage read and write
46+
sides to work around a design problem.
3847

39-
* :gh:issue:`419`: almost all connection setup happens on one thread, reducing
40-
contention and context switching early in a run.
48+
* :gh:issue:`419`: setup for all connections happens almost entirely on one
49+
thread, reducing contention and context switching early in a run.
4150

4251
* :gh:issue:`419`: Connection setup is better pipelined, eliminating some
4352
network round-trips. Most infrastructure is in place to support future
44-
removal of the final round-trips between a target fully booting and receiving
53+
removal of the final round-trips between a target booting and receiving
4554
function calls.
4655

4756
* :gh:pull:`595`: the :meth:`~mitogen.parent.Router.buildah` connection method
4857
is available to manipulate `Buildah <https://buildah.io/>`_ containers, and
4958
is exposed to Ansible as the :ans:conn:`buildah`.
5059

51-
* :gh:issue:`615`: the ``mitogen_fetch``
52-
action is included, and the standard Ansible :ans:mod:`fetch` is redirected
53-
to it. This implements streaming file transfer in every case, including when
54-
``become`` is active, preventing excessive CPU usage and memory spikes, and
55-
significantly improving throughput. A copy of 2 files of 512 MiB each drops
56-
from 47 seconds to just under 7 seconds, with peak memory usage dropping from
57-
10.7 GiB to 64.8 MiB.
60+
* :gh:issue:`615`: a modified :ans:mod:`fetch` implements streaming transfer
61+
even when ``become`` is active, avoiding excess CPU usage and memory spikes,
62+
and improving performance. A copy of two 512 MiB files drops from 47 seconds
63+
to 7 seconds, with peak memory usage dropping from 10.7 GiB to 64.8 MiB.
5864

5965
* `Operon <https://networkgenomics.com/operon/>`_ no longer requires a custom
60-
installation, both Operon and Ansible are supported by a unified release.
66+
library installation, both Ansible and Operon are supported by a single
67+
Mitogen release.
6168

62-
* The ``MITOGEN_CPU_COUNT`` environment variable shards the connection
63-
multiplexer into per-CPU workers. This may improve throughput for runs
64-
involving large file transfers, and is required for future in-process SSH
65-
support. One multiplexer starts by default, to match existing behaviour.
69+
* The ``MITOGEN_CPU_COUNT`` variable shards the connection multiplexer into
70+
per-CPU workers. This may improve throughput for large runs involving file
71+
transfer, and is required for future functionality. One multiplexer starts by
72+
default, to match existing behaviour.
6673

67-
* :gh:commit:`d6faff06`,
68-
:gh:commit:`807cbef9`,
69-
:gh:commit:`e93762b3`,
70-
:gh:commit:`50bfe4c7`: locking is
71-
avoided on hot paths, and some locks are released earlier, before waking a
72-
thread that must immediately take the same lock.
74+
* :gh:commit:`d6faff06`, :gh:commit:`807cbef9`, :gh:commit:`e93762b3`,
75+
:gh:commit:`50bfe4c7`: locking is avoided on hot paths, and some locks are
76+
released before waking a thread that must immediately acquire the same lock.
7377

7478

7579
Mitogen for Ansible
@@ -80,46 +84,41 @@ Mitogen for Ansible
8084

8185
* :gh:issue:`410`: Uses of :linux:man7:`unix` sockets are replaced with
8286
traditional :linux:man7:`pipe` pairs when SELinux is detected, to work around
83-
a broken heuristic in popular SELinux policies that prevents inheriting
87+
a broken heuristic in common SELinux policies that prevents inheriting
8488
:linux:man7:`unix` sockets across privilege domains.
8589

8690
* `#467 <httpe://github.com/dw/mitogen/issues/467>`_: an incompatibility
87-
running Mitogen under Molecule was resolved.
88-
89-
* :gh:issue:`547`, :gh:issue:`598`: fix a serious deadlock
90-
possible while initializing the service pool of any child, such as during
91-
connection, ``async`` tasks, tasks using custom :mod:`module_utils`,
92-
``mitogen_task_isolation: fork`` modules, and those present on an internal
93-
blacklist of misbehaving modules.
94-
95-
This deadlock is relatively easy hit, has been present since 0.2.0, and is
96-
likely to have impacted many users. For new connections it could manifest as
97-
a *Connection timed out* error, for forked tasks it could manifest as a
98-
timeout or an apparent hang.
99-
100-
* :gh:issue:`549`: the open file descriptor limit for the Ansible process is
101-
increased to the available hard limit. It is common for distributions to ship
102-
with a much higher hard limit than their default soft limit, allowing *"too
103-
many open files"* errors to be avoided more often in large runs without user
104-
configuration.
105-
106-
* :gh:issue:`558`, :gh:issue:`582`: on Ansible 2.3 a remote directory was
91+
running Mitogen under `Molecule
92+
<https://molecule.readthedocs.io/en/stable/>`_ was resolved.
93+
94+
* :gh:issue:`547`, :gh:issue:`598`: fix a deadlock during initialization of
95+
connections, ``async`` tasks, tasks using custom :mod:`module_utils`,
96+
``mitogen_task_isolation: fork`` modules, and modules present on an internal
97+
blacklist. This would manifest as a timeout or hang, was easily hit, had been
98+
present since 0.2.0, and likely impacted many users.
99+
100+
* :gh:issue:`549`: the open file limit is increased to the permitted hard
101+
limit. It is common for distributions to ship with a higher hard limit than
102+
the default soft limit, allowing *"too many open files"* errors to be avoided
103+
more often in large runs without user intervention.
104+
105+
* :gh:issue:`558`, :gh:issue:`582`: on Ansible 2.3 a directory was
107106
unconditionally deleted after the first module belonging to an action plug-in
108-
had executed, causing the :ans:mod:`unarchive` module to fail.
107+
had executed, causing the :ans:mod:`unarchive` to fail.
109108

110-
* :gh:issue:`578`: the extension could crash while rendering an error message,
111-
due to an incorrect format string.
109+
* :gh:issue:`578`: the extension could crash while rendering an error due to an
110+
incorrect format string.
112111

113112
* :gh:issue:`590`: the importer can handle modules that replace themselves in
114-
:data:`sys.modules` during import.
113+
:data:`sys.modules` with completely unrelated modules during import, as in
114+
the case of Ansible 2.8 :mod:`ansible.module_utils.distro`.
115115

116-
* :gh:issue:`591`: the target's current working directory is restored to a
117-
known-existent directory between tasks to ensure :func:`os.getcwd` will not
118-
fail when called, in the same way that :class:`AnsibleModule` restores it
119-
during initialization. However this restore happens before the module ever
120-
executes, ensuring any code that calls :func:`os.getcwd` prior to
116+
* :gh:issue:`591`: the working directory is reset between tasks to ensure
117+
:func:`os.getcwd` cannot fail, in the same way :class:`AnsibleModule`
118+
resets it during initialization. However this restore happens before the
119+
module executes, ensuring code that calls :func:`os.getcwd` prior to
121120
:class:`AnsibleModule` initialization, such as the Ansible 2.7
122-
:ans:mod:`pip`, cannot fail due to the behavior of a prior task.
121+
:ans:mod:`pip`, cannot fail due to the actions of a prior task.
123122

124123
* :gh:issue:`593`: the SSH connection method exposes
125124
``mitogen_ssh_keepalive_interval`` and ``mitogen_ssh_keepalive_count``
@@ -131,32 +130,47 @@ Mitogen for Ansible
131130
encoding.
132131

133132
* :gh:issue:`602`: connection configuration is more accurately inferred for
134-
`meta: reset_connection`, the `synchronize` module, and for any action
135-
plug-ins that establish additional connections.
133+
:ans:mod:`meta: reset_connection <meta>` the :ans:mod:`synchronize`, and for
134+
any action plug-ins that establish additional connections.
136135

137136
* :gh:issue:`598`, :gh:issue:`605`: fix a deadlock managing a shared counter
138-
used for load balancing.
137+
used for load balancing, present since 0.2.4.
139138

140-
* :gh:issue:`615`: streaming file transfer is implemented for ``fetch`` and
141-
other actions that transfer files from the target to the controller.
142-
Previously the file was sent in one message, requiring it to fit in RAM and
143-
be smaller than the internal message size limit.
139+
* :gh:issue:`615`: streaming is implemented for the :ans:mod:`fetch` and other
140+
actions that transfer files from targets to the controller. Previously files
141+
delivered were sent in one message, requiring them to fit in RAM and be
142+
smaller than an internal message size sanity check. Transfers from controller
143+
to targets have been streaming since 0.2.0.
144144

145-
* :gh:commit:`7ae926b3`: the Ansible :ans:mod:`lineinfile` began leaking
146-
writable temporary file descriptors since Ansible 2.7.0. When
147-
:ans:mod:`~lineinfile` was used to create or modify a script, and that script
148-
was later executed, the execution could fail with "*text file busy*" due to
149-
the leaked descriptor. Temporary descriptors are now tracked and cleaned up
150-
on exit for all modules.
145+
* :gh:commit:`7ae926b3`: the :ans:mod:`lineinfile` leaks writable temporary
146+
file descriptors since Ansible 2.7.0. When :ans:mod:`~lineinfile` created or
147+
modified a script, and that script was later executed, the execution could
148+
fail with "*text file busy*". Temporary descriptors are now tracked and
149+
cleaned up on exit for all modules.
151150

152151

153152
Core Library
154153
~~~~~~~~~~~~
155154

156-
* Log readability is improving, and many :func:`repr` strings are more
157-
descriptive. The old pseudo-function-call format is slowly migrating to
158-
human-readable output where possible. For example,
159-
*"Stream(ssh:123).connect()"* might be written *"connecting to ssh:123"*.
155+
* Log readability is improving and many :func:`repr` strings are more
156+
descriptive. The old pseudo-function-call format is migrating to
157+
readable output where possible. For example, *"Stream(ssh:123).connect()"*
158+
might be written *"connecting to ssh:123"*.
159+
160+
* In preparation for reducing default log output, many messages are delivered
161+
to per-component loggers, including messages originating from children,
162+
enabling :mod:`logging` aggregation to function as designed. An importer
163+
message like::
164+
165+
12:00:00 D mitogen.ctx.remotehost mitogen: loading module "foo"
166+
167+
Might instead be logged to the ``mitogen.importer.[remotehost]`` logger::
168+
169+
12:00:00 D mitogen.importer.[remotehost] loading module "foo"
170+
171+
Allowing a filter or handler for ``mitogen.importer`` to select that logger
172+
in every process. This introduces a small risk of leaking memory in
173+
long-lived programs, as logger objects are internally persistent.
160174

161175
* :func:`bytearray` was removed from the list of supported serialization types.
162176
It was never portable between Python versions, unused, and never made much
@@ -168,27 +182,24 @@ Core Library
168182
asynchronous context.
169183

170184
* :gh:issue:`419`: the internal
171-
:class:`~mitogen.core.Stream` has been refactored into 7 new classes,
185+
:class:`~mitogen.core.Stream` has been refactored into many new classes,
172186
modularizing protocol behaviour, output buffering, line-oriented input
173187
parsing, option handling and connection management. Connection setup is
174-
internally asynchronous, laying almost all the groundwork needed for fully
175-
asynchronous connect, proxied Ansible become plug-ins, and integrating
176-
`libssh <https://www.libssh.org/>`_.
188+
internally asynchronous, laying most groundwork for fully asynchronous
189+
connect, proxied Ansible become plug-ins, and in-process SSH.
177190

178191
* :gh:issue:`169`,
179192
:gh:issue:`419`: zombie subprocess reaping
180-
has vastly improved, by using timers to efficiently poll for a slow child to
181-
finish exiting, and delaying broker shutdown while any subprocess remains.
182-
Polling avoids relying on process-global configuration such as a `SIGCHLD`
183-
handler, or :func:`signal.set_wakeup_fd` available in modern Python.
184-
185-
* :gh:issue:`256`,
186-
:gh:issue:`419`: most :func:`os.dup` use
187-
was eliminated, along with almost all manual file descriptor management.
188-
Descriptors are trapped in :func:`os.fdopen` objects at creation, ensuring a
189-
leaked object will close itself, and ensuring every descriptor is fused to a
190-
`closed` flag, preventing historical bugs where a double close could destroy
191-
descriptors belonging to unrelated streams.
193+
has vastly improved, by using timers to efficiently poll for a child to exit,
194+
and delaying shutdown while any subprocess remains. Polling avoids
195+
process-global configuration such as a `SIGCHLD` handler, or
196+
:func:`signal.set_wakeup_fd` available in modern Python.
197+
198+
* :gh:issue:`256`, :gh:issue:`419`: most :func:`os.dup` use was eliminated,
199+
along with most manual file descriptor management. Descriptors are trapped in
200+
:func:`os.fdopen` objects at creation, ensuring a leaked object will close
201+
itself, and ensuring every descriptor is fused to a `closed` flag, preventing
202+
historical bugs where a double close could destroy unrelated descriptors.
192203

193204
* :gh:issue:`533`: routing accounts for
194205
a race between a parent (or cousin) sending a message to a child via an
@@ -218,13 +229,13 @@ Core Library
218229
deliver a message for some reason other than the sender cannot or should not
219230
reach the recipient, and no reply-to address is present on the message,
220231
instead send a :ref:`dead message <IS_DEAD>` to the original recipient. This
221-
ensures a descriptive messages is delivered to a thread sleeping on the reply
232+
ensures a descriptive message is delivered to a thread sleeping on the reply
222233
to a function call, where the reply might be dropped due to exceeding the
223234
maximum configured message size.
224235

225-
* :gh:issue:`624`: the number of threads used for a child's auto-started thread
226-
pool has been reduced from 16 to 2. This may drop to 1 in future, and become
227-
configurable via a :class:`Router` option.
236+
* :gh:issue:`624`: the number of threads used for a child's automatically
237+
initialized service thread pool has been reduced from 16 to 2. This may drop
238+
to 1 in future, and become configurable via a :class:`Router` option.
228239

229240
* :gh:commit:`a5536c35`: avoid quadratic
230241
buffer management when logging lines received from a child's redirected
@@ -264,13 +275,15 @@ bug reports, testing, features and fixes in this release contributed by
264275
`Florent Dutheil <https://github.com/fdutheil>`_,
265276
`James Hogarth <https://github.com/hogarthj>`_,
266277
`Jordan Webb <https://github.com/jordemort>`_,
278+
`Julian Andres Klode <https://github.com/julian-klode>`_,
267279
`Marc Hartmayer <https://github.com/marc1006>`_,
268280
`Nigel Metheringham <https://github.com/nigelm>`_,
269281
`Orion Poplawski <https://github.com/opoplawski>`_,
270282
`Pieter Voet <https://github.com/pietervoet/>`_,
271283
`Stefane Fermigier <https://github.com/sfermigier>`_,
272284
`Szabó Dániel Ernő <https://github.com/r3ap3rpy>`_,
273285
`Ulrich Schreiner <https://github.com/ulrichSchreiner>`_,
286+
`Vincent S. Cojot <https://github.com/ElCoyote27>`_,
274287
`yen <https://github.com/antigenius0910>`_,
275288
`Yuki Nishida <https://github.com/yuki-nishida-exa>`_,
276289
`@alexhexabeam <https://github.com/alexhexabeam>`_,

docs/conf.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
copyright = u'2019, Network Genomics'
1111
exclude_patterns = ['_build', '.venv']
1212
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinxcontrib.programoutput', 'domainrefs']
13+
14+
# get rid of version from <title>, it messes with piwik
15+
html_title = 'Mitogen Documentation'
16+
1317
html_show_copyright = False
1418
html_show_sourcelink = False
1519
html_show_sphinx = False
@@ -51,11 +55,11 @@
5155
'url': 'https://github.com/dw/mitogen/pull/%s',
5256
},
5357
'ans:mod': {
54-
'text': '%s Module',
58+
'text': '%s module',
5559
'url': 'https://docs.ansible.com/ansible/latest/modules/%s_module.html',
5660
},
5761
'ans:conn': {
58-
'text': '%s Connection Plug-in',
62+
'text': '%s connection plug-in',
5963
'url': 'https://docs.ansible.com/ansible/latest/plugins/connection/%s.html',
6064
},
6165
'freebsd:man2': {

docs/toc.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ Table Of Contents
77

88
index
99
Mitogen for Ansible <ansible_detailed>
10-
contributors
1110
changelog
11+
contributors
1212
howitworks
13-
getting_started
1413
api
14+
getting_started
1515
examples
1616
internals
1717

mitogen/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636

3737
#: Library version as a tuple.
38-
__version__ = (0, 2, 7)
38+
__version__ = (0, 2, 8)
3939

4040

4141
#: This is :data:`False` in slave contexts. Previously it was used to prevent

mitogen/parent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2607,9 +2607,9 @@ def reap(self):
26072607

26082608
if not self.kill:
26092609
pass
2610-
elif self._tries == 1:
2610+
elif self._tries == 2:
26112611
self._signal_child(signal.SIGTERM)
2612-
elif self._tries == 5: # roughly 4 seconds
2612+
elif self._tries == 6: # roughly 4 seconds
26132613
self._signal_child(signal.SIGKILL)
26142614

26152615

0 commit comments

Comments
 (0)