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 2005/11/08 18:05:37 UTC

DO NOT REPLY [Bug 37407] New: - file descriptor leak in jasper

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=37407

           Summary: file descriptor leak in jasper
           Product: Tomcat 5
           Version: 5.5.12
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: fred@stsci.edu


On my linux system I was in the proc directory for tomcat and noticed that
for each jsp file that was compiled I was ending up with two file
descriptors that were never closed.

I made the following change to JspReader and the problem seems to have gone
away.  I don't know what is causing the jsp files to be "reregistered"
multiple times that in turn causes the descriptor leak to appear.  Also I
am assuming there that err.jspError() always throws an Exception.  You could
also put the err.jspErrror() call inside the try/catch, but then you would have
to check for the type of exception in the catch block.

My impression is that it should never lead pushFile() with the reader still
open.

diff -C5 JspReader.java JspReader.java.new
*** JspReader.java      2005-09-23 09:45:24.000000000 -0400
--- JspReader.java.new  2005-11-08 12:04:14.000000000 -0500
***************
*** 513,522 ****
--- 513,527 ----
          String longName = file;
   
          int fileid = registerSourceFile(longName);
   
          if (fileid == -1) {
+             if (reader != null) {
+                 try {
+                     reader.close();
+                 } catch (Exception any) {}
+             }
              err.jspError("jsp.error.file.already.registered", file);
          }
   
          currFileId = fileid;

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org