Jetty
  1. Jetty
  2. JETTY-848

Temporary folder not fully cleanup after stop

    Details

    • Type: Improvement Improvement
    • Status: Resolved Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 6.1.14
    • Fix Version/s: 6.1.15.rc4
    • Component/s: Servlet
    • Labels:
      None
    • Environment:
      Windows XP SP2, JRE 1.4.2
    • Number of attachments :
      0

      Description

      Jetty is embedded into my application and a WebAppContext created from a WAR file. When the server is started, a temporary directory is created for the web application. When the server is stopped, the temporary directory remains, it has been cleanup but not completely: the jsps sub folder has been deleted (which is correct) but the webapp directory is still there: some JAR files remains under WEB-INF/lib.

        Activity

        Hide
        David Yu added a comment -

        Thanks. It indeed does leave the jars.
        I did not get the same behavior before as the jetty test-webapp did not have any jars in its WEB-INF/lib, ... and so I tested with another webapp
        that has em.

        If you look at http://bugs.sun.com/view_bug.do?bug_id=4950148 , Its a 5 year old windows bug that has not been fixed by sun.

        The behavior is that you can the jars can only be deleted when the jvm that oaded/used it is already terminated.

        There are workarounds for this ... e.g like launching a separate process (right after the jvm stops) which cleans up the jars.

        I'll think of a better solution and get back to u.

        Thanks

        Show
        David Yu added a comment - Thanks. It indeed does leave the jars. I did not get the same behavior before as the jetty test-webapp did not have any jars in its WEB-INF/lib, ... and so I tested with another webapp that has em. If you look at http://bugs.sun.com/view_bug.do?bug_id=4950148 , Its a 5 year old windows bug that has not been fixed by sun. The behavior is that you can the jars can only be deleted when the jvm that oaded/used it is already terminated. There are workarounds for this ... e.g like launching a separate process (right after the jvm stops) which cleans up the jars. I'll think of a better solution and get back to u. Thanks
        Hide
        Jan Bartel added a comment -

        Dyu,

        Good detective work. That certainly looks like the problem.

        Can you try just one more thing - try calling Resource.setDefaultUseCaches(false) early in the jetty.xml file or embedded setup. This controls whether the UrlConnection class will cache the jar contents. I'm wondering if the caches are off, if that might help the garbage collector. Probably not, but maybe worth trying?

        cheers
        Jan

        Show
        Jan Bartel added a comment - Dyu, Good detective work. That certainly looks like the problem. Can you try just one more thing - try calling Resource.setDefaultUseCaches(false) early in the jetty.xml file or embedded setup. This controls whether the UrlConnection class will cache the jar contents. I'm wondering if the caches are off, if that might help the garbage collector. Probably not, but maybe worth trying? cheers Jan
        Hide
        David Yu added a comment -

        Jan, the jars still aren't deleted even with Resource.setDefaultUseCaches(false)

        A workaround would be having a sweeper (daemon) check temp dirs that are no longer used (marked by WebAppContext) and deletes them.
        This component will be placed in jetty-contrib for those who are interested.

        Cheers

        Show
        David Yu added a comment - Jan, the jars still aren't deleted even with Resource.setDefaultUseCaches(false) A workaround would be having a sweeper (daemon) check temp dirs that are no longer used (marked by WebAppContext) and deletes them. This component will be placed in jetty-contrib for those who are interested. Cheers
        Show
        David Yu added a comment - http://svn.codehaus.org/jetty-contrib/branches/jetty-6.1.x/contrib/sweeper/
        Hide
        David Yu added a comment -

        Since this is a jvm bug (on windows), the Sweeper (daemon) will serve as a workaround

        Show
        David Yu added a comment - Since this is a jvm bug (on windows), the Sweeper (daemon) will serve as a workaround

          People

          • Assignee:
            David Yu
            Reporter:
            Jeff MAURY
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: