bugGNU Octave - Bugs: bug #50696, Iterating "saveas" or...

 
 

bug #50696: Iterating "saveas" or "print" function crashes after many iterations (e.g. 500)

Submitter:  None
Submitted:  Sat 01 Apr 2017 12:02:36 PM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 4.2.1
Operating System:  * Microsoft Windows Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 06 Jul 2017 08:29:05 PM UTC, comment #6: 

Thanks.  I pushed the change here:

http://hg.savannah.gnu.org/hgweb/octave/rev/38188d1aaf3f

Closing report as fixed.

John W. Eaton <jwe>
Group administrator
Thu 06 Jul 2017 08:19:42 PM UTC, comment #5: 

it does for me on Fedora 26.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Thu 06 Jul 2017 06:55:14 PM UTC, comment #4: 

Does the attached patch fix the problem for you?


(file #41134)

John W. Eaton <jwe>
Group administrator
Thu 06 Jul 2017 06:40:09 PM UTC, comment #3: 

I can duplicate this problem with the development sources on a Debian system, so I'll try to see if I can figure out what is opening and unlinking these files.

John W. Eaton <jwe>
Group administrator
Tue 04 Jul 2017 02:25:57 AM UTC, comment #2: 

It seems to me that the bug here is octave leaking open file handles (i.e. it creates and deletes files without closing them).
The crash happens becqause you exceed ulimit on number of open files.
I modified (simplified) the script to:

1;
for ii=1:200
 plot(rand(10))
 title(ii)
 print('figs/testCrash.svg');
endfor


every time i run it I see number of open files
(as reported by "lsof | grep octave | wc -l") is increasing by 200. Eventually it reaches my ulimit and octave crashes.

(this is with a recent developemnt snapshot)

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Mon 03 Jul 2017 10:43:52 PM UTC, comment #1: 

I get this crash with the following code:


f=figure;
funits = get(figureHandle,'Units');
set(figureHandle,'Units','pixels')
fpos = get(figureHandle,'Position');
set(figureHandle,'Units',funits)

size = sprintf("-S%d,%d",fpos(3:4));

%crashes after 504th print
for i=1:1000
 plot(rand(10,10),rand(10,10))
 title(i)
 %crashes in print -> __opengl_print__ -> drawnow (gl2ps_device{n}, ['|' pipeline{n}]);
 print(f,'figs/testCrash.png',vid.size);
end


It crashes exactly after the 504th print. This might be related to bug #34631, because before simplifying my crashing code down to what's shown here, I was able to catch

warning: ft_manager: unable to load font: ...
warning: ft_render: unable to load ...

repeated frequently. However, currently the code shown here crashes without any flash of these warnings as it exits.

I ran into this problem while saving images to later piece together as a video animation.


Marshall <marsian>
Sat 01 Apr 2017 12:02:36 PM UTC, original submission:  

% Iterating "saveas" or "print" function crashes after many iterations (e.g. 500):

% given the following set up where we have an array of vectors we wish to plot, loading vectors in loop, performing plotting, labelling and saving works successfully up to a limit. Above this limit, the octave engine crashes. In the GUI I reach a limit of 505 plots, in the CLI I reach the limit of 509 plots.

for i = dataIndex = 1:N %(e.g. N = 1000)

    v1 = csvread(strcat(PATHTOFILE,v1Data(dataIndex ).name));
    v2 = csvread(strcat(PATHTOFILE,v2Data(dataIndex ).name));

    % assuming length(v1) == length(v2) - my measurements were length(v1) == length(v2) == circa 40 to 50

    h = figure;

    plot(v1,v2,'-ob');

    title(num2str(dataIndex));
    u = max(max(v1,v2));
   
    xlim([0 u]);
    ylim([0 u]);
    xlabel('v1');
    ylabel('v2');
 
    drawnow;

% following assumes filenames are preallocated in filenameout:
     saveas(h,strcat(SAVEDIR,filenameout(dataIndex).name,'.png'),'png');
    % OR:
    %print(h,strcat(SAVEDIR,filenameout(dataIndex).name,'.png'),'-dpng');
   

    close(h)

end


The Windows system resources are very far from saturation. Can anyone else replicate this condition or similar?

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #41134:  diffs.txt added by jwe (1KiB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by marsian (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-07-06 jwe StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2017-07-06 jwe Attached File- Added diffs.txt, #41134
        StatusNone Patch Submitted

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code