Uploaded image for project: 'Tapestry'
  1. Tapestry
  2. TAPESTRY-2735

File handle "leak" in AssetService.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 4.1.6
    • None
    • Framework
    • None
    • Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
      Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02, mixed mode)
      Tomcat 6.0.18
      RHEL 5.3 X64

    Description

      I've been hitting my ulimit for file descriptors on a production server. I've tracked it down to several hundred open connections to tapestry-framework-4.1.6.jar

      Using: https://issues.apache.org/jira/browse/TRINIDAD-978 which led me to: http://www.nabble.com/WEBSPHERE-:-ModificationWatcher-OutOfMemory-errors-td18486458.html . I was able to resolve the issue by explicitly closing the JarURLConnection input stream with the following diff off the http://svn.apache.org/repos/asf/tapestry/tapestry4/tags/4.1.6-final-corrected branch:

      Index: tapestry-framework/src/java/org/apache/tapestry/asset/AssetService.java
      ===================================================================
      — tapestry-framework/src/java/org/apache/tapestry/asset/AssetService.java (revision 774015)
      +++ tapestry-framework/src/java/org/apache/tapestry/asset/AssetService.java (working copy)
      @@ -309,7 +309,23 @@
      if (_log.isDebugEnabled())
      _log.debug("cachedResource(" + resourceURL.getURL() + ") modified-since header is: " + modifiedSince);

      • if (resourceURL.getLastModified() > modifiedSince)
        + long lastModified = 0;
        + try
        + { + lastModified = resourceURL.getLastModified(); + }

        + finally
        +

        Unknown macro: {+ try+ { + resourceURL.getInputStream().close(); + }+ catch (java.io.IOException e)+ { + }+ }


        +
        + if (lastModified > modifiedSince)
        return false;

      _response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);

      Attachments

        Activity

          People

            Unassigned Unassigned
            jkessinger Joshua Kessinger
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: