Commit Graph

55 Commits (ca573c1a594c822cb567935f250521b99cd466c6)

Author SHA1 Message Date
David Wilson a6324aaeb1 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 c9affbaf50 core: add auth_id field. 7 years ago
David Wilson b194e46d35 docs: reorder sections 7 years ago
David Wilson 1acb068fb6 docs: remove obsolete warning 7 years ago
David Wilson 3f86347edc docs: fix typo 7 years ago
David Wilson e930099755 docs: vastly simplify importer concurrency docs 7 years ago
David Wilson 716637a20c importer: Beginnings of howitworks section. 7 years ago
David Wilson 36300b9fe6 docs: convert paragraph to footnote. 7 years ago
David Wilson 255656ef50 issue #49: update howitworks.rst for command line change 7 years ago
David Wilson b43cd31d59 docs: Add warning to preloading section. 7 years ago
David Wilson 7eb81a1694 docs: more getting started guide 7 years ago
David Wilson d800b684ef Merge branch 'module-preloading'
Not much point in keeping the docs changes separate.
7 years ago
David Wilson dddaa29526 docs: Get started on Getting Started 7 years ago
David Wilson 8e69838b44 docs: annother barriage of cross-reference fixes. 7 years ago
David Wilson b88e68df72 docs: Fix up tons of references, document trust chain 7 years ago
David Wilson bab232f07c importer: module preloading docs 7 years ago
David Wilson 8439e889ed 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 0e51aa5cd9 master: hack to avoid executing __main__. 7 years ago
David Wilson 8fec1f985e docs: remove note, unpickling can no longer trigger module loads 7 years ago
David Wilson 2d2d547a1c docs: s/random/pseudorandom/ 7 years ago
David Wilson a71c9fd128 docs: fix pickler docs, begin relabelling master/slave->parent/child 7 years ago
David Wilson abf1aa33dd docs: remove final references to call_with_deadline(). 7 years ago
David Wilson 09985204ad docs: with_context element is replaced by a decorator. 7 years ago
David Wilson 1b823dc0b0 Accidentally hecked in incomplete paragraph. 7 years ago
David Wilson 3a883d79f6 More API documentation. 7 years ago
David Wilson 25963736c6 Fix function reference. 7 years ago
David Wilson 62c9dc6f49 Better document Router API and constructors. 7 years ago
David Wilson df1dc41d4f Remove final vestiges of context.key. 7 years ago
David Wilson 491b5ab575 core: add ALLOCATE_ID message for fakessh. 7 years ago
David Wilson 446e956e8f Rename package. 7 years ago
David Wilson a1044d8a6e Tidy up docs 7 years ago
David Wilson de91f9ef7a Get rid of HMAC use. 7 years ago
David Wilson a11003862b Add warning to docs. 7 years ago
David Wilson d702a61589 More doc updates. 7 years ago
David Wilson 9ca39dcf72 Add Message Routing section to docs 7 years ago
David Wilson 65d5844d1a Tidy up docs. 7 years ago
David Wilson 06d65ac6ac howitworks additions 7 years ago
David Wilson 6c33d251df Reduce src_id/dst_id to 16 bits. 7 years ago
David Wilson 39e70fe50c Typo. 7 years ago
David Wilson 37934f8b5a Document GET_MODULE in a slave context. 7 years ago
David Wilson 0a0a060492 Introduce econtext.core.Router, refactor everything
* Header now contains (src, dst) context IDs for routing.
* econtext.context_id now contains current process' context ID.
* Now do 16kb-sized reads rather than 4kb.
* econtext package is uniformly imported in econtext/core.py in slave
  and master.
* Introduce econtext.core.Message() to centralize pickling policy, and
  various function interfaces, may rip it out again later.
* Teach slave/first stage to preserve the copy of econtext.core sent to
  it, so that it can be used for subsequent slave-of-slave bootstraps.
* Disconnect Stream from Context, and teach Context to send messages via
  Router. In this way the Context class works identically for slaves
  directly connected via a Stream, or those for whom other slaves are
  acting as proxies.
* Implement Router, which knows a list of contexts reachable via a
  Stream. Move context registry out of Broker and into Router.
* Move _invoke crap out of stream and into Context.
* Try to avoid pickling on the Broker thread wherever possible.
* Delete connection-specific fields from Context, they live on the
  associated Stream subclass now instead.
* Merge alloc_handle() and add_handle_cb() into add_handler().
* s/enqueue/send/
* Add a hacky guard to prevent send_await() deadlock from Broker thread.
* Temporarily break shutdown logic: graceful shutdown is broken since
  Broker doesn't know about which contexts exist any more.
* Handle EIO in iter_read() too. Also need to support ECONNRESET in here.
* Make iter_read() show last 100 bytes on failure.
* econtext.master.connect() is now econtext.master.Router.connect(),
  move most of the context/stream construction cutpaste into a single
  function, and Stream.construct().
* Stop using sys.executable, since it is the empty string when Python
  has been started with a custom argv[0]. Hard-wire python2.7 for now.
* Streams now have names, which are used as the default name for the
  associated Context during construction. That way Stream<->Context
  association is still fairly obviously and Stream.repr() prints
  something nice.
7 years ago
David Wilson e374f85888 Fix module loader deadlock
Stop using cPickle on the broker thread where it is not known whether
the pickle data would cause the import machinery to be invoked, which
currently relies on blocking calls. Huge mess but it works.

This is due to:

        context.call(some.module.func, another.module.func)

We stringify ("some.module", "func"), but the reference to
another.module.func is passed into the pickle machinery, and there's no
way to generically stringify all function references in user data for
reification on the main thread, without doing something like this
instead.
7 years ago
David Wilson 9733668b50 Replace OK indicator with EC0/EC1. 8 years ago
David Wilson a26a6bd66e More docs. 8 years ago
David Wilson fea12a6030 Many updates: graceful shutdown, docs, threading
* Start splitting docs up into internals.rst / api.rst
* Docs for lots more of econtext.core.
* Get rid of _update_stream() and has_output(), replace with individual
  functions called as state changes.
* Add Broker.on_thread() and remove Stream._lock: simply call
  on_thread() to ensure buffer management is linearized.
* Rename read_side/write_side to receive_side/transmit_side like event
  handler names.
* Clean up some more repr / debug logs.
* Move handle cleanup to Context.on_shutdown where it belongs.
* Make wake() a noop when called from broker thread.
* Replace graceful_count crap with Side.graceful attribute, add
  Broker.keep_alive() to check whether any registered readers want to
  be kept alive for graceful shutdown() or any child contexts with a
  connected stream exist.
* Make master.Broker timeout slightly longer than slave broker.
* Add generic on_thread() to allow running code on the IO thread.
8 years ago
David Wilson 1bc8681cb4 More doc updates. 8 years ago
David Wilson 1f27872eda Many docs updates. 8 years ago
David Wilson da4e457247 More docs, move call/call_with_deadline to econtext.master. 8 years ago
David Wilson c607831561 SlaveModuleImporter->Importer, enable intersphinx, finish howitworks.rst. 8 years ago
David Wilson c82ddeb0f7 More howitworks.rst. 8 years ago