bugGNU Octave - Bugs: bug #48519, Segfault with Qt plotting when...


bug #48519: Segfault with Qt plotting when running demos

Submitted by:  Andreas Weber <andy1978>
Submitted on:  Fri 15 Jul 2016 08:38:57 AM UTC  
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  In Progress Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  dev Operating System:  GNU/Linux

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Thu 19 Jan 2017 05:37:31 AM UTC, comment #18:

change report status to "In Progress", according to comment #17

Avinoam Kalma <avinoam>
Project Member
Wed 21 Sep 2016 12:44:33 AM UTC, comment #17:

I am still getting crashes on machines with with NVidia and AMD cards (as of 4.2.0-rc2). Crashes are intermittent but it looks like the situation gets worse if I LD_PRELOAD multithreaded openblas library. At least once instead of crash octave hanged on
ghostscript making zoom1.png (I killed it after ~20 minutes).


Dmitri A. Sergatskov <dasergatskov>
Mon 22 Aug 2016 09:46:44 PM UTC, comment #16:

So I changed dump_plot_demos_2.m so it save hold_06.eps instead of png. No crash but file is corrupted (attached).


(file #38322)

Dmitri A. Sergatskov <dasergatskov>
Mon 22 Aug 2016 09:39:22 PM UTC, comment #15:

With changeset: 22361:a12f11e20c75
I have crashes on computers with AMD and NVIDIA cards
(no crash on i7 with intel graphics).
After applying lachlan's patch still crash on nvidia (I have not tried others):

The crash is due to ghostscript. It looks like it gets a corrupted input file from gl2ps.


Dmitri A. Sergatskov <dasergatskov>
Mon 22 Aug 2016 05:15:19 PM UTC, comment #14:

@Dmitri: Does the crash go away if you apply Lachlan's original fix in file 37907?

Rik <rik5>
Project Administrator
Mon 22 Aug 2016 05:04:38 PM UTC, comment #13:

The crash has gone away for me after Andy pushed the second fix mentioned in comment #11. But, there is clearly still an instability that depend on exact hardware and software versions.

Rik <rik5>
Project Administrator
Sun 21 Aug 2016 05:09:30 AM UTC, comment #12:

I still get crash running dump_plot_demos_2:

At least once it froze at the same hold_06 demo instead of a crash. It is not 100% reproducible: if I restart after the crash it tends to go through and finish the script, but if I delete all hold_*.png files and restart it crashes at hold_06
with fairly high reproducibility.

changeset: 22348:9deb86bb5632


Dmitri A. Sergatskov <dasergatskov>
Sat 20 Aug 2016 07:06:21 AM UTC, comment #11:

I've pushed http://hg.savannah.gnu.org/hgweb/octave/rev/2e49ab3d6b48 which should prevent the segfault (but of course doesn't solve the timing problems in the first place)

Andreas Weber <andy1978>
Project Member
Wed 17 Aug 2016 10:39:53 PM UTC, comment #10:

What if you change in ObjectProxy.cc

but I think this is also only a workaround. ObjectProxy::update shouldn't be called before a valid object is set, right?

Andreas Weber <andy1978>
Project Member
Wed 17 Aug 2016 04:44:15 PM UTC, comment #9:

Unfortunately, this still crashes for me as well.

It is fairly repeatable in stopping at axis demo #3. This is a demo that contains 9 subplots so there is going to be a lot of work by the graphics system as it initially places the 9 subplots and then adjusts the positioning slightly as titles are added.

Steps to reproduce

I experimented with adding back in the small delay in graphics.cc that allows for the print routine to grab the mutex on the graphics object. The value that was there before was .05 (50 milliseconds). That definitely helped, but it is not a cure. I experimented with delays up to 1 second, but I still occasionally get segfaults.

Rik <rik5>
Project Administrator
Wed 17 Aug 2016 08:17:08 AM UTC, comment #8:

It still crashes for me as of

changeset: 22326:71dd9d5a5ecd
bookmark: @
tag: tip
user: John W. Eaton <jwe@octave.org>
date: Wed Aug 17 02:57:50 2016 -0400
summary: move more new classes inside octave namespace


Dmitri A. Sergatskov <dasergatskov>
Wed 17 Aug 2016 06:04:48 AM UTC, comment #7:

Pantxo's fix from #44463

Fixes the segfault for me.

@Dmitri: can you confirm it's fixed on fc127f0e1ccd?

Andreas Weber <andy1978>
Project Member
Wed 17 Aug 2016 12:06:12 AM UTC, comment #6:

I used Andreas Weber


and they both coredump of two computers I tried.
Then I modify the scripts by adding 1 sec delay
in front of every tic ();
After that I was able to finish both scripts on
both computers w/o obvious problems.

Looks like some race condition on GL buffer?


Dmitri A. Sergatskov <dasergatskov>
Tue 16 Aug 2016 08:55:57 PM UTC, comment #5:

Marking as confirmed. I used 'dump_demos' to create 'dump_plot_demos.m'. I then ran

The dump_plot_demos script really stresses the graphics system and quickly led to segfaults. It could be software versions. I'm using Qt5.4. I'll try the ObjectProxy fix from Lachlan later.

Rik <rik5>
Project Administrator
Fri 29 Jul 2016 01:07:43 PM UTC, comment #4:

Still present with 8971508e21c8
(I was hoping that e68128601f5e solved this)
@Pantxo: Sorry: forgot to test your patch, I'll do it soon

Andreas Weber <andy1978>
Project Member
Sun 17 Jul 2016 04:35:17 PM UTC, comment #3:

I can't reproduce the bug either but it may have to do with bug #44463, for which the current workaround may not always work. You may want to try the last patch I attached there, I think it is more robust than the current workaround.

Pantxo Diribarne <pantxo>
Project Member
Sun 17 Jul 2016 12:09:50 PM UTC, comment #2:

Hi Lachlan. Your patch clearly avoids the segfault but it looks to me like a workaround for a deeper problem.

The problem is triggered if the previous parameters are restored after "print". I've added some debug output to stdout

which gives before the segfault:

I'm doubt it's in intended that ObjectProxy::init ist called with both obj=0 and m_object=0. This whole QtHandles backend is a unfathomable beast for me...

Andreas Weber <andy1978>
Project Member
Sat 16 Jul 2016 03:19:36 AM UTC, comment #1:

I've tried to reproduce this, and don't seem to be able to.

Thanks for providing a stack trace. That really helps. You can see that slotUpdate is being called on a NULL object. That means the bug must be in QtHandles::ObjectProxy::update or earlier. It seems that ObjectProxy::init is not being called to set m_object.

Can you see if the attached changeset makes a difference?

There are several Qt bugs that are system dependent. One thing you could do to debug it is to look for the other problems with Qt and see if your system reproduces any of them.

(My guess is that this is different, because those crashes were often in the OpenGL drivers and this in in Octave code, but it is something to try.)

(file #37907)

Lachlan Andrew <lachlan>
Fri 15 Jul 2016 08:38:57 AM UTC, original submission:

hg id c8abb2ba4017

This bug is not deterministic and happened with "demo axis", "demo pbaspect" and "demo light"(see below). Perhaps it's some race condition which happens if you make a lot plots in a sequence. In my case I've used 'compare_plot_demos ("toolkits", "qt")' from the scripts/testfun/private dir which basically makes "demo xyz, print demo xyz2, print..."

Is there anything I can do to help debug this?

Andreas Weber <andy1978>
Project Member


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #38322:  hold_06.eps added by dasergatskov (168KiB - application/postscript)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by avinoam (Posted a comment)
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by lachlan (Updated the item)
  • -email is unavailable- added by andy1978 (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-01-19 avinoam StatusReady For Test => In Progress
    2016-08-22 dasergatskov Attached File- => Added hold_06.eps, #38322
    2016-08-17 andy1978 StatusConfirmed => Ready For Test
    2016-08-16 rik5 StatusNone => Confirmed
    2016-07-16 lachlan Attached File- => Added bug_48519_qt_invalid_proxy.cset, #37907

    Back to the top

    Powered by Savane 3.3