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

Need to handle a KeyError in _debug._hijack_stdin_for_child #310

Closed
goodboy opened this issue May 10, 2022 · 2 comments
Closed

Need to handle a KeyError in _debug._hijack_stdin_for_child #310

goodboy opened this issue May 10, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@goodboy
Copy link
Owner

goodboy commented May 10, 2022

This is probably yet another edge case to be included in #165

Traceback (most recent call last):
  File "/home/goodboy/repos/tractor/tractor/_streaming.py", line 619, in open_stream
    yield stream
  File "/home/goodboy/repos/tractor/tractor/_debug.py", line 280, in _hijack_stdin_for_child
    assert await stream.receive() == 'pdb_unlock'
  File "/home/goodboy/repos/tractor/tractor/_streaming.py", line 104, in receive
    msg = await self._rx_chan.receive()
  File "/home/goodboy/repos/piker/310/lib/python3.10/site-packages/trio/_channel.py", line 314, in receive
    return await trio.lowlevel.wait_task_rescheduled(abort_fn)
  File "/home/goodboy/repos/piker/310/lib/python3.10/site-packages/trio/_core/_traps.py", line 166, in wait_task_rescheduled
    return (await _async_yield(WaitTaskRescheduled(abort_func))).unwrap()
  File "/home/goodboy/repos/piker/310/lib/python3.10/site-packages/outcome/_impl.py", line 138, in unwrap
    raise captured_error
trio.ClosedResourceError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/goodboy/repos/tractor/tractor/_debug.py", line 279, in _hijack_stdin_for_child
    async with ctx.open_stream() as stream:
  File "/usr/lib/python3.10/contextlib.py", line 217, in __aexit__
    await self.gen.athrow(typ, value, traceback)
  File "/home/goodboy/repos/tractor/tractor/_streaming.py", line 628, in open_stream
    self._portal._streams.remove(stream)
KeyError: <tractor._streaming.MsgStream object at 0x7f8298dbe5f0>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/goodboy/repos/tractor/tractor/_debug.py", line 299, in _hijack_stdin_for_child
    lock.release()
  File "/home/goodboy/repos/piker/310/lib/python3.10/site-packages/trio/_core/_ki.py", line 159, in wrapper
    return fn(*args, **kwargs)
  File "/home/goodboy/repos/piker/310/lib/python3.10/site-packages/trio/_sync.py", line 556, in release
    raise RuntimeError("can't release a Lock you don't own")
RuntimeError: can't release a Lock you don't own
@goodboy goodboy added bug Something isn't working debugging labels May 10, 2022
@goodboy
Copy link
Owner Author

goodboy commented Jun 26, 2022

Pretty sure this is now addressed in 71e779d but not sure exactly how to test for it?

@goodboy goodboy removed the debugging label Aug 1, 2022
@goodboy
Copy link
Owner Author

goodboy commented Aug 1, 2022

Marking resolved for now since it hasn't be reported since that patch.

@goodboy goodboy closed this as completed Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant