Bug report #5335

"export/add geometry columns" make QGIS crash if you have previously opened the attribute table

Added by Giovanni Manghi over 7 years ago. Updated over 2 years ago.

Status:Closed
Priority:High
Assignee:Alexander Bruy
Category:Processing/QGIS
Affected QGIS version:master Regression?:
Operating System: Easy fix?:
Pull Request or Patch supplied:No Resolution:fixed
Crashes QGIS or corrupts data:Yes Copied to github as #:15036

Description

[email protected]:~$ qgis
Warning: loading of qgis translation failed [/usr/share/qgis/i18n//qgis_en_US]
Warning: loading of qt translation failed [/usr/share/qt4/translations/qt_en_US]
Warning: QHttp: empty path requested is invalid -- using '/'
Warning: QObject::setParent: Cannot set parent, new parent is in a different thread
Warning: QPixmap: It is not safe to use pixmaps outside the GUI thread
Warning: QPixmap: It is not safe to use pixmaps outside the GUI thread
Xlib: sequence lost (0x1970f > 0x9717) in reply type 0x1c!
[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
qgis.bin: ../../src/xcb_io.c:178: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.
Aborted

Associated revisions

Revision d18529fc
Added by Alexander Bruy over 7 years ago

show warning before updating exisiting shapefile (fix #5335)

Revision 52a35edd
Added by Alexander Bruy over 7 years ago

show warning before updating exisiting shapefile (fix #5335)

History

#1 Updated by Giovanni Manghi over 7 years ago

  • Subject changed from "export/add geomtery columns" make QGIS crash if columns do already exist to "export/add geomtery columns" make QGIS crash if columns (area, perimeter,coordx,corrdy,etc.) do already exist

#2 Updated by Alexander Bruy over 7 years ago

Tested under 32-bit Slackware and QGIS master d1a11bec96 and it works fine with both options (create new layer and update existing layer). Maybe it crashes when this fields created by user and have different data type?

#3 Updated by Giovanni Manghi over 7 years ago

Alexander Bruy wrote:

Maybe it crashes when this fields created by user and have different data type?

no, it crashes when using the tool two times in a row. I will attach here sample data that is causing the crash on both windows and ubuntu with qgis-master.

#4 Updated by Giovanni Manghi over 7 years ago

Giovanni Manghi wrote:

Alexander Bruy wrote:

Maybe it crashes when this fields created by user and have different data type?

no, it crashes when using the tool two times in a row. I will attach here sample data that is causing the crash on both windows and ubuntu with qgis-master.

this is weird. I got the crash consistently for many tries while trying to find a pattern, then suddenly it stopped crashing (using the very same vectors)...

#5 Updated by Giovanni Manghi over 7 years ago

Giovanni Manghi wrote:

Giovanni Manghi wrote:

Alexander Bruy wrote:

Maybe it crashes when this fields created by user and have different data type?

no, it crashes when using the tool two times in a row. I will attach here sample data that is causing the crash on both windows and ubuntu with qgis-master.

this is weird. I got the crash consistently for many tries while trying to find a pattern, then suddenly it stopped crashing (using the very same vectors)...

but still pretty easy to replicate... I tested other vectors and is enough to run two times in a row (after clicking "close" after the first time), regardless of the vector used. I have also vector that cause qgis to crash the first time the tool is run.

#6 Updated by Alexander Bruy over 7 years ago

Weird, still works for me. I tried several times with different vectors.

#7 Updated by Salvatore Larosa over 7 years ago

Alexander Bruy wrote:

Weird, still works for me. I tried several times with different vectors.

The same for me, no problem!

#8 Updated by Salvatore Larosa over 7 years ago

I did some tests in more detail and I noticed that sometimes QGIS crashes!
It is very difficult to reproduce!

When it crashes I get this:

$ qgis
Warning: QObject::setParent: Cannot set parent, new parent is in a different thread
Warning: QObject::setParent: Cannot set parent, new parent is in a different thread
Warning: QPixmap: It is not safe to use pixmaps outside the GUI thread
Warning: QPixmap: It is not safe to use pixmaps outside the GUI thread
Warning: QPixmap: It is not safe to use pixmaps outside the GUI thread
Warning: QApplication: Object event filter cannot be in a different thread.
Warning: QPixmap: It is not safe to use pixmaps outside the GUI thread
Warning: QPixmap: It is not safe to use pixmaps outside the GUI thread
Warning: QPixmap: It is not safe to use pixmaps outside the GUI thread
Warning: QPixmap: It is not safe to use pixmaps outside the GUI thread
Warning: QPixmap: It is not safe to use pixmaps outside the GUI thread
Warning: QPixmap: It is not safe to use pixmaps outside the GUI thread
Segmentation fault

#9 Updated by Giovanni Manghi over 7 years ago

Salvatore Larosa wrote:

I did some tests in more detail and I noticed that sometimes QGIS crashes!
It is very difficult to reproduce!

When it crashes I get this:

[...]

it is really puzzling, but not that hard to replicate, at least on my Ubuntu machine with qgis-master installed with the nightly-build repo (and regardless of the vector used). The errors are the one already posted.

#10 Updated by Salvatore Larosa over 7 years ago

Is it still confirmed after Alexander's commit (d3a50e8bcb)?

I cannot seem to reproduce it!

#11 Updated by Alexander Bruy over 7 years ago

  • Assignee deleted (cfarmer -)
  • Status changed from Open to Feedback

#12 Updated by Giovanni Manghi over 7 years ago

  • Status changed from Feedback to Open

Hi Alexander, the feedback is that I'm still able to get the crash consistently (but not always) on both Linux and Windows.

#13 Updated by Salvatore Larosa over 7 years ago

Now, I am able to reproduce!!
Apparently, it occurs if before opens attribute table (very strange!)!

For reproduce:
Load layer;
Open Attribute table;
run Export/add geometry column (fTools)
Crashes!

I am investigating!

#14 Updated by Alexander Bruy over 7 years ago

Maybe I'm wrong but this is because QGIS don't support simultaneous access to one datasource from different threads

#15 Updated by Salvatore Larosa over 7 years ago

  • Subject changed from "export/add geomtery columns" make QGIS crash if columns (area, perimeter,coordx,corrdy,etc.) do already exist to "export/add geomtery columns" make QGIS crash if you have previously opened the attribute table

It also occurs if the columns do not exist!

#16 Updated by Salvatore Larosa over 7 years ago

if "save to new shapefile" is flagged, works fine!

Alexander, you're probably right!

#17 Updated by Salvatore Larosa over 7 years ago

Alexander, I confirm, you're right!
Seems you can not access the same datasource from different threads simultaneously!!
That also occurs with Simplify Geometries tool!

one solution possible is:
I edited fTools (doGeometry.py and ui_frmGeometry.py) to avoid the issue by adding constraint to save a new file, as occurs in other tools!

#18 Updated by Alexander Bruy over 7 years ago

  • Assignee set to Alexander Bruy

I think remove this functionality is not good solution. Maybe it is better to add warning before processing. Giovanni what do you think?

#19 Updated by Jürgen Fischer over 7 years ago

  • Subject changed from "export/add geomtery columns" make QGIS crash if you have previously opened the attribute table to "export/add geometry columns" make QGIS crash if you have previously opened the attribute table

#20 Updated by Giovanni Manghi over 7 years ago

Alexander Bruy wrote:

I think remove this functionality is not good solution. Maybe it is better to add warning before processing. Giovanni what do you think?

running ftools and have the results computed in the input layer instead of a new shapefile seems to be a need of most common users, so I would like to keep this option. The warning seems ok to me.

#21 Updated by Alexander Bruy over 7 years ago

  • Status changed from Open to Closed

#22 Updated by Alexander Bruy over 7 years ago

  • Resolution set to fixed

#23 Updated by Giovanni Manghi over 2 years ago

The "ftools" category is being removed from the tracker, changing the category of this ticket to "Processing/QGIS" to not leave the category orphaned.

Also available in: Atom PDF