Commit Graph

1045 Commits (master)

Author SHA1 Message Date
David Wilson 5bd6bd06d1 parent: don't send messages on streams that no longer exist; closes #480 5 years ago
David Wilson a31718a6bc issue #477: use PY24 constant rather than explicit test. 5 years ago
David Wilson bc434a4f99 issue #477: backport mitogen.master to Python 2.4. 5 years ago
David Wilson ffd46e9f1c issue #477: parent: make iter_read() log disconnect reason. 5 years ago
David Wilson 87d2af4c6e issue #477: polyfill partition() use in mitogen.parent. 5 years ago
David Wilson dd86a157ff issue #477: polyfill partition() use in mitogen.service. 5 years ago
David Wilson d6da84c38f issue #477: polyfill partition() use in mitogen.ssh. 5 years ago
David Wilson e9706a4a09 issue #477: _update_linecache() must append newlines. 5 years ago
David Wilson 19b708e141 issue #415, #477: Poller must handle POLLHUP too.
Linux will fire poll() with simply the POLLHUP bit set even though it
was not requested, resulting in an infinite loop.
5 years ago
David Wilson 07f1b9bdd0 issue #477: Python 2.5 needs next() polyfill too. 5 years ago
David Wilson 3afd667136 issue #477: explicitly populate Py2.4 linecache from Importer. 5 years ago
David Wilson 97a96f5dd8 issue #477: rename and add tests for polyfill functions. 5 years ago
David Wilson da13415b00 issue #477: various core.py docstring cleanups. 5 years ago
David Wilson 5135ff9068 issue #477: master: ability to override ModuleResponder output.
This is needed to cope Ansible 2.3 doing weird stuff as usual. It serves
up __init__.py for ansible and ansible.module_utils as hard-coded
namespace packages, the real ansible/__init__.py on disk is not 2.4
compatible.
5 years ago
David Wilson dd36450daf issue #477: yet another bug in core._partition(). 5 years ago
David Wilson d8490bc90a issue #477: 2.4.x compat fixes for mitogen.service. 5 years ago
David Wilson 58d8813c03 issue #477: Py2.4 lacks all(). 5 years ago
David Wilson 1f17422598 issue #477: make CallError serializable on 2.4.
Making CallError inherit from object broke 'raise CallError()'.

Instead use pure-Python pickler on 2.4 (grmbl) and force it to emit
new-style-alike output for what is otherwise a classic class.

Remove needless complexity from _unpickle_call_error() that only worked
for new-style classes.
5 years ago
David Wilson 4b89dc4813 issue #477: log full module name when SyntaxError occurs. 5 years ago
David Wilson d4afa102c7 issue #477: more Py2.4 (str|unicode).partition(). 5 years ago
David Wilson 0ee8ee78b8 issue #477: Py2.4 cannot tolerate unicode kwargs. 5 years ago
David Wilson 08cecb92f6 issue #477: Py2.4 lacks BaseException. 5 years ago
David Wilson 51a07dce70 issue #477: Py2.4: more unicode.rpartition() usage. 5 years ago
David Wilson 07401d767a issue #477: Python 2.4 type(exc) returns old-style instance. 5 years ago
David Wilson 3767d56187 issue #477: Python <2.5 did not have combined try/finally/except. 5 years ago
David Wilson 33caea06ed issue #477: Python <2.5 lacked any(). 5 years ago
David Wilson 3109abd518 issue #477: Python <2.6 lacked rpartition(). 5 years ago
David Wilson 84601f41fd issue #477: make CallError inherit from object for 2.4/2.5.
Otherwise cPickle will not call __reduce__().
5 years ago
David Wilson f3dae10fe1 issue #477: 2.4/2.5 had no better poller than poll(). 5 years ago
David Wilson 881dc7d5ca issue #477: more 2.4-compatible thread.get_ident() use. 5 years ago
David Wilson a1e0b4381f issue #477: bump corrupt msg output size to 2Kb
Allows much more of any tracebacks present to become visible.
5 years ago
David Wilson e99b8a8de7 core: replace ancient YOLO loop in fire(). 5 years ago
David Wilson 1119f24071 issue #414: reinitialize service pool lock on fork 5 years ago
David Wilson 120c667052 core: many docstring updates and an example substitute for Channel 5 years ago
David Wilson 84f75551a3 core: make Receiver a self-closing context manager. 5 years ago
David Wilson fcc403cc2f core: make Receiver.to_sender() use Router.myself(). 5 years ago
David Wilson bc0be45612 issue #61: unused import (reported by LGTM) 5 years ago
David Wilson 6da52ff00e issue #61: unused import (reported by LGTM) 5 years ago
David Wilson d63c99d912 issue #61: unused import (reported by LGTM) 5 years ago
David Wilson 00838e9134 issue #61: unused import (reported by LGTM) 5 years ago
David Wilson 96c35ccab1 issue #61: unused variable (reported by LGTM) 5 years ago
David Wilson 95fe052158 issue #61: unused import (reported by LGTM) 5 years ago
David Wilson fb750edfa7 issue #61: fix bare except (reported by LGTM) 5 years ago
David Wilson abfb6e39a8 issue #61: unused variable (reported by LGTM) 5 years ago
David Wilson 7bb6b4ab4b issue #61: remove duplicate method (reported by LGTM) 5 years ago
David Wilson 5bd9efb723 issue #61: add missing close() implementation (reported by LGTM) 5 years ago
David Wilson 767737265a issue #61: add inverse comparison (reported by LGTM) 5 years ago
David Wilson 51bd35280a issue #61: remove duplicated method (reported by LGTM) 5 years ago
David Wilson 06415bb720 issue #310: fix test failures, teach old import method new tricks
- don't try anything unless something really lives in sys.modules by
  that name
- non-ASCII files are possible
- the unimportable thing might be an extension module, we don't want
  that
5 years ago
David Wilson 6af1a64cce master: handle crazy non-modules in sys.modules again; closes #310. 5 years ago
David Wilson ea9ef50b3c issue #415: replace default Poller with select.poll()
30% latency reduction for IPC.
5 years ago
David Wilson fd90834944 issue #408: fix test fallout. 5 years ago
David Wilson 51ac309647 issue #408: 2.4 compat: replace iter_read with explicit generator
Can't use yield inside try/finally on 2.4.
5 years ago
David Wilson 41626b82dd issue #408: 2.4 compat: remove ternary if use in master.py. 5 years ago
David Wilson 5b45b5851c issue #408: use compatible method to get thread ID. 5 years ago
David Wilson 3aff3e5506 issue #408: fix mitogen.compat.tokenize 2.4 compatibility. 5 years ago
David Wilson a8c056c27b issue #436: decode debug log lines on Python 3. 5 years ago
David Wilson 5761652e02 core: allow Router.shutdown() to succeed after exit.
For join_thread():

Exception in thread mitogen.master.join_thread_async:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/dmw/src/mitogen/mitogen/master.py", line 249, in _watch
    watcher.on_join()
  File "/home/dmw/src/mitogen/mitogen/master.py", line 816, in shutdown
    super(Broker, self).shutdown()
  File "/home/dmw/src/mitogen/mitogen/core.py", line 2741, in shutdown
    self.defer(_shutdown)
  File "/home/dmw/src/mitogen/mitogen/core.py", line 2142, in defer
    raise Error(self.broker_shutdown_msg)
Error: An attempt was made to enqueue a message with a Broker that has already exitted. It is likely your program called Broker.shutdown() too early.
5 years ago
David Wilson 822978520f issue #446: update Receiver.__iter__ to match
iter() previously relied on the fake dead message being enqueued.
5 years ago
David Wilson 57b652eddc parent: remove unused imports
The stray functools import must have been there forever! Instant 4kb
knocked off wire footprint.
5 years ago
David Wilson 5ef94eb3e2 issue #456: loosen Waker.defer() shutdown test a little
Allow messages to continue being queued during the shutdown period,
right up until the final loop iteration, even though this is racy, as
too many things depend on .defer() during exit right now.

This doesn't hurt the spirit of the check: it still catches the worst
situation where $user accidentally shut down Broker then tried to
continue using it.
5 years ago
David Wilson cce1dbf3b1 tests: quieten a bunch of spam printed during run 5 years ago
David Wilson b6840aab75 issue #459: one line stats output during shutdown
CI logs are too noisy.
5 years ago
David Wilson 3b17cb7c5b unix: add Listener.__repr__. 5 years ago
David Wilson bcd9827c3b core: Latch.empty() improvements
- throw LatchError if the latch is closed.
- wrap with the lock to avoid unexpected weirdness.
5 years ago
David Wilson 388649df97 core: Receiver.close() now wakes all threads; closes #446. 5 years ago
David Wilson f2f41809ae issue #459: initial get_stats() implementation 5 years ago
David Wilson 1d97493fcd tests: fallout from #447. 5 years ago
David Wilson ab8d6afbae core: use ModuleNotFoundError in imporer if it is available; closes #448. 5 years ago
David Wilson de719fa249 core: throw error on duplicate add_handler(); closes #447. 5 years ago
David Wilson dc92e529bc service: unregister receiver at shutdown; closes #445. 5 years ago
David Wilson 85e965118d Merge remote-tracking branch 'origin/issue462'
* origin/issue462:
  issue #462: docs: update Changelog.
  parent: cope with broken /dev/pts on Linux; closes #462.
5 years ago
David Wilson 04755c3321 issue #426: tighten up PushFileService types.
Bytes/Unicode mixing caused a hang, so prevent bytes entirely.
5 years ago
David Wilson 8fa3c74de4 issue #426: RouterMonitor format incorrect for 3->2 forward.
Each hop would cause "b''" to be wrapped around the context name.
5 years ago
David Wilson d8b9634c85 issue #426: PushFileService missing to_text() call. 5 years ago
David Wilson a4c7a98dd9 parent: cope with broken /dev/pts on Linux; closes #462. 5 years ago
David Wilson 2f3a8f2a32 parent: proxy_connect docstring. 6 years ago
David Wilson ec056042e0 core: more Poller docstrings. 6 years ago
David Wilson d286eeb2ea core: more Poller docs 6 years ago
David Wilson 5f5396bcb2 core: more poller doc 6 years ago
David Wilson 499e7273d1 core: poller tidyups and minify fix 6 years ago
David Wilson 3f5774cfd5 core: document/tidy up poller.
Remove duplicate attribute creates in subclasses too.
6 years ago
David Wilson a156d7aab3 core: move importer inline data out to class vars. 6 years ago
David Wilson 824c7931a9 core: improve importer exception messages. 6 years ago
David Wilson 1eb08fb5c5 core: docstring tidyups 6 years ago
David Wilson 81a68223d4 issue #456: exception text typo. 6 years ago
David Wilson 497234e782 issue #456: core: raise error during defer() if Broker shutdown 6 years ago
David Wilson 917a1ffb29 issue #453: prevent accidental child logging loop. 6 years ago
David Wilson 6713b90acc FileService: exceptions must be sent explicitly for no-reply methods
FileService should not be using no-reply at all.
6 years ago
David Wilson 98696af9f8 service: log failing path in FileService call. 6 years ago
David Wilson 2bbab585f7 service: fix NameError during no-reply call on 3.x. 6 years ago
David Wilson 9680a84824 core: rename Router.self() to Router.myself(). 6 years ago
David Wilson 8f85ee038e core: Add Router.self()
Returns a reference to the current context.
6 years ago
David Wilson f20e0bbac1 service: Allow registering path prefixes with FileService.
e.g. service.register_prefix('/') disables all security checks.
6 years ago
David Wilson 6fafc0a631 select: Python 2.x required __nonzero__ for bool(Select) 6 years ago
David Wilson d030decf57 issue #444: master: lower log level for soft import error. 6 years ago
David Wilson 300cb41e2e core: detect stream corruption. Closes #438. 6 years ago
David Wilson 3876590aa1 parent: add descriptive errors for unsupported call() types.
Closes #439.
6 years ago
David Wilson c2c7caa34f core: ignore DeprecationWarning for imp module.
Closes #399, #437.
6 years ago
David Wilson fbd7346d02 examples: import the_basics.py. 6 years ago
David Wilson 15ddecdb58 issue #391: FileService metadata dict keys must be Unicode.
This is a regression since moving FileService from a 2.6-compatible file
with unicode_literals set, to a <2.5-compatible file.
6 years ago
David Wilson 57504ba6ec issue #109: core: meta_path regression in newer Pythons
Python at some point (at least since https://bugs.python.org/issue14605)
began populating sys.meta_path with its internal importer classes,
meaning that interpreters no longer start with an empty sys.meta_path.
6 years ago
David Wilson 2a2dda8e39 issue #364: remove stat() caching. 6 years ago
David Wilson 4267014ca6 issue #364: clarify logged error when incorrect file size detected 6 years ago
David Wilson 65d9eec353 issue #364: core: have Sender.close() supply reason= to dead() 6 years ago
David Wilson 01c4f3fee1 core: rearrange stdio setup to cope with buffering; closes #422 6 years ago
David Wilson de7d4e0908 setns: decode utility command output for 3.x. 6 years ago
David Wilson c7931be524 issue #420: core: include PID in Latch cookie data. 6 years ago
David Wilson 6d5facec4c su/sudo: fallout from previous commits
issue #418 and FD cleanup work.
6 years ago
David Wilson 045db6f689 Fix iter_read() FD leaks on 3.x; closes #418. 6 years ago
David Wilson 6e1f9e2596 core: 2.6 str.decode() compat fix. 6 years ago
David Wilson 76ec4f201c issue #413: paper over harmless duplicate del_route()
Ideally it would only be called once, and in future maybe it can, but
right now we need to cope with these cases:

* Downstream parent notifies us of disconnection (DEL_ROUTE)
* We notify ourself of disconnection
* We notify ourself and so does downstream parent

It's case 3 that causes the error.
6 years ago
David Wilson cf97932fad core: dead messages have optional body, use it everywhere; closes #387. 6 years ago
David Wilson c09780aeb0 core: fix add_handler(respondent=..) memory leak
Closes #416.
6 years ago
David Wilson 802de6a8d5 issue #406: clean up DiagLogStream handling and connect() failure.
When Stream.connect() fails, have it just use on_disconnect(). Now there
is a single disconnect cleanup path.

Remove cutpasted DiagLogStream setup/destruction, and move it into the
base class (temporarily), and only manage the lifetime of its underlying
FD via Side.close().  This cures another EBADF failure.
6 years ago
David Wilson 586c6aca9a issue #406: unix: fix ordering of stop_receive/close. 6 years ago
David Wilson 661e274556 issue #406: ensure is_path_dead() socket is finalized. 6 years ago
David Wilson 411af6c167 issue #406: unix: don't leak already-closed socket object
if Side.close() closes the socket (which it does), and it gets reused,
GC will cause socketobject.__del__ to later delete some random FD.
6 years ago
David Wilson dc3db49c5a issue #406: more leaked FDs when create_child() fails. 6 years ago
David Wilson 17631b0573 issue #406: parent: close extra_fd on failure too. 6 years ago
David Wilson b3841317dd issue #406: clean up FDs on failure explicitly
The previous approach was crap since it left e.g. socketpair instances
lying around for GC with their underlying FD already closed, coupled
with FD number reuse, led to random madness when GC finally runs.
6 years ago
David Wilson 10af266678 issue #406: attempt Broker cleanup in case of a crash. 6 years ago
David Wilson 375182b71b issue #406: don't leak side FDs on bootstrap failure. 6 years ago
David Wilson 14b389cb46 issue #406: don't leak FDs on failed child start. 6 years ago
David Wilson d1c2e7a834 issue #406: call Poller.close() during broker shutdown. 6 years ago
David Wilson e4280dc14a core: Don't crash in Waker.__repr__ if partially initialized. 6 years ago
David Wilson 87e8c45f76 core: fix minify_test regression introduced in 804bacdadb
The minifier can't handle empty function bodies, so the pass statements
are necessary.
6 years ago
David Wilson 16c364910a core: avoid redundant write() calls in Waker.defer()
Using _lock we can know for certain whether the Broker has received a
wakeup byte yet. If it has, we can skip the wasted system call.

Now on_receive() can exactly read the single byte that can possibly
exist (modulo FD sharing bugs -- this could be improved on later)
6 years ago
David Wilson 8e4c164d93 issue #388: fix Sphinx markup 6 years ago
David Wilson 804bacdadb docs: move most remaining docstrings back into *.py; closes #388
The remaining ones are decorators which don't seem to have an autodoc
equivlent.
6 years ago
David Wilson 711aed7a4c core: split _broker_shutdown() out into its own function.
Makes _broker_main() logic much clearer.
6 years ago
David Wilson 1d32ed3b5a core: avoid shutdown() in IoLogger on WSL; closes #333. 6 years ago
David Wilson 07fefa4067 kubectl: paper over importer issue by removing unicode. 6 years ago
David Wilson 5be9a55bf4 core: allow Context to be pickled by non-Mitogen pickler. 6 years ago
David Wilson f2d288bb1e tests: ensure minify() result can be compiled for all of core. 6 years ago
David Wilson a7ee23719a issue #388: move a ton of documentation back into the source 6 years ago
David Wilson fadb9181bc issue #410: support sudo --user and SELinux options, add stub test. 6 years ago
David Wilson 0394dac2c7 docs: document RouteMonitor class. 6 years ago
David Wilson 71f9e84ab3 Add EOF error hints for LXC/LXD; closes #373. 6 years ago
David Wilson 22b4b186d7 issue #333: add versioning to EpollPoller too. 6 years ago
David Wilson 73cda2994f issue #333: add versioning, initial batch of poller tests
Now poller is start enough to know a start_receive() during an iteration
does not cause events yielded by that iteration to associate with the
wrong descriptor.

These changes are tangentially related to the associated ticket, but
event versioning is still the underlying issue.
6 years ago
David Wilson 1cbff1011e core: send dead message if max message size exceeded; closes #405 6 years ago
David Wilson 1eae594e32 ssh: fix check_host_keys="accept" and test; closes #411
Add real accept/enforce tests.
6 years ago
David Wilson 16ca111ebd ssh: better OpenSSH 7.5+ permission denied handling
The user@host prefix in new-style OpenSSH messages unfortunately takes
the host part from ~/.ssh/config and friends. There is no way to know
which hostname will appear in this string without parsing the OpenSSH
config, nor which username will appear.

Instead just regex it.

Add SSH stub modes to print the new/old errors and add some simple
tests.

This extends the work done in b9112a9cbb
6 years ago
David Wilson 9ec360c26d core: split out & extend Broker.sync_call() 6 years ago
David Wilson f343bbba3a unix: fix exception catch on 3.x. 6 years ago
David Wilson 0d04e940b7 master: docstring fixes. 6 years ago
David Wilson 4e3830d75e tests: add basic unix_test.py. 6 years ago
David Wilson 58d0a45738 issue #76: quieten routing errors.
Receiving DEL_ROUTE without a corresponding ADD_ROUTE is now legit
behaviour, so don't print an error in this case.

Don't print an error for dropped messages if the reply_to indicates the
sender doesn't care about a response (dead and no_reply)
6 years ago
David Wilson fba52a0edf issue #76: add API for ansible_mitogen to get route list
Earlier commit moved Stream.routes attribute into a private map
belonging to RouteMonitor, to make upgrades smoother. This adds a new
accessor method to RouteMonitor.
6 years ago
David Wilson 431051f69b issue #76: parent: broadcast DEL_ROUTE to interested parties
Now rather than simply propagate DEL_ROUTE upwards towards the parent,
we broadcast it downward to any stream that ever sent a message toward
any of the routes that have just become disconnected.
6 years ago
David Wilson b9bafb78af issue #76: add stub DEL_ROUTE handler to core.py.
This handler knows how to fire 'disconnect' event on reception of a
DEL_ROUTE, and nothing more.
6 years ago
David Wilson babe3eec31 issue #76: record egress context IDs
Used in a subsequent change to broadcast DEL_ROUTE to potentially
interested children.
6 years ago
David Wilson d7d40f1123 issue #76: reduce Context duplication during unpickling
When unpickling a context, arrange for there to be a single instance
representing that context, managed by the corresponding router. This
context_by_id() was already in use by parent.py, it just needs to move
down.

This to eventually reach the point where a single Context exists that
needs 'disconnect' fired on it, so all sleeping receivers are definitely
woken.
6 years ago
David Wilson cfcc7c0273 Bump version for release. 6 years ago
David Wilson 9828588e97 master: group is_stdlib_name() with other module functions. 6 years ago
David Wilson bf597d257f master: document LogForwarder. 6 years ago
David Wilson 74cf9c3c96 master: document ThreadWatcher 6 years ago
David Wilson a7b1831ddf core: move IS_DEAD doc into core.py. 6 years ago
David Wilson 3aa5c4c53d issue #373: parse the child process wait status
Don't log the raw waitpid() result, convert it to a useful string first.
6 years ago
dw ad44ad16f1
Merge pull request #385 from moreati/python-3.x-cleanups
Test with Tox on Python 3.x
6 years ago
Alex Willmer 6da31c9dee docs: Remove unneeded backslash escapes
Python 3.x was emitting a DeprecationWarning. AFAICT there has been no
impact on the HTML rendering.
6 years ago
Alex Willmer b9112a9cbb ssh: Fix password authentication with Python 3.x & OpenSSH 7.5+
Since PERMDENIED_PROMPT is a byte string the interpolation was resulting
in: b"user@host: b'permission denied'". Needless to say this didn't
match.
6 years ago
David Wilson 0fa5fe5559 parent: handle masters with blank sys.executable; closes #356. 6 years ago
David Wilson 4c81eba599 Merge commit 'refs/pull/377/head' of github.com:dw/mitogen into dmw
(Pull #377)

Changes:
- additional_parameters -> extra_args
- Merge with kubectl changes from dmw branch
- Update docs
- Remove unused username class member
- Avoid mutable kubectl_args class member
- Use six.iteritems
6 years ago
David Wilson 4146648759 master: log error an refuse __main__ import if no guard detected.
Closes #366.
6 years ago
David Wilson f6b201bdfc docs: updates for #376 and #371 6 years ago
Yannig Perré 17548d1e49 [Enhancement] handle kubectl vars from Ansible connector.
This change allows the kubectl connector to support the same options as
Ansible's original connector.

The playbook sample comes with an example of a pod containing two containers
and checking that moving from one container to another, the version of Python
changes as expected.
6 years ago
Alex Willmer 2c2878012d Match "user@host: Permission denied ..." messages
OpenSSH 7.5 changed the text of the permission denied message. As a
result ssh_test.SshTest.test_password_required and test_pubkey_required
were failing on an Ubuntu 18.04 client, which ships OpenSSH 7.6.

Refs
- https://bugzilla.mindrot.org/show_bug.cgi?id=2720
6 years ago
dw 4356fdf027
Merge pull request #376 from Yannig/kubectl
Kubernetes connection support for mitogen.
6 years ago
Yannig Perré 6828926a36 Kubernetes connection support for mitogen. 6 years ago
Brian Candler d1c84552ec Use `lxc exec --mode=noninteractive` which is more widely compatible
Closes #371
6 years ago
David Wilson 530fd18e4c service: wake FileService client on file open failure.
Previously client would hang and excption woud be dumped to logger.
6 years ago
David Wilson dfc67b89fd docs: some more cleanups
- add faulthandler/thread stacks to changelog.
- various api.rst cleanups.
- docs: explain chain_id in howitworks.
6 years ago
David Wilson 8e9605db02 ssh: fix another 3.x regression. 6 years ago
David Wilson b3be182795 ssh: fix 2/3 regression. 6 years ago
David Wilson 294f17e491 core: fix econtext on_start parameter, used by fork_test. 6 years ago
David Wilson 863c1b7597 parent: correct CallSpec name formatting for class methods. 6 years ago
David Wilson e241081cae ansible: stop sharing target temp_dir in runner.
This cannot work with delegate_to, since delegate_to permits multiple
concurrent tasks to be executing on the same target.
6 years ago
David Wilson 42d3f96d14 parent: do updates 6 years ago
David Wilson 43d9815f6d ansible: use CallChain everywhere.
This replaces the 'dump to logger' behaviour of pipelined calls from
before with a call chain that returns any exception on next synchronized
call.
6 years ago
David Wilson 4d3873c784 core: call chains v3: abstract it into a new CallChain class. 6 years ago
David Wilson a52f66328b parent: test fixes. 6 years ago
David Wilson a3957d6aaf parent: add Context.forget_chain(). 6 years ago
David Wilson 37223adacd core: fix Dispatcher race introduced in 3a7815e5ca6255272334415916b6289378173859
It must be constructed before are messages pumped.
6 years ago
David Wilson 42b1b3d286 core: support mitogen_chain dispatcher option. 6 years ago
David Wilson 92c092d27b core: split Dispatcher out into own class. 6 years ago
David Wilson 32751cd356 master: allow batching context switches for forward_modules()
-7 switches per task.
6 years ago
David Wilson ba0b3af205 core: remove accidentally checked in debug crap (#337) 6 years ago
David Wilson c6159c9154 core: fix startup logging race. Closes #305. 6 years ago
David Wilson 870bbe0eae unix: don't crash listener if remote end disconnects.
In some scenarios, Ansible's worker seems to exit early, resulting in
EPIPE during .recv() or .send(). Log an error and gracefully disconnect
in that case.
6 years ago
David Wilson 7d62a53264 issue #337: ssh: disabling PTYs round 2: make it automatic. 6 years ago
David Wilson 5004207705 issue #337: ssh: support disabling PTY allocation
`.ssh(batch_mode=True)`
6 years ago
David Wilson c4c6ae88a4 parent: raise a descriptive error when openpty fails. 6 years ago
David Wilson 2647f73501 ansible: bump UNIX listener default backlog, and set it to match forks.
The connection multiplexer can expect to not be scheduled at least until
every $forks worker processes has attempted a connection, so the backlog
must be able to hold every worker.
6 years ago
David Wilson 946c4964bb issue #349: master: fix broken importer logging format string 6 years ago
David Wilson 8ab11f415f ansible: better support for diagnosing hangs
* Always enable the faulthandler module in the top-level process if it
  is available.
* Make MITOGEN_DUMP_THREAD_STACKS interval configurable, to better
  handle larger runs.
* Add docs subsection on diagnosing hangs.

Conflicts:
	ansible_mitogen/process.py
6 years ago
David Wilson 42f07466d2 setns: always assume a user identity, default to root.
Without this, an invocation like:

    sudo ansible-playbook foo.yml

Where foo.yml uses setns, could inherit the HOME environment variable
from the external non-root user, which broke /usr/bin/mysql_upgrade and
plenty more.
6 years ago
Jesse London 3453d4d7d0 Python 3 support for classmethod call targets
There were two problems with detection and handling of class methods as call targets in Python 3:

* Methods no longer define `im_self` -- this is now only `__self__`
* The `types` module no longer defines a `ClassType`

The universally-compatible (v2.6+) solution was to switch to using the `inspect` module -- whose interface has been stable -- and to checking the method attribute `__self__`.

(It doesn't hurt that `inspect` checks are more brief and we now no longer need the `types` module here.)
6 years ago
David Wilson 49f3a61164 parent: prevent subprocess.Popen.__del__ from calling waitpid().
Closes #253.
6 years ago
David Wilson bce4f59138 issue #345: disable IdentitiesOnly by default. 6 years ago
David Wilson 2fcea4b199 add extra 'pass' statements to work around minify issues. 6 years ago
David Wilson 27b64a484b docs: document mitogen.core.CHUNK_SIZE. 6 years ago
David Wilson ec8d759d46 docs: document one more. 6 years ago
David Wilson df5342af22 core: split out _internal_receive()
This is needed for libssh2.
6 years ago
David Wilson 442d88e3d7 docs: many more fixes/merges. 6 years ago
David Wilson a561fb79e5 docs: merge more docs back into mitogen/core.py. 6 years ago
David Wilson 06e2e846c5 parent: don't generate illegal default remote names.
getpass.getuser() output may contain slashes, which must be avoided as
they break virtualenv when present in argv[0].

Closes #344.
6 years ago
David Wilson 27c1f3e21e sudo: missing comma >:( 6 years ago
David Wilson 2d50270781 sudo: support '-i' flag.
Closes #343.
6 years ago
David Wilson 7d62c79ab7 docker: redirect stderr to stdout for nicer exceptions.
Unclear whether or not this is a hack, or whether it should be the
default for more connection methods. When enabled, the exception text
thrown when bootstrap fails includes the stderr text, which is
apparently always useful.
6 years ago
David Wilson 6f524d3ff8 issue #339: minimal tests for lxc/lxd modules. 6 years ago
David Wilson 81c8156965 Support LXD; closes #339. 6 years ago
David Wilson 5c573f7fcb ansible: insert short sleep when MITOGEN_PROFILING active.
Hacky, but works fine.
6 years ago
David Wilson af2ded663d fork: public on_fork() function.
Generally useful, and needed for ongoing Ansible work.
6 years ago
David Wilson d64729e041 Bump version for release. 6 years ago
David Wilson 5d67ce7746 service: service pool threads should respect _profile_hook. 6 years ago
David Wilson 22bab87821 issue #319: avoid TCSAFLUSH flag on WSL.
Closes #319.
6 years ago
David Wilson 56943d3141 issue #319: have cfsetraw() generate sensible flags.
Attempting to fix issue on WSL.

Closes #71
6 years ago
David Wilson 50a1bf6f22 issue #300: temporary workaround for shutdown issue.
Closes #300.
6 years ago
David Wilson 1171b06eb5 Merge remote-tracking branch 'origin/issue320' into dmw 6 years ago
David Wilson 76caf7d41d issue #320: ignore kqueue events marked KQ_EV_ERROR.
Since BasicStream.close() invokes _stop_transmit() followed by
os.close(), and KqueuePoller._stop_transmit() defers the unsubscription
until the IO loop resumes, kqueue generates an error event for the
associated FD, even though the changelist includes an unsubscription
command for the FD.

We could fix this by deferring close() until after the IO loop has run
once (simply by calling .defer()), but that generates extra wakeups for
no real reason.

Instead simply notice the error event and log it, rather than treating
it as a legitimate event.

Another approach to fixing this would be to process
_stop_receive()/_stop_transmit() eagerly, however that entails making
more syscalls.

Closes #320.
6 years ago
David Wilson d26fe5b993 issue #310: fix negative imports on Python 3.x.
On 3.x, Importer() can still have its methods called even if
load_module() raises ImportError.

Closes #310.
6 years ago
David Wilson f7e288fa25 core: fd 0/1 were accidently made non-blocking.
This breaks regular code. Triggered by a huge pprint() in the child to
stdout.
6 years ago
David Wilson f977be2868 issue #291: permit supplying a full Python argv. 6 years ago
David Wilson 830a133ad6 issue #307: require partial line when matching interactive prompt.
This is a best-effort attempt to avoid SSHd banner spam from breaking
our password entry loop.

Closes #307.
6 years ago
David Wilson 54a93f3c46 issue #307: suppress SSH login banner when verbosity is disabled.
Login banner may include the password prompt, and there is no race-free
way to detect the difference between the banner and the prompt.
6 years ago
David Wilson 336e90c5e3 parent: avoid needless quoting in Argv.
This just makes debug output a little more readable.
6 years ago
napkindrawing 745d72bb1d core: support for "doas" become_method 6 years ago
David Wilson 1c5a03bfa5 Bump version for release. 6 years ago
David Wilson 9a453d4753 Bump version for release. 6 years ago
David Wilson 4122fa4a46 debug: give dump_to_logger() thread a name. 6 years ago
David Wilson 894926cf61 docs: add initial release notes. 6 years ago
David Wilson 692275064b parent: fix TtyLogger str/unicode crash on 3.x. 6 years ago
David Wilson 038f8d5dec master: fix another case where built-in module loader throws ImportError
requests/packages.py just imports urllib3 normally, then makes up new
names for it. pkgutil can't cope with that, and returns the loader
(builtin) for the requests package. The built-in loader obviously can't
find_module() for "requests/packages/urllib3/contrib/pyopenssl" because
it doesn't exist on disk.
6 years ago
David Wilson 3a8ea930d7 core: fix NameError in Latch.put(), FileService exception 6 years ago
David Wilson 5da371c5dd service: fix UnboundLocalError. 6 years ago
David Wilson 484d4fdb74 core: fix Latch socket sharing race.
If thread A is about to wake as thread B is about to sleep, and A loses
the GIL at an inopportune moment, it was possible for two latches to
share the same socketpair, causing wakeups routed to the wrong latch.

The pair was returned to the 'idle sockets' list before .recv() had been
called. This manifested as TimeoutError() thrown rarely with many active
threads and the host is heavily loaded (such as Travis CI).

Add more documentation and stop writing single wake bytes. Instead the
recipient's identity is written instead, making it simpler to detect
future bugs.
6 years ago
David Wilson b92545e61a minify: avoid cStringIO use.
On 2.7 it was "accidentally fine" because the buffer object the StringIO
was initialized from happened to look like ASCII, but in 2.6 either
UCS-2 or UCS-4 is used for that buffer, and so the result was junk.

Just use the io module everywhere if we can, falling back to pure-Python
StringIO for Python<2.6.
6 years ago
David Wilson 29f15c236c core: remove needless size prefix from core_src_fd.
I think this is brainwrong held over from an early attempt to write the
duplicate copy of core_src on stdin.
6 years ago
David Wilson 04e138e060 core: fix serialization of empty bytes() on 3.x. 6 years ago
David Wilson ff2f44b046 core: reduce chance of Latch.read()/write()/close() race.
Previously it was possible for a thread to call Waker.defer() after
Broker has torns its Waker down, and the underlying file descriptor
reallocated by the OS to some other component.

This manifested as latches of a subsequent test invocation receiving the
waker byte (' ') rather than their expected byte '\x7f'.

This doesn't fix the problem, it just significantly reduces the chance
of it occurring. In future Side.write()/read()/close() must be
synchronized with a lock.

Previously the problem could be reliably triggered with:

    while :; do
        python tests/call_function_test.py -vf CallFunctionTest.{test_aborted_on_local_broker_shutdown,test_aborted_on_local_context_disconnect}
    done
6 years ago
David Wilson e24eddb1ce core: move Latch docs back inline. 6 years ago
David Wilson 42276f158b core: log the data received on the latch file handle. 6 years ago
David Wilson 970f54de85 service: remove stray debug 6 years ago
David Wilson caa648b1ea utils: handle duplicate log_to_file() calls. 6 years ago
David Wilson 8791d40081 parent: tidy up call_async() logging. 6 years ago
David Wilson 4ff47d6a93 parent: more 2/3x format fixes 6 years ago
David Wilson a52064a24f core: reordered find_module() test was broken (again)
e81b3bd0652b5eb125eb224ceca281b9d540dd5e

The whitelist check must happen /after/ the other checks, otherwise we
unconditionally retunr self for crap like 'ansible.module_utils.json'.
6 years ago
David Wilson 24ecfb3b13 Fix setns.py syntax for 3.x 6 years ago
David Wilson 9e3e02fb65 tokenize must parse under 3.x even if it won't run there
To support 3.x parent 2.x child
6 years ago
David Wilson 6b4e047017 tests: 3.x parent_test fixes. 6 years ago
David Wilson 6cbf34d5fe tests: another smattering of 3.x type/API fixes. 6 years ago
David Wilson 0422a8c263 parent: python_path setting depends on local or remote
For local, we want to default to the same Python version as the current
process. For remote, we want whatever is on offer.
6 years ago
David Wilson db529e8228 core: fix Receiver.__iter__ regression on EOF 6 years ago
David Wilson 0eb77b5f7c utils: always enable microsecond logging.
It's too useful, and the logs are fairly out of control already, may as
well just capture everything in the first pass.
6 years ago
David Wilson c141dd10ec master: fix resolve_relpath()
looks like this was just as broken on 2.x, and suddenly we're
finding a bunch more legit Django deps. It seems anywhere
absolute_import appeared in 2.x, we skipped some imports.
6 years ago
David Wilson b0404bef40 tests: fix get_module_via_* encoding issues 6 years ago
David Wilson 9903692811 master: update scan_code_imports to cope with wordcode
Constant-sized opcodes were introduced as an optimization in Python 3.6.
See https://bugs.python.org/issue26647
6 years ago
David Wilson 9fb2371d64 importer: reorder/tweak find_module() tests to cope with six.moves
The old hack on the master side we had is broken for some reason on 3.x.
Instead tweak the client to be more selective: if a request is for a
module within a package, the package must be loaded (in sys.modules),
and its __loader__ must be us. Previously if the module didn't exist in
sys.modules, we'd still try to fetch from the master, which doesn't
appear to ever make sense.
6 years ago
David Wilson 410016ff47 Initial Python 3.x port work.
* ansible: use unicode_literals everywhere since it only needs to be
  compatible back to 2.6.
* compat/collections.py: delete this entirely and rip out the parts of
  functools that require it.
* Introduce serializable Kwargs dict subclass that translates keys to
  Unicode on instantiation.
* enable_debug_logging() must set _v/_vv globals.
* cStringIO does not exist in 3.x.
* Treat IOLogger and LogForwarder input as latin-1.
* Avoid ResourceWarnings in first stage by explicitly closing fps.
* Fix preamble_size.py syntax errors.
6 years ago
David Wilson 3a304b2458 issue #275: su: add CentOS 6 style su failure 6 years ago
David Wilson d6126a9516 issue #275: parent/ssh: centralize EC0_MARKER and change it for ssh.py.
Must maintain a minimum buffer length prior to deciding whether we have
an interesting token, and 'EC0' is too short for that.
6 years ago
David Wilson 84fa3ff024 issue #275: ssh: state machine-ish filter_debug() 6 years ago
David Wilson fbd5837cf2 issue #275: parent: use TIOCSCTTY on Linux too.
This appears to be harmless, except for Python 2.6 on Linux/Travis,
where for some reason (some stdlib change?) simply opening the TTY is
insufficient.
6 years ago
David Wilson 60ad75f436 issue #275: Tidier SSH debug logging. 6 years ago
David Wilson e0c116a29f issue #275: logging package uses classic classes in 2.6. 6 years ago
David Wilson cfd2887292 issue #275: default to 'python' for default remote interpreter.
So we get 2.4/2.5/2.6/2.7/3.x.
6 years ago
David Wilson 884a72ee86 issue #277: core: move Darwin versioner check into first stage
The 'versioner.c' dodging check added in 0ef23d86 was wrong, since the
check occurred on the host machine, when the fix actually needs to apply
to the Darwin target.

Fixes ability to target OS X from a Red Hat controller, manifesting as
an error like:

    D mitogen: mitogen.parent.TtyLogStream('local.2472'):  'python(mitogen:dmw@localhost.localdomain:2449): realpath couldn\'t resolve "/usr/bin/python(mitogen:dmw@localhost.localdomain:2449)"'

The "realpath couldn't resolve" error comes from versioner.c:

    https://opensource.apple.com/source/perl/perl-104/versioner/versioner.c
6 years ago
David Wilson 75b195ba4b core: race during Receiver construction.
It's possible for a message to arrive after .add_handler() but before
Latch construction.

This is papering over a bigger problem with service pool instantiation.

https://travis-ci.org/dw/mitogen/jobs/390409832#L2901

    TASK [Spin up a few interpreters] **********************************************
    changed: [target] => (item=1)
    ERROR! [pid 5355] 14:47:50.224945 E mitogen.ctx.ssh.localhost:2201.sudo.mitogen__user2: mitogen: Router(Broker(0x7f1e93911450))._invoke(Message(19100, 19095, 19095, 110, 1005, '\x80\x02U\x1fmitogen.service.PushFileServiceq\x01U\x11store_and_f'..8955)): <bound method Receiver._on_receive of Receiver(Router(Broker(0x7f1e93911450)), 110)> crashed
    Traceback (most recent call last):
      File "<stdin>", line 1471, in _invoke
      File "<stdin>", line 491, in _on_receive
    AttributeError: 'Receiver' object has no attribute '_latch'
6 years ago
dw 27ab051289
Merge pull request #282 from dw/issue278
Issue278
6 years ago
David Wilson 0e958ea177 issue #278: tty logger Side constructed with incorrect Stream
Harmless, but produced the wrong log message prefix.
6 years ago
David Wilson b58603c7a4 issue #278: ssh: support ssh_debug_level option and log TTY output.
Now debug logs may be captured all the way through the connection.
6 years ago
David Wilson 888829544a issue #280: move find_module() log output to IOLOG
It just generates far too much spam, and its final decision is obvious
since a followup load_module() will exist for positive matches.
6 years ago
David Wilson e3482bdd8f ssh: Only match "permission denied" at start of line; closes #271. 6 years ago
David Wilson 2fbe1f1b54 Get integration tests running under 2.6.
Closes #270
Closes #273
6 years ago
David Wilson 205052ed90 service: fix SerializedInvoker CallError handling.
This cutpaste needs refactored. Ensure the caller receives a copy of the
exception.
6 years ago
David Wilson d5c4333b9e debug: functions for triggering EINTR 6 years ago
David Wilson 6377f2d69c issue #257: split pool shutdown and join. 6 years ago
David Wilson e35694acd5 ansible: flake8 fixes. 6 years ago
David Wilson 3909cb11f6 service: recreate the pool after fork. 6 years ago
David Wilson 05e0b134f9 service: simplify CALL_SERVICE stub and fix race.
If PushService.store_and_forward() loses the race to arrive at a brand
new context first, and the context's main thread is already executing a
CALL_FUNCTION that is blocked on the result of PushService, deadlock
could occur in the old scheme.

Instead (for now) simply spam a thread for each incoming message, and
use the get_or_create_pool() lock to ensure things work out in the end.
This could potentially generate a huge number of threads given the wrong
app, but we'll fix that problem when it appears.
6 years ago
David Wilson 92ecf29559 core: check in the hacks that let Ansible work just now. 6 years ago
David Wilson f6d9b074ff master: reduce module verbosity somewhat. 6 years ago
David Wilson 526590027a issue #186: PushFileService improvements.
New method to send all modules and files in one roundtrip.
6 years ago
David Wilson 9e78c20eba core/parent: add Context.call_no_reply(). 6 years ago
David Wilson b3a5fa70b0 core: copy debug setting to child's Router too.
core.Router doesn't pay attention to this attribute, but after
upgrade_router() has been called, the new parent.Router will.
6 years ago
David Wilson 23b2a545cf fork: avoid another logging deadlock at startup.
The very first task /must/ be clearing out logging locks, since
_at_fork() functions call LOG.debug() via Side.close(). Additionally,
the root logger is not included in loggerDict, so we must specify it
explicitly.
6 years ago
David Wilson 785df88fa4 issue #186: core: remove long-forgotten hack.
This is likely to break something, it was definitely needed at some
point, but I never put much effort into figuring out why. Meanwhile,
Python appears to make find_module('ansible.module_utils.facts.')
requests in some circumstances, which causes us to indicate the module
exists while this hack exists.

So remove it, and let's see what breaks.
6 years ago
David Wilson 76beea6554 issue #186: move target._get_file into mitogen.service
For lack of a better place to keep the client function, make it a
classmethod of FileService itself for now.

The old _get_file() is removed in a subsequent commit.
6 years ago
David Wilson a3b747af1b issue #186: add PushFileService
This is like FileService but blocks until the file is pushed by a parent
context, with deduplicating behaviour at each level in the hierarchy. It
does not stream large files, so it is only suitable for small files like
Python modules.

Additionally add SerializedInvoker for use with PushFileService, which
ensures all method calls to a single service occur in sequence.
6 years ago
David Wilson 2e8c027322 issue #213: avoid service.Pool construction race
Ensure concurrent calls to service.Pool do not result in a duplicate
pool being constructed in a child.
6 years ago
David Wilson 34daec4a7a core: prevent warning when CALL_FUNCTION used without reply_to
Such as when the stub CALL_SERVICE handler is used.
6 years ago
David Wilson d9087c510b ansible: move FileService into mitogen.service. 6 years ago
David Wilson b577a11f86 master: fix IdAllocator log messages. 6 years ago
David Wilson f7d2eace08 tests: importer fixes 6 years ago
David Wilson f7b368b1fb master: implement ModuleResponder.forward_module(). 6 years ago
David Wilson 9492dbc4d7 parent: split out minify.py and add stub where master can install it.
This needs a cleaner mechanism to install it, at least this one is
documented.
6 years ago
David Wilson 325d13538f issue #196: debug: don't statically import master. 6 years ago
dw c24d29d367
Merge pull request #255 from dw/dmw
Dmw
6 years ago
David Wilson 3b0addcfb0 service: v2. Closes #213 6 years ago
David Wilson 469bde63c2 parent: fix log message ordering 6 years ago
David Wilson a4ddef25a1 core: move reader/writer debug prints
They stop working with kqueue/epoll poller in the old location. Also
comment them out again, should never have been checked in uncommented.
6 years ago
David Wilson 3f595bbc7e issue #213: use import_module() in parent.py.
This dynamic import crap really needs to be ripped out of parent.py
again. Static imports work much better for the module loader too.
6 years ago
David Wilson e118963b30 issue #254: fork: take care not to rely on FD numbers. 6 years ago
David Wilson fc59f57ba2 issue #213: core: split out import_module() for use in services.py. 6 years ago
David Wilson 49fb25ee1c issue #213: core: fix shutdown crash due to member variable rename 6 years ago
David Wilson 40c6c6426f issue #213: core: fix test breakage due to log message change 6 years ago
David Wilson 2310497d55 issue #213: core: have Message.reply() log msg for zero reply_to
It's easy to call msg.reply() by accident on a message that never had
reply_to set, resulting in a "invalid handle" error message coming from
router. Instead log a more accurate message on the stack that actualy
caused the problem.
6 years ago
David Wilson d2714752ee docs: tidy ups 6 years ago
David Wilson 61365236ad docs/select: fix up more references, fix headings. 6 years ago
David Wilson 4bf3d01104 select: add missing get(block=..) parameter. 6 years ago
David Wilson ddf28987a0 master: split Select() into new module to reduce wire size.
service.py currently imports master.py(+parent.py) just to get Select().
6 years ago
David Wilson 7a592d1c34 core: better Poller.__repr__ 6 years ago
David Wilson b0ce6eecd7 fork: support on_start= argument. 6 years ago
David Wilson 00edf0d66d core: have ExternalContext accept a config dict rather than kwargs.
The parameter lists had gotten out of control.
6 years ago
David Wilson 7d0209d8de issue #249: have upgrade_router() upgrade the poller too.
Now when a child becomes a parent, it gets a new poller suitable for
many more children than was possible using select().
6 years ago
David Wilson 55fff54774 core: make try/catch logic a little clearer in Latch.get() 6 years ago
David Wilson 05a5f2b6e5 core: if Poller.poll() fails, TimeoutError would be raised.
We must check whether poller threw an exception both in the case that we
weren't woken and the case that we were.
6 years ago
David Wilson 5bdc1719c5 issue #249: epoll() raises IOError for EINTR, not select.error. 6 years ago
David Wilson 6d18ce81d8 issue #249: restore duplex behaviour for epoll
With epoll() there is only one kernel-side object per file descriptor,
which is why _control() is such a pain. Since we merge receive/transmit
watching into that single object, we must always test the mask for both
conditions when reading results.

Kqueue isn't/doesn't appear to be like this. The identity of a Kqueue
event is keyed on (fd, filter), and we register a separate event for
both transmit and receive, so the 'elif' in KqueuePoller.poll() does not
appear to need to change.

Previously, a FD marked for read+write would not indicate writeability
until it was no longer readable.
6 years ago
David Wilson 6b98818046 issue #249: epoll distinguishes between hangup and disconnect
..typical Linux, for certain descriptor types only. So our receive mask
must match both, and normalize it into a read event like every other
poller.
6 years ago
David Wilson 07056b0dd1 issue #249: fix ordering bug masked by previous implementation 6 years ago
David Wilson 36a1024861 issue #249: port Latch to poller too.
This is probably going to suck for perf :/
6 years ago
David Wilson 1070dfae72 issue #249: fix iter_read() regression. 6 years ago
David Wilson dcf0aa351e issue #249: whoops, fix new poller timeouts. 6 years ago
David Wilson aa8f786413 issue #249: fix Poller.from_existing() for v2 API 6 years ago
David Wilson 5645629e5d issue #249: the new pollers must handle syscall restarts too. 6 years ago
David Wilson 4df020827d issue #249: explicitly close pollers when done. 6 years ago
David Wilson 9905f6d8b4 issue #249: make write_all() and iter_read() use PREFERRED_POLLER. 6 years ago
David Wilson b6124f8396 issue #249: EpollPoller v2. 6 years ago
David Wilson 9abcf63155 issue #249: Poller API v2 (BSD only).
Now it's BasicStream/Side-agnostic, so it can be reused for Latch and
iter_read().
6 years ago
David Wilson 11c2e4ab3e core: set _v and _vv to True in enable_debug_logging().
router.enable_debug() has been broken for ages.
6 years ago
David Wilson 7320c542df issue #249: EpollPoller() for Linux. 6 years ago
David Wilson bc7be1879d issue #249: initial poller implementation (BSD only) 6 years ago
Daniel Badea 020c8b5013 fix host_keys= exception message 6 years ago
David Wilson d1a22cb5d4 issue #186: parent: implement FORWARD_MODULE.
To support detach, we must be able to preload the target with every
module it will need prior to detachment. This implements the
intermediary part of the process (i.e. the Ansible fork parent) --
receiving LOAD_MODULE/FORWARD_MODULE pairs and ensuring they reach the
child.
6 years ago
David Wilson 78d375e0c5 core: CallError should handle any exception type.
Previously SystemExit would be pickled.
6 years ago
David Wilson def22c226f issue #179: don't reap first stage until core_src_fd is drained.
Bootstrap would hang if (as of writing) a pipe sufficient to hold 42,006
bytes was not handed out by the kernel to the first stage. It was luck
that this didn't manifest before, as first stage could write the full
source and exit completely before reading begun.

It is not clear under which circumstances this could previously occur,
but at least since Linux 4.5, it can be triggered if
/proc/sys/fs/pipe-max-size is reduced from the default of 1MiB, which
can have the effect of capping the default pipe buffer size of 64KiB to
something lower.

Suspicion is that buffer pipe size could also be reduced under memory
pressure, as reference to busy machines appeared a few times in the bug
report.
6 years ago
David Wilson d65e047b12 issue #179: ec0_receive() and connect_bootstrap() should use deadline.
Now there is a single global deadline derived from ansible.cfg timeout=
value.
6 years ago
David Wilson 356647bef4 issue #132: initial unidirectional routing mode. 6 years ago
David Wilson e615265ebd master: make is_stdlib_path() a free function
For Ansible module loader work.
6 years ago
David Wilson a37ccabd91 core: wrapper functions provide no protection in this case 6 years ago
David Wilson cecef992b0 issue #218: core: add Secret and Blob types. 6 years ago
David Wilson 42cc009b60 service: don't sleep on empty Select during shutdown.
Avoids a select error during random CTRL+C.
6 years ago
David Wilson 7f1060f54a issue #186: initial version of subtree detachment. 6 years ago
David Wilson 8bd34e1e28 ansible: gracefully report connection timeouts as StreamError. 6 years ago
David Wilson c0e8b3d60a ssh: error wording was inaccurate. 6 years ago
David Wilson 8fc1eac6ae utils: combine MITOGEN_LOG_LEVEL and MITOGEN_LOG_IO.
Saves lots of readline fiddling.
6 years ago
David Wilson 4d1c6d2101 issue #127: ssh: reasonable solution to host key checking.
Ideally it would be possible to specify a callback function, but this is
not possible for proxied connections. So simply provide the 3 most
useful modes, defaulting to the most secure.

Closes #127. Closes #134.
6 years ago