Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore SIGINT when in a debugger REPL #165

Merged
merged 100 commits into from
Aug 3, 2022
Merged
Changes from 1 commit
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
3cac323
Add WIP while-debugger-active SIGINT ignore handler
goodboy Jan 23, 2022
6b7b583
(facepalm) Reraise `BdbQuit` and discard ownerless lock releases
goodboy Jan 23, 2022
4e60c17
Refine the handler for child vs. root cases
goodboy Jan 23, 2022
345573e
Make `mypy` happy
goodboy Jan 23, 2022
42f9d10
Add a pre-started breakpoint example
goodboy Jan 27, 2022
e519526
Handle a context cancel? Might be a noop
goodboy Feb 4, 2022
99c4319
Fix example name typo
goodboy Feb 7, 2022
7964a9f
Try overriding `_GeneratorContextManager.__exit__()`; didn't work..
goodboy Feb 7, 2022
aea8f63
Drop all the `@cm.__exit__()` override attempts..
goodboy Feb 7, 2022
21dccb2
A `.open_context()` example that causes a hang!
goodboy Feb 7, 2022
8f4bbf1
Add and use a pdb instance factory
goodboy Feb 9, 2022
8892204
Add notes around py3.10 stdlib bug from `pdb++`
goodboy Feb 9, 2022
74b819a
Typing fixes, simplify `_set_trace()`
goodboy Feb 9, 2022
bb732ce
Drop high log level in ctx example
goodboy Feb 9, 2022
bf0ac31
Only cancel/get-result from a ctx if transport is up
goodboy Feb 14, 2022
206c7c0
Make `Actor._process_messages()` report disconnects
goodboy Feb 14, 2022
41924c8
Drop uneeded backframe traceback hide annotation
goodboy Feb 14, 2022
f2671ed
Type annot updates
goodboy Feb 14, 2022
2819b6a
Avoid attr error XD
goodboy Feb 16, 2022
89b44f8
Pre-declare disconnected flag
goodboy Feb 16, 2022
dd23e78
Add back in async gen loop
goodboy Feb 16, 2022
fe0fd1a
Add example that triggers bug #302
goodboy Feb 17, 2022
4fd924c
Make example a subpkg for `python -m <mod>` testing
goodboy Feb 18, 2022
7bb5add
Only warn on `trio.BrokenResourceError`s from `_invoke()`
goodboy Feb 18, 2022
4be13b7
Just warn on IPC breaks
goodboy Feb 24, 2022
0062c96
Log cancels with appropriate level
goodboy Mar 4, 2022
d47d0e7
Always call pdb hook even if tty locking fails
goodboy Apr 11, 2022
deaca7d
Always propagate SIGINT when no locking peer found
goodboy May 14, 2022
c7035be
Tolerate double `.remove()`s of stream on portal teardowns
goodboy May 14, 2022
418e74e
Pin to `pdbpp` upstream master, 3.10 problem?
goodboy May 31, 2022
2f5a604
Readme formatting tweaks
goodboy May 31, 2022
f07e9db
Always undo SIGINT overrides, cancel detached children
goodboy Jun 26, 2022
b29def8
Add runtime level msg around channel draining
goodboy Jun 26, 2022
e2453fd
Add spaces before values in log msg
goodboy Jun 26, 2022
2a61aa0
Move pydantic-click hang example to new dir, skip in test suite
goodboy Jun 26, 2022
201c026
Show full KBI trace for help with CI hangs
goodboy Jun 26, 2022
18c525d
Hack around double long list print issue..
goodboy Jun 27, 2022
439d320
Add basic ctl-c testing cases to suite
goodboy Jun 27, 2022
abb0053
Add help msg for non `__main__` modules as well
goodboy Jul 1, 2022
ff3f595
Always enable debug level logging if mode enabled
goodboy Jul 1, 2022
56c1909
Add basic module-not-found when opening a ctx eg.
goodboy Jul 6, 2022
519f4c3
I dunno, seems like `breakpoint()` needs this?
goodboy Jul 7, 2022
4e08605
Only do `pdbpp` from `git` install on 3.10+
goodboy Jul 10, 2022
d0dcd55
Only report disconnected actors if proc is still alive?
goodboy Jul 10, 2022
a90ca4b
Call longlist normally when on py < 3.10
goodboy Jul 11, 2022
9bc38cb
Add slight delay 2nd ctlc round..
goodboy Jul 11, 2022
bd7d507
Guard against `asyncio` cancelled logged to console
goodboy Jul 11, 2022
8b9f342
Port to new `.lowlevel.open_process()` API
goodboy Jul 11, 2022
19fb77f
Pin to `trio >= 0.20`
goodboy Jul 11, 2022
64909e6
Fix loglevel in subactor test; actually pass the level XD
goodboy Jul 11, 2022
4dcc212
Only call `.poll()` if a method on the spawn backend
goodboy Jul 11, 2022
b9eb601
General typing fixes for `mypy`
goodboy Jul 11, 2022
925d5c1
Pin to specific `pdbppp` master commit
goodboy Jul 11, 2022
56b30a9
Add sleep around ctl-c iteration loop
goodboy Jul 11, 2022
70ad0f6
Add longer delays around ctl-c loop, don't expect longlist
goodboy Jul 11, 2022
8358361
Just don't call longlist on 3.10+ for now
goodboy Jul 11, 2022
a101971
Go back to original longlist code
goodboy Jul 11, 2022
ef8dc02
Just drop all longlisting for now and leave comments
goodboy Jul 11, 2022
a723501
Test: drop expect prompt
goodboy Jul 11, 2022
dadd5e6
Add back prompt expect via flag
goodboy Jul 12, 2022
617d57d
Disable ctl-c prompt checks again
goodboy Jul 12, 2022
ba7b355
Add note about default behaviour of `fancycompleter`
goodboy Jul 12, 2022
a2e9019
Add ctl-c case to `subactor_breakpoint` example test
goodboy Jul 12, 2022
adbebd3
Add ctl-c to remaining tests, only expect prompt in non-CI
goodboy Jul 12, 2022
6bdcbdb
Do child decode on `do_ctlc` exit?
goodboy Jul 12, 2022
4779bad
Add before assert helper and print console bytes on fail
goodboy Jul 15, 2022
b21f2e1
Always consider the debugger when exiting contexts
goodboy Jul 23, 2022
808d7ae
Add timeout guard around caller side context open
goodboy Jul 27, 2022
cb0c47c
Try disabling prompt expect in ctrlc cases
goodboy Jul 28, 2022
bd362a0
Run release hook around `next` repl commands as well
goodboy Jul 28, 2022
b01daa5
Factor lock-state release logic into helper
goodboy Jul 28, 2022
a4538a3
Drop ctlc tests on Py3.9...
goodboy Jul 28, 2022
c0cd99e
Timeout on arbiter ping, avoid TCP SYN hangs in CI?
goodboy Jul 28, 2022
1d4d55f
Increase verbosity in ci tests for now
goodboy Jul 28, 2022
20c660f
Add timeout on spawn error msg check
goodboy Jul 29, 2022
a4bac13
Use `pytest-timeout` plug to try and prevent CI hang
goodboy Jul 29, 2022
457499b
Avoid infinite wait for EOF
goodboy Jul 29, 2022
6f01c78
Disable `pygments` highlighting on ctlc tests
goodboy Jul 29, 2022
5e23b3c
Drop pytest full-tracing in CI again
goodboy Jul 29, 2022
08cf03c
Handle missing prompt render case?
goodboy Jul 29, 2022
91f034a
Move all module vars into a `Lock` type
goodboy Jul 29, 2022
937ed99
Factor sigint overriding into lock methods
goodboy Jul 29, 2022
87b2ccb
Try less times for EOF
goodboy Jul 29, 2022
8896ba2
Use `assert_before` more extensively
goodboy Jul 29, 2022
aca9a6b
Try just skipping nested actor tests in CI
goodboy Aug 1, 2022
acfbae4
Drop verbose level, report xfails
goodboy Aug 1, 2022
a9aaee9
Use xfails for nested cases, revert prompt expect
goodboy Aug 1, 2022
e4771ee
Go back to skipping since xfail is wack
goodboy Aug 1, 2022
c5c7a90
Line len lint and drop rpc log msg level again
goodboy Aug 1, 2022
54de72d
Loosen timeout on nested child re-locking
goodboy Aug 1, 2022
fa43888
Add an expect wrapper, use in hanging CI test
goodboy Aug 1, 2022
02c3b9a
Put `pygments` back to default
goodboy Aug 1, 2022
8115759
Mark final nested-actor debugger test
goodboy Aug 1, 2022
2d387f2
Add in issue link for nested cases
goodboy Aug 2, 2022
7f6169a
Drop legacy commented/todo remote debug helper block
goodboy Aug 2, 2022
e4006da
Drop `pdbpp` bug notes, add follow up issue #320 note
goodboy Aug 2, 2022
650313d
Drop legacy handler blocks factored into `_acquire_debug_lock()`
goodboy Aug 2, 2022
65540f3
Add nooz
goodboy Aug 2, 2022
8f1fe23
Simplify all hooks to a common `Lock.release()`
goodboy Aug 2, 2022
cc5f60b
List deps in CI
goodboy Aug 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Drop uneeded backframe traceback hide annotation
goodboy committed Jul 27, 2022

Unverified

The signing certificate or its chain could not be verified.
commit 41924c86a6c484b78d46d9534bca9e4052224283
10 changes: 1 addition & 9 deletions tractor/_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,16 +259,11 @@ async def _hijack_stdin_for_child(
orig_handler = signal.signal(
signal.SIGINT,
shield_sigint,
# partial(shield_sigint, pdb=pdb),
)
# try:
# yield
try:
with (
trio.CancelScope(shield=True),
# disable_sigint(),
):

try:
lock = None
async with _acquire_debug_lock(subactor_uid) as lock:
Expand Down Expand Up @@ -584,10 +579,6 @@ def shield_sigint(
'''
__tracebackhide__ = True

frame = sys._getframe()
last_f = frame.f_back
last_f.f_globals['__tracebackhide__'] = True

global _local_task_in_debug, _global_actor_in_debug
in_debug = _global_actor_in_debug

Expand All @@ -604,6 +595,7 @@ def shield_sigint(
log.pdb(
f"Ignoring SIGINT while child in debug mode: `{in_debug}`"
)

else:
log.pdb(
"Ignoring SIGINT while in debug mode"
Expand Down