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

TypeError: arguments did not match any overloaded call QMutexLocker #128

Open
blluv opened this issue Jan 1, 2025 · 9 comments
Open

TypeError: arguments did not match any overloaded call QMutexLocker #128

blluv opened this issue Jan 1, 2025 · 9 comments

Comments

@blluv
Copy link

blluv commented Jan 1, 2025

Exception in callback _ProactorReadPipeTransport._loop_reading(<_OverlappedF...hed result=10>)
handle: <Handle _ProactorReadPipeTransport._loop_reading(<_OverlappedF...hed result=10>)>
Traceback (most recent call last):
  File "asyncio\events.py", line 80, in _run
  File "asyncio\proactor_events.py", line 301, in _loop_reading
  File "qasync\_windows.py", line 86, in recv_into
TypeError: arguments did not match any overloaded call:
  QMutexLocker(mutex: Optional[QMutex]): argument 1 has unexpected type 'QMutexLocker'
  QMutexLocker(mutex: Optional[QRecursiveMutex]): argument 1 has unexpected type 'QMutexLocker'
Traceback (most recent call last):
  File "qasync\_windows.py", line 196, in run
  File "qasync\_windows.py", line 69, in select
  File "qasync\_windows.py", line 149, in _poll
TypeError: arguments did not match any overloaded call:
  QMutexLocker(mutex: Optional[QMutex]): argument 1 has unexpected type 'QMutexLocker'
  QMutexLocker(mutex: Optional[QRecursiveMutex]): argument 1 has unexpected type 'QMutexLocker'
@HubKing
Copy link

HubKing commented Jan 26, 2025

Is this project dead?

@st-walker
Copy link

I think the maintainers typically reply to say it's not dead but nothing ever gets merged so 🤷

See:

#119 (comment)

@dnadlinger
Copy link
Contributor

We are also seeing this on the latest release (in the context of https://github.com/m-labs/artiq on Windows):

  File "C:\Users\LabUser\AppData\Local\Programs\Python\Python311\Lib\asyncio\streams.py", line 332, in write
    self._transport.write(data)
  File "C:\Users\LabUser\AppData\Local\Programs\Python\Python311\Lib\asyncio\proactor_events.py", line 365, in write
    self._loop_writing(data=bytes(data))
  File "C:\Users\LabUser\AppData\Local\Programs\Python\Python311\Lib\asyncio\proactor_events.py", line 401, in _loop_writing
    self._write_fut = self._loop._proactor.send(self._sock, data)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\LabUser\AppData\Local\pypoetry\Cache\virtualenvs\artiq-oitg-UIB2HjkM-py3.11\Lib\site-packages\qasync\_windows.py", line 102, in send
    with QtCore.QMutexLocker(self._lock):
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: arguments did not match any overloaded call:
  QMutexLocker(mutex: Optional[QMutex]): argument 1 has unexpected type 'QMutexLocker'
  QMutexLocker(mutex: Optional[QRecursiveMutex]): argument 1 has unexpected type 'QMutexLocker'

I strongly suspect that this involves memory corruption or lifetime management issues, as self._lock is obviously not itself a QMutexLocker.

@blluv: Do you have a stand-alone reproducer for this?

@dnadlinger
Copy link
Contributor

It would be interesting to see whether this also occurs with PySide instead of PyQt.

@halkony
Copy link

halkony commented Jan 27, 2025

May not be totally related, but I was getting errors like this when using the QApplication from Pyside instead of qasync. Switching to the qasync one fixed the async crashes I was getting.

@halkony
Copy link

halkony commented Jan 27, 2025

This was after determining that these crashes were memory faults by looking at the windows event viewer. For future readers, if you get unexplainable crashes from PyQT / Pyside, add this to your code to get the traceback.

import faulthandler
faulthandler.enable()

@dnadlinger
Copy link
Contributor

May not be totally related, but I was getting errors like this when using the QApplication from Pyside instead of qasync. Switching to the qasync one fixed the async crashes I was getting.

Huh – isn't that just a re-exported version of the underlying PyQt/PySide one, though?

@halkony
Copy link

halkony commented Jan 27, 2025

It seems you are correct. Nevertheless my application hasn't had a random crash from a thread since I made that change. Seems preposterous.

@dnadlinger
Copy link
Contributor

And it wasn't maybe the auto-selelction causing you to switch to a different (Py)Qt library?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants