SUMMARY: Weird behaviour of our HTTP-daemon

From: Erik Sundermann <erik_at_petaxp.rug.ac.be>
Date: Wed, 13 Mar 1996 20:00:49 +0100

My original question:

> We are using the CERN HTTP-daemon (version 3.0). Everything works fine
> for normal HTML-files, images, etc ... However, if somebody tries to
> execute a cgi-bin script on our machine, 2 times out of 3 you get a
> correct result, and sometimes you get a "Document contains no data"
> error message.
>
> ...
>
> Can anyone shed some light on this, or even point me to the
> people/mailing-list/newsgroup that might be able to help me ...

As it turned out, this list wasn't the wrong place to ask after all,
since the promblem seems to be a specific bug under OSF/1 3.0.

The problem seems to arise when the script exits. The problem is know
to CERN and a patch is available under ..
   http://www.w3.org/hypertext/WWW/Daemon/User/Patch/
The patch just adds a 'sleep (1);' statement. However, this still
seems to cause problems, so I applied the following piece of code,
provided by Chris Dalton <cid_at_hplb.hpl.hp.com> and recompiled.

> Here's a "diff HTScript.c HTScript.c.orig":
>
> 202,229c202
> < #ifndef Original
> < int status;
> < /*
> < Modified by C.I.Dalton (cid_at_bangor.ac.uk) - Feb 96
> <
> < Surround the call to fread with sighold/sigrelse. If we
> < get a signal when executing the fread system call and we
> < haven't yet read any data, the fread will return straight
> < away (man read).
> < Since we forked a child to execute the cgi script,
> < we will get notified when that child exits (via a SIGCHLD
> < signal). If we get this child termination signal
> < before the parent process (below) has chance to read
> < any data from its output (but has started the fread call),
> < the fread call will return without bringing us any data.
> < Hence we get a "Document contains no data" message in
> < Netscape, for example.
> < */
> <
> < sighold(SIGCHLD);
> < status = fread(input_buffer, 1, INPUT_BUFFER_SIZE, fp);
> < sigrelse(SIGCHLD);
> <
> < #else /* Original */
> <
> < int status = fread(input_buffer, 1, INPUT_BUFFER_SIZE,fp);
> <
> < #endif /* Original */
> - ---
> > int status = fread(input_buffer, 1, INPUT_BUFFER_SIZE, fp);
>
> After applying this fix I haven't had any problems with cgi scripts on
> the OSF1 box.

Neither have I (so far). Some other solutions and workarounds were
suggested, but I didn't try them.

Thanks to:
   Chris Dalton <cid_at_hplb.hpl.hp.com>
   Gyula Szemenyei <szemgy_at_rkk.hu>
   <igb_at_axnd22.cern.ch>
   Michael Matthews <matthewm_at_sgate.com>
   Randy M. Hayman <haymanr_at_icefog.sois.alaska.edu>
   Harald Mayer <mayer_at_piis05.joanneum.ac.at>

Erik

                                                      ,,,
Erik Sundermann (0 0)
MEDISIP Group - University of Ghent +-----oOO----(_)------------+
Sint-Pietersnieuwstraat 41 | You know how Einstein got |
B-9000 Ghent - Belgium | bad grades as a kid ? |
                                         | Well, mine are even worse |
tel : +32-9-264.66.19 | (Calvin) |
fax : +32-9-264.35.94 +-------------------oOO-----+
                                                    |__|__|
email: Erik.Sundermann_at_rug.ac.be || ||
WWW : http://petaxp.rug.ac.be/~erik ooO Ooo
Received on Wed Mar 13 1996 - 20:50:20 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:46 NZDT