bugGNU Octave - Bugs: bug #41747, Octave crashes if you try to plot...


bug #41747: Octave crashes if you try to plot and your video card is not configured for OpenGL

Submitted by:  Michael Pender <sparx>
Submitted on:  Sat 01 Mar 2014 09:05:51 PM UTC  
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  Andreas Weber <andy1978>
Originator Name:  Michael Pender Open/Closed:  Closed
Release:  3.8.0 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)

Fri 02 Jan 2015 02:50:53 AM UTC, comment #6: 

@Andreas: I think this is fine.  I applied the patch under your name on the stable branch (http://hg.savannah.gnu.org/hgweb/octave/rev/8dbd55742112) and then pulled the changes through to the gui-release and default branches.  Closing report.

Rik <rik5>
Project Administrator
Thu 01 Jan 2015 08:01:55 PM UTC, comment #5: 

I would suggest this patch for stable:

+++ b/libinterp/dldfcn/__init_fltk__.cc        Thu Jan 01 20:56:15 2015 +0100
@@ -929,7 +929,9 @@

   void show_canvas (void)
-    if (fp.is_visible ())
+    if (! canvas->can_do ())
+      error ("unable to plot due to insufficient GL support");
+    else if (fp.is_visible ())
         canvas->show ();
         canvas->make_current ();

This should also avoid the segfault in #43183 which I've marked as duplicate of this report.

Andreas Weber <andy1978>
Project MemberIn charge of this item.
Sun 27 Apr 2014 03:30:22 AM UTC, comment #4: 

This seems like a good patch to me.  I would push it to stable since Octave should never segfault.

Do we need a similar piece of error checking code for the qt toolkit on the gui-release branch?

Rik <rik5>
Project Administrator
Sun 27 Apr 2014 02:37:44 AM UTC, comment #3: 

The segfault occurs in the function Fl_Gl_Window::make_current(). The following patch avoids a crash for me:

--- a/__init_fltk__.cc
+++ b/__init_fltk__.cc
@@ -932,7 +932,10 @@ public:
     if (fp.is_visible ())
         canvas->show ();
-        canvas->make_current ();
+        if (! canvas->shown ())
+          error ("unable to plot with OpenGL");
+        else
+          canvas->make_current ();

In this case I end up seeing the error message "unable to plot with OpenGL" and I get a figure with an empty drawing area, no segfault.

With this patch I still end up with an empty figure being created, but it at least avoids crashing Octave. When I run "figure" I get an empty figure created with no crash or error message from Octave, but a message, presumably from FLTK, saying "Insufficient GL support". So there might still be a different way to catch this even before a figure is created.

Mike Miller <mtmiller>
Project Administrator
Sat 26 Apr 2014 03:39:36 PM UTC, comment #2: 

I think Octave should be able to catch this and prevent a segfault.  I don't think it will even be that hard.  Somewhere we are calling an init routine and simply not checking whether the return result was success or failure.

But, there are multiple possibilities where this might be in the Octave code.  I don't experience this problem, but could someone who does run octave under gdb, try the following code, and then upload the backtrace (bt command) from gdb when it segfaults?

graphics_toolkit gnuplot
graphics_toolkit fltk
plot (1)

Rik <rik5>
Project Administrator
Sat 01 Mar 2014 09:13:44 PM UTC, comment #1: 

Yes, also crashes consistently for me running Octave in a VNC session which does not have OpenGL support.

Mike Miller <mtmiller>
Project Administrator
Sat 01 Mar 2014 09:05:51 PM UTC, original submission:  

I switched the video adapter I use as my primary recently from an NVIDIA card to my motherboard video adapter and started getting this error message when I try to do a simple plot in Octave 3.8.0 under Ubuntu 12.04.3 LTS:

octave:2> plot (tr)
Xlib:  extension "GLX" missing on display ":0.0".
Insufficient GL support
Xlib:  extension "GLX" missing on display ":0.0".
Insufficient GL support
panic: Segmentation fault -- stopping myself...
attempting to save variables to 'octave-workspace'...
save to 'octave-workspace' complete
Segmentation fault (core dumped)

Octave then crashes, losing the results.  I found out that the Intel video adapter for my motherboard does actually support OpenGL, but the driver installed for Ubuntu 12.04.3 LTS apparently does not support OpenGL on the adapter.  I've worked around the problem by switching from OpenGL to gnuplot before opening any plot windows:
close all
graphics_toolkit gnuplot

However, it would be much better if Octave tested for the necessary OpenGL features and 1) switched to gnuplot as an alternative, or 2) issued an error message that the necessary OpenGL functionality was not available, instead of crashing.

Michael Pender <sparx>


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

Attach Files:

No files currently attached


Depends on the following items: None found

   bug dependencies.


Carbon-Copy List
  • -email is unavailable- added by andy1978 (Posted a comment)
  • -email is unavailable- added by mycae (Affected by bug, virtualbox does not support non-software GL)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by sparx (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 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-01-02 rik5 StatusPatch Submitted => Fixed
        Open/ClosedOpen => Closed
    2015-01-01 andy1978 StatusConfirmed => Patch Submitted
        Assigned toNone => andy1978
    2015-01-01 andy1978 Dependencies- => bugs #43183 is dependent
    2014-05-07 mycae Carbon-Copy- => Added mycae@gmx.com
    2014-03-02 rik5 Carbon-CopyRemoved 72865 => -
    2014-03-02 rik5 CategoryPlotting => Plotting with OpenGL
    2014-03-01 mtmiller StatusNone => Confirmed

    Back to the top

    Powered by Savane 3.5