httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 44800] New: Windows console signals
Date Thu, 10 Apr 2008 15:44:10 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=44800

           Summary: Windows console signals
           Product: Apache httpd-2
           Version: 2.2.8
          Platform: PC
        OS/Version: Windows 2000
            Status: NEW
          Keywords: PatchAvailable
          Severity: normal
          Priority: P2
         Component: mpm_winnt
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: Tom.Donovan@acm.org


Created an attachment (id=21808)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=21808)
branches/2.2.x patch

Starting with Apache 2.2.8, Windows console signal handlers no longer work and
the Apache console window has no message loop (i.e. it is never repainted when
uncovered). This is due to a change to mpm_winnt.c which creates a "NUL" stdout
handle for both parent & child processes.  This change was SVN /trunk rev
609354 and /branches/2.2.x rev 609712.

After change 609354, console signals are no longer delivered to the parent
process.  Specifically: CTRL_BREAK_EVENT which triggers an Apache restart; and
CTRL_C_EVENT, CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, and CTRL_SHUTDOWN_EVENT
which trigger an Apache shutdown.

The attached patch creates all Apache child processes with a "NUL" stdout at
their inception, but leaves the parent process with its original stdout intact
when Apache is not started as a service.  

Note that there is pre-existing code to supply a "NUL" stdout for the parent
process when Apache runs as a service without console handles, and the parent
process has no need to catch console signals when running as a Windows service
- so Apache behavior as a service remains unchanged.

This patch causes the parent to re-declare its console signal handler after
every restart.  Some libraries used by modules (like perl5xx.dll) declare a
signal handler which terminates the process on CTRL_BREAK_EVENT or
CTRL_C_EVENT.  This is the reason Apache could only perform one graceful
restart when mod_perl was used on Windows.  By re-declaring Apache's parent
signal handler after each (re-)configuration, the Apache parent process can
catch, handle, and dismiss these signals before any other library's handler can
cause the parent process to exit and leave an orphaned Apache child process.

This patch creates a new copy of the _environ array to pass to apr_proc_create
instead of trying to re-use a static copy for subsequent child creations. The
comment in mpm_winnt.c that "it won't change for the lifetime of this parent
process" is not always true.  If a module adds or changes any Windows
environment variable during configuration, the _environ array might be
realloc'd causing the static copy to have invalid pointers.

This patch works with Apache 2.2.8 and mod_perl 2.0.3/AS_Perl 5.8.8 and
mod_perl 2.0.4rc1/AS_Perl 5.10.0 on Win2k, WinXP, and Vista.  rotatelogs (for
both error and access logs) is observed to work correctly through restarts and
to terminate completely on shutdown.  Builds with VC6, VS2005 and VS2008 were
tested.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message