Return-Path: Delivered-To: apmail-jakarta-tomcat-dev-archive@www.apache.org Received: (qmail 84921 invoked from network); 13 Oct 2004 16:38:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 13 Oct 2004 16:38:08 -0000 Received: (qmail 94891 invoked by uid 500); 13 Oct 2004 16:37:13 -0000 Delivered-To: apmail-jakarta-tomcat-dev-archive@jakarta.apache.org Received: (qmail 94738 invoked by uid 500); 13 Oct 2004 16:37:11 -0000 Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Developers List" Reply-To: "Tomcat Developers List" Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 94647 invoked by uid 99); 13 Oct 2004 16:37:06 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [213.191.128.16] (HELO mxout2.iskon.hr) (213.191.128.16) by apache.org (qpsmtpd/0.28) with SMTP; Wed, 13 Oct 2004 09:37:02 -0700 Received: (qmail 20637 invoked from network); 13 Oct 2004 18:36:57 +0200 X-Remote-IP: 213.191.142.123 Received: from unknown (HELO mx.iskon.hr) (213.191.142.123) by mxout2.iskon.hr with SMTP; 13 Oct 2004 18:36:57 +0200 Received: (qmail 13288 invoked from network); 13 Oct 2004 18:36:57 +0200 X-Remote-IP: 213.191.128.85 Received: from postman.iskon.hr (HELO postman.iskon.local) (213.191.128.85) by mx.iskon.hr with SMTP; 13 Oct 2004 18:36:57 +0200 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable Subject: CGIRunner (at CGIServlet) problem X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Date: Wed, 13 Oct 2004 18:36:57 +0200 Message-ID: <550DB94D61B5BA43AF7A61339ECA6B4CC69A6B@postman.iskon.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: CGIRunner (at CGIServlet) problem Thread-Index: AcSxQtrCk2LyT9GGTraEt8hwsJ6XIA== From: =?iso-8859-2?Q?Kre=B9imir_Pavi=E6?= To: "Tomcat Developers List" X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi! I've found a problem in CGI module (servlets-cgi.jar) in Tomcat = distribution. The problem occures in some occasions that are hard to reproduce.=20 We have Tomcat that invokes some CGI (webmail) on Linux (Debian). Everthings worked fine, but after few days we discoverd lots of cgi programms that are hanged in = WRITE mode. So after a week, we needed fast restart of Tomcat (OutOfMemoryError -> = hanging=20 forked proceses). Problem was detected in next few line (thread that reads from forked = process and wirites data to client). In few occasions we catched this exception: java.net.SocketExcpetion: ClientAbortException (in code below) and our forked process didn't finish his work and remained hanging (in write mode ), but sometimes we got = this exception: java.net.SocketException: Broken pipe (in catalina.out) and forked = process finished=20 his work as supposed. Both exceptions are thrown wheb client closes his/her browser before = anthing appears. First excpetion is very hard to reproduce (try it :-). The solution is to add try-catch block in while loop. With this = modification, any forked process will finish his work and be able to write the complete = content=20 (somewhere). while ((bufRead =3D commandsStdOut.read(cBuf)) !=3D -1) { if (servletContainerStdout !=3D null) { if (debug >=3D 4) { log("runCGI: write(\"" + new String(cBuf, 0, bufRead) + "\")"); } ///////////////////////////// // new code try { servletContainerStdout.write(cBuf, 0, bufRead); // old line } catch (java.net.SocketException se { servletContainerStdout =3D null; // end of new code //////////////////////// } } kresimir --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org