Crash related to network activity in p2p app on macOS M1
-
Hi there, I have a p2p application built with Qt 6.6.1 that seems to be crashing for users on macOS, but only if they have an M1 chip. The application is compiled with both the x86_64 and arm64 ABIs, but since it's only crashing for M1 users I'm guessing the problem only happens with the arm64 ABI. The crash report they're all sending me looks like this:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 QtCore 0x104edb1b5 QCoreApplication::notifyInternal2(QObject*, QEvent*) + 133
1 QtCore 0x10504b159 0x104e6f000 + 1950041
2 CoreFoundation 0x7ff80bd202ce __CFSocketPerformV0 + 669
3 CoreFoundation 0x7ff80bcf62c7 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
4 CoreFoundation 0x7ff80bcf6269 __CFRunLoopDoSource0 + 157
5 CoreFoundation 0x7ff80bcf6034 __CFRunLoopDoSources0 + 215
6 CoreFoundation 0x7ff80bcf4cb1 __CFRunLoopRun + 919
7 CoreFoundation 0x7ff80bcf4352 CFRunLoopRunSpecific + 557
8 HIToolbox 0x7ff8165969d9 RunCurrentEventLoopInMode + 292
9 HIToolbox 0x7ff8165967e6 ReceiveNextEventCommon + 665
10 HIToolbox 0x7ff816596531 _BlockUntilNextEventMatchingListInModeWithFilter + 66
11 AppKit 0x7ff80f304885 _DPSNextEvent + 880
12 AppKit 0x7ff80fbf8348 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1304
13 AppKit 0x7ff80f2f5dfa -[NSApplication run] + 603
14 libqcocoa.dylib 0x102d39833 0x102d23000 + 92211
15 QtCore 0x104ee4526 QEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) + 486
16 QtCore 0x104edb7d5 QCoreApplication::exec() + 133
17 SoulseekQt 0x1026de739 main + 4585
18 dyld 0x7ff80b8923a6 start + 1942These are also very heavy users so their client probably generates a lot of network traffic, and it always seems to crash for them within 8-12 hours. They also all seem to be using macOS Sonoma.
My first guess was that it was a QTcpSocket object somewhere being used after it's deleted, but seeing as it's happening outside my code and in the process of the Qt framework delivering signals (I think?) it seems unlikely that a signal would be delivered to an already deleted object.
My second guess was memory corruption, but I would imagine that would crash in less uniform ways than to always produce the same stack trace...
This isn't just a Qt 6 problem by the way. I sent users who were having this problem a build that uses Qt 5.15.12 (open source), and it crashes for them in the exact same way.
Any ideas of where I should be looking?
Thanks, Nir
-
Hi,
we experience several crashes that sometimes look alike (see first stack-trace in my ticket: https://forum.qt.io/topic/158065/crashes-on-macos-arm-using-sockets)
To me it looks as if there's a remaining reference not properly cleaned up after a deletion of a QObject.
Regards