Bug report #13278

Qgis crash saving postgis layer

Added by Anibal Alarcon Acosta over 8 years ago. Updated about 8 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Data Provider
Affected QGIS version:2.10.0 Regression?:No
Operating System:GNU/Linux Debian Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:Yes Copied to github as #:21338

Description

We have Postgresql/Postgis (9.1+134wheezy4 / 1.5) table of roads when a new line is created qgis(2.10) crash in debug mode (gdb) and in normal mode the Qgis disappear. Sometimes in debug mode a notice appears at the top:

Could not commit changes to layer roads
Errors: ERROR: 1 feature(s) not added.
  Provider errors:
      PostGIS error while adding features: ERROR:  the syntax is invalid for an integer: «nextval('roads_gid_seq'::regclass)»

the field gid is SERIAL and have this sequence:

CREATE SEQUENCE roads_gid_seq
  INCREMENT 1
  MINVALUE 1
  MAXVALUE 9223372036854775807
  START 820119
  CACHE 1;
ALTER TABLE roads_gid_seq
  OWNER TO postgres;

the backtrace in debug mode with gdb:

(gdb) run
Starting program: /usr/bin/qgis.bin 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffd6cda700 (LWP 10323)]
[New Thread 0x7fffd63c9700 (LWP 10324)]
[New Thread 0x7fff7d6ef700 (LWP 10331)]
[New Thread 0x7fff7ceee700 (LWP 10333)]
[Thread 0x7fff7ceee700 (LWP 10333) exited]
[Thread 0x7fff7d6ef700 (LWP 10331) exited]
[New Thread 0x7fff7d6ef700 (LWP 10348)]
[New Thread 0x7fff7ceee700 (LWP 10351)]
[Thread 0x7fff7ceee700 (LWP 10351) exited]
[New Thread 0x7fff7ceee700 (LWP 10352)]
[Thread 0x7fff7ceee700 (LWP 10352) exited]

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff2e51b59 in QString::operator==(QString const&) const ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
(gdb)  

But in Qgis 2.8 there is no problem.

statistics_roads (8.14 KB) Anibal Alarcon Acosta, 2015-10-18 07:01 AM

properties_roads (6.53 KB) Anibal Alarcon Acosta, 2015-10-18 07:01 AM

crash_qgis_2.10.png (328 KB) Anibal Alarcon Acosta, 2015-10-18 07:01 AM

History

#1 Updated by Jürgen Fischer over 8 years ago

Please provide a backtrace (bt in gdb)

#2 Updated by Anibal Alarcon Acosta over 8 years ago

Jürgen Fischer wrote:

Please provide a backtrace (bt in gdb)

bt
[Thread 0x7fff7b632700 (LWP 24214) exited]
[New Thread 0x7fff7b632700 (LWP 24223)]
[Thread 0x7fff7b632700 (LWP 24223) exited]
[New Thread 0x7fff7b632700 (LWP 24225)]
[New Thread 0x7fff727be700 (LWP 24226)]
[Thread 0x7fff727be700 (LWP 24226) exited]
[New Thread 0x7fff727be700 (LWP 24227)]
[Thread 0x7fff727be700 (LWP 24227) exited]

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff2e51b59 in QString::operator==(QString const&) const ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
(gdb) bt
#0  0x00007ffff2e51b59 in QString::operator==(QString const&) const ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#1  0x00007fff8d610677 in QgsPostgresProvider::paramValue(QString, QString const&) const () from /usr/lib/qgis/plugins/libpostgresprovider.so
#2  0x00007fff8d61361e in QgsPostgresProvider::addFeatures(QList<QgsFeature>&)
    () from /usr/lib/qgis/plugins/libpostgresprovider.so
#3  0x00007ffff4abc334 in QgsVectorLayerEditBuffer::commitChanges(QStringList&)
    () from /usr/lib/libqgis_core.so.2.10.0
#4  0x00007ffff4aa67b6 in QgsVectorLayer::commitChanges() ()
   from /usr/lib/libqgis_core.so.2.10.0
#5  0x0000000000512e73 in QgisApp::saveEdits(QgsMapLayer*, bool, bool) ()
#6  0x0000000000512dc3 in QgisApp::saveActiveLayerEdits() ()
#7  0x00000000008ceac8 in ?? ()
#8  0x00007ffff2f1d54f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#9  0x00007ffff22ab502 in QAction::triggered(bool) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#10 0x00007ffff22ab6f0 in QAction::activate(QAction::ActionEvent) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11 0x00007ffff266b85f in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#12 0x00007ffff266bb0c in QAbstractButton::mouseReleaseEvent(QMouseEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#13 0x00007ffff2725a8a in QToolButton::mouseReleaseEvent(QMouseEvent*) ()
---Type <return> to continue, or q <return> to quit---
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#14 0x00007ffff2300e10 in QWidget::event(QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#15 0x00007ffff22b170c in QApplicationPrivate::notify_helper(QObject*, QEvent*)
    () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#16 0x00007ffff22b63eb in QApplication::notify(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#17 0x00007ffff48def1a in QgsApplication::notify(QObject*, QEvent*) ()
   from /usr/lib/libqgis_core.so.2.10.0
#18 0x00007ffff2f07b5e in QCoreApplication::notifyInternal(QObject*, QEvent*)
    () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#19 0x00007ffff22b254b in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#20 0x00007ffff232cfc4 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#21 0x00007ffff232bd51 in QApplication::x11ProcessEvent(_XEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#22 0x00007ffff2352bc2 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#23 0x00007fffee82d355 in g_main_context_dispatch ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#24 0x00007fffee82d688 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#25 0x00007fffee82d744 in g_main_context_iteration ()
   from /lib/x86_64-linux-gnu/libglib-2.0.so.0
---Type <return> to continue, or q <return> to quit---
#26 0x00007ffff2f36276 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#27 0x00007ffff235283e in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#28 0x00007ffff2f068af in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#29 0x00007ffff2f06b38 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#30 0x00007ffff2f0bcf8 in QCoreApplication::exec() ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#31 0x00000000004debec in _start ()
(gdb) q
A debugging session is active.

    Inferior 1 [process 24142] will be killed.

Quit anyway? (y or n) y

:)

AA

#3 Updated by Jürgen Fischer over 8 years ago

Can you share the table definition and/or a dump and steps to reproduce? Does the crash happen only after you get the message or independantly?

#4 Updated by Jürgen Fischer over 8 years ago

  • Status changed from Open to Feedback

#5 Updated by Anibal Alarcon Acosta over 8 years ago

Jürgen Fischer wrote:

Can you share the table definition and/or a dump and steps to reproduce? Does the crash happen only after you get the message or independantly?

The dump of roads tar.gz is 60M, when I cut a part and create a new table with this (same definition), there is no problem. Maybe for the number of rows???
When there are message there is no crash because no way to save, but sometimes crash independantly with out message. Attach statistics and properties of the table in html from pgadmin3 and the image of message. The table name originaly is in spanish. Thanks!

#6 Updated by Jürgen Fischer over 8 years ago

  • OS version changed from Versión 7.8 (wheezy) de 64-bit to Version 7.8 (wheezy) de 64-bit

Anibal Alarcon Acosta wrote:

Jürgen Fischer wrote:

Can you share the table definition and/or a dump and steps to reproduce? Does the crash happen only after you get the message or independantly?

The dump of roads tar.gz is 60M, when I cut a part and create a new table with this (same definition)

But if you copy the full table it's still reproducible?

Are you positive that the value nextval(... is left unchanged? QGIS executes it separately before the actually insert happens - but only if it matches the exact default value. Otherwise if it's not changed to an actual integer value the above error message appears. But that's the intended behavior.

#7 Updated by Anibal Alarcon Acosta over 8 years ago

Jürgen Fischer wrote:

Anibal Alarcon Acosta wrote:

Jürgen Fischer wrote:

Can you share the table definition and/or a dump and steps to reproduce? Does the crash happen only after you get the message or independantly?

The dump of roads tar.gz is 60M, when I cut a part and create a new table with this (same definition)

But if you copy the full table it's still reproducible?

Are you positive that the value nextval(... is left unchanged? QGIS executes it separately before the actually insert happens - but only if it matches the exact default value. Otherwise if it's not changed to an actual integer value the above error message appears. But that's the intended behavior.

When the restore is full the problem is the same. I can give you the link for download the dump to your email?

#8 Updated by Jürgen Fischer over 8 years ago

Anibal Alarcon Acosta wrote:

When the restore is full the problem is the same. I can give you the link for download the dump to your email?

sure

#9 Updated by Giovanni Manghi over 8 years ago

  • Target version deleted (Version 2.10)

#10 Updated by Giovanni Manghi about 8 years ago

Jürgen Fischer wrote:

Anibal Alarcon Acosta wrote:

When the restore is full the problem is the same. I can give you the link for download the dump to your email?

sure

what is the status of this issue? was the dump sent?

#11 Updated by Sandro Santilli about 8 years ago

I'm also available to look at this, if given a link to the dump

#12 Updated by Sandro Santilli about 8 years ago

I cannot reproduce with current master (b2a1273) using the full big-table data.
Can you try, Anibal ?
Maybe there's some specific additional step I need to take ?
What I did:
1) Add the layer ("borr_cp") -- canvas shows the whole data
2) Enter edit mode
3) Add a single-segment feature on the left, leave all attributes untouched, click OK (nextval function call is in the "gid" attribute)
4) Stop editing, click "Save"

Whaht I obtain is that the new line IS added just fine.
The only WARNING I get in the "PostGIS" tab is about SRID 0 being converted to the "officially unknown SRID value".

#13 Updated by Sandro Santilli about 8 years ago

I tried both against POSTGIS 1.5.9SVN over PostgreSQL 9.1.19 and POSTGIS 2.2.2dev r14600 over PostgreSQL 9.3.6 -- same result: no crash

#14 Updated by Anibal Alarcon Acosta about 8 years ago

Sandro Santilli wrote:

I tried both against POSTGIS 1.5.9SVN over PostgreSQL 9.1.19 and POSTGIS 2.2.2dev r14600 over PostgreSQL 9.3.6 -- same result: no crash

With the current master no crash.(This issue was for 2.10 but no closed) Who must close this issue?

Thanks

#15 Updated by Sandro Santilli about 8 years ago

  • Target version set to Version 2.14
  • Status changed from Feedback to Closed
  • Resolution set to fixed/implemented

I'm closing it for lack of feedback (and seems fixed anyway)

Also available in: Atom PDF