htdig: RH 5.1, htmerge and sort failing - a hacked solution


Rob Willett (r.willett@linst.ac.uk)
Fri, 10 Jul 1998 20:55:20 +0100


Deal all,
The plot thickens re htmerge failing on RH 5.1 Linux systems.

I've looked at the code a lot more closely and it appears that the sort
on the word list is working but the
pclose at the end of the chunk of code is returning
        Word sort failed errno 10 No child processes (I modified the code to
give a little more info)

This is the sort of thing that normally causes zombies. In this case
though there aren't any. I wrote some code that
does much the same thing as htmerge i.e. opens a pipe onto /bin/sort,
reads it and then tries to close it. It then ran OK,
I ran it a couple of times and it seemed fine. I then introduced a sleep
command into the crontab and the errors started appearing
again.

It appears that either the pclose or the fork command is time sensitive.
I've run the same file around 20 more times via
a crontab and most of the time it works but the program still sometimes
fails with a NOCHILD error message. I think this is a bug
in Linux. I can't check the net for more information as our gateway is
down until Monday.

I have found a solution, of sorts. I modified the code at the end of the
htmerge section to check explicity for
a NOCHILD error and to then ignore it. This is not a good solution but
it is one that works until I can find a better one.

The code is as follows:

    //
    // Check for successful completion of sort
    //
    int sortRC = pclose(sorted);
    extern int errno;
    if (sortRC && errno != 10)
    {
        extern char *sys_errlist[];

        cout << "Word sort failed errno " << errno << " " <<
sys_errlist[errno] << endl;
        reportError("Word sort failed");
        exit(1);
    }

When this compiles it complains of bad pointers for sys_errlist but I
just ignore them and it works fine. If you're willing to hack the code
and compile it then this now works OK. Obviously your mileage will vary
and no guarantees are offered etc etc.

If I can find a better solution I'll post to the group.

Hope this helps. If people need binaries then I'll post.

-- 
Rob Willett			Operations and Development Manager IT
Phone: 0171 514 6054 		Fax: 0171 514 6046
http://it.linst.ac.uk		mailto: r.willett@linst.ac.uk
----------------------------------------------------------------------
To unsubscribe from the htdig mailing list, send a message to
htdig-request@sdsu.edu containing the single word "unsubscribe" in
the body of the message.



This archive was generated by hypermail 2.0b3 on Sat Jan 02 1999 - 16:26:52 PST