octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #34750] Plotting Hangs on OpenBSD


From: Edd Barrett
Subject: [Octave-bug-tracker] [bug #34750] Plotting Hangs on OpenBSD
Date: Wed, 09 Nov 2011 16:06:19 +0000
User-agent: Mozilla/5.0 (X11; OpenBSD i386; rv:7.0.1) Gecko/20100101 Firefox/7.0.1

Follow-up Comment #5, bug #34750 (project octave):

Further findings:

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


octave:2> sombrero
^C
stopped in
/usr/ports/pobj/octave-3.4.3/octave-3.4.3/scripts/plot/__gnuplot_get_var__.m
at line 108
108:         if (isnumeric (str{end}) && (str{end} == -1))
debug> dbstack
stopped in:

  --> __gnuplot_get_var__ at line 108
[/usr/ports/pobj/octave-3.4.3/octave-3.4.3/scripts/plot/__gnuplot_get_var__.m]
         __go_draw_axes__ at line 40
[/usr/ports/pobj/octave-3.4.3/octave-3.4.3/scripts/plot/__go_draw_axes__.m]
       __go_draw_figure__ at line 173
[/usr/ports/pobj/octave-3.4.3/octave-3.4.3/scripts/plot/__go_draw_figure__.m]
      __gnuplot_drawnow__ at line 93
[/usr/ports/pobj/octave-3.4.3/octave-3.4.3/scripts/plot/__gnuplot_drawnow__.m]


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:

      ## Now read from fifo.
      reading = true;
      str = {};
      while (reading)
        str{end+1} = fgets (gpin);
        if (isnumeric (str{end}) && (str{end} == -1))
          reading = false;
          str = str(1:(end-1));
        endif
      endwhile


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

        str{end+1} = fgets (gpin);


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

Looking at the code for fgets:

{
  static std::string who = "fgets";

  octave_value_list retval;

  retval(1) = 0.0;
  retval(0) = -1.0;

  int nargin = args.length ();

  if (nargin == 1 || nargin == 2)
    {
      octave_stream os = octave_stream_list::lookup (args(0), who);

      if (! error_state)
        {
          octave_value len_arg = (nargin == 2) ? args(1) : octave_value ();

          bool err = false;

          std::string tmp = os.gets (len_arg, err, who);

          if (! (error_state || err))
            {
              retval(1) = tmp.length ();
              retval(0) = tmp;
            }
        }
    }
  else
    print_usage ();

  return retval;
}


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?

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?34750>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]