help-octave
[Top][All Lists]
Advanced

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

Re: Print plot error


From: Ben Abbott
Subject: Re: Print plot error
Date: Sun, 23 Aug 2009 16:07:16 -0400

On Aug 23, 2009, at 1:40 PM, Rob Mahurin wrote:

On Aug 22, 2009, at 6:29 PM, Dmitri A. Sergatskov wrote:
On Sat, Aug 22, 2009 at 4:32 PM, Ben Abbott<address@hidden> wrote:
I'm not sure I see the same thing ...

plot(1:10)
for n = 1:25
print -dpdf test.pdf
system ('ps axu | grep gnuplot | wc -l');
end
6
5
6
6
6


I think ps tranketes long output lines.
Try

system ('ps axwww | grep gnuplot | wc -l');

I can confirm this on both Linux and OS X 10.4. Every Octave command like

        octave> print /tmp/out.pdf

adds one more defunct process to

        shell$ ps x -o pid,ppid,stat,command |
                awk '$3 ~ /Z/ {print}'

I think the solution is an occasional waitpid(-1,0,WNOHANG), but I'm not sure where in the code this goes.

Rob

I'm running Mac OSX 10.5.8, and when I try ...

contour (peaks)
print test.pdf
contour (peaks)
print test.pdf
contour (peaks)
print test.pdf
contour (peaks)
print test.pdf
...

... and try Rob's command after each print, I see

$ ps x -o pid,ppid,stat,command | awk '$3 ~ /Z/ {print}'
 1660  1657 Z+   (gnuplot_x11)
 1661  1657 Z+   (gnuplot_x11)
 1890  1437 Z+   (sh)
$ ps x -o pid,ppid,stat,command | awk '$3 ~ /Z/ {print}'
 1969    57 Z    (SFLSharedPrefsTo)
 1660  1657 Z+   (gnuplot_x11)
 1661  1657 Z+   (gnuplot_x11)
 1890  1437 Z+   (sh)
 1967  1437 Z+   (sh)
$ ps x -o pid,ppid,stat,command | awk '$3 ~ /Z/ {print}'
 1660  1657 Z+   (gnuplot_x11)
 1661  1657 Z+   (gnuplot_x11)
 1890  1437 Z+   (sh)
 1967  1437 Z+   (sh)
 1974  1437 Z+   (sh)
$ ps x -o pid,ppid,stat,command | awk '$3 ~ /Z/ {print}'
 1660  1657 Z+   (gnuplot_x11)
 1661  1657 Z+   (gnuplot_x11)
 1890  1437 Z+   (sh)
 1967  1437 Z+   (sh)
 1974  1437 Z+   (sh)
 1980  1437 Z+   (sh)
$ ps x -o pid,ppid,stat,command | awk '$3 ~ /Z/ {print}'
 1660  1657 Z+   (gnuplot_x11)
 1661  1657 Z+   (gnuplot_x11)
 1890  1437 Z+   (sh)
 1967  1437 Z+   (sh)
 1974  1437 Z+   (sh)
 1980  1437 Z+   (sh)
 1987  1437 Z+   (sh)
$ ps x -o pid,ppid,stat,command | awk '$3 ~ /Z/ {print}'
 1660  1657 Z+   (gnuplot_x11)
 1661  1657 Z+   (gnuplot_x11)
 1890  1437 Z+   (sh)
 1967  1437 Z+   (sh)
 1974  1437 Z+   (sh)
 1980  1437 Z+   (sh)
 1987  1437 Z+   (sh)
 1994  1437 Z+   (sh)

The growing list of shells each have octave as their parent.

$ ps x -o pid,ppid,stat,command

1437 1436 S+ /Users/bpabbott/Development/mercurial/octave-3.2/src/ octave --no-init-path --path=
 1656  1437 S+   /bin/sh /sw/bin/gnuplot
 1657  1656 S+   /sw/bin/gnuplotx
 1660  1657 Z+   (gnuplot_x11)
 1661  1657 Z+   (gnuplot_x11)
 1883  1657 S+   gnuplot_x11
 1890  1437 Z+   (sh)
 1967  1437 Z+   (sh)
 1974  1437 Z+   (sh)
 1980  1437 Z+   (sh)
 1987  1437 Z+   (sh)
 1994  1437 Z+   (sh)

So Mac OSX 10.5.8 does have the same problem.

It appears that when a bidirectional pipe is opened (via popen2()), pclose() is not doing all that is needed to close the pipes.

Ben





reply via email to

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