Bug report #15899

Crash with segmentation fault in 2.18 - may relate to large PostGIS layers

Added by Roy Brander about 8 years ago. Updated over 7 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:-
Category:Project Loading/Saving
Affected QGIS version:2.18.2 Regression?:No
Operating System:Linux Easy fix?:No
Pull Request or Patch supplied:No Resolution:not reproducable
Crashes QGIS or corrupts data:Yes Copied to github as #:23817

Description

I have a project where all layers (some 100) are stored in PostGIS, and the project opens with about 20-30 layers turned on, about 1-2GB of data in those tables.

Since my Linux Mint made me upgrade to 2.18 as part of the standard update system, I can't open my project for more than a minute or so without QGIS browser just crashing, totally, no error message.

I started it from the command line and when the crash happened, the command line showed "Segmentation Fault" and nothing else.

I'm seeing some other crash reports on 2.18 in Windows, so this problem may not be resticted to Linux. I'm not about to upgrade my 2.16 Windows install to 2.18 at the moment, I need a working machine! Sorry.

History

#1 Updated by Roy Brander about 8 years ago

I just got an update to: Version: 1:2.18.1+20trusty ... and it did the same. Here are all the screen messages:

Warning: loading of qgis translation failed [/usr/share/qgis/i18n//qgis_en_CA]
Warning: loading of qt translation failed [/usr/share/qt4/translations/qt_en_CA]
Warning: QCss::Parser - Failed to load file "/style.qss"
Warning: QLayout: Attempting to add QLayout "" to QgsPanelWidgetStack "mWidgetStack", which already has a layout
Warning: Loading a file that was saved with an older version of qgis (saved in 2.14.3-Essen, loaded in 2.18.1). Problems may occur.
setLayerType: OpenStreetMap
Warning: QPainter::begin: A paint device can only be painted by one painter at a time.
Segmentation fault

....it ran fine with very little data showing. As soon as I turned on a larger number of layers (20) it crashed on the segmentation fault immediately.

#2 Updated by Roy Brander almost 8 years ago

Installed 2.18.2+20 trusty, same result exactly. Hardly surprising since this bug is unaddressed, but there's always hope a different bug fix will catch this one as a side-effect. With "Segmentation fault" I can only assume that somebody has introduced a massive memory leak for layers coming fro PostGIS queries. It runs for a bout of a minute of pans and zooms and usually crashes on a major "zoom out" that would pull in a lot more data from PosGIS.

#3 Updated by Roy Brander almost 8 years ago

  • Target version set to Version 2.18

I just realized I never checked off the box for "Causes Crash or Corruption" on this one, but there seems to be no way to edit that and perhaps flag it for more interest.

#4 Updated by Giovanni Manghi almost 8 years ago

  • Priority changed from Normal to High
  • Pull Request or Patch supplied changed from No to Yes
  • Affected QGIS version changed from 2.18.0 to 2.18.2
  • Category set to Project Loading/Saving
  • Status changed from Open to Feedback

"Warning: Loading a file that was saved with an older version of qgis (saved in 2.14.3-Essen, loaded in 2.18.1). Problems may occur."

Does it happen if you load the same project on 2.14?

#5 Updated by Roy Brander almost 8 years ago

Nope, no problem like this has happened to me since 2.4. I could do anything in 2.14 or 2.16, never a crash.

I just watched the error messages as I finally made the failure replicable: turn on ONE MORE LAYER at one point, and this happened:

Warning: QPainter::begin: A paint device can only be painted by one painter at a time.
Segmentation fault

...and the whole program goes blank. Alas, I cannot figure out how, in Linux, to tell Linux Mint to "downgrade" me back to 2.16, as QGIS upgrades simply show up in my upgrades queue when they hit Mint's repository.

Thanks for giving this a look!

#6 Updated by Giovanni Manghi almost 8 years ago

  • Priority changed from High to Severe/Regression
  • Status changed from Feedback to Open

Alas, I cannot figure out how, in Linux, to tell Linux Mint to "downgrade" me back to 2.16, as QGIS upgrades simply show up in my upgrades queue when they hit Mint's repository.

remove the qgis related packages and user the

http://qgis.org/debian-ltr

repo and you'll get 2.14. See

http://qgis.org/en/site/forusers/alldownloads.html#debian-ubuntu

#7 Updated by Roy Brander almost 8 years ago

Mixed results! Once I got downgraded to 2.14 from the repository you explained to me (a thousand thanks, there, I simply didn't understand how to pick repositories before), I loaded in a project and it crashed immediately. Then I loaded the project I was working on yesterday, and having to re-start every 30 minutes or so from crashes...which I only avoided by trying to keep the info on-screen down to a minimum of needed layers.

That project worked fine for FAR longer than it ever did yesterday, didn't crash in 20 minutes of heavy "zooming out" to bring a gigabyte or more of PostGIS queries on-screen - multiple dense layers.

Then I went back to the project that crashed and got a new behaviour - screen freezing though the app didn't go away. Finally, I triggered a crash with it after a command-line start, giving me the error messages:

====================================
roy@royz ~/Desktop $ qgis OWWA.qgs
Warning: loading of qgis translation failed [/usr/share/qgis/i18n//qgis_en_CA]
Warning: loading of qt translation failed [/usr/share/qt4/translations/qt_en_CA]
Warning: QCss::Parser - Failed to load file "/style.qss"
pure virtual method called
Warning: QPainter::begin: A paint device can only be painted by one painter at a time.
Warning: QPainter::setRenderHint: Painter must be active to set rendering hints
Warning: QPainter::setBrush: Painter not active
Warning: QPainter::setPen: Painter not active
Warning: QPainter::translate: Painter not active
Warning: QPainter::drawPath: Painter not active
Warning: QPainter::end: Painter not active, aborted
terminate called without an active exception
Aborted
roy@royz ~/Desktop $ ^C
roy@royz ~/Desktop $ qgis OWWA.qgs
Warning: loading of qgis translation failed [/usr/share/qgis/i18n//qgis_en_CA]
Warning: loading of qt translation failed [/usr/share/qt4/translations/qt_en_CA]
Warning: QCss::Parser - Failed to load file "/style.qss"
Warning: QPainter::begin: A paint device can only be painted by one painter at a time.
Warning: QPainter::setRenderHint: Painter must be active to set rendering hints
Warning: QPainter::setBrush: Painter not active
Warning: QPainter::setPen: Painter not active
Warning: QPainter::translate: Painter not active
Warning: QPainter::drawPath: Painter not active
Warning: QPainter::end: Painter not active, aborted
Segmentation fault ===================================
...

Then I tried yet another project, an even larger one. That one crashed simply attempting to OPEN the file....and I tried again and it opened this time. I panned around the map a little and got a burst of error messages from "QPainter", but no crash. Then zoomed out a little more to bring in more info an it crashed instantly.

=========================
roy@royz ~/Desktop $ qgis YYC_GIS.qgs
Warning: loading of qgis translation failed [/usr/share/qgis/i18n//qgis_en_CA]
Warning: loading of qt translation failed [/usr/share/qt4/translations/qt_en_CA]
Warning: QCss::Parser - Failed to load file "/style.qss"
Warning: QPainter::begin: A paint device can only be painted by one painter at a time.
Warning: QPainter::setRenderHint: Painter must be active to set rendering hints
Warning: QPainter::setBrush: Painter not active
Warning: QPainter::setPen: Painter not active
Warning: QPainter::translate: Painter not active
Warning: QPainter::drawPath: Painter not active
Warning: QPainter::end: Painter not active, aborted
Segmentation fault <<<<<<<<<<<CRASH IN THE MIDDLE OF LOADING THE PROJECT FILE

roy@royz ~/Desktop $ qgis YYC_GIS.qgs <<<<<<<<<<<<SECOND ATTEMPT A MOMENT LATER
Warning: loading of qgis translation failed [/usr/share/qgis/i18n//qgis_en_CA]
Warning: loading of qt translation failed [/usr/share/qt4/translations/qt_en_CA]
Warning: QCss::Parser - Failed to load file "/style.qss"
Warning: QPainter::begin: A paint device can only be painted by one painter at a time. <<<<BURST OF MESSAGES DURING PAN, BUT NO CRASH
Warning: QPainter::setRenderHint: Painter must be active to set rendering hints
Warning: QPainter::setBrush: Painter not active
Warning: QPainter::setPen: Painter not active
Warning: QPainter::translate: Painter not active
Warning: QPainter::drawPath: Painter not active
Warning: QPainter::end: Painter not active, aborted
pure virtual method called <<<<<<<<<ZOOM OUT AND IMMEDIATE CRASH
Warning: QPainter::begin: A paint device can only be painted by one painter at a time.
Warning: QPainter::setRenderHint: Painter must be active to set rendering hints
Warning: QPainter::setBrush: Painter not active
Warning: QPainter::setPen: Painter not active
Warning: QPainter::translate: Painter not active
Warning: QPainter::drawPath: Painter not active
Warning: QPainter::end: Painter not active, aborted
terminate called without an active exception
Warning: QPainter::begin: A paint device can only be painted by one painter at a time.
Aborted =============================

Then I went back to the one that didn't crash, and used it longer...and it finally crashed the way it did so many times yesterday, when I turned on a really quite small layer that puts street names on top of all the much-busier linework of buildings, contour lines, etc.

=================
roy@royz ~/Desktop $ qgis Storm.qgs
Warning: loading of qgis translation failed [/usr/share/qgis/i18n//qgis_en_CA]
Warning: loading of qt translation failed [/usr/share/qt4/translations/qt_en_CA]
Warning: QCss::Parser - Failed to load file "/style.qss" <<<<<<<<<<< Messges upon start up. No more messages until the layer was turned on, then:
Warning: QPainter::begin: A paint device can only be painted by one painter at a time.
Warning: QPainter::setRenderHint: Painter must be active to set rendering hints
Warning: QPainter::setBrush: Painter not active
Warning: QPainter::setPen: Painter not active
Segmentation fault ==============================

So, in short....crap. It's about more than just qgis version 2.16. Though I'm certain that 2.14 was MORE stable than 2.16, which would have crashed 3 times in the time I used it. But when I re-started, I could crash it at once by turning on that "street names" layer and doing almost anything.

Man, I guess I need to regress backwards in my whole Linux version here? It's an underlying library at fault, not QGIS???

#8 Updated by Nyall Dawson almost 8 years ago

Have you tried removing your .qgis2 folder and testing with NO plugins loaded?

#9 Updated by Roy Brander almost 8 years ago

Excellent Suggestion! I feel dumb for not thinking of that. Alas, it didn't work. At all.

oy@royz ~/Desktop $ qgis YYC_GIS.qgs
Warning: loading of qgis translation failed [/usr/share/qgis/i18n//qgis_en_CA]
Warning: loading of qt translation failed [/usr/share/qt4/translations/qt_en_CA]
Warning: QCss::Parser - Failed to load file "/style.qss"
QInotifyFileSystemWatcherEngine::addPaths: inotify_add_watch failed: No such file or directory
Warning: QFileSystemWatcher: failed to add paths: /home/roy/.qgis2//project_templates
Segmentation fault <<<<<<<<<<<<<< CRASHED ON START-UP, AGAIN

roy@royz ~/Desktop $ qgis YYC_GIS.qgs
Warning: loading of qgis translation failed [/usr/share/qgis/i18n//qgis_en_CA]
Warning: loading of qt translation failed [/usr/share/qt4/translations/qt_en_CA]
Warning: QCss::Parser - Failed to load file "/style.qss"
QInotifyFileSystemWatcherEngine::addPaths: inotify_add_watch failed: No such file or directory
Warning: QFileSystemWatcher: failed to add paths: /home/roy/.qgis2//project_templates
Segmentation fault

....AND THE SECOND TIME, IT STARTED, BUT CRASHED INSTANTLY UPON SOME ZOOMING.

These crashes are courtesy of my "Kitchen Sink" project that has EVERY layer in Calgary on it. (I was Sr.Infrastructure Engineer for Calgary Water, and routinely loaded in all the Water, Sanitary Sewer and Storm Sewer layers, which were minor compared to every street, building, park, legal lot, and tree.) This project has them all, though only about a dozen turned on at start-up. But they are big ones: the buildings, etc. Rendering would take minutes if I zoomed out to the full city, so I don't; dense layers like buildings and legal lots turn off at 1:4000 or so. There are rarely hundreds of megabytes on-screen at any time.

With fewer layers on, I just got a few hours of work done with 2.14 and no crashes.

#10 Updated by Giovanni Manghi almost 8 years ago

  • Pull Request or Patch supplied changed from Yes to No
  • Crashes QGIS or corrupts data changed from No to Yes
  • Status changed from Open to Feedback
  • OS version deleted (2.18)

Not really sure what to do with this ticket. Replicating the issue locally does not seems possible: I have loaded ~100 postgis layers with no problems but the issue maybe is about some labelling/symbology settings... so... hard to replicate.

What about if you wipe out also ~/.config/QGIS along with .qgis2? (please note that this way you will really reset QGIS as if it was just installed for the first time).

#11 Updated by Giovanni Manghi almost 8 years ago

Please also try the latest version available 2.18.4

#12 Updated by Giovanni Manghi over 7 years ago

  • Resolution set to not reproducable
  • Status changed from Feedback to Closed

Closing for lack of feedback, please reopen of necessary.

Also available in: Atom PDF