goodboy / tractor

A distributed, structured concurrent runtime for Python (and friends)
GNU Affero General Public License v3.0
265 stars 12 forks source link

Recursion error on `BroadcastReceiver.receive()`? #328

Open goodboy opened 2 years ago

goodboy commented 2 years ago

Just hit this in piker doing some nasty clearing engine testing:

    await self.gen.athrow(typ, value, traceback)
    File "/home/goodboy/repos/piker/piker/ui/order_mode.py", line 684, in open_order_mode
      async with (
    File "/usr/lib/python3.10/contextlib.py", line 217, in __aexit__
      await self.gen.athrow(typ, value, traceback)
    File "/home/goodboy/repos/piker/piker/clearing/_client.py", line 249, in open_ems
      async with trio.open_nursery() as n:
    File "/home/goodboy/.virtualenvs/xonsh310/lib/python3.10/site-packages/trio/_core/_run.py", line 813, in __aexit__
      raise combined_error_from_nursery
    File "/home/goodboy/repos/piker/piker/clearing/_client.py", line 157, in relay_order_cmds_from_sync_code
      async for cmd in orders_stream:
    File "/home/goodboy/.virtualenvs/xonsh310/lib/python3.10/site-packages/trio/_abc.py", line 641, in __anext__
      return await self.receive()
    File "/home/goodboy/repos/tractor/tractor/trionics/_broadcast.py", line 294, in receive
      return await self.receive()
    File "/home/goodboy/repos/tractor/tractor/trionics/_broadcast.py", line 294, in receive
      return await self.receive()
    File "/home/goodboy/repos/tractor/tractor/trionics/_broadcast.py", line 294, in receive
      return await self.receive()
    [Previous line repeated 970 more times]
    File "/home/goodboy/repos/tractor/tractor/trionics/_broadcast.py", line 273, in receive
      await ev.wait()
    File "/home/goodboy/.virtualenvs/xonsh310/lib/python3.10/site-packages/trio/_sync.py", line 67, in wait
      await trio.lowlevel.checkpoint()
    File "/home/goodboy/.virtualenvs/xonsh310/lib/python3.10/site-packages/trio/_core/_run.py", line 2346, in checkpoint
      await cancel_shielded_checkpoint()
    File "/home/goodboy/.virtualenvs/xonsh310/lib/python3.10/site-packages/trio/_core/_traps.py", line 43, in cancel_shielded_checkpoint
      return (await _async_yield(CancelShieldedCheckpoint)).unwrap()
    File "/home/goodboy/.virtualenvs/xonsh310/lib/python3.10/site-packages/outcome/_impl.py", line 108, in unwrap
      self._set_unwrapped()
    File "/home/goodboy/.virtualenvs/xonsh310/lib/python3.10/site-packages/outcome/_impl.py", line 59, in _set_unwrapped
      object.__setattr__(self, '_unwrapped', True)
  RecursionError: maximum recursion depth exceeded while calling a Python object

Not sure how this is possible exactly nor how to reproduce it?

The accompanying multi and assertion error were as follows:

  Traceback (most recent call last):
  File "/home/goodboy/repos/tractor/tractor/_root.py", line 206, in open_root_actor
    yield actor
  File "/home/goodboy/repos/piker/piker/_daemon.py", line 244, in maybe_open_runtime
    yield
  File "/home/goodboy/repos/piker/piker/_daemon.py", line 269, in maybe_open_pikerd
    yield portal
  File "/home/goodboy/repos/piker/piker/ui/_exec.py", line 175, in main
    await func(*((instance,) + args))
  File "/home/goodboy/repos/piker/piker/ui/_app.py", line 100, in _async_main
    async with (
  File "/home/goodboy/.virtualenvs/xonsh310/lib/python3.10/site-packages/trio/_core/_run.py", line 813, in __aexit__
    raise combined_error_from_nursery
trio.MultiError: AssertionError(), RecursionError('maximum recursion depth exceeded while calling a Python object')

Details of embedded exception 1:

  Traceback (most recent call last):
    File "/home/goodboy/repos/piker/piker/ui/_display.py", line 1057, in display_symbol_data
      async with (
    File "/usr/lib/python3.10/contextlib.py", line 217, in __aexit__
      await self.gen.athrow(typ, value, traceback)
    File "/home/goodboy/repos/piker/piker/ui/order_mode.py", line 684, in open_order_mode
      async with (
    File "/home/goodboy/.virtualenvs/xonsh310/lib/python3.10/site-packages/trio/_core/_run.py", line 813, in __aexit__
      raise combined_error_from_nursery
    File "/home/goodboy/repos/piker/piker/ui/order_mode.py", line 928, in process_trades_and_update_ui
      await process_trade_msg(
    File "/home/goodboy/repos/piker/piker/ui/order_mode.py", line 1073, in process_trade_msg
      mode.on_fill(
    File "/home/goodboy/repos/piker/piker/ui/order_mode.py", line 494, in on_fill
      assert len(lines) == 2
  AssertionError