agronholm / apscheduler

Task scheduling library for Python
MIT License
6.28k stars 710 forks source link

AnyIO related exception issue #986

Open HK-Mattew opened 8 hours ago

HK-Mattew commented 8 hours ago

Things to check first

Version

4.0.0a5

What happened?

The problem seems to be more related to AnyIO. However, I'm not using AnyIO directly so I opened this issue here.

Exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/home/username/.cache/pypoetry/virtualenvs/projectx-3coxCssU-py3.10/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 810, in task_done
    self._exceptions.append(exc)
AttributeError: 'TaskGroup' object has no attribute '_exceptions'

--- Logging error in Loguru Handler #1 ---
Record was: {'elapsed': datetime.timedelta(seconds=12797, microseconds=790013), 'exception': (type=<class 'RecursionError'>, value=RecursionError('maximum recursion depth exceeded in comparison'), traceback=<traceback object at 0x7f68a7692c80>), 'extra': {}, 'file': (name='base_events.py', path='/usr/local/lib/python3.10/asyncio/base_events.py'), 'function': 'call_exception_handler', 'level': (name='ERROR', no=40, icon='❌'), 'line': 1762, 'message': 'Exception in default exception handler', 'module': 'base_events', 'name': 'asyncio.base_events', 'process': (id=6499, name='MainProcess'), 'thread': (id=140087471896320, name='Thread-2 (run_blocking_portal)'), 'time': datetime(2024, 11, 13, 19, 31, 21, 260738, tzinfo=datetime.timezone(datetime.timedelta(0), 'UTC'))}
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/home/username/.cache/pypoetry/virtualenvs/projectx-3coxCssU-py3.10/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 810, in task_done
    self._exceptions.append(exc)
AttributeError: 'TaskGroup' object has no attribute '_exceptions'

[APSCHEDULER] ERROR - Job 8c6ed35c-bb78-4501-95f3-4f53326ab3af raised an exception - Traceback (most recent call last):

  File "/usr/local/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/home/username/.cache/pypoetry/virtualenvs/projectx-3coxCssU-py3.10/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 810, in task_done
    self._exceptions.append(exc)
AttributeError: 'TaskGroup' object has no attribute '_exceptions'

How can we reproduce the bug?

I don't know exactly.

agronholm commented 8 hours ago

Which version of AnyIO is this on?

HK-Mattew commented 8 hours ago

Which version of AnyIO is this on?

anyio==4.6.2.post1

agronholm commented 8 hours ago

Now I'd just need a clue on how to reproduce this so I can fix the problem.