Commit Graph

456 Commits (76beea6554f4ddfce64b25e899cbffc75b85b2c8)

Author SHA1 Message Date
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.
8 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.
8 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.
8 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.
8 years ago
David Wilson d9087c510b ansible: move FileService into mitogen.service. 8 years ago
David Wilson b577a11f86 master: fix IdAllocator log messages. 8 years ago
David Wilson f7d2eace08 tests: importer fixes 8 years ago
David Wilson f7b368b1fb master: implement ModuleResponder.forward_module(). 8 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.
8 years ago
David Wilson 325d13538f issue #196: debug: don't statically import master. 8 years ago
dw c24d29d367
Merge pull request #255 from dw/dmw
Dmw
8 years ago
David Wilson 3b0addcfb0 service: v2. Closes #213 8 years ago
David Wilson 469bde63c2 parent: fix log message ordering 8 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.
8 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.
8 years ago
David Wilson e118963b30 issue #254: fork: take care not to rely on FD numbers. 8 years ago
David Wilson fc59f57ba2 issue #213: core: split out import_module() for use in services.py. 8 years ago
David Wilson 49fb25ee1c issue #213: core: fix shutdown crash due to member variable rename 8 years ago
David Wilson 40c6c6426f issue #213: core: fix test breakage due to log message change 8 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.
8 years ago
David Wilson d2714752ee docs: tidy ups 8 years ago
David Wilson 61365236ad docs/select: fix up more references, fix headings. 8 years ago
David Wilson 4bf3d01104 select: add missing get(block=..) parameter. 8 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().
8 years ago
David Wilson 7a592d1c34 core: better Poller.__repr__ 8 years ago
David Wilson b0ce6eecd7 fork: support on_start= argument. 8 years ago
David Wilson 00edf0d66d core: have ExternalContext accept a config dict rather than kwargs.
The parameter lists had gotten out of control.
8 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().
8 years ago
David Wilson 55fff54774 core: make try/catch logic a little clearer in Latch.get() 8 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.
8 years ago
David Wilson 5bdc1719c5 issue #249: epoll() raises IOError for EINTR, not select.error. 8 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.
8 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.
8 years ago
David Wilson 07056b0dd1 issue #249: fix ordering bug masked by previous implementation 8 years ago
David Wilson 36a1024861 issue #249: port Latch to poller too.
This is probably going to suck for perf :/
8 years ago
David Wilson 1070dfae72 issue #249: fix iter_read() regression. 8 years ago
David Wilson dcf0aa351e issue #249: whoops, fix new poller timeouts. 8 years ago
David Wilson aa8f786413 issue #249: fix Poller.from_existing() for v2 API 8 years ago
David Wilson 5645629e5d issue #249: the new pollers must handle syscall restarts too. 8 years ago
David Wilson 4df020827d issue #249: explicitly close pollers when done. 8 years ago
David Wilson 9905f6d8b4 issue #249: make write_all() and iter_read() use PREFERRED_POLLER. 8 years ago
David Wilson b6124f8396 issue #249: EpollPoller v2. 8 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().
8 years ago
David Wilson 11c2e4ab3e core: set _v and _vv to True in enable_debug_logging().
router.enable_debug() has been broken for ages.
8 years ago
David Wilson 7320c542df issue #249: EpollPoller() for Linux. 8 years ago
David Wilson bc7be1879d issue #249: initial poller implementation (BSD only) 8 years ago
Daniel Badea 020c8b5013 fix host_keys= exception message 8 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.
8 years ago
David Wilson 78d375e0c5 core: CallError should handle any exception type.
Previously SystemExit would be pickled.
8 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.
8 years ago