You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2003/01/31 00:16:45 UTC

DO NOT REPLY [Bug 16621] New: - mod_win32.c 1.16 cgi "detached" fix breaks pipes

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16621>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16621

mod_win32.c 1.16 cgi "detached" fix breaks pipes

           Summary: mod_win32.c 1.16 cgi "detached" fix breaks pipes
           Product: Apache httpd-2.0
           Version: 2.0.44
          Platform: PC
               URL: http://cvs.apache.org/viewcvs.cgi/httpd-
                    2.0/modules/arch/win32/mod_win32.c?rev=1.16&only_with_ta
                    g=APACHE_2_0_37&content-type=text/vnd.viewcvs-markup
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Platform
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: rtsai@netapp.com


Something in the mod_win32.c 1.16 change for PR 8387 (new bugzilla database)
<http://cvs.apache.org/viewcvs.cgi/httpd-2.0/modules/arch/win32/mod_win32.c?rev=1.16&only_with_tag=APACHE_2_0_37&content-type=text/vnd.viewcvs-markup>
causes a CGI (Win32 console application) to be unable to read stdout from a
spawned process (another Win32 console application).

File handles are duplicated and the child process created as documented on MSDN
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/creating_a_child_process_with_redirected_input_and_output.asp>.
The problem is that ReadFile in the parent immediately returns 109
(ERROR_BROKEN_PIPE).

Applying the following change to mod_win32.c (2.0.44) makes the problem go away:

543,544d542
< e_info->detached = 1;
<

At this point, the parent can properly read the stdout generated by the child.

The problem and solution apply both when apache is run as a service or console
application.

A side note: With and without my patch above, when apache is run as a console
application, a cmd.exe window appears on the screen when the CGI is executed
(perhaps PR 8387 is not completely fixed?).

Our apache runs as a service, so the cmd.exe windows don't bother us.

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