QtBluetooth crashes at discoverDetails on Win11
-
Hello Community!
I've written a Qt application in python on windows 11 using PyQt 6.5.1.
On windows 10 it worked fine to scan for devices, connect to one (that I also developped myself, so I have access to the clients GATT details), discover services and discover details of a specific service.
Now I upgraded to windows 11 due to customer requirements and the program freezes as soon as I call discoverDetails.
Snapshot of the code:
def serviceDiscovered(self, serviceUuid): print("service discovered... " + str(serviceUuid)) if (serviceUuid == QBluetoothUuid("00000100-a2f9-45da-988f-c3517912fa9f")): print("service recognized") self.bleService = self.bleCentral.createServiceObject(serviceUuid) if self.bleService: self.bleService.stateChanged.connect(self.serviceStateChanged, type=Qt.ConnectionType.QueuedConnection) self.bleService.characteristicChanged.connect(self.updateValues, type=Qt.ConnectionType.QueuedConnection) self.bleService.characteristicRead.connect(self.dataRead, type=Qt.ConnectionType.QueuedConnection) self.bleService.descriptorWritten.connect(self.confirmedDescriptorWrite, type=Qt.ConnectionType.QueuedConnection) self.bleService.errorOccurred.connect(self.bleServiceError, type=Qt.ConnectionType.QueuedConnection) ## Here an error occurs in WIN 11... program (Qt GUI) freezes self.bleService.discoverDetails(QLowEnergyService.DiscoveryMode.SkipValueDiscovery)
Any help or hints appreciated, also telling me if it perfectly works for you would help, then maybe the error is to be searched on the clients side... however, it did work well on windows 10.
Best regards, Hendrik
-
-
I appear to have the same problem. discoverDetails gets stuck in some kind of infinite loop on Win11.
Has anyone else seen this? Or found a way round it?
I am running on PySide6 v.6.6.
I have checked the threads:
41744, 12.38, 2,876,720,284, python.exe+0x12a0, Normal 45740, 0.02, 5,287,066, winmm.dll!PlaySoundW+0xe30, Time critical 18724, 0.01, 3,369,858, ucrtbase.dll!recalloc+0x10, Normal 51356, , 1,301,246, ucrtbase.dll!recalloc+0x10, Normal 18760, , 874,602, ucrtbase.dll!recalloc+0x10, Normal 52100, , , ntdll.dll!RtlClearThreadWorkOnBehalfTicket+0x70, Normal 46912, , , ntdll.dll!RtlClearThreadWorkOnBehalfTicket+0x70, Normal 45108, , , Qt6Core.dll!QThread::start+0x2d0, Normal 41732, , , ntdll.dll!RtlClearThreadWorkOnBehalfTicket+0x70, Normal 41424, , , combase.dll!CoIncrementMTAUsage+0x3590, Normal 41208, , , ucrtbase.dll!recalloc+0x10, Normal 32288, , , ntdll.dll!RtlClearThreadWorkOnBehalfTicket+0x70, Normal 11612, , , igd10um64xe.dll!OpenAdapter10_2+0x3e730, Normal 7644, , , Qt6Core.dll!QThread::start+0x2d0, Normal 3404, , , igd10um64xe.dll!OpenAdapter10_2+0x3e730, Normal
The busiest thread (41744) looks reasonable enough:
0, Windows.Devices.Bluetooth.dll!DllGetClassObject+0x103c8 1, Qt6Bluetooth.dll!QBluetoothLocalDevice::setHostMode+0x104d 2, Qt6Bluetooth.dll!QBluetoothServer::setMaxPendingConnections+0x16770 3, Qt6Bluetooth.dll!QBluetoothServer::setMaxPendingConnections+0x12c7b 4, Qt6Bluetooth.dll!QBluetoothServer::setMaxPendingConnections+0xfb9d 5, Windows.Devices.Bluetooth.dll!DllGetClassObject+0x22a5e 6, Windows.Devices.Bluetooth.dll!DllGetClassObject+0x311c2 7, Windows.Devices.Bluetooth.dll!DllGetClassObject+0x21661 8, Windows.Devices.Bluetooth.dll!DllGetClassObject+0x2159c 9, Windows.Devices.Bluetooth.dll!DllGetClassObject+0x129ee 10, Windows.Devices.Bluetooth.dll!DllGetClassObject+0x1d1d1 11, Windows.Devices.Bluetooth.dll!DllGetClassObject+0x29eff 12, combase.dll!Ordinal111+0x7bd6 13, combase.dll!Ordinal111+0x79d4 14, combase.dll!Ordinal139+0x14214 15, combase.dll!CoIsHandlerConnected+0x2022 16, combase.dll!CStdStubBuffer_DebugServerRelease+0x177e4 17, user32.dll!DispatchMessageW+0x741 18, user32.dll!DispatchMessageW+0x201 19, Qt6Core.dll!QEventDispatcherWin32::processEvents+0x53a 20, Qt6Gui.dll!QWindowsGuiEventDispatcher::processEvents+0x19 21, Qt6Core.dll!QEventLoop::exec+0x19f 22, Qt6Core.dll!QCoreApplication::exec+0x15d 23, QtCore.pyd!PyInit_QtCore+0x17caf0 24, python310.dll!PyObject_GC_Malloc+0x2e0 25, python310.dll!PyErr_NormalizeException+0x555 26, python310.dll!PyErr_NormalizeException+0x2cf 27, python310.dll!PyErr_NormalizeException+0x28c 28, python310.dll!PyEval_EvalFrameDefault+0xa5c4 29, python310.dll!PyMapping_Check+0x311 30, python310.dll!PyEval_EvalCode+0x82 31, python310.dll!PyEval_GetBuiltins+0x70b 32, python310.dll!PyEval_GetBuiltins+0x60b 33, python310.dll!PyObject_GetBuffer+0xd59 34, python310.dll!PyErr_NormalizeException+0x555 35, python310.dll!PyErr_NormalizeException+0x2cf 36, python310.dll!PyErr_NormalizeException+0x28c 37, python310.dll!Py_gitversion+0x20628 38, python310.dll!PyFunction_Vectorcall+0x87 39, python310.dll!PyErr_NormalizeException+0x555 40, python310.dll!PyErr_NormalizeException+0x2cf 41, python310.dll!Py_gitversion+0x2c350 42, python310.dll!Py_gitversion+0x20628 43, python310.dll!PyFunction_Vectorcall+0x87 44, python310.dll!PyErr_NormalizeException+0x555 45, python310.dll!PyErr_NormalizeException+0x2cf 46, python310.dll!Py_gitversion+0x2c350 47, python310.dll!Py_gitversion+0x20ced 48, python310.dll!PyFunction_Vectorcall+0x87 49, python310.dll!PyErr_NormalizeException+0x555 50, python310.dll!PyErr_NormalizeException+0x2cf 51, python310.dll!Py_gitversion+0x2c350 52, python310.dll!Py_gitversion+0x20ced 53, python310.dll!PyFunction_Vectorcall+0x87 54, python310.dll!PyEval_EvalFrameDefault+0x5f4 55, python310.dll!PyFunction_Vectorcall+0x87 56, python310.dll!PyEval_EvalFrameDefault+0x1a3b 57, python310.dll!PyMapping_Check+0x311 58, python310.dll!PyEval_EvalCode+0x82 59, python310.dll!PyEval_GetBuiltins+0x70b 60, python310.dll!PyEval_GetBuiltins+0x60b 61, python310.dll!PyEval_EvalFrameDefault+0x1957 62, python310.dll!PyFunction_Vectorcall+0x87 63, python310.dll!PyEval_EvalFrameDefault+0x5f4 64, python310.dll!PyFunction_Vectorcall+0x87 65, python310.dll!PyVectorcall_Call+0x5c 66, python310.dll!PyObject_Call+0x4f 67, python310.dll!PyArg_Parse+0x1ba 68, python310.dll!Py_RunMain+0x13d 69, python310.dll!Py_RunMain+0x15 70, python310.dll!Py_Main+0x25 71, python.exe+0x1230 72, kernel32.dll!BaseThreadInitThunk+0x1d 73, ntdll.dll!RtlUserThreadStart+0x28
But the second busiest thread (45740)... I' don't know what it's up to:
0, ntdll.dll!ZwWaitForMultipleObjects+0x14 1, winmm.dll!PlaySoundW+0xec1 2, kernel32.dll!BaseThreadInitThunk+0x1d 3, ntdll.dll!RtlUserThreadStart+0x28
Here is the complete thread list:
-
I wonder how much time would it require to fix this issue!
I reported this issue 1.5 years ago and no real help. This is frustrating! -
I have shared a solution to this issue on the following bug report:
https://bugreports.qt.io/browse/QTBUG-109510 -
@Rida-Shamasneh
Although this is not my area I read through the bug report and thank you for contributing your workaround for the community.I am just intrigued about one thing: why is this a Python/PyQt/PySide issue, yet (apparently) not from C++?
-
This post is deleted!