Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. This segfaults on MacOS Ventura on a M2 Max MBP.
Forum Updated to NodeBB v4.3 + New Features

This segfaults on MacOS Ventura on a M2 Max MBP.

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 496 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    arcadio
    wrote on last edited by
    #1

    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 QtCoreQEventDispatcherUNIXPrivate::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

    Is this a bug in Qt or am I screwing something up here?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MagicGrapes
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by
        #3

        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


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        M 1 Reply Last reply
        0
        • J.HilkJ J.Hilk

          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

          M Offline
          M Offline
          MagicGrapes
          wrote on last edited by MagicGrapes
          #4

          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.xcodeproj
          

          and without the Qt designer project

          J.HilkJ 1 Reply Last reply
          0
          • M MagicGrapes

            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.xcodeproj
            

            and without the Qt designer project

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by
            #5

            @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.pro
            

            https://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!


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            1 Reply Last reply
            1
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              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.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved