You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2009/12/29 11:46:55 UTC

DO NOT REPLY [Bug 48454] New: "Bad file descriptor"-IOException in CGIServlet for some programs

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: mgrieder@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 48454] "Bad file descriptor"-IOException in CGIServlet for some programs

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48454

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #2 from Mark Thomas <ma...@apache.org> 2010-01-06 02:29:50 GMT ---
This has been fixed in 6.0.x and will be included in 6.0.23 onwards.

-- 
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 48454] "Bad file descriptor"-IOException in CGIServlet for some programs

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48454

--- Comment #1 from Mark Thomas <ma...@apache.org> 2009-12-30 02:47:51 GMT ---
Thanks for the report and the patch.

I have applied the patch + a configuration option for the timeout to trunk
(Tomcat 7) and proposed it for 6.0.x.

-- 
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org