bugGNU Octave - Bugs: bug #39504, fclose ("all") stops...

 
 

bug #39504: fclose ("all") stops gnuplot pipes creating graphics errors

Submitted by:  imartinez <imartinez>
Submitted on:  Wed 17 Jul 2013 06:20:05 AM UTC  
 
Category: Plotting with gnuplotSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: imartinezOpen/Closed: Closed
Release: 3.6.3Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Thu 26 Nov 2015 05:45:21 PM UTC, comment #3:

I checked in a patch that should mostly fix this issue. See (http://hg.savannah.gnu.org/hgweb/octave/rev/0ad449bc8848). This is on the development branch which will be Octave 4.2.

Rik <rik5>
Project Administrator
Fri 19 Jul 2013 03:49:03 PM UTC, comment #2:

I'm guessing that this is only a problem with the gnuplot toolkit. Have you tried running the script with the FLTK toolkit?

For gnuplot, I can definitely reproduce this with the following:

The problem is that gnuplot is a separate program outside of Octave. To communicate with it we open up pipes. When you use 'fclose all' you are closing every pipe and file handle throughout Octave except for STDIN, STDOUT, and STDERR. Unfortunately there is no notification to Octave that the pipe has been closed so the next time you try and do something with graphics Octave encounters this unexpected situation and starts throwing errors.

As an immediate workaround, I would not use 'fclose all'. Instead, you should be tracking the file descriptors that you open and closing them individually.

Rik <rik5>
Project Administrator
Fri 19 Jul 2013 07:43:10 AM UTC, comment #1:

Somebody suggested a clean exit...

close all
fclose all
clear all

nonetheless... sometimes after a syntax error... where the plot is incomplete, or you close a plot manually.

error: fputs: invalid stream number = 14
error: called from:
error: /usr/share/octave/3.6.3/m/plot/__gnuplot_drawnow__.m at line 299, column 1
error: /usr/share/octave/3.6.3/m/plot/__gnuplot_drawnow__.m at line 84, column 16
error: /usr/share/octave/3.6.3/m/plot/figure.m at line 60, column 7
error: /home/imartinez/Documents/Inst_scripts/HP8510C_Spar.m at line 466, column 3

A long time ago there was a bug reporting some problems when the link was between gnuplot and octave wan not close in a clean way.

Anyway, the error always shows after having a syntax error... closing plots manually and running the script again. Right at the point where a call like

H4=figure(4);
plot(Frequency/1e9,20*log10(abs(S12M)),'m');
Most of the time close, clear and fclose work... but some times they do not.

imartinez <imartinez>
Wed 17 Jul 2013 06:20:05 AM UTC, original submission:

Not sure what to do about this.
My script to control an HP8510C runs ok the first time, multiple plots, several generated files are ok.
Everything is closed and cleaned when it exits.

After it finishes the first time, and it runs again... after trying to plot the second figure....

Calculate, plot and save transimpedance(Zt) (y/n)?? (Enter => n)
Measure, plot and save S21 delay (y/n)?? (Enter => n)
Measure, plot and save S12 delay (y/n)?? (Enter => n)NP_test = 801
error: fputs: invalid stream number = 5
error: called from:
error: /usr/share/octave/3.6.3/m/plot/__gnuplot_drawnow__.m at line 299, column 1
error: /usr/share/octave/3.6.3/m/plot/__gnuplot_drawnow__.m at line 84, column 16
error: /usr/share/octave/3.6.3/m/plot/figure.m at line 60, column 7
error: /home/labuser/Windows_drive/Inst_programs/HP8510C_Spar.m at line 225, column 3

H1=figure(1);
plot(Frequency/1e9,20*log10(abs(S11M)),'b');
grid on;
xlabel('Frequency (GHz)');
ylabel(['S11 ' filename ' (dB)']);
set(gca,'XMinorTick','on','YMinorTick','on');
print(1, strcat('S11_', filename, '.png'), '-portrait');

#LINE 225 is below..
H2=figure(2);
plot(Frequency/1e9,20*log10(abs(S22M)),'r');
grid on;
xlabel('Frequency (GHz)');
ylabel(['S22 ' filename ' (dB)']);
set(gca,'XMinorTick','on','YMinorTick','on');
print(2, strcat('S22_', filename, '.png'), '-portrait');

The only option is to exit octave and run again.... bug???

imartinez <imartinez>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by imartinez (Submitted the item)
  •  

    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 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 26 Nov 2015 05:45:21 PM UTCrik5StatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Fri 19 Jul 2013 03:51:13 PM UTCrik5Dependencies-=>bugs #39525 is dependent
    Fri 19 Jul 2013 03:49:03 PM UTCrik5CategoryPlotting=>Plotting with gnuplot
      Item GroupSegfault, Bus Error, etc.=>Incorrect Result
      StatusNone=>Confirmed
      SummaryInstrument contol script only runs once... plot crashes on second run.=>fclose ("all") stops gnuplot pipes creating graphics errors

    Back to the top


    Powered by Savane 3.1-cleanup1