You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Tim McConnell (JIRA)" <ji...@apache.org> on 2008/10/07 05:13:44 UTC

[jira] Created: (AXIS2-4072) URLClassloader locking jarfiles on Windows

URLClassloader locking jarfiles on Windows 
-------------------------------------------

                 Key: AXIS2-4072
                 URL: https://issues.apache.org/jira/browse/AXIS2-4072
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
    Affects Versions: 1.4.1
         Environment: Windows XP, Geronimo 2.1.3
            Reporter: Tim McConnell


There is at least one scenario using Axis2 and Geronimo that is causing jarfiles to get locked on Windows such that a deployed WAR cannot be either redeployed or uninstalled. Here is a brief description of the failing scenario:

1. A WAR file containing various jarfiles in the /lib directory is deployed on Geronimo 2.1.3
2. Navigate to the deployed app's address to generate the WSDL for the web service
3. Redeploy or uninstall of the WAR will now fail since all the jarfiles in the WAR /lib directory are locked by Windows and cannot be deleted.

What appears to be happening is that there are three Axis2 URLClassLoaders in this scenario and at least two of them are creating their own ClassPath and URLClassPath$JarLoader objects that apparently are locking the jarfiles in the /lib directory. 

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Re: [jira] Created: (AXIS2-4072) URLClassloader locking jarfiles on Windows

Posted by Davanum Srinivas <da...@gmail.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tim,

For #1, There's code inside Geronimo that creates the ConfigurationContext i believe. You can set the variable there.

For #2, Sounds good, we'll have to try checking it in and see what fails :)

- -- dims

Tim McConnell wrote:
> Hi Axis2 community, I actually have a couple patches ready that can be
> used to address this JIRA, but if possible would request a little
> direction/advise first. The two patches are as described:
> 
> 1. This patch is very small and contained in the
> org.apache.axis2.deployment.util.Utils class. It essentially checks to
> determine if the Context ClassLoader can be used in the getClassLoader
> method instead of allocating a new URLClassLoader. This works great for
> this specific failing scenario and as best as I can tell does not
> adversely impact other deployment scenarios (e.g., hot deployment). It
> would be even better though if I could determine if Axis2 is running in
> a container-managed environment (e.g., Geronimo) but it's not obvious to
> me how to do so since the Constants.CONTAINER_MANAGED variable is no
> longer set for the ConfigurationContext, as it was in previous versions
> of Axis2. Would someone be able to recommend a tactic I can use to
> determine this ??
> 
> 2. The second patch essentially swaps the usage of URLClassLoader in the
> org.apache.axis2.deployment.util.Utils.getClassLoader() method with a
> variant of Geronimo's JarFileClassLoader, which extends the
> URLClassLoader to properly close JarFiles when the classloader is
> destroyed so that the file read lock will be released and the jar file
> can be modified or deleted. This also works great for this specific
> failing scenario but the patch is much larger since new classes are
> added for the JarFileClassLoader implementation plus the existing
> MultiParentClassLoader in Axis2 is enhanced as well.
> 
> My plan is attached the first patch tomorrow and ask that it be reviewed
> since it seems to me that it might be a viable solution with little
> risk, but my knowledge of Axis2 is very limited. Does this seem like a
> reasonable approach ?? Thanks much.
> 
> 
> Tim McConnell (JIRA) wrote:
>> URLClassloader locking jarfiles on Windows
>> -------------------------------------------
>>
>>                  Key: AXIS2-4072
>>                  URL: https://issues.apache.org/jira/browse/AXIS2-4072
>>              Project: Axis 2.0 (Axis2)
>>           Issue Type: Bug
>>     Affects Versions: 1.4.1
>>          Environment: Windows XP, Geronimo 2.1.3
>>             Reporter: Tim McConnell
>>
>>
>> There is at least one scenario using Axis2 and Geronimo that is
>> causing jarfiles to get locked on Windows such that a deployed WAR
>> cannot be either redeployed or uninstalled. Here is a brief
>> description of the failing scenario:
>>
>> 1. A WAR file containing various jarfiles in the /lib directory is
>> deployed on Geronimo 2.1.3
>> 2. Navigate to the deployed app's address to generate the WSDL for the
>> web service
>> 3. Redeploy or uninstall of the WAR will now fail since all the
>> jarfiles in the WAR /lib directory are locked by Windows and cannot be
>> deleted.
>>
>> What appears to be happening is that there are three Axis2
>> URLClassLoaders in this scenario and at least two of them are creating
>> their own ClassPath and URLClassPath$JarLoader objects that apparently
>> are locking the jarfiles in the /lib directory.
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFI61DMgNg6eWEDv1kRAi6AAJ99a0mkwlO3Fh9mmfwXb7mp63FvLACg62Y9
yhxDWwob7DgwAmy5SB2/NQI=
=zQFK
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Re: [jira] Created: (AXIS2-4072) URLClassloader locking jarfiles on Windows

Posted by Tim McConnell <ti...@gmail.com>.
Hi Axis2 community, I actually have a couple patches ready that can be used to 
address this JIRA, but if possible would request a little direction/advise first. 
The two patches are as described:

1. This patch is very small and contained in the 
org.apache.axis2.deployment.util.Utils class. It essentially checks to determine 
if the Context ClassLoader can be used in the getClassLoader method instead of 
allocating a new URLClassLoader. This works great for this specific failing 
scenario and as best as I can tell does not adversely impact other deployment 
scenarios (e.g., hot deployment). It would be even better though if I could 
determine if Axis2 is running in a container-managed environment (e.g., Geronimo) 
but it's not obvious to me how to do so since the Constants.CONTAINER_MANAGED 
variable is no longer set for the ConfigurationContext, as it was in previous 
versions of Axis2. Would someone be able to recommend a tactic I can use to 
determine this ??

2. The second patch essentially swaps the usage of URLClassLoader in the 
org.apache.axis2.deployment.util.Utils.getClassLoader() method with a variant of 
Geronimo's JarFileClassLoader, which extends the URLClassLoader to properly close 
JarFiles when the classloader is destroyed so that the file read lock will be 
released and the jar file can be modified or deleted. This also works great for 
this specific failing scenario but the patch is much larger since new classes are 
added for the JarFileClassLoader implementation plus the existing 
MultiParentClassLoader in Axis2 is enhanced as well.

My plan is attached the first patch tomorrow and ask that it be reviewed since it 
seems to me that it might be a viable solution with little risk, but my knowledge 
of Axis2 is very limited. Does this seem like a reasonable approach ?? Thanks much.


Tim McConnell (JIRA) wrote:
> URLClassloader locking jarfiles on Windows 
> -------------------------------------------
> 
>                  Key: AXIS2-4072
>                  URL: https://issues.apache.org/jira/browse/AXIS2-4072
>              Project: Axis 2.0 (Axis2)
>           Issue Type: Bug
>     Affects Versions: 1.4.1
>          Environment: Windows XP, Geronimo 2.1.3
>             Reporter: Tim McConnell
> 
> 
> There is at least one scenario using Axis2 and Geronimo that is causing jarfiles to get locked on Windows such that a deployed WAR cannot be either redeployed or uninstalled. Here is a brief description of the failing scenario:
> 
> 1. A WAR file containing various jarfiles in the /lib directory is deployed on Geronimo 2.1.3
> 2. Navigate to the deployed app's address to generate the WSDL for the web service
> 3. Redeploy or uninstall of the WAR will now fail since all the jarfiles in the WAR /lib directory are locked by Windows and cannot be deleted.
> 
> What appears to be happening is that there are three Axis2 URLClassLoaders in this scenario and at least two of them are creating their own ClassPath and URLClassPath$JarLoader objects that apparently are locking the jarfiles in the /lib directory. 
> 

-- 
Thanks,
Tim McConnell

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-4072) URLClassloader locking jarfiles on Windows

Posted by "Jarek Gawor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4072?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12639166#action_12639166 ] 

Jarek Gawor commented on AXIS2-4072:
------------------------------------

Forgot to mention: thanks Tim for the patch!


> URLClassloader locking jarfiles on Windows 
> -------------------------------------------
>
>                 Key: AXIS2-4072
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4072
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>    Affects Versions: 1.4.1
>         Environment: Windows XP, Geronimo 2.1.3
>            Reporter: Tim McConnell
>            Assignee: Jarek Gawor
>             Fix For: nightly
>
>         Attachments: 4072-2.patch, AXIS2-4072.patch
>
>
> There is at least one scenario using Axis2 and Geronimo that is causing jarfiles to get locked on Windows such that a deployed WAR cannot be either redeployed or uninstalled. Here is a brief description of the failing scenario:
> 1. A WAR file containing various jarfiles in the /lib directory is deployed on Geronimo 2.1.3
> 2. Navigate to the deployed app's address to generate the WSDL for the web service
> 3. Redeploy or uninstall of the WAR will now fail since all the jarfiles in the WAR /lib directory are locked by Windows and cannot be deleted.
> What appears to be happening is that there are three Axis2 URLClassLoaders in this scenario and at least two of them are creating their own ClassPath and URLClassPath$JarLoader objects that apparently are locking the jarfiles in the /lib directory. 

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Assigned: (AXIS2-4072) URLClassloader locking jarfiles on Windows

Posted by "Davanum Srinivas (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-4072?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Davanum Srinivas reassigned AXIS2-4072:
---------------------------------------

    Assignee: Jarek Gawor

Jarek,

Can you please take care of this?

thanks,
dims

> URLClassloader locking jarfiles on Windows 
> -------------------------------------------
>
>                 Key: AXIS2-4072
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4072
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>    Affects Versions: 1.4.1
>         Environment: Windows XP, Geronimo 2.1.3
>            Reporter: Tim McConnell
>            Assignee: Jarek Gawor
>         Attachments: AXIS2-4072.patch
>
>
> There is at least one scenario using Axis2 and Geronimo that is causing jarfiles to get locked on Windows such that a deployed WAR cannot be either redeployed or uninstalled. Here is a brief description of the failing scenario:
> 1. A WAR file containing various jarfiles in the /lib directory is deployed on Geronimo 2.1.3
> 2. Navigate to the deployed app's address to generate the WSDL for the web service
> 3. Redeploy or uninstall of the WAR will now fail since all the jarfiles in the WAR /lib directory are locked by Windows and cannot be deleted.
> What appears to be happening is that there are three Axis2 URLClassLoaders in this scenario and at least two of them are creating their own ClassPath and URLClassPath$JarLoader objects that apparently are locking the jarfiles in the /lib directory. 

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-4072) URLClassloader locking jarfiles on Windows

Posted by "Tim McConnell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-4072?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tim McConnell updated AXIS2-4072:
---------------------------------

    Attachment: AXIS2-4072.patch

Attaching patch to use context classloader whenever possible to remedy a very specific failing scenario when running on Geronimo. If this patch, or some variation of it, is not acceptable to Axis2 community I can attach another patch that will swap the usage of URLClassLoader in the org.apache.axis2.deployment.util.Utils.getClassLoader() method with a variant of Geronimo's JarFileClassLoader, which extends the URLClassLoader to properly close JarFiles when the classloader is destroyed so that the held read lock(s) will be released. Please advise. Thanks much

> URLClassloader locking jarfiles on Windows 
> -------------------------------------------
>
>                 Key: AXIS2-4072
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4072
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>    Affects Versions: 1.4.1
>         Environment: Windows XP, Geronimo 2.1.3
>            Reporter: Tim McConnell
>         Attachments: AXIS2-4072.patch
>
>
> There is at least one scenario using Axis2 and Geronimo that is causing jarfiles to get locked on Windows such that a deployed WAR cannot be either redeployed or uninstalled. Here is a brief description of the failing scenario:
> 1. A WAR file containing various jarfiles in the /lib directory is deployed on Geronimo 2.1.3
> 2. Navigate to the deployed app's address to generate the WSDL for the web service
> 3. Redeploy or uninstall of the WAR will now fail since all the jarfiles in the WAR /lib directory are locked by Windows and cannot be deleted.
> What appears to be happening is that there are three Axis2 URLClassLoaders in this scenario and at least two of them are creating their own ClassPath and URLClassPath$JarLoader objects that apparently are locking the jarfiles in the /lib directory. 

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-4072) URLClassloader locking jarfiles on Windows

Posted by "Jarek Gawor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4072?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12637366#action_12637366 ] 

Jarek Gawor commented on AXIS2-4072:
------------------------------------

Tim, please correct me if I'm wrong but this problem can be replicated on Tomcat (or any other web container or application server) on Windows. 

> URLClassloader locking jarfiles on Windows 
> -------------------------------------------
>
>                 Key: AXIS2-4072
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4072
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>    Affects Versions: 1.4.1
>         Environment: Windows XP, Geronimo 2.1.3
>            Reporter: Tim McConnell
>
> There is at least one scenario using Axis2 and Geronimo that is causing jarfiles to get locked on Windows such that a deployed WAR cannot be either redeployed or uninstalled. Here is a brief description of the failing scenario:
> 1. A WAR file containing various jarfiles in the /lib directory is deployed on Geronimo 2.1.3
> 2. Navigate to the deployed app's address to generate the WSDL for the web service
> 3. Redeploy or uninstall of the WAR will now fail since all the jarfiles in the WAR /lib directory are locked by Windows and cannot be deleted.
> What appears to be happening is that there are three Axis2 URLClassLoaders in this scenario and at least two of them are creating their own ClassPath and URLClassPath$JarLoader objects that apparently are locking the jarfiles in the /lib directory. 

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Resolved: (AXIS2-4072) URLClassloader locking jarfiles on Windows

Posted by "Jarek Gawor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-4072?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jarek Gawor resolved AXIS2-4072.
--------------------------------

       Resolution: Fixed
    Fix Version/s: nightly

Committed the patch to trunk (revision 704201) with a minor change so that the JarFileClassLoader is only used on Windows by default. The user can also explicitly control whether JarFileClassLoader should be used or not (on any OS) by setting org.apache.axis2.classloader.JarFileClassLoader=<boolean> system property.


> URLClassloader locking jarfiles on Windows 
> -------------------------------------------
>
>                 Key: AXIS2-4072
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4072
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>    Affects Versions: 1.4.1
>         Environment: Windows XP, Geronimo 2.1.3
>            Reporter: Tim McConnell
>            Assignee: Jarek Gawor
>             Fix For: nightly
>
>         Attachments: 4072-2.patch, AXIS2-4072.patch
>
>
> There is at least one scenario using Axis2 and Geronimo that is causing jarfiles to get locked on Windows such that a deployed WAR cannot be either redeployed or uninstalled. Here is a brief description of the failing scenario:
> 1. A WAR file containing various jarfiles in the /lib directory is deployed on Geronimo 2.1.3
> 2. Navigate to the deployed app's address to generate the WSDL for the web service
> 3. Redeploy or uninstall of the WAR will now fail since all the jarfiles in the WAR /lib directory are locked by Windows and cannot be deleted.
> What appears to be happening is that there are three Axis2 URLClassLoaders in this scenario and at least two of them are creating their own ClassPath and URLClassPath$JarLoader objects that apparently are locking the jarfiles in the /lib directory. 

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-4072) URLClassloader locking jarfiles on Windows

Posted by "Tim McConnell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-4072?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tim McConnell updated AXIS2-4072:
---------------------------------

    Attachment: 4072-2.patch

As requested by Jarek I'm attaching my second patch. This one will swap the URLClassLoader instantiated in 
package org.apache.axis2.deployment.util.Utils.getClassLoader() with a JarFileClassLoader. It also explicitly calls the destroy() operation on those JarFileClassLoader(s) where appropriate and necessary. Note that this patch is mutually exclusive of the first patch. Thanks 

> URLClassloader locking jarfiles on Windows 
> -------------------------------------------
>
>                 Key: AXIS2-4072
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4072
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>    Affects Versions: 1.4.1
>         Environment: Windows XP, Geronimo 2.1.3
>            Reporter: Tim McConnell
>            Assignee: Jarek Gawor
>         Attachments: 4072-2.patch, AXIS2-4072.patch
>
>
> There is at least one scenario using Axis2 and Geronimo that is causing jarfiles to get locked on Windows such that a deployed WAR cannot be either redeployed or uninstalled. Here is a brief description of the failing scenario:
> 1. A WAR file containing various jarfiles in the /lib directory is deployed on Geronimo 2.1.3
> 2. Navigate to the deployed app's address to generate the WSDL for the web service
> 3. Redeploy or uninstall of the WAR will now fail since all the jarfiles in the WAR /lib directory are locked by Windows and cannot be deleted.
> What appears to be happening is that there are three Axis2 URLClassLoaders in this scenario and at least two of them are creating their own ClassPath and URLClassPath$JarLoader objects that apparently are locking the jarfiles in the /lib directory. 

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-4072) URLClassloader locking jarfiles on Windows

Posted by "Tim McConnell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-4072?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12637691#action_12637691 ] 

Tim McConnell commented on AXIS2-4072:
--------------------------------------

Hi Jarek, yes you are correct.

> URLClassloader locking jarfiles on Windows 
> -------------------------------------------
>
>                 Key: AXIS2-4072
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4072
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>    Affects Versions: 1.4.1
>         Environment: Windows XP, Geronimo 2.1.3
>            Reporter: Tim McConnell
>
> There is at least one scenario using Axis2 and Geronimo that is causing jarfiles to get locked on Windows such that a deployed WAR cannot be either redeployed or uninstalled. Here is a brief description of the failing scenario:
> 1. A WAR file containing various jarfiles in the /lib directory is deployed on Geronimo 2.1.3
> 2. Navigate to the deployed app's address to generate the WSDL for the web service
> 3. Redeploy or uninstall of the WAR will now fail since all the jarfiles in the WAR /lib directory are locked by Windows and cannot be deleted.
> What appears to be happening is that there are three Axis2 URLClassLoaders in this scenario and at least two of them are creating their own ClassPath and URLClassPath$JarLoader objects that apparently are locking the jarfiles in the /lib directory. 

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org