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

qasync is getting stuck in an infinite loop after an uncaught exception #22

Open
hartytp opened this issue Dec 14, 2020 · 4 comments
Open
Labels
need repro Needs minimal, reproducible example

Comments

@hartytp
Copy link
Contributor

hartytp commented Dec 14, 2020

Summary

When closing an application after an uncaught exception in user code, qasync is getting stuck in an infinite loop at

del self.__callbacks[timerid]
due to an unhandled KeyError in a finally block.

NB the line numbers in the traceback below don't match master since I'm a few commits behind (one of the commits added some whitespace).

Full traceback is:

ERROR<8>:qasync._QEventLoop:Exception in callback _ProactorBasePipeTransport._call_connection_lost(None)
handle: <Handle _ProactorBasePipeTransport._call_connection_lost(None)>
Traceback (most recent call last):
  File "...\lib\asyncio\events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "...\asyncio\proactor_events.py", line 162, in _call_connection_lost
    self._sock.shutdown(socket.SHUT_RDWR)
OSError: [WinError 10038] An operation was attempted on something that is not a socket
ERROR<8>:qasync._QEventLoop:Exception in callback _ProactorBasePipeTransport._call_connection_lost(None)
handle: <Handle _ProactorBasePipeTransport._call_connection_lost(None)>
Traceback (most recent call last):
  File "...lib\asyncio\events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "...\lib\asyncio\proactor_events.py", line 162, in _call_connection_lost
    self._sock.shutdown(socket.SHUT_RDWR)
OSError: [WinError 10038] An operation was attempted on something that is not a socket
Traceback (most recent call last):
  File "...\lib\site-packages\qasync-0.11.0-py3.9.egg\qasync\__init__.py", line 262, in timerEvent
  File "...\lib\asyncio\events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "...\lib\asyncio\proactor_events.py", line 299, in _loop_reading
    self._read_fut = self._loop._proactor.recv(self._sock, 32768)
  File "...\wand\lib\site-packages\qasync-0.11.0-py3.9.egg\qasync\_windows.py", line 79, in recv
KeyboardInterrupt
Traceback (most recent call last):
  File "...\lib\site-packages\qasync-0.11.0-py3.9.egg\qasync\__init__.py", line 264, in timerEvent
KeyError: 15
Traceback (most recent call last):
  File "...lib\site-packages\qasync-0.11.0-py3.9.egg\qasync\__init__.py", line 264, in timerEvent
KeyError: 15
Traceback (most recent call last):
  File "...\lib\site-packages\qasync-0.11.0-py3.9.egg\qasync\__init__.py", line 264, in timerEvent
KeyError: 15
Traceback (most recent call last):
  File "...\lib\site-packages\qasync-0.11.0-py3.9.egg\qasync\__init__.py", line 264, in timerEvent
KeyError: 15
Traceback (most recent call last):
  File "...\lib\site-packages\qasync-0.11.0-py3.9.egg\qasync\__init__.py", line 264, in timerEvent
KeyError: 15
Traceback (most recent call last):
  File "...\lib\site-packages\qasync-0.11.0-py3.9.egg\qasync\__init__.py", line 264, in timerEvent
KeyError: 15
Traceback (most recent call last):
  File "...\lib\site-packages\qasync-0.11.0-py3.9.egg\qasync\__init__.py", line 264, in timerEvent
KeyError: 15
Traceback (most recent call last):
  File "...\lib\site-packages\qasync-0.11.0-py3.9.egg\qasync\__init__.py", line 264, in timerEvent
KeyError: 15
Traceback (most recent call last):
  File "...\lib\site-packages\qasync-0.11.0-py3.9.egg\qasync\__init__.py", line 264, in timerEvent
KeyError: 15
Traceback (most recent call last):
  File "...\lib\site-packages\qasync-0.11.0-py3.9.egg\qasync\__init__.py", line 264, in timerEvent
KeyError: 15
Traceback (most recent call last):
  File "...\lib\site-packages\qasync-0.11.0-py3.9.egg\qasync\__init__.py", line 264, in timerEvent
@hartytp
Copy link
Contributor Author

hartytp commented Dec 14, 2020

The original error looks like it might be an asyncio error, but I would not expect qasync to get stuck in an infinite loop because of it.

@SantosJMM
Copy link
Contributor

Could you indicate how you got to that exception ?

@serg06
Copy link

serg06 commented Sep 22, 2021

I'm getting the same one now, but with KeyError: 358.

I think it happened after I added a background flask server on a daemon thread.

When I hit stop in PyCharm, it enters an infinite loop and keeps spamming that error.

@hosaka hosaka changed the title keyError in qasync is getting stuck in an infinite loop after an uncaught exception Apr 11, 2023
@hosaka
Copy link
Collaborator

hosaka commented Apr 11, 2023

If the isssue is still present, please provide a minimal, reproducible example.

@hosaka hosaka added the need repro Needs minimal, reproducible example label Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need repro Needs minimal, reproducible example
Projects
None yet
Development

No branches or pull requests

4 participants