Commit Graph

78 Commits (4bf3d011042cd3e5dc1848175121d39f07b78aee)

Author SHA1 Message Date
David Wilson 4bf3d01104 select: add missing get(block=..) parameter. 6 years ago
David Wilson b0ce6eecd7 fork: support on_start= argument. 6 years ago
David Wilson 8a089e975d docs: Document Router.unidirectional. 6 years ago
David Wilson 2ee727f5c0 docs: typos and clarifications 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
David Wilson 3322eaef45 Basic "su" method. 6 years ago
David Wilson f5d22a3ca1 core: support deleting handlers, make Receiver.close() unregister 6 years ago
David Wilson ff7fb00569 parent: return latch to wait() caller to allow graceful timeout 6 years ago
David Wilson e8b4c4e683 issue #223: implement setns connection type
machinectl does not support any sensible form of pipe to the child
process, so it is necessary to bypass it when talking to a systemd
container (see systemd/systemd#8850).

This can also form the basis for issue #223, where the post-fork
namespace switching dance required to connect to the Pythonless
container will be the same.
6 years ago
David Wilson 3196b6e7f7 Add FreeBSD jail support. 6 years ago
David Wilson b3d352c601 Add lxc container support. 6 years ago
David Wilson 1fc7df5be5 Move canonical library version to __init__.py. 6 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.
6 years ago
David Wilson 6670cba41c Introduce handler policy functions; closes #138.
Now you can specify a function to add_handler() that authenticates the
message header, with has_parent_authority() and is_immediate_child()
built in.
6 years ago
David Wilson 80a97fbc9b core: Rename Sender.put() to Sender.send().
Been annoying me for months.
6 years ago
David Wilson b48d63f33b docs: add to_sender() and update serialization notes 6 years ago
David Wilson 8676c40674 core: make _start_transmit / _stop_transmit async-only
For now at least, these APIs are always used in an asynchronous context,
so stop using the defer mechanism.
6 years ago
David Wilson 4903052f42 fork: reseed Python/SSL PRNGs
Mac's SSL seems to have a pthread_atfork handler or similar that does
this for us, no clue if Linux is the same.
6 years ago
David Wilson 7f4368db87 docs: pad out signal handlers note 6 years ago
David Wilson 0dbb63ae3d docs: typo 6 years ago
David Wilson 2813d1a968 docs: update 6 years ago
David Wilson 5579ac936b issue #155: docs: more fork() liability warnings 6 years ago
David Wilson f457f54758 docs: fix formatting 6 years ago
David Wilson d370290687 docs: one more warning 6 years ago
David Wilson 03e08e25fd docs: put huge liability notice in fork() docs. 6 years ago
David Wilson 48351a1889 issue #155: parent: support Context.shutdown(), reap children on exit.
This permits graceful shutdown of individual contexts, without tearing
down everything.

Update mitogen.parent.Stream to also wait for the child to exit, to
prevent the buildup of zombie processes. This introduces a blocking wait
for process exit on the Broker thread, let's see if we can get away with
it. Chances are reasonable that it'll cause needless hangs on heavily
loaded machines.
6 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.
6 years ago
David Wilson 20780820a6 docs: typo 6 years ago
David Wilson 75b9e1d71e issue #155: docs: document behaviour of forked children 6 years ago
David Wilson 1a8ac9f4d1 issue #155: introduce mitogen.fork / Router.fork() 6 years ago
David Wilson f241eac5ce parent: allow Python to determine its install prefix from argv[0]
Fixes support for virtualenv. Closes #152.
6 years ago
David Wilson 4f361be7e7 issue #144: teach Select() to close its latch
Causes all threads sleeping on the select to wake.
6 years ago
David Wilson 8aada2646c core: support throwing LatchError in every sleeping thread
This is to allow Select() to be used as a generic queueing primitive
that supports graceful shutdown.
6 years ago
David Wilson b2a433dcc4 ssh: CompressionLevel is a v1-only option.
It's ignored by newer SSHes, which only pay attention to Compression.
6 years ago
David Wilson 235e1df987 sudo: support parsing sudo flags back out into parameters 6 years ago
David Wilson 7cf2edc3a8 ansible: Support many more common playbook variables. 6 years ago
David Wilson 14251539cd docs: Docker typo. 6 years ago
David Wilson 5036a9448f Add Docker method. 6 years ago
David Wilson b221eaaa10 ansible: log call timings 6 years ago
David Wilson 91116810a1 ansible: delete utils.py and promote cast() to mitogen.utils 6 years ago
David Wilson bdd8648bae ssh: enable compression by default
Using the same test as in 7af97c0365,
transmitted wire bytes drops from 135,531 to 133,071 (-1.81%), while
received drops from 21,073 to 14,775 (-30%).

Combined, both changes shave 13,914 bytes (-8.6%) off aggregate
bandwidth usage.

Make it configurable as compression hurts in some scenarios.
6 years ago
David Wilson 71a6b9e32a master: Select.all() sugar 6 years ago
Alex Willmer a69d9650ad Fix indentation of Router.route anchor 6 years ago
Alex Willmer eb1ad66469 docs: Fix out of date get_data() snippets
As of adc8fe3aed Receiver objects do not
have a get_data() method and Receiver.get() does not unpickle the
message.
6 years ago
David Wilson e63e9d299e docs: add Message documentation 6 years ago
David Wilson dd088908df select: clean up API. 6 years ago
David Wilson 07d4d799f1 Add mitogen.main() decorator mainly for docs and demo use. 6 years ago
David Wilson 09eb3fd9ba utils: support log_to_file(usec=True) 6 years ago
David Wilson f1f36cec35 Simplify the API, make Broker optional and auto-shutdown on main thread exit. 6 years ago
David Wilson b1ad04330b docs: move Router.route() into Sphinx. 6 years ago