I am no expert either, but the logic looks reasonable
so I gave it a shot.
Attached are my versions of filter.c swish.h,
implemented your change. I didnt put in the proper
logic for the #ifdef HAVE_KILL - this still has to be
added. The fork_program function now has the FileProp
structure passed so the PID can be stored. I updated
the structure in the swish.h file. All my changes are
preceded with my initials (gjh), but diff it to CVS to
see.
Ran it on a couple of thousand files and it seems
happy so far....
Cheers
Gertjan
--- Bill Moseley <moseley@hank.org> wrote:
> On Sun, Nov 05, 2006 at 03:51:48PM -0800, Gertjan
> Hofman wrote:
> > Looks like the program never comes back from the
> call
> > to wait (&status) in FilterClose in filter.c.,
> which
> > is called from index.c near line 1140.
>
> Not as easy to test as I'd like. For one thing -S
> prog doesn't allow
> TruncateDocSize. It's possible to fix that but
> would require quite a
> few changes. There is a "flush_steam()" function
> that is designed to
> read data from the -S prog program up to the next
> input file, but it's
> hard to detect this when using a filter. (Just
> because I only track
> bytes read from the source which could be a filter
> and not the -S prog
> program when using a filter).
>
> Anyway, maybe someone with good unix IPC skills can
> review this.
> What I'm now doing is calling waitpid with WNOHANG
> on the filter and if that
> returns zero mean no change to the child process
> (i.e. it hasn't
> finished) then I kill -9 it. Maybe kill -9 is a bit
> too demanding.
>
> So basically the code is this:
>
> #ifdef HAVE_KILL
> pid = waitpid( fprop->filter_pid, &status,
> WNOHANG );
>
> /* Is program still running? */
> if ( 0 == pid )
> {
> if ( -1 == kill( fprop->filter_pid, 9 ) )
> progerrno("Failed to kill filter program
> with pid %d", fprop->filter_pid );
>
> /* Now reap killed filter */
> pid = waitpid( fprop->filter_pid, &status, 0
> );
> }
> #else
> pid = wait(&status);
> #endif /* HAVE_KILL */
>
>
> Again, I hope someone with better IPC skills can
> take a look at this
> for me.
>
>
>
>
>
> --
> Bill Moseley
> moseley@hank.org
>
> Unsubscribe from or help with the swish-e list:
> http://swish-e.org/Discussion/
>
> Help with Swish-e:
> http://swish-e.org/current/docs
> swish-e@sunsite.berkeley.edu
>
>
____________________________________________________________________________________
Sponsored Link
Mortgage rates near 39yr lows. $420k for $1,399/mo.
Calculate new payment!
http://www.LowerMyBills.com/lre
*********************************************************************
Due to deletion of content types excluded from this list by policy,
this multipart message was reduced to a single part, and from there
to a plain text message.
*********************************************************************
Received on Mon Nov 6 14:32:08 2006