Ticket #458 (closed defect: fixed)

Opened 10 years ago

Last modified 4 years ago

MapServer hangs with Apache 2.x

Reported by: dmorissette Owned by: dmorissette
Priority: high Milestone:
Component: MapServer CGI Version: 4.1
Severity: normal Keywords:
Cc: mko

Description (last modified by dmorissette) (diff)

This problem was found while working on bug 418, but since this could affect
many users I think it deserves its own bug so that the issue is properly documented.

Apache 2.x has a problem with CGIs that hang when they generate more than 4096
bytes of output to stderr: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22030

When --enable-debug is enabled MapServer can generate quite a bit of output to
stderr which causes it to hang when running under Apache 2.x.  The current
version is Apache 2.0.47 and the stderr bug is still not fixed so we need to
work around the problem.

Note that this problem does not affect Apache 1.3.x users, it happens only with
Apache 2.x.  This will affect all versions of MapServer but we will implement
the workaround only in 4.0.1 (current stable release) and 4.1 (CVS dev).

Change History

Changed 10 years ago by dmorissette

  • status changed from new to assigned
I made the following changes for this in version 4.0.1 and will apply the same
changes to 4.1 in a few minutes:

- configure attempts to detect the version of Apache that you are running by
looking for httpd in some default locations.  You can force it to find a
specific copy of httpd using --with-httpd=/path/to/httpd

- If you happen to be running a version of Apache >= 2.0 then stderr will be set
to be non-blocking in msDebug().  This is controlled by the
NEED_NONBLOCKING_STDERR compilation flag.  

When stderr is set to non-bloking then MapServer doesn't hang any more after
4096 bytes of output to stderr but you may lose some stderr output (still better
than nothing).

Assefa: can you please checkout the latest 'branch-4-0' source and confirm that
it builds properly on Windows when you add -DNEED_NONBLOCKING_STDERRR to the
compile flags.

Changed 10 years ago by dmorissette

  • status changed from assigned to closed
  • resolution set to fixed
Marking fixed, changes committed to both the 4.0 and 4.1 branches and everything
seems to work fine for me.

Changed 10 years ago by assefa

Daniel,

 4.1 maperror.c builds properly on windows after doing a small modification
(#include <unistd.h> not used on windows). I have commited this change.
 Would you mind updating the eralier branched with the same fix and retag I guess ?

Changed 10 years ago by dmorissette

Thanks Assefa, I've applied your fix to the 4.0 branch and re-tagged the 4.0.1
release.  

Steve: I think you can go ahead with the 4.0.1 release now.

Changed 4 years ago by mko

  • cc mko added

Wonder why the configure script still says

configure: checking HTTPD server (Apache) version...
        using user-supplied httpd (/usr/local/apache2/bin/httpd)
        /usr/local/apache2/bin/httpd version is Apache/2.2.11 (2002011).
        Your system is apparently running Apache/2.2.11.  Setting stderr to non-blocking for msDebug() due to Apache 2.x bug (see MapServer bug 458 or Apache bug 22030).

Apache marked the bug fixed since Version 2.0.49.

Changed 4 years ago by dmorissette

  • description modified (diff)

I committed a new configure.in in r9301 that will check if the version is lower than 2.0.49.

(Unfortunately I could not commit the generated "configure" script because I've got autoconf 2.63 on my system which has a problem: the generated "configure" file contains an "ac_cr='M'" line which causes SVN to complain about "Inconsistent line ending style".)

Changed 4 years ago by aboudreault

The configure script has been successfully generated.

Fixed and committed in and r9301 and r9303.

Changed 4 years ago by mko

After applying fix r9301 logging has considerably improved, but output is written only at the next request. In other words, the log of request n is written when request n+1 is processed.

Changed 4 years ago by aboudreault

I suppose you are talking about MapServer in fastcgi mode. I've noticed that problem recently. Please fill a new ticket and assign it to me.

Note: See TracTickets for help on using tickets.