Commit Graph

1202 Commits (6d146520778ba28cdeb99386d4a2afc1af68b385)
 

Author SHA1 Message Date
David Wilson 6d14652077 issue #278: tests: fix fakessh.
See source comment. This behaviour always existed, but it now seems to
be triggered since we started draining the master side input buffer,
which someone was prolonging the life of the PTY.
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 04b65020ac issue #278: ansible: support mitogen_ssh_debug_level variable. 7 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.
7 years ago
dw bf478b451b
Merge pull request #276 from dw/issue271
ssh: Only match "permission denied" at start of line; closes #271.
7 years ago
David Wilson e3482bdd8f ssh: Only match "permission denied" at start of line; closes #271. 7 years ago
dw 58ff550b37
Merge pull request #274 from dw/issue270
Get integration tests running under 2.6.
7 years ago
David Wilson 2fbe1f1b54 Get integration tests running under 2.6.
Closes #270
Closes #273
7 years ago
dw 876a82f00d
Merge pull request #263 from dw/dmw
Stray mux process on CTRL+C, EINTR on async task timeout, temp dir cleanup race
7 years ago
David Wilson 9617f4d7bf Revert "try to catch EINTR on travis"
This reverts commit 42797d5cff.
7 years ago
David Wilson 08538d327b ansible: don't write failed job result after async timeout.
The failed job result is likely to be "interrupted system call", and we
don't want that to overwrite the SIGALRM handler's "the task timed out",
so just discard it.
7 years ago
David Wilson 205052ed90 service: fix SerializedInvoker CallError handling.
This cutpaste needs refactored. Ensure the caller receives a copy of the
exception.
7 years ago
David Wilson 45b748833d ansible: don't randomly fail due to temp directory cleanup.
Happens about 1 time in 3 when async task times out.
7 years ago
David Wilson fbb67e837e tests: import nice_stdout plugin 7 years ago
David Wilson 42797d5cff try to catch EINTR on travis 7 years ago
David Wilson ffc7306cf8 tests: better runner_two_simultaneous_jobs.yml. 7 years ago
David Wilson 1d96d80e8d tests: osx_setup.yml missing line 7 years ago
David Wilson d5c4333b9e debug: functions for triggering EINTR 7 years ago
David Wilson 6377f2d69c issue #257: split pool shutdown and join. 7 years ago
David Wilson d33ef1866e ansible: wrap socket calls in io_op()
Breaks under signal stress test.
7 years ago
dw 3a2f422725
Merge pull request #262 from dw/dmw
Fully functional async tasks, minify refactor, import trimming, module/script preloading/deduplication, service framework enhancements, fix logging deadlock
7 years ago
David Wilson 3994f1b30a ansible: implment async job time limit. 7 years ago
David Wilson d2accbce53 docs: remove more Ansible limitations 7 years ago
David Wilson e35694acd5 ansible: flake8 fixes. 7 years ago
David Wilson df8fe59eda tests: replace hard-coded sleep with a polling loop 7 years ago
David Wilson 4bd992e35a issue #186: move module code fetch back to overridden method 7 years ago
David Wilson 3909cb11f6 service: recreate the pool after fork. 7 years ago
David Wilson ae20a689ef issue #186: finally enable detach. 7 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.
7 years ago
David Wilson 92ecf29559 core: check in the hacks that let Ansible work just now. 7 years ago
David Wilson f6d9b074ff master: reduce module verbosity somewhat. 7 years ago
David Wilson caffaa79f7 issue #186: rework async/forked tasks again.
The controller must know the ID of the forked child in order to
propagate dependencies to it, so forking+starting the module run cannot
happen entirely on the target, without some additional mechanism to
wait-and-repropagate the deps as they arrive on the target.

Rework things so that init_child() also handles starting the fork parent,
and returns it along with the context's home directory in a single round
trip.

Now master knows the identity of the fork parent, it can directly create
fork children and call run_module_async() in them. This necessitates 2
roundtrips to start an asynchronous task.

This whole thing sucks and entirely needs simplified, but for now things
almost work, so keeping it.

connection.py:
  * Expect ContextService to return the entire dict return value of
    init_child(). Store the fork_contxt from the return value.

planner.py:
  * Rework Planner to store the invocation as an instance attribute, to
    simplify method calls.
  * Add Planner.get_push_files() and Planner.get_module_deps().
  * Add _propagate_deps() which takes a Planner and ensures the deps it
    describes are sent to a (non forked or forked) context.
  * Move async task logic out of target.py and into invoke() /
    _invoke_*().

process.py:
  * Services no longer need references to each other. planner.py handles
    sending module deps with one extra RPC.

services.py:
  * Return "init_child_result" key instead of simple "home_dir" key.
  * Get rid of dep propagation from ModuleDepService, it lives in
    planner.py now.

target.py:
  * Get rid of async task start logic, lives in planner.py now.
7 years ago
David Wilson 526590027a issue #186: PushFileService improvements.
New method to send all modules and files in one roundtrip.
7 years ago
David Wilson 9e78c20eba core/parent: add Context.call_no_reply(). 7 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.
7 years ago
David Wilson 64b60be50c tests: split runner_new_process out of runner_one_job 7 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.
7 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.
7 years ago
David Wilson 569c12a2d6 ansible: use PushFileService for module deps.
planner.py:
  * Rather than grant FileService access to a file for children, use
    PushFileService to trigger deduplicating send of the file through
    the hierarchy immediately.
  * Send the complete list of Ansible module imports to the target so
    runner.py knows which files and scripts must be loaded via
    PushFileService prior to detaching.

runner.py:
  * Teach NewStyleRunner to use the full module map to block until
    everything is loaded prior to detach().

target.py:
  * Delete old _get_file(), replace get_file() with get_small_file()
    which uses PushFileService instead.

Closes #186
7 years ago
David Wilson 7d4f4b205f ansible: update module preload list. 7 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.
7 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.
7 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.
7 years ago
David Wilson 1745c3aff0 issue #186: ansible: detach asynchronous tasks
After Runner.setup() has executed, but before the module executes. This
relies on subsequent commits to ensure all files are preloaded.
7 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.
7 years ago
David Wilson 088a7e5cff ansible: handle "from timeout import timeout" imports.
It's not simple without executing a module to determine whether the
above refers to a submodule of a package, or an object defined within a
module.

Therefore detect when resolution of a child module yields the same path
as the parent, and ignore the result.
7 years ago
David Wilson 3aadfbcfa1 Add select to preamble_size 7 years ago
David Wilson daa9cfd0a8 ansible: MITOGEN_DUMP_THREAD_STACKS for mux process too 7 years ago
David Wilson 7162c13e05 docs: add more notes for getting_started.rst 7 years ago
David Wilson d9087c510b ansible: move FileService into mitogen.service. 7 years ago