https://issues.apache.org/bugzilla/show_bug.cgi?id=48454
Summary: "Bad file descriptor"-IOException in CGIServlet for some programs Product: Tomcat 6 Version: 6.0.20 Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: Catalina AssignedTo: dev@tomcat.apache.org ReportedBy: mgrie...@gmx.ch Created an attachment (id=24763) --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24763) Patch The internal CGIRunner-thread which reads the errorstream logs a "Bad file descriptor"-IOException everytime i called a program (see stacktrace at the end). The program works fine, but the log-messages disturb. I could reproduce the behaviour with Nagiostat as CGI-Program (http://nagiostat.sourceforge.net/). I think the behaviour depends on how fast the cgi-program will return, because I haven't the error with another cgi-program on the same machine. Looking at the code shows that the Process-Object in CGIRunner could be destroyed before the internal Thread has a chance to completely read the errorstream. I fixed the problem in CGIServlet with a errorStreamReaderThread.join(...) before proc.destroy() to allow a clean processing of the errorstream. This is not yet fixed in tomcat trunk / branch tc6.0.x Environment: Linux, Centos5.3 x64, JDK SUN 1.6.0_17, JBoss AS 5.1.0.GA (based on tomcat6.0) Patch: The attached Patch is against source of JBossWeb2.1.3. Improvement: The timeout of the join should be configurable. java.io.IOException: Bad file descriptor at java.io.FileInputStream.readBytes(Native Method) at java.io.FileInputStream.read(FileInputStream.java:199) at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264) at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158) at java.io.InputStreamReader.read(InputStreamReader.java:167) at java.io.BufferedReader.fill(BufferedReader.java:136) at java.io.BufferedReader.readLine(BufferedReader.java:299) at java.io.BufferedReader.readLine(BufferedReader.java:362) at org.apache.catalina.servlets.CGIServlet$CGIRunner.sendToLog(CGIServlet.java:1828) at org.apache.catalina.servlets.CGIServlet$CGIRunner.access$400(CGIServlet.java:1388) at org.apache.catalina.servlets.CGIServlet$CGIRunner$1.run(CGIServlet.java:1663) -- 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: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org