Commit Graph

682 Commits (bd3832e70fa07a3a17e877a35a909eb223abae77)

Author SHA1 Message Date
Tyler Goodlet bd3832e70f Flip "trace" level to "transport" level logging 2021-07-05 16:42:40 -04:00
Tyler Goodlet af61d93bad Add fast fail test using the context api 2021-07-05 16:42:40 -04:00
Tyler Goodlet 1bca5c8144 Adjust debug tests to accomodate no more root clobbering
We may get multiple re-entries to debugger by `bp_forever` sub-actor
now since the root will incrementally try to cancel it only when the tty
lock is not held.
2021-07-05 16:42:40 -04:00
Tyler Goodlet c174a59758 Go back to only logging tbs on no debugger 2021-07-05 16:42:40 -04:00
Tyler Goodlet 91c70cad24 Comment hard-kill-sidestep for now since nursery version covers it? 2021-07-05 16:42:40 -04:00
Tyler Goodlet 9b4f7a3076 Go back to only logging crashes if no pdb gets engaged 2021-07-05 16:42:38 -04:00
Tyler Goodlet 3179eded73 Solve the root-cancels-child-in-tty-lock race
Finally this makes a cancelled root actor nursery not clobber child
tasks which request and lock the root's tty for the debugger repl.

Using an edge triggered event which is set after all fifo-lock-queued
tasks are complete, we can be sure that no lingering child tasks are
going to get interrupted during pdb use and tty lock acquisition.
Further, even if new tasks do queue up to get the lock, the root will
incrementally send cancel msgs to each sub-actor only once the tty is
not locked by a (set of) child request task(s). Add shielding around all
the critical sections where the child attempts to allocate the lock from
the root such that it won't be disrupted from cancel messages from the
root after the acquire lock transaction has started.
2021-07-05 16:40:58 -04:00
Tyler Goodlet b603904d3e Distinguish between a local pdb unlock and the tty unlock in root 2021-07-05 16:40:58 -04:00
Tyler Goodlet 1ec1743c48 Fix hard kill in debug mode; only do it when debug lock is empty 2021-07-05 16:40:58 -04:00
Tyler Goodlet 3412d344e2 Move some infos to runtime level 2021-07-05 16:40:58 -04:00
Tyler Goodlet 780476541a Add PDB level and make runtime below info but above debug 2021-07-05 16:40:58 -04:00
Tyler Goodlet ef4dbdcf85 Move debugger wait inside OCA nursery 2021-07-05 16:40:58 -04:00
Tyler Goodlet da9a33bf37 Don't shield debugger status wait; it causes hangs 2021-07-05 16:40:58 -04:00
Tyler Goodlet 11f8d14e38 Catch and delay errors in the root if debugger is active 2021-07-05 16:40:58 -04:00
Tyler Goodlet 65aa1f3e2a Don't shield on root cancel it can causes hangs 2021-07-05 16:40:58 -04:00
Tyler Goodlet 625fc87410 Don't kill root's immediate children when in debug
If the root calls `trio.Process.kill()` on immediate child proc teardown
when the child is using pdb, we can get stdstreams clobbering that
results in a pdb++ repl where the user can't see what's been typed. Not
killing such children on cancellation / error seems to resolve this
issue whilst still giving reliable termination. For now, code that
special path until a time it becomes a problem for ensuring zombie
reaps.
2021-07-05 16:40:58 -04:00
Tyler Goodlet 8cc41090dd Add debug example that causes pdb stdin clobbering 2021-07-05 16:40:58 -04:00
Tyler Goodlet cb1e208599 Add some brief todo notes on idea of shielded breakpoint 2021-07-05 16:39:37 -04:00
Tyler Goodlet 53d25b58a1 Wait for debugger lock task context termination 2021-07-05 16:39:37 -04:00
Tyler Goodlet 9729f66672 Avoid mutate on iterate race 2021-07-05 16:39:37 -04:00
Tyler Goodlet a5848effa4 Fix up var naming and typing 2021-07-05 16:39:37 -04:00
Tyler Goodlet f59bb1aaf1 Use context for remote debugger locking
A context is the natural fit (vs. a receive stream) for locking the root
proc's tty usage via it's `.started()` sync point. Simplify the
`_breakpoin()` routine to be a simple async func instead of all this
"returning a coroutine" stuff from before we decided that
`tractor.breakpoint()` must be async. Use `runtime` level for locking
logging making it easier to trace.
2021-07-05 16:39:37 -04:00
Tyler Goodlet 55760b3fe0 Only expect further message in non-name-error first case 2021-07-04 12:55:36 -04:00
Tyler Goodlet 6aab16f877 Drop added logging around root cancel 2021-07-04 11:00:08 -04:00
Tyler Goodlet caa70245e0 Try remapping all broken errs wholesale on windows 2021-07-04 10:47:15 -04:00
Tyler Goodlet 9c9309faf8 Handle race for tty by child actors 2021-07-04 10:25:41 -04:00
Tyler Goodlet 3f75732b02 Remap windows specific connection reset error 2021-07-04 10:25:19 -04:00
Tyler Goodlet 1edf5c2f06 Specially remap TCP 104-connection-reset to `TransportClosed`
Since we currently have no real "discovery protocol" between process
trees, the current naive approach is to check via a connect and drop to
see if a TCP server is bound to a particular address during root actor
startup. This was a historical decision and had no real grounding beyond
taking a simple approach to get something working when the project
was first started.

This  is obviously problematic from an error handling perspective since
we need to be able to avoid such quick connect-and-drops from cancelling
an "arbiter"'s (registry actor's) channel-msg loop machinery (which
would propagate and cancel the actor).

For now we map this particular TCP error, which gets remapped by `trio`
as a `trio.BrokenResourceError` to our own internal `TransportClosed`
which is swallowed by channel message loop processing and indicates
a graceful teardown of the far end actor.
2021-07-03 18:57:54 -04:00
Tyler Goodlet a2d400583f Fix tuple type 2021-07-02 18:10:06 -04:00
Tyler Goodlet 85246d2df3 Benign deps reorg 2021-07-02 11:56:14 -04:00
Tyler Goodlet b372f4c92b Handle top level multierror that presents now? 2021-07-02 11:55:16 -04:00
Tyler Goodlet 32b4ae0603 Accept transport closed error during handshake and msg loop 2021-07-02 11:38:24 -04:00
Tyler Goodlet 80e100f818 Add our own "transport closed" signal
This change some super old (and bad) code from the project's very early
days. For some redic reason i must have thought masking `trio`'s
internal stream / transport errors and a TCP EOF as `StopAsyncIteration`
somehow a good idea. The reality is you probably
want to know the difference between an unexpected transport error
and a simple EOF lol. This begins to resolve that by adding our own
special `TransportClosed` error to signal the "graceful" termination of
a channel's underlying transport. Oh, and this builds on the `msgspec`
integration which helped shed light on the core issues here B)
2021-07-02 11:36:22 -04:00
Tyler Goodlet 44d7988204 New docs theme hotfix 2021-06-14 08:10:59 -04:00
goodboy e98302212a
Merge pull request #211 from goodboy/new_docs_polish
New docs theme, readme actors rant.
2021-06-14 07:33:02 -04:00
Tyler Goodlet 0301d105dd Better rant flow as per suggestions 2021-06-14 06:41:10 -04:00
Tyler Goodlet 4ee7db338d Fill out the rant a bit more 2021-06-14 06:31:16 -04:00
Tyler Goodlet 558d546c8f Bump readme for #210 2021-06-14 06:31:16 -04:00
Tyler Goodlet 5528a4eb45 Attempt configuring sphinx-book-theme 2021-06-14 06:31:16 -04:00
Tyler Goodlet fb23a9d8d4 Try out sphinx-book-theme 2021-06-14 06:31:16 -04:00
goodboy f48548ab94
Merge pull request #197 from goodboy/drop_run
Drop run
2021-05-07 12:02:23 -04:00
Tyler Goodlet 73e123bac7 Fix line length 2021-05-07 11:21:40 -04:00
Tyler Goodlet 2b4cf59ee1 Drop sleep 2021-05-07 11:21:40 -04:00
Tyler Goodlet 0551756e22 Use trio.run() in windows tests 2021-05-07 11:21:40 -04:00
Tyler Goodlet 5ca963148e Disable leftover debug mode 2021-05-07 11:21:40 -04:00
Tyler Goodlet 4798d3b5db Drop lingering rpc_module_paths refs 2021-05-07 11:21:40 -04:00
Tyler Goodlet 247483ee93 Drop run and rpc_module_paths from streaming tests 2021-05-07 11:21:40 -04:00
Tyler Goodlet 9e64161538 Drop run and rpc_module_paths from rpc tests 2021-05-07 11:21:40 -04:00
Tyler Goodlet 3bddf9a94b Drop run and rpc_module_paths from spawning tests 2021-05-07 11:21:40 -04:00
Tyler Goodlet 1eedd463cb Drop run and rpc_module_paths from pubsub tests 2021-05-07 11:21:40 -04:00