glassfish
  1. glassfish
  2. GLASSFISH-19696

[osgi/web] wab expanded directory does not be cleaned during undeployment of WAB due to jar file handle being in use

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.2
    • Fix Version/s: 4.0_b82_EE7MS7
    • Component/s: OSGi-JavaEE
    • Labels:
      None
    • Environment:

      Windows XP

      Description

      wab expanded directory can not be cleaned while having fragments.

      Reproduced Steps are as following:

      1 asadmin deploy --type=osgi sample.uas.api.jar
      2 asadmin deploy --type=osgi sample.uas.simplewabfragment.jar
      3 asadmin deploy --type=osgi sample.uas.simplewab.war
      4 asadmin undeploy sample.uas.simplewab
      5 entering into OS temp directory, and you will find the following file(eg. in my env) is not deleted

      osgiapp569463777010148476\WEB-INF\lib\Bundle290.jar, and Bundle290 is the fragment bundle id.

      So, the fragment bundle must be in use.

        Activity

        Hide
        TangYong added a comment -

        The bug is not only for fragments and general scene is that in a wab, once putting any jar into the wab's WEB-INF\lib, the bug will re-produce.

        Now, the bug reason(jar file resouces have not been closed) has been found and a patch is in sahoo's review.

        Current my fixing patch is as following:

        Index: OSGiWebDeploymentContext.java
        ===================================================================
        — OSGiWebDeploymentContext.java (revision 58798)
        +++ OSGiWebDeploymentContext.java (working copy)
        @@ -1,7 +1,7 @@
        /*

        • DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
          *
        • * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
          + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
          *
        • The contents of this file are subject to the terms of either the GNU
        • General Public License Version 2 only ("GPL") or the Common Development
          @@ -230,9 +230,12 @@
          }
          }))
          {
          + //[TangYong]fixing GLASSFISH-19696
          + JarFile jarFile = null;
          try { - addJar(file.getPath().substring(baseFileLen), - new JarFile(file), file); + jarFile = new JarFile(file); + addJar(file.getPath().substring(baseFileLen), jarFile, file); + jarFile.close(); }

          catch (Exception e) {
          // Catch and ignore any exception in case the JAR file
          // is empty.

        Show
        TangYong added a comment - The bug is not only for fragments and general scene is that in a wab, once putting any jar into the wab's WEB-INF\lib, the bug will re-produce. Now, the bug reason(jar file resouces have not been closed) has been found and a patch is in sahoo's review. Current my fixing patch is as following: Index: OSGiWebDeploymentContext.java =================================================================== — OSGiWebDeploymentContext.java (revision 58798) +++ OSGiWebDeploymentContext.java (working copy) @@ -1,7 +1,7 @@ /* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. * The contents of this file are subject to the terms of either the GNU General Public License Version 2 only ("GPL") or the Common Development @@ -230,9 +230,12 @@ } })) { + // [TangYong] fixing GLASSFISH-19696 + JarFile jarFile = null; try { - addJar(file.getPath().substring(baseFileLen), - new JarFile(file), file); + jarFile = new JarFile(file); + addJar(file.getPath().substring(baseFileLen), jarFile, file); + jarFile.close(); } catch (Exception e) { // Catch and ignore any exception in case the JAR file // is empty.
        Hide
        TangYong added a comment -

        Patch has passed fighterfish it tests.

        Show
        TangYong added a comment - Patch has passed fighterfish it tests.
        Hide
        Sanjeeb Sahoo added a comment -

        Fabulous. Pl commit.

        BTW, when you commit, please use following format in svn comment (I will update WIki with this information):

        GLASSFISH-19696: wab expanded directory can not be cleaned
        Description ...

        Also, update RELEASENOTE.txt with details.

        Finally, when you supply code in JIRA comments, surround them with

         Your Code 

        so that they come out nicely formatted. See the little formatting help tooltip on the right side.

        Show
        Sanjeeb Sahoo added a comment - Fabulous. Pl commit. BTW, when you commit, please use following format in svn comment (I will update WIki with this information): GLASSFISH-19696 : wab expanded directory can not be cleaned Description ... Also, update RELEASENOTE.txt with details. Finally, when you supply code in JIRA comments, surround them with Your Code so that they come out nicely formatted. See the little formatting help tooltip on the right side.
        Hide
        TangYong added a comment -

        Committing has been done.

        [GLASSFISH-19696 Fixing]
        Revision: 59768

        [RELEASENOTE.txt Updating]
        Revision: 59770

        [Fixing Code]

        OSGiWebDeploymentContext.java
        ...
        //[TangYong]fixing GLASSFISH-19696
        JarFile jarFile = null;
        try {
              jarFile = new JarFile(file);
              addJar(file.getPath().substring(baseFileLen), jarFile, file);
              jarFile.close();
        ...
        
        Show
        TangYong added a comment - Committing has been done. [GLASSFISH-19696 Fixing] Revision: 59768 [RELEASENOTE.txt Updating] Revision: 59770 [Fixing Code] OSGiWebDeploymentContext.java ... //[TangYong]fixing GLASSFISH-19696 JarFile jarFile = null ; try { jarFile = new JarFile(file); addJar(file.getPath().substring(baseFileLen), jarFile, file); jarFile.close(); ...
        Hide
        Sanjeeb Sahoo added a comment -

        Updated the synopsys.

        Show
        Sanjeeb Sahoo added a comment - Updated the synopsys.
        Hide
        Sanjeeb Sahoo added a comment -

        Integrated osgi-web-container:1.0.6 with glassfish trunk in svn #60905, so marking the bug as resolved.

        Show
        Sanjeeb Sahoo added a comment - Integrated osgi-web-container:1.0.6 with glassfish trunk in svn #60905, so marking the bug as resolved.

          People

          • Assignee:
            TangYong
            Reporter:
            TangYong
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: