AF:
NF:0
PS:10
SRH:1
SFN:
DSR:
MID:<20070306100205.148d56b7@ripper.onstor.net>
CFG:
PT:0
S:andy.sharp@onstor.com
RQ:
SSV:onstor-exch02.onstor.net
NSV:
SSH:
R:<rendell.fong@onstor.com>
MAID:1
X-Sylpheed-Privacy-System:
X-Sylpheed-Sign:0
SCF:#mh/Mailbox/sent
RMID:#imap/andys@onstor.net@onstor-exch02.onstor.net/INBOX	0	BB375AF679D4A34E9CA8DFA650E2B04E0149E36D@onstor-exch02.onstor.net
X-Sylpheed-End-Special-Headers: 1
Date: Tue, 6 Mar 2007 10:03:20 -0800
From: Andrew Sharp <andy.sharp@onstor.com>
To: "Rendell Fong" <rendell.fong@onstor.com>
Subject: Re: popen() in BSD
Message-ID: <20070306100320.328c8b4a@ripper.onstor.net>
In-Reply-To: <BB375AF679D4A34E9CA8DFA650E2B04E0149E36D@onstor-exch02.onstor.net>
References: <BB375AF679D4A34E9CA8DFA650E2B04E0149E36D@onstor-exch02.onstor.net>
Organization: Onstor
X-Mailer: Sylpheed-Claws 2.6.0 (GTK+ 2.8.20; x86_64-pc-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Sounds like you're not using pclose() to close the stream returned from
popen().  Lingering processes are there because they have not been
reaped.  That will only happen if you have failed to close the stream
with pclose.  Or perhaps there is a bug in C library or OpenBSD, but
what are the chances of that?

Cheers,

a

On Tue, 6 Mar 2007 09:52:22 -0800 "Rendell Fong"
<rendell.fong@onstor.com> wrote:

> Is anyone aware of issues with using popen/pclose?
> When I use it in my code, I've noticed a side effect where sometimes a
> zombie process is left lingering.
> It only occurs sometimes when it is used.
> 
> eng59# ps -ax | grep Z
>  1362 ??  Z       0:00.00 (sh)
>  7240 ??  Z       0:00.00 (sh)
> 15137 ??  Z       0:00.00 (sh)
> 24215 ??  Z       0:00.00 (sh)
> 30321 ??  Z       0:00.00 (sh)
> eng59#
> 
> I'm fairly certain that popen is the cause of these zombie processes
> because replacing it with the equivalent functionality (system call
> and fopen/fclose) makes this problem go away.
> 
