[ 
https://issues.apache.org/jira/browse/WICKET-438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12490290
 ] 

Jean-Baptiste Quenot commented on WICKET-438:
---------------------------------------------

In UrlResourceStream#lastModifiedTime() have you tried to remove the whole code 
within the "if (urlConnection instanceof JarURLConnection)" statement to see if 
it helps?  Also be careful with the finally statement that might open a 
connection to the JAR if (close == true).

> File handles are leaked when loading images from a jar file, Tomcat crashes
> ---------------------------------------------------------------------------
>
>                 Key: WICKET-438
>                 URL: https://issues.apache.org/jira/browse/WICKET-438
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.2.5
>         Environment: java version "1.5.0_07", Mac OS X 10.4, Tomcat 5.5.20
> and also 
> java version "1.5.0_07", Linux 2.6.8, Tomcat 5.5.17
> Firefox 2.0.3 with Web developer Toolbar
>            Reporter: Stefan Wille
>         Assigned To: Johan Compagner
>             Fix For: 1.2.6
>
>         Attachments: UrlResourceStream.java
>
>
> Wicket leaks file handles when it accesses image files that are part of a jar 
> file, e.g. wicket-1.2.5.jar.
> To reproduce this bug, please switch off the browser cache.
> My Wicket application uses TreeTable. When I access the page with the 
> TreeTable on my Mac server, I see the number of open file handles jump. If I 
> do that repeatedly, I can leak about 50 file handles.
> I observe the number of open file handles via this shell command: while true; 
>  do sleep 1; lsof | grep wicket | wc -l; done
> If I do the same test on a Linux server, the number of open files jumps so 
> quickly that I reach 1015 open files after about 4 requests.  At this point, 
> Tomcat runs out of file handles, writes a log entry in catalina.out and dies. 
> Probably Tomcat shouldn't crash, but the problem is that Wicket leaks file 
> handles.
> I can also see leaked file handles when I repeatedly access an image from a 
> jar file via 
> http://localhost:8070/wicket-examples/ajax/resources/wicket.extensions.markup.html.tree.DefaultAbstractTree/res/tree-images.png
> The problem can also be reproduced via wicket-examples 1.2.5 and its 
> TreeTable example page by exanding and collapsing the tree table repeatedly.
> If I unpack both wicket-1.2.5.jar and wicket-extensions-1.2.5.jar in 
> WEB-INF/classes and delete the jars afterwards, the number of used file 
> handles remains constant at 5! So access to images in WEB-INF/classes works 
> fine.
> "lsof | grep wicket" gives me:
> firefox-b 1372 stefan   19r     REG      14,2    486664  1733273 
> /Users/stefan/Software/apache-tomcat-5.5.20/webapps/middletier/WEB-INF/lib/wicket-extensions-1.2.5.jar
> bash      1880 stefan  cwd      DIR      14,2       578  1058285 
> /Users/stefan/Software/wicket-1.2.5
> bash      4339 stefan  cwd      DIR      14,2       578  1058285 
> /Users/stefan/Software/wicket-1.2.5
> java      9529 stefan  txt      REG      14,2   1249210  1750285 
> /Users/stefan/Software/apache-tomcat-5.5.20/webapps/middletier/WEB-INF/lib/wicket-1.2.zoomos-SNAPSHOT.jar
> java      9529 stefan  txt      REG      14,2    486664  1750274 
> /Users/stefan/Software/apache-tomcat-5.5.20/webapps/middletier/WEB-INF/lib/wicket-extensions-1.2.5.jar
> java      9529 stefan  txt      REG      14,2     11063  1750305 
> /Users/stefan/Software/apache-tomcat-5.5.20/webapps/middletier/WEB-INF/lib/wicket-spring-annot-1.2.5.jar
> java      9529 stefan  txt      REG      14,2     24890  1750306 
> /Users/stefan/Software/apache-tomcat-5.5.20/webapps/middletier/WEB-INF/lib/wicket-spring-1.2.5.jar
> java      9529 stefan   29r     REG      14,2    486664  1750274 
> /Users/stefan/Software/apache-tomcat-5.5.20/webapps/middletier/WEB-INF/lib/wicket-extensions-1.2.5.jar
> java      9529 stefan   30r     REG      14,2    486664  1750274 
> /Users/stefan/Software/apache-tomcat-5.5.20/webapps/middletier/WEB-INF/lib/wicket-extensions-1.2.5.jar
> java      9529 stefan   31r     REG      14,2    486664  1750274 
> /Users/stefan/Software/apache-tomcat-5.5.20/webapps/middletier/WEB-INF/lib/wicket-extensions-1.2.5.jar
> java      9529 stefan   32r     REG      14,2    486664  1750274 
> /Users/stefan/Software/apache-tomcat-5.5.20/webapps/middletier/WEB-INF/lib/wicket-extensions-1.2.5.jar
> java      9529 stefan   33r     REG      14,2    486664  1750274 
> /Users/stefan/Software/apache-tomcat-5.5.20/webapps/middletier/WEB-INF/lib/wicket-extensions-1.2.5.jar
> java      9529 stefan   34r     REG      14,2    486664  1750274 
> /Users/stefan/Software/apache-tomcat-5.5.20/webapps/middletier/WEB-INF/lib/wicket-extensions-1.2.5.jar
> java      9529 stefan   35r     REG      14,2    486664  1750274 
> /Users/stefan/Software/apache-tomcat-5.5.20/webapps/middletier/WEB-INF/lib/wicket-extensions-1.2.5.jar
> java      9529 stefan   36r     REG      14,2    486664  1750274 
> /Users/stefan/Software/apache-tomcat-5.5.20/webapps/middletier/WEB-INF/lib/wicket-extensions-1.2.5.jar
> java      9529 stefan   37r     REG      14,2    486664  1750274 
> /Users/stefan/Software/apache-tomcat-5.5.20/webapps/middletier/WEB-INF/lib/wicket-extensions-1.2.5.jar
> java      9529 stefan   38r     REG      14,2    486664  1750274 
> /Users/stefan/Software/apache-tomcat-5.5.20/webapps/middletier/WEB-INF/lib/wicket-extensions-1.2.5.jar
> java      9529 stefan   39r     REG      14,2    486664  1750274 
> /Users/stefan/Software/apache-tomcat-5.5.20/webapps/middletier/WEB-INF/lib/wicket-extensions-1.2.5.jar
> java      9529 stefan   40r     REG      14,2    486664  1750274 
> /Users/stefan/Software/apache-tomcat-5.5.20/webapps/middletier/WEB-INF/lib/wicket-extensions-1.2.5.jar
> java      9529 stefan   41r     REG      14,2    486664  1750274 
> /Users/stefan/Software/apache-tomcat-5.5.20/webapps/middletier/WEB-INF/lib/wicket-extensions-1.2.5.jar
> [...many lines like this deleted]

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to