Bug report #8102
Qgis Crash on exit
Status: | Closed | ||
---|---|---|---|
Priority: | Severe/Regression | ||
Assignee: | - | ||
Category: | - | ||
Affected QGIS version: | master | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 16937 |
Description
The current master crashes when closing a project. here is the output..
QGis Version: da0e4f3
Debug: src/gui/qgsmapcanvas.cpp: 1589: (mapToolDestroyed) maptool destroyed Debug: src/app/legend/qgslegend.cpp: 282: (removeAll) Entering. Debug: src/app/legend/qgslegend.cpp: 2387: (updateMapCanvasLayerSet) Entering. Debug: src/app/legend/qgslegend.cpp: 350: (removeLayers) Entering. Debug: src/app/legend/qgslegend.cpp: 2387: (updateMapCanvasLayerSet) Entering. Fatal: QGIS died on signal 11 Stacktrace (piped through c++filt): /home/vinayan/gitQgisBuild/output/bin/qgis(myMessageOutput(QtMsgType, char const*)+0x2dc)[0x549171] /usr/lib/x86_64-linux-gnu/libQtCore.so.4(qt_message_output(QtMsgType, char const*)+0x2e)[0x7fe1d51f741e] /usr/lib/x86_64-linux-gnu/libQtCore.so.4(+0x718bf)[0x7fe1d51f78bf] /usr/lib/x86_64-linux-gnu/libQtCore.so.4(qFatal(char const*, ...)+0x94)[0x7fe1d51f7a64] /home/vinayan/gitQgisBuild/output/bin/qgis(qgisCrash(int)+0x1f)[0x548e93] /lib/x86_64-linux-gnu/libc.so.6(+0x364a0)[0x7fe1d26e64a0] /usr/lib/libpython2.7.so.1.0(+0x151c4a)[0x7fe19e060c4a] /usr/lib/libpython2.7.so.1.0(PyGILState_Ensure+0x3c)[0x7fe19e060cec] /usr/lib/python2.7/dist-packages/PyQt4/QtCore.so(+0x181539)[0x7fe19da2e539] /usr/lib/python2.7/dist-packages/PyQt4/QtGui.so(+0x3692ac)[0x7fe19d32b2ac] /usr/lib/x86_64-linux-gnu/libQtGui.so.4(QApplication::palette(QWidget const*)+0x126)[0x7fe1d4682dc6] /usr/lib/x86_64-linux-gnu/libQtGui.so.4(QWidgetPrivate::naturalWidgetPalette(unsigned int) const+0x2d)[0x7fe1d46c6b0d] /usr/lib/x86_64-linux-gnu/libQtGui.so.4(QWidget::setPalette(QPalette const&)+0x35)[0x7fe1d46d1055] /usr/lib/x86_64-linux-gnu/libQtGui.so.4(+0x501a46)[0x7fe1d49b9a46] /usr/lib/x86_64-linux-gnu/libQtGui.so.4(+0x501cef)[0x7fe1d49b9cef] /usr/lib/x86_64-linux-gnu/libQtGui.so.4(QWidgetPrivate::setStyle_helper(QStyle*, bool, bool)+0xf6)[0x7fe1d46c5ea6] /usr/lib/x86_64-linux-gnu/libQtGui.so.4(QWidgetPrivate::inheritStyle()+0x142)[0x7fe1d46c5cb2] /usr/lib/x86_64-linux-gnu/libQtGui.so.4(QWidget::setParent(QWidget*, QFlags<Qt::WindowType>)+0x446)[0x7fe1d46d7306] /usr/lib/x86_64-linux-gnu/libQtGui.so.4(QWidget::setParent(QWidget*)+0x22)[0x7fe1d46d7892] /usr/lib/x86_64-linux-gnu/libQtGui.so.4(QWidgetAction::releaseWidget(QWidget*)+0xa0)[0x7fe1d46da410] /usr/lib/x86_64-linux-gnu/libQtGui.so.4(+0x653af3)[0x7fe1d4b0baf3] /usr/lib/x86_64-linux-gnu/libQtGui.so.4(+0x653ba9)[0x7fe1d4b0bba9] /usr/lib/x86_64-linux-gnu/libQtGui.so.4(QWidget::~QWidget()+0x14f)[0x7fe1d46ce60f] /usr/lib/python2.7/dist-packages/PyQt4/QtGui.so(+0x2204a9)[0x7fe19d1e24a9] /usr/lib/x86_64-linux-gnu/libQtCore.so.4(QObjectPrivate::deleteChildren()+0x85)[0x7fe1d5313935] /usr/lib/x86_64-linux-gnu/libQtGui.so.4(QWidget::~QWidget()+0x280)[0x7fe1d46ce740] /usr/lib/python2.7/dist-packages/PyQt4/QtGui.so(+0x360eed)[0x7fe19d322eed] /usr/lib/x86_64-linux-gnu/libQtCore.so.4(QObjectPrivate::deleteChildren()+0x85)[0x7fe1d5313935] /usr/lib/x86_64-linux-gnu/libQtGui.so.4(QWidget::~QWidget()+0x280)[0x7fe1d46ce740] /home/vinayan/gitQgisBuild/output/bin/qgis(QgisApp::~QgisApp()+0xa07)[0x55285f] /home/vinayan/gitQgisBuild/output/bin/qgis(QgisApp::~QgisApp()+0x18)[0x552972] /home/vinayan/gitQgisBuild/output/bin/qgis(main+0x2c17)[0x54be0a] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7fe1d26d176d] /home/vinayan/gitQgisBuild/output/bin/qgis[0x548ba9] The program has unexpectedly finished. /home/vinayan/gitQgisBuild/output/bin/qgis exited with code 0
Associated revisions
Only cleanup python with newer sip versions (Fix #8102)
History
#1 Updated by Giovanni Manghi over 11 years ago
- Target version set to Version 2.0.0
- Priority changed from High to Severe/Regression
I will test for this issue asap on both Linux and Windows. Did you added a layer using the browser? There was an issue when adding layers with the browser, but it should be fixed.
#2 Updated by vinayan Parameswaran over 11 years ago
I did not add any layer. simply opening and closing QGIS would produce this. Tested on Ubuntu 12.04
#3 Updated by Matthias Kuhn over 11 years ago
Do you have any plugins enabled? Especially an open plugin dock or window would explain something.
#4 Updated by Salvatore Larosa over 11 years ago
Confirmed here also with the qgis --noplugins
command
#5 Updated by Salvatore Larosa over 11 years ago
here the stacktrace with gdb:
Program received signal SIGSEGV, Segmentation fault. new_threadstate (init=1, interp=0x0) at ../Python/pystate.c:199 199 ../Python/pystate.c: File o directory non esistente. (gdb) bt full #0 new_threadstate (init=1, interp=0x0) at ../Python/pystate.c:199 tstate = 0x2bb3fe0 #1 PyThreadState_New (interp=0x0) at ../Python/pystate.c:210 No locals. #2 0x00007fffd1d8955c in PyGILState_Ensure () at ../Python/pystate.c:597 current = <optimized out> tcur = 0x0 #3 0x00007fffd173ed56 in ?? () from /usr/lib/python2.7/dist-packages/PyQt4/QtCore.so No symbol table info available. #4 0x00007fffd0fa457e in ?? () from /usr/lib/python2.7/dist-packages/PyQt4/QtGui.so No symbol table info available. #5 0x00007ffff288ec27 in QApplication::palette(QWidget const*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4 No symbol table info available. #6 0x00007ffff28cfe0d in QWidgetPrivate::naturalWidgetPalette(unsigned int) const () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4 No symbol table info available. #7 0x00007ffff28dbb95 in QWidget::setPalette(QPalette const&) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4 No symbol table info available. #8 0x00007ffff2bb237d in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#6 Updated by Salvatore Larosa over 11 years ago
Commenting out the lines 799 and 800 in qgisapp.cpp
does not produce the crash.
#7 Updated by Matthias Kuhn over 11 years ago
We can comment them again, that's not a big deal, the OS will clean up (at least the memory) on app exit anyway.
But I wonder, what is really causing that problem, because here python / pyqt cleanup and exit nice and clean.
What's left of python when running with --noplugins?
Only the python console and part of the plugin manager?
#8 Updated by Giovanni Manghi over 11 years ago
Matthias Kuhn wrote:
We can comment them again, that's not a big deal, the OS will clean up (at least the memory) on app exit anyway.
But I wonder, what is really causing that problem, because here python / pyqt cleanup and exit nice and clean.
What's left of python when running with --noplugins?
Only the python console and part of the plugin manager?
Today I'm getting a lot of
gio@sibirica ~ $ qgis
Warning: loading of qt translation failed [/usr/share/qt4/translations/qt_en_US]
Fatal: QGIS died on signal 11
Stacktrace (piped through c++filt):
Segmentation fault
when clicking on "new project"
#9 Updated by Matthias Kuhn over 11 years ago
This bug only concerns a crash when exiting qgis.
#10 Updated by Giovanni Manghi over 11 years ago
Matthias Kuhn wrote:
This bug only concerns a crash when exiting qgis.
Hi Matthias, right. I got it also on exit. Cheers!
#11 Updated by Borys Jurgiel over 11 years ago
Matthias Kuhn wrote:
What's left of python when running with --noplugins?
Only the python console and part of the plugin manager?
The Plugin Manager is fully loaded, so you can disable/uninstall/update crashing plugins.
#12 Updated by Borys Jurgiel over 11 years ago
In my case the crash only happens if Value Tool is loaded (or was loaded in the session, even if I unload it prior to closing). Can anybody confirm? See #8184
#13 Updated by Salvatore Larosa over 11 years ago
Borys Jurgiel wrote:
In my case the crash only happens if Value Tool is loaded (or was loaded in the session, even if I unload it prior to closing). Can anybody confirm? See #8184
Hi Borys,
here the crash is not dependent from plugins (I guess) as I run with --noplugins command.
I did try by installing Value Tool plugin (it was not installed yet on my machine) and I got the same stacktrace.
ouf of curiosity, which Qt version?
#14 Updated by Borys Jurgiel over 11 years ago
Salvatore Larosa wrote:
here the crash is not dependent from plugins (I guess) as I run with --noplugins command.
Ok, so it's something another.
ouf of curiosity, which Qt version?
Qt 4.8.4 + PyQt 4.10.1 @ Debian Jessie.
#15 Updated by Pedro Venâncio over 11 years ago
Hi,
Here the problem is also not dependent of plugins.
QGIS compiled against Qt 4.8.1 and Python-Qt 4.9.1.
#16 Updated by Matthias Kuhn over 11 years ago
- Status changed from Open to Feedback
Would you be able to debug the crash in gdb and then enter "py-bt" in the gdb console?
I hope this gives valuable additional information about this problem.
#17 Updated by Salvatore Larosa over 11 years ago
Matthias Kuhn wrote:
Would you be able to debug the crash in gdb and then enter "py-bt" in the gdb console?
I hope this gives valuable additional information about this problem.
I already had tried that but unfortunately it doesn't give any additional info.
#18 Updated by Matthias Kuhn over 11 years ago
I tracked down the issue in the ZoomToCoordinates plugin:
The issue is related to creating a QMainWindow in init (Line 57) and then reparenting this window to iface.mainWindow() (Line 59), if instead ownership remains with the plugin ( pass None instead of iface.mainWindow() to setParent() ) there is no crash.
That it is in init is important, because this gets also executed with --noparent and if the plugin is disabled.
Therefore a question to the plugin department (borys?):
Why does this code need to be executed (I see it's executed once and destroyed almost immediately again when loading the plugins)?
If this code would not need to be executed, it would be much easier to find buggy plugins instead of suspecting QGIS of being responsible for the crash.
I would vote for closing this bug as soon as the QGIS application does not crash any more because of a buggy but disabled plugin.
Concerning this particular issue. There seems to be an ownership issue with PyQt, such that certain widgets get deleted but references to these remain present in other widgets. I guess, that this issue has been resolved in a recent version of PyQt or depend on a certain configuration because it does not happen on every system. So I don't see, what we could do from the QGIS side. (This paragraph is based on assumptions, I would be happy to be corrected by somebody with a better understanding of this problem)
#19 Updated by Matthias Kuhn over 11 years ago
Also interesting:
When the Python interpreter exits it garbage collects those objects that it can. This means that any corresponding C++ instances and C structures owned by Python are destroyed. Unfortunately this happens in an unpredictable order and so can cause memory faults within the wrapped library. Calling this function with a value of False disables the automatic destruction of C++ instances and C structures.
Source: http://pyqt.sourceforge.net/Docs/sip4/python_api.html?highlight=destroyonexit#sip.setdestroyonexit
sip.setdestroyonexit is unfortunately only available starting from SIP 4.14.2
Current OSGeo4W version is 4.12.1
#20 Updated by Matthias Kuhn over 11 years ago
One of the following package updates solves the problem, if I downgrade I get the crash also:
PyQt4-4.9.5 => PyQt4-4.10.1
sip-4.14.1 => sip-4.14.6
#21 Updated by Matthias Kuhn over 11 years ago
- Status changed from Feedback to Closed
Fixed in changeset f3e08b521f8053056bb7accb6dc46582e0a2c05a.
#22 Updated by Pedro Venâncio over 11 years ago
Hi Matthias,
I no longer have the crash. I think I can confirm the fix!
Thank you very much!