Issue Details (XML | Word | Printable)

Key: GLASSFISH-19696
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: TangYong
Reporter: TangYong
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
glassfish

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

Created: 20/Feb/13 11:17 AM   Updated: 27/Mar/13 04:02 AM   Resolved: 27/Mar/13 04:02 AM
Component/s: OSGi-JavaEE
Affects Version/s: 3.1.2
Fix Version/s: 4.0_b82_EE7MS7

Time Tracking:
Not Specified

Environment:

Windows XP


Tags:
Participants: Sanjeeb Sahoo and TangYong


 Description  « Hide

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.



TangYong added a comment - 22/Feb/13 12:15 PM

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.

TangYong added a comment - 22/Feb/13 12:33 PM

Patch has passed fighterfish it tests.


Sanjeeb Sahoo added a comment - 22/Feb/13 12:38 PM

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.


TangYong added a comment - 22/Feb/13 01:16 PM

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();
...

Sanjeeb Sahoo added a comment - 26/Mar/13 05:05 AM

Updated the synopsys.


Sanjeeb Sahoo added a comment - 27/Mar/13 04:02 AM

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