Bug report #20241

Crashes on QGIS3 app quit, but also from python when creating ref using QgsApplication

Added by John Harrop over 5 years ago. Updated about 5 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Python bindings / sipify
Affected QGIS version:3.2.3 Regression?:No
Operating System:Mac OSX 10.3.6 Easy fix?:No
Pull Request or Patch supplied:No Resolution:no timely feedback
Crashes QGIS or corrupts data:Yes Copied to github as #:28062

Description

QGIS3 app seems to run fine and saves work. But when I come to close it consistently crashes.

Running on Mac OSX 10.3.6

I've taken out all plugins. I uninstalled QGIS and reinstalled. I've also taken out potentially conflicting pythons so the only 3 version is 3.6.6 and I've uninstalled QT so it could be reinstalled by QGIS the way it wanted. The messages seemed to suggest there was a problem with QT.

Here is the dump (but also look below, the message from the standalone python code might be more useful):

Process: QGIS [1372]
Path: /Applications/QGIS3.app/Contents/MacOS/QGIS
Identifier: org.qgis.qgis3
Version: 3.2.3 (3.2.3 [exported])
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: QGIS [1372]
User ID: 501

Date/Time: 2018-10-27 14:02:54.396 -0700
OS Version: Mac OS X 10.13.6 (17G65)
Report Version: 12
Anonymous UUID: FBF32117-62BF-61F8-B162-45CD0680355D

Time Awake Since Boot: 4300 seconds

System Integrity Protection: enabled

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x000000000000001c
Exception Note: EXC_CORPSE_NOTIFY

Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [0]

VM Regions Near 0x1c:
-->
__TEXT 00000001087b0000-0000000108c16000 [ 4504K] r-x/rwx SM=COW /Applications/QGIS3.app/Contents/MacOS/QGIS

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 org.qgis.qgis3_gui 0x0000000109a466e4 QgsFloatingWidget::onAnchorPointChanged() + 124
1 org.qt-project.QtCore 0x0000000111fd244b QMetaObject::activate(QObject*, int, int, void**) + 2347
2 org.qgis.qgis3_gui 0x0000000109a46c17 QgsFloatingWidgetEventFilter::eventFilter(QObject*, QEvent*) + 21
3 org.qt-project.QtCore 0x0000000111fa1d42 QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) + 210
4 org.qt-project.QtWidgets 0x000000010ea6bb6d QApplicationPrivate::notify_helper(QObject*, QEvent*) + 285
5 org.qt-project.QtWidgets 0x000000010ea6ce9f QApplication::notify(QObject*, QEvent*) + 383
6 org.qgis.qgis3_core 0x000000010a9b9ba1 QgsApplication::notify(QObject*, QEvent*) + 93
7 org.qt-project.QtCore 0x0000000111fa1a7f QCoreApplication::notifyInternal2(QObject*, QEvent*) + 159
8 org.qt-project.QtWidgets 0x000000010eac6b9f 0x10ea5a000 + 445343
9 org.qt-project.QtWidgets 0x000000010eac4d45 0x10ea5a000 + 437573
10 org.qt-project.QtWidgets 0x000000010ea6bb82 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 306
11 org.qt-project.QtWidgets 0x000000010ea6ce9f QApplication::notify(QObject*, QEvent*) + 383
12 org.qgis.qgis3_core 0x000000010a9b9ba1 QgsApplication::notify(QObject*, QEvent*) + 93
13 org.qt-project.QtCore 0x0000000111fa1a7f QCoreApplication::notifyInternal2(QObject*, QEvent*) + 159
14 org.qt-project.QtGui 0x00000001117a585d QGuiApplicationPrivate::processGeometryChangeEvent(QWindowSystemInterfacePrivate::GeometryChangeEvent*) + 333
15 org.qt-project.QtGui 0x000000011178928b QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 155
16 org.qt-project.QtGui 0x0000000111785060 QWindowSystemInterface::flushWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 576
17 libqcocoa.dylib 0x0000000114a9c1be 0x114a80000 + 115134
18 org.qt-project.QtCore 0x0000000111faba7c QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const + 1308
19 libqcocoa.dylib 0x0000000114a997e9 0x114a80000 + 104425
20 com.apple.Foundation 0x00007fff4d100640 + 303
21 com.apple.CoreFoundation 0x00007fff4aff2edc CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 12
22 com.apple.CoreFoundation 0x00007fff4aff2daa CFXRegistrationPost + 458
23 com.apple.CoreFoundation 0x00007fff4aff2ae1 _
_CFXNotificationPost_block_invoke + 225
24 com.apple.CoreFoundation 0x00007fff4afb0880 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1664
25 com.apple.CoreFoundation 0x00007fff4afaf9b7 _CFXNotificationPost + 599
26 com.apple.AppKit 0x00007fff485a135b -[NSView _postFrameChangeNotification] + 314
27 com.apple.AppKit 0x00007fff4859b87b -[NSView setFrameSize:] + 2061
28 com.apple.AppKit 0x00007fff485b1b1e -[NSView setFrame:] + 371
29 com.apple.AppKit 0x00007fff485bc49c -[NSThemeFrame _relayoutAuxiliaryViewsOfType:] + 163
30 com.apple.AppKit 0x00007fff485bc3e6 -[NSThemeFrame relayoutAuxiliaryViewsOfType:] + 27
31 com.apple.AppKit 0x00007fff488e7237 -[NSTitlebarViewController removeChildViewControllerAtIndex:] + 431
32 com.apple.AppKit 0x00007fff48dd62c6 -[NSWindowStackController _removeTabBarAccessoryViewControllerForWindow:] + 213
33 com.apple.AppKit 0x00007fff48dd7162 -[NSWindowStackController removeWindow:] + 277
34 com.apple.AppKit 0x00007fff4896097d -[NSWindow(NSWindowTabbing) _doTabbedWindowCleanupForOrderOut] + 97
35 com.apple.AppKit 0x00007fff48e4d03d __79
[NSWindow _reallyDoOrderWindowOutRelativeTo:findKey:forCounter:force:isModal:]_block_invoke + 62
36 com.apple.AppKit 0x00007fff4869dc0c NSPerformVisuallyAtomicChange + 146
37 com.apple.AppKit 0x00007fff48e4ccbc -[NSWindow _reallyDoOrderWindowOutRelativeTo:findKey:forCounter:force:isModal:] + 340
38 com.apple.AppKit 0x00007fff486a58ec -[NSWindow _reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 172
39 com.apple.AppKit 0x00007fff486a4765 -[NSWindow _doOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 287
40 com.apple.AppKit 0x00007fff486a45cb -[NSWindow orderWindow:relativeTo:] + 169
41 libqcocoa.dylib 0x0000000114a93860 0x114a80000 + 79968
42 org.qt-project.QtGui 0x00000001117ae3b9 QWindow::setVisible(bool) + 1113
43 org.qt-project.QtWidgets 0x000000010eaa2976 QWidgetPrivate::hide_sys() + 214
44 org.qt-project.QtWidgets 0x000000010eaa51f7 QWidgetPrivate::hide_helper() + 183
45 org.qt-project.QtWidgets 0x000000010eaa5659 QWidget::setVisible(bool) + 281
46 org.qt-project.QtWidgets 0x000000010ea948a2 QWidgetPrivate::close_helper(QWidgetPrivate::CloseMode) + 274
47 org.qt-project.QtWidgets 0x000000010ea9438b QWidget::~QWidget() + 699
48 libqgis_app.3.2.3.dylib 0x0000000108c731f0 QgisApp::~QgisApp() + 2194
49 libqgis_app.3.2.3.dylib 0x0000000108c73622 QgisApp::~QgisApp() + 14
50 org.qgis.qgis3 0x00000001087c2a89 main + 22445
51 libdyld.dylib 0x00007fff72e28015 start + 1

When I run the following code I get a crash:

from qgis.core import *

  1. supply path to qgis install location
    print('Nothing yet...')

QgsApplication.setPrefixPath("/Applications/QGIS3.app/Contents/MacOS", True)
print('Finished first call to QGIS...')

  1. create a reference to the QgsApplication, setting the # second argument to False disables the GUI
    qgs = QgsApplication([], False) <--- THIS CRASHES with the messages below
    print('About to init QGIS...')
  1. load providers
    qgs.initQgis()

print('Got QGIS up...')
str = input('Waiting for input...')

  1. Write your code here to load some layers, use processing
  2. algorithms, etc.
  1. When your script is complete, call exitQgis() to remove the
  2. provider and layer registries from memory

qgs.exitQgis()

Output from the python crash:

John-Harrops-MacBook-Pro:Intro john$ python3 connect.py
Nothing yet...
Finished first call to QGIS...
This application failed to start because it could not find or load the Qt platform plugin "cocoa"
in "".

Reinstalling the application may fix this problem.
Abort trap: 6

Do you want the dump as well?

Thanks,

John

History

#1 Updated by Giovanni Manghi over 5 years ago

  • Category changed from Unknown to mac_os_specific
  • Status changed from Open to Feedback

Try 3.4, try also with a new/clean profile.

#2 Updated by John Harrop over 5 years ago

Thanks for your comments.

1) I tried a clean profile and it did not make any difference that I could see. (Meaning the crash still seemed to be for the same cause.)

2) As far as I can see 3.4 is not yet available for Mac OSX. I'm looking forward to trying this when it is available.

I was hoping that the message from when I'm running standalone python and trying to connect to QGIS might be helpful. The "missing plugin" might suggest a messed up path somewhere but I'm struggling to find where that would be. Perhaps I should have reported the QGIS app and python API crashes as separate bugs, but I was suspicious that they are related and I thought that disconnecting the information might not help.

#3 Updated by John Harrop over 5 years ago

I see 3.4 is available now for Mac OSX. Tried that and neither problem has changed.

I've looked through the installation and the plugin support seems to be in the right places in the app contents, so I'm still not sure why QT cocoa is failing to be found.

#4 Updated by Giovanni Manghi over 5 years ago

  • Category changed from mac_os_specific to Python bindings / sipify

You should ask in the developers mailing list if your code is ok.

#5 Updated by David Todd over 5 years ago

John Harrop wrote:

I see 3.4 is available now for Mac OSX. Tried that and neither problem has changed.

I've looked through the installation and the plugin support seems to be in the right places in the app contents, so I'm still not sure why QT cocoa is failing to be found.

John, I've had that QT error in python before (see http://osgeo-org.1560.x6.nabble.com/QGIS-3-Standalone-Python-Script-td5373335.html#a5373573 for answer from William Kyngesbury). As an example, see if the first 20 lines from this gist work for you - https://gist.github.com/dmofot/94345126db10660053ccfb0d76a1e32a#file-qgis3_standalone_osx-py-L1-L20

#6 Updated by Giovanni Manghi over 5 years ago

Please try on QGIS 3.4.1, if the issue is still valid change the affected version, thanks.

#7 Updated by Nyall Dawson about 5 years ago

  • Resolution set to no timely feedback
  • Status changed from Feedback to Closed

Also available in: Atom PDF