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:
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 );
pid = wait(&status);
#endif /* HAVE_KILL */
Again, I hope someone with better IPC skills can take a look at this
Unsubscribe from or help with the swish-e list:
Help with Swish-e:
Received on Mon Nov 6 13:12:55 2006