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=12041>.
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=12041

CGIServlet can block on input





------- Additional Comments From [EMAIL PROTECTED]  2002-08-29 13:31 -------
I'm running existing CGI script (perl/DBI), and encountered the same problem. My
current workaround is to redirect STDERR at the beginning of the script to avoid
getting into deadlock.

I applied the patch, and found the following additional issues:
+ STRERR messages should always go to the log file (following Apache
convention). It should not matter if the message if produced before, during of
after the header  section (which is coming from STDOUT).

+ The patch do not support long running scripts, that do not produce output
(during database activity)

+ The patch does not work well when there are a lot of message on STDERR, but
little output on STDOUT. The CGI script is getting blocked on STDERR, while the
servlet is waiting on STDOUT (#1734).

I think that a good solution will be
A. running an extra thread to deal with STDERR, OR
B. Using Non-Blocking IO (unfortunantely, only with JDK 1.4), OR
C. Fixing the polling loop
        while ( isRunning ) {
                if (commandsStdErr != null && commandsStdErr.ready()) {
                        /* Move STDERR data */
                else if (commandsStdOut != null && commandsStdOut.ready()) {
                        /* Deal with STDOUT data */
                else {
                        sleep a little (0.1 sec)
                }
        }
        /* Process  Cleanup */
        try {
                ... = proc.exitValue()}
        catch ( ... ) {
                /* Pause, then Kill Process if needed */
        } ;

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to