Commit Graph

62 Commits (c0d3deeac571eb36dfccbe5ca2f1579f2aceca2a)

Author SHA1 Message Date
Alex Willmer e76eefb8be Fix miscellaneous spelling/formatting 3 years ago
David Wilson 01a1914a1f docs: tweaks to better explain changelog race 5 years ago
David Wilson e12f391106 docs: mention another __main__ safeguard 5 years ago
David Wilson a79d2bd50b docs: another round of docstring cleanups. 5 years ago
Luka Matijevic 598821e865 docs: fixed message routing example description
Message routing example description does not match given diagram.
6 years ago
Luka Matijevic 81db1c94b3 docs: removed repeated word 6 years ago
David Wilson 300cb41e2e core: detect stream corruption. Closes #438. 6 years ago
David Wilson fd5698c191 docs: 4kify images.
These commits were squashed to avoid repo size exploding.
6 years ago
David Wilson 5bdb745f07 docs: howitworks tweaks 6 years ago
David Wilson f3e19d81da docs: reorder sections 6 years ago
David Wilson bd71a2760e docs: describe disconnect propagation; closes #76. 6 years ago
David Wilson a7b1831ddf core: move IS_DEAD doc into core.py. 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 4d3873c784 core: call chains v3: abstract it into a new CallChain class. 6 years ago
David Wilson 442d88e3d7 docs: many more fixes/merges. 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 d2714752ee docs: tidy ups 7 years ago
David Wilson b7ab473343 issue #186: split handle list up so it makes sense 7 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.
7 years ago
David Wilson 7f1060f54a issue #186: initial version of subtree detachment. 7 years ago
David Wilson 7c88e4d013 Move _DEAD into header, autogenerate dead messages
This change blocks off 2 common scenarios where a race condition is
upgraded to a hang, when the library could internally do better.

* Since we don't know whether the receiver of a `reply_to` is expecting
  a raw or pickled message, and since in the case of a raw reply, there
  is no way to signal "dead" to the receiver, override the reply_to
  field to explicitly mark a message as dead using a special handle.

  This replaces the serialized _DEAD sentinel value with a slightly
  neater interface, in the form of the reserved IS_DEAD handle, and
  enables an important subsequent change: when a context cannot route a
  message, it can send a generic 'dead' reply back towards the message
  source, ensuring any sleeping thread is woken with ChannelError.

  The use of this field could potentially be extended later on if
  additional flags are needed, but for now this seems to suffice.

* Teach Router._invoke() to reply with a dead message when it receives a
  message for an invalid local handle.

* Teach Router._async_route() to reply with a dead message when it
  receives an unroutable message.
7 years ago
David Wilson 6a74edce6b issue #155: parent: move master.Context into parent.
The Context and Router APIs for constructing children and making
function calls should be available in every parent context, as user code
wants to have access to the same API.
7 years ago
David Wilson 54ff1c90fa issue #155: add DEL_ROUTE, propagate ADD_ROUTE upwards
* IDs are allocated by the parent responsible for contructing a new
  child, using ALLOCATE_ID to the master as necessary to allocate new ID
  ranges.

* ADD_ROUTE is sent up the tree rather than down. This permits
  construction of the new context to complete concurrent to parent
  contexts learning about its existence. Since all streams are strictly
  ordered, it's not possible for any parent to observe messages from the
  new context prior to arrival of an ADD_ROUTE from the parent notifying
  of its existence.

  If the new context, for example, implements an Ansible async task, its
  parent can start executing that without waiting for any synchronous
  confirmation from any parent or the master.

* Since routes propagate up, it's no longer possible for a plain
  non-parent child to ever receive ADD_ROUTE, so that code can be moved
  out of core.py and into parent.py (-0.2kb compressed).

* Add a .routes attribute to parent.Stream, and respond to disconnection
  signal on the stream by propagating DEL_ROUTE for any ADD_ROUTE ever
  received from that stream.

* Centralize route management in a new parent.RouteMonitor class
7 years ago
David Wilson 1ed86774b5 issue #156: document select exception 7 years ago
David Wilson 20f5d89dfa issue #156: fix several more races
* Don't need to sleep if queue>sleepers, can just pop the right queue
  element and return it.

* If queue>sleeping and waking==sleeping, no mechanism existed to ensure
  a thread newly added to sleeping would ever be woken. Above change
  fixes that.

* Cannot trust select() return value, scheduler might sleep us
  indefinitely while put() writes a byte.

* Sleeping threads didn't pop FIFO, they popped in whatever order
  scheduler woke them up. Must recover index and use it to pick the pop
  index.
7 years ago
David Wilson 526b0a514b issue #156: prevent Latch.close() triggering spurious wakeups 7 years ago
David Wilson 18e2977baf docs: annoying phrasing 7 years ago
David Wilson 2c22c41819 issue #156: don't decrement `waking` if we timed out rather than being woken. 7 years ago
David Wilson 07a8994ff5 issue #156: waking thread result dictionary with an integer. 7 years ago
David Wilson b5398bd17f issue #156: docs typo 7 years ago
David Wilson 512ff77a46 issue #156: prevent non-sleeping threads from starving sleeping threads.
See new docs
7 years ago
David Wilson 148ce1d703 issue #155: increase context ID width to 32 bits
Needed to make large range allocations (1000 per ALLOCATE_ID roundtrip)
feasible.
7 years ago
David Wilson 03e51fdaa7 docs: mitogen.core.Latch docs 7 years ago
David Wilson 20afa5b90c Latch v2: combined queue + one self-pipe-per-thread
Turns out it is far too easy to burn through available file descriptors,
so try something else: self-pipes are per thread, and only temporarily
associated with a Lack that wishes to sleep.

Reduce pointless locking by giving Latch its own queue, and removing
Queue.Queue() use in some places.

Temporarily undo merging of of Waker and Latch, let's do this one step
at a time.
7 years ago
David Wilson a39cd44bf2 core: add auth_id field. 7 years ago
David Wilson 592ebd59c2 docs: reorder sections 7 years ago
David Wilson dee856f6f4 docs: remove obsolete warning 7 years ago
David Wilson 4d9d21c808 docs: fix typo 7 years ago
David Wilson 4a6d55ced6 docs: vastly simplify importer concurrency docs 7 years ago
David Wilson 984b39180e importer: Beginnings of howitworks section. 7 years ago
David Wilson 038ab04908 docs: convert paragraph to footnote. 7 years ago
David Wilson e3d2c8d649 issue #49: update howitworks.rst for command line change 7 years ago
David Wilson cf0668b2b1 docs: Add warning to preloading section. 7 years ago
David Wilson ac7cada323 docs: more getting started guide 7 years ago
David Wilson ffa063cc01 docs: annother barriage of cross-reference fixes. 7 years ago
David Wilson 9372d2c3de docs: Fix up tons of references, document trust chain 7 years ago
David Wilson 051285437f importer: module preloading docs 7 years ago
David Wilson dcc45bc7de docs: Get started on Getting Started 7 years ago
David Wilson b7a9aa46cf core: More robust shutdown
Now there is a separate SHUTDOWN message that relies only on being
received by the broker thread, the main thread can be hung horribly and
the process will still eventually receive a SIGTERM.
7 years ago
David Wilson 79dd00db5a master: hack to avoid executing __main__. 7 years ago