This segfaults on MacOS Ventura on a M2 Max MBP.
-
I am using Qt 6.5.1 for MacOS. The following code segfaults when I send the process a SIGTERM on MacOS Ventura 13.4 on an M2 Max MBP:
#include <QCoreApplication> #include <QDebug> #include <QTcpServer> #include <QTcpSocket> #include <signal.h> static QTcpServer* server {}; static void signal_handler(int sig) { qInfo() << "got termination signal; closing server socket..."; server->close(); } int main(int argc, char* argv[]) { QCoreApplication a(argc, argv); server = new QTcpServer(&a); a.connect(server, &QTcpServer::newConnection, &a, []() { qInfo() << "got client connection"; auto client = server->nextPendingConnection(); client->deleteLater(); }); signal(SIGTERM, signal_handler); signal(SIGINT, signal_handler); server->listen(QHostAddress::Any, 5150); qInfo() << "listening for connections..."; return a.exec(); }Code works fine on a Debian Linux arm64 box. And by fine, I mean "doesn't segfault".
Doing a backtrace on the core file, I get the following:
- thread #1, stop reason = ESR_EC_DABORT_EL0 (fault address: 0x20)
- frame #0: 0x000000010133aaac QtCore
QEventDispatcherUNIXPrivate::markPendingSocketNotifiers() + 144 frame #1: 0x000000010133afe4 QtCoreQEventDispatcherUNIXPrivate::activateSocketNotifiers() + 28
frame #2: 0x000000010133ba24 QtCoreQEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 888 frame #3: 0x00000001011d98fc QtCoreQEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) + 532
frame #4: 0x00000001011d0614 QtCoreQCoreApplication::exec() + 112 frame #5: 0x00000001001c43b8 segvtestmain(argc=1, argv=0x000000016fc3f650) at main.cpp:33:12
frame #6: 0x000000018fecff28 dyld`start + 2236
- frame #0: 0x000000010133aaac QtCore
Is this a bug in Qt or am I screwing something up here?
- thread #1, stop reason = ESR_EC_DABORT_EL0 (fault address: 0x20)
-
Hi,
I also have the same problem. But I do not know how to check the backtrace. If you have solutions, thanks for leaving some message. -
Might be a permissions error/ missing entry in the auto generated info.plist file.
I would suggest opening the generated Xcode project file and launching the application from there. That usually gives better, more in depth error messages and suggest solutions
-
Might be a permissions error/ missing entry in the auto generated info.plist file.
I would suggest opening the generated Xcode project file and launching the application from there. That usually gives better, more in depth error messages and suggest solutions
Hi @J-Hilk
Where can I find the generated Xcode file?
when I find xcodeproj in the source code directory I only find the following result.//qtwebengine/src/3rdparty/chromium/v8/tools/v8.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/vulkan-deps/vulkan-tools/src/vulkaninfo/iOS/vulkaninfo.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/build/ios/convert_gn_xcodeproj.py .//qtwebengine/src/3rdparty/chromium/third_party/nearby/src/connections/samples/ios/NearbyConnectionsExample/NearbyConnectionsExample.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/openh264/src/codec/build/iOS/processing/processing.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/openh264/src/codec/build/iOS/enc/encDemo/encDemo.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/openh264/src/codec/build/iOS/enc/welsenc/welsenc.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/openh264/src/codec/build/iOS/common/common.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/openh264/src/codec/build/iOS/dec/demo/demo.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/openh264/src/codec/build/iOS/dec/welsdec/welsdec.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/openh264/src/codec/build/iOS/openh264/openh264.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/tools/mac/symupload/symupload.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/tools/mac/crash_report/crash_report.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/tools/mac/dump_syms/dump_syms.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/ios/Breakpad.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/mac/handler/minidump_test.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/mac/Breakpad.xcodeproj .//qt3d/tests/manual/planets-qml/planets-watchos/PlanetsClient.xcodeproj .//qt3d/src/3rdparty/assimp/src/contrib/gtest/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj .//qt3d/src/3rdparty/assimp/src/contrib/gtest/xcode/gtest.xcodeproj .//qt3d/src/3rdparty/assimp/src/samples/SimpleAssimpViewX/SimpleAssimpViewX.xcodeprojand without the Qt designer project
-
Hi @J-Hilk
Where can I find the generated Xcode file?
when I find xcodeproj in the source code directory I only find the following result.//qtwebengine/src/3rdparty/chromium/v8/tools/v8.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/vulkan-deps/vulkan-tools/src/vulkaninfo/iOS/vulkaninfo.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/build/ios/convert_gn_xcodeproj.py .//qtwebengine/src/3rdparty/chromium/third_party/nearby/src/connections/samples/ios/NearbyConnectionsExample/NearbyConnectionsExample.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/openh264/src/codec/build/iOS/processing/processing.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/openh264/src/codec/build/iOS/enc/encDemo/encDemo.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/openh264/src/codec/build/iOS/enc/welsenc/welsenc.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/openh264/src/codec/build/iOS/common/common.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/openh264/src/codec/build/iOS/dec/demo/demo.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/openh264/src/codec/build/iOS/dec/welsdec/welsdec.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/openh264/src/codec/build/iOS/openh264/openh264.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/tools/mac/symupload/symupload.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/tools/mac/crash_report/crash_report.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/tools/mac/dump_syms/dump_syms.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/ios/Breakpad.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/mac/handler/minidump_test.xcodeproj .//qtwebengine/src/3rdparty/chromium/third_party/breakpad/breakpad/src/client/mac/Breakpad.xcodeproj .//qt3d/tests/manual/planets-qml/planets-watchos/PlanetsClient.xcodeproj .//qt3d/src/3rdparty/assimp/src/contrib/gtest/xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj .//qt3d/src/3rdparty/assimp/src/contrib/gtest/xcode/gtest.xcodeproj .//qt3d/src/3rdparty/assimp/src/samples/SimpleAssimpViewX/SimpleAssimpViewX.xcodeprojand without the Qt designer project
@MagicGrapes I just noticed, this only happens automatically when compiling for iOS
you have to use this command to convert a *.pro file to an Xcode project file:
qmake -spec macx-xcode project.prohttps://doc.qt.io/qt-6/qmake-platform-notes.html#creating-and-moving-xcode-projects
the should also be possible with cmake, but that command I do not know!
-
Hi,
Have a look at the Calling Qt Functions From Unix Signal Handers chapter in Qt's documentation. There are some considerations there that might also apply to your use case.