bugGNU Octave - Bugs: bug #34750, Plotting Hangs on OpenBSD


bug #34750: Plotting Hangs on OpenBSD

Submitted by:  Edd Barrett <vext01>
Submitted on:  Sat 05 Nov 2011 01:39:15 AM UTC  
Category: Plotting with gnuplotSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: 3.4.3Operating System: BSD

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 Jump to the original submission)

Thu 08 Aug 2013 03:17:41 AM UTC, comment #13:

I am able to plot normally with gnuplot with the current development version of Octave on OpenBSD 5.3. Whatever was the problem with 3.4.x and 3.6.x has apparently been fixed.

Mike Miller <mtmiller>
Project Administrator
Wed 22 Feb 2012 05:00:16 PM UTC, comment #12:

Ok. This looks like it is a problem with the i/o pipe between Octave and Gnuplot.

The pipe is being opened in .../scripts/plot/private/__gnuplot_get_var__.m

This calls Octave's builtin popen2() which is part of .../src/syscalls.cc

I recommend you start a thread on the octave help mail-list.


Ben Abbott <bpabbott>
Project Member
Wed 22 Feb 2012 04:00:36 PM UTC, comment #11:

Ah -- sorry.

I know gnuplot works fine, I use it all the time from maxima.

Edd Barrett <vext01>
Wed 22 Feb 2012 02:50:24 PM UTC, comment #10:

Please try that from gnuplot not from Octave.

Ben Abbott <bpabbott>
Project Member
Wed 22 Feb 2012 02:47:51 PM UTC, comment #9:


Are these tools required for x11 rendering?

Edd Barrett <vext01>
Wed 22 Feb 2012 02:37:37 PM UTC, comment #8:

From your earlier comment the hang is occurring when Octave waits for gnuplot to respond to "print GPVAL_TERM"

Please run gnuplot and type "print GPVAL_TERM". What is the result ?

On MacOS I see the result below.

Since you are running OpenBSD, I expect you'll see "x11" instead of "aqua". Perhaps you'll get some thing else?

Ben Abbott <bpabbott>
Project Member
Wed 22 Feb 2012 11:24:43 AM UTC, comment #7:

This is still an issue with 3.6.1rc0 using gnuplot-4.4.3.

octave:1> plot([1 2 3])

Edd Barrett <vext01>
Wed 23 Nov 2011 01:00:08 AM UTC, comment #6:

I've changed the category to gnuplot.

Edd, What version of gnuplot do you have installed?

Have you looked at _gnuplot_get_var_.m to attempt to debug the problem?

Ben Abbott <bpabbott>
Project Member
Wed 09 Nov 2011 04:06:19 PM UTC, comment #5:

Further findings:

Having found the octave debugger, i can tell you that the hang I am experiencing is reported to be:

I obtained this by pressing ctrl+c with debug_on_interrupt set. I did this a number of times (3 times, rebooting inbetween), incase this code is looping.

If I issue a 'dbcont' after interrupting, everything continues fine and the plot is drawn just fine.

The code of interest here is:

I actually believe that octave is stuck on the previous line:

As an fgets would explain the read() we see in the ktrace output.

Looking at the code for fgets:

I was interested in seeing if the call to os.gets() ever returns. However, putting a 'std::cout()' either side of it seems to "fix" the issue altogether(!?*) but why? -- I will not settle with that as a fix; I still think this code is racing.

I was hoping the octave community would have commented by now. Can someone please lend a hand here?

Edd Barrett <vext01>
Wed 09 Nov 2011 09:51:47 AM UTC, comment #4:

Further findings:

I have built the entirety of octave-3.4.3 with -O0 and the hang still happens, however, I notice only the first plot hangs; you can hit ctrl+c and try again and it will work; as will subsequent plots.

I think we have a race condition on our hands and building with -O0 has changed the timings of things. After you have hit ctrl+c on the first plot, the only way to reproduce the plot hang is to reboot (weird, yes). This is why I think it is a race condition.

Further inspection with ktrace (like strace) shows differing behavior with regards to a fifo in /tmp.

A failing plot looks like this:

(The poll is the hang, notice the failed read() syscall).

Whereas the same area of execution on a working plot looks like:

(Notice that read DID NOT fail this time)

I suspscted the gnulib::mkfifo() at first, but if i remove the gnulib prefix, so as to use openbsd's implementation, the same happens.

Looks like a race condition to me (right?)

I am out of time for now, but my question now is, do we know where in the code this fifo is being made? Does gnuplot output to a pipe and octave picks it up? Is it the case that octave is reading from the pipe before gnuplot is done?

Comments and ideas welcome.


Edd Barrett <vext01>
Mon 07 Nov 2011 12:04:53 PM UTC, comment #3:

Hi Ben,

I am an OpenBSD developer attempting to bring our old package up to date.

I tried putting some debug std::couting in the gnuplot class and oddly got the same error as running with gdb. This could be a compiler bug? I will try turning the optimiser off perhaps?

Edd Barrett <vext01>
Sun 06 Nov 2011 01:46:41 AM UTC, comment #2:

Are you building Octave yourself, or using your package manager?

Ben Abbott <bpabbott>
Project Member
Sat 05 Nov 2011 12:08:37 PM UTC, comment #1:

Enabling fltk for native graphics does not seem to help either.

Edd Barrett <vext01>
Sat 05 Nov 2011 01:39:15 AM UTC, original submission:


On OpenBSD plotting hangs:

If I set the LD_LIBRARY_PATH manually and use gdb (as opposed to using run_octave), something different happens:

Not sure how to go about this...

Edd Barrett <vext01>


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

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by bpabbott (Posted a comment)
  • -email is unavailable- added by vext01 (Submitted the item)
  • -email is unavailable- added by vext01

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

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 08 Aug 2013 03:17:41 AM UTCmtmillerStatusNone=>Fixed
    Wed 23 Nov 2011 01:00:08 AM UTCbpabbottCategoryPlotting=>Plotting with gnuplot
    Sat 05 Nov 2011 01:39:15 AM UTCvext01Carbon-Copy-=>Added -email is unavailable-

    Back to the top

    Powered by Savane 3.1-cleanup1