Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-104415

[REG 6.3] Segfault on exit in AppleUnifiedLogger::messageHandler with QT_DEBUG_PLUGINS

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • None
    • 6.3.0, 6.3.1, 6.4.0 Beta1
    • Core: Plugins
    • None
    • macOS 10.14.6; macOS 12.4
    • macOS

    Description

      When launching any QtWidgets application on macOS with QT_DEBUG_PLUGINS=1, it segfaults or aborts on exit. This works properly with Qt 6.2.4.

      This:

      QT_DEBUG_PLUGINS=1 python3 -c "from PySide6.QtWidgets import QApplication; QApplication([])"
      

      fails with:

      Crashed Thread:        0  Dispatch queue: com.apple.main-thread
      
      Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
      Exception Codes:       KERN_INVALID_ADDRESS at 0x00000000000031b8
      Exception Note:        EXC_CORPSE_NOTIFY
      
      Termination Signal:    Segmentation fault: 11
      Termination Reason:    Namespace SIGNAL, Code 0xb
      Terminating Process:   exc handler [7516]
      
      VM Regions Near 0x31b8:
      --> 
          __TEXT                 0000000101ec3000-0000000101ec5000 [    8K] r-x/rwx SM=COW  /usr/local/Cellar/python@3.9/3.9.12_1/Frameworks/Python.framework/Versions/3.9/Resources/Python.app/Contents/MacOS/Python
      
      Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
      0   org.qt-project.QtCore         	0x00000001044e2088 0x1042ff000 + 1978504
      1   org.qt-project.QtCore         	0x00000001044de649 AppleUnifiedLogger::cachedLog(QString const&, QString const&) + 153
      2   org.qt-project.QtCore         	0x00000001044de349 AppleUnifiedLogger::messageHandler(QtMsgType, QMessageLogContext const&, QString const&, QString const&) + 201
      3   org.qt-project.QtCore         	0x000000010430eab0 0x1042ff000 + 64176
      4   org.qt-project.QtCore         	0x000000010430e868 0x1042ff000 + 63592
      5   org.qt-project.QtCore         	0x000000010430e75d qt_message_output(QtMsgType, QMessageLogContext const&, QString const&) + 13
      6   org.qt-project.QtCore         	0x0000000104315897 QDebug::~QDebug() + 103
      7   org.qt-project.QtCore         	0x00000001045db785 0x1042ff000 + 3000197
      8   org.qt-project.QtCore         	0x00000001045de64b 0x1042ff000 + 3012171
      9   org.qt-project.QtCore         	0x00000001045da879 0x1042ff000 + 2996345
      10  libsystem_c.dylib             	0x00007fff604043cf __cxa_finalize_ranges + 319
      11  libsystem_c.dylib             	0x00007fff604046b3 exit + 55
      12  libdyld.dylib                 	0x00007fff6035e3dc start + 8
      

      Similarly, launching e.g. QT_DEBUG_PLUGINS=1 6.3.1/macos/bin/pixeltool.app/Contents/MacOS/pixeltool in my Qt directory fails with:

      pixeltool(7575,0x10f7635c0) malloc: *** error for object 0x7fbbc150e0e0: pointer being freed was not allocated
      pixeltool(7575,0x10f7635c0) malloc: *** set a breakpoint in malloc_error_break to debug
      Abort trap: 6
      

      and:

      Crashed Thread:        0  Dispatch queue: com.apple.main-thread
      
      Exception Type:        EXC_CRASH (SIGABRT)
      Exception Codes:       0x0000000000000000, 0x0000000000000000
      Exception Note:        EXC_CORPSE_NOTIFY
      
      Application Specific Information:
      abort() called
      pixeltool(7575,0x10f7635c0) malloc: *** error for object 0x7fbbc150e0e0: pointer being freed was not allocated
       
      
      Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
      0   libsystem_kernel.dylib        	0x00007fff604992c6 __pthread_kill + 10
      1   libsystem_pthread.dylib       	0x00007fff60554bf1 pthread_kill + 284
      2   libsystem_c.dylib             	0x00007fff604036a6 abort + 127
      3   libsystem_malloc.dylib        	0x00007fff60512077 malloc_vreport + 545
      4   libsystem_malloc.dylib        	0x00007fff60511e38 malloc_report + 151
      5   org.qt-project.QtCore         	0x0000000103861f1b AppleUnifiedLogger::messageHandler(QtMsgType, QMessageLogContext const&, QString const&, QString const&) + 459
      6   org.qt-project.QtCore         	0x0000000103694ee0 0x103682000 + 77536
      7   org.qt-project.QtCore         	0x0000000103694c98 0x103682000 + 76952
      8   org.qt-project.QtCore         	0x0000000103694b8d qt_message_output(QtMsgType, QMessageLogContext const&, QString const&) + 13
      9   org.qt-project.QtCore         	0x000000010369bcd7 QDebug::~QDebug() + 103
      10  org.qt-project.QtCore         	0x000000010395b125 0x103682000 + 2986277
      11  org.qt-project.QtCore         	0x000000010395dfeb 0x103682000 + 2998251
      12  org.qt-project.QtCore         	0x000000010395a219 0x103682000 + 2982425
      13  libsystem_c.dylib             	0x00007fff604043cf __cxa_finalize_ranges + 319
      14  libsystem_c.dylib             	0x00007fff604046b3 exit + 55
      15  libdyld.dylib                 	0x00007fff6035e3dc start + 8
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vestbo Tor Arne Vestbø
            the compiler Florian Bruhin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes