DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41502>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41502

           Summary: WebappClassLoader concurrency problem defining packages
           Product: Tomcat 5
           Version: 5.5.20
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: [EMAIL PROTECTED]


If multiple threads happen to try to load Classes from the same package at the
same time, an IllegalArgumentException can be thrown from
ClassLoader.definePackage() in the second thread as the package has been defined
in the first thread already.

The problem is the call to ClassLoader.getPackage(String) followed by
ClassLoader.definePackage(...) if there is a null package object returned. These
methods synchronize internally on the "packages" map, but it is possible if that
lock is contended on the getPackages() call to call definePackage() twice -
leading to the IllegalArgEx.

We have seen this in production (with 5.5.15):
2007-01-25 16:48:20,269 ERROR [atlassian.jira.util.JiraTypeUtils] Exception
loading type: com.atlassian.jira.security.type.CurrentReporter
java.lang.IllegalArgumentException: com.atlassian.jira.security.type
at java.lang.ClassLoader.definePackage(ClassLoader.java:1418)
at
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1595)
at
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:850)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1299)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
at com.atlassian.core.util.ClassLoaderUtils.loadClass(ClassLoaderUtils.java:51)
at com.atlassian.jira.util.JiraUtils.loadComponent(JiraUtils.java:53)

I believe this is the same as this report:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4717252

Which seems to have led to this patch:
http://mail-archives.apache.org/mod_mbox/tomcat-dev/200207.mbox/[EMAIL 
PROTECTED]

of which I know not what happened. That being said, the patch does not seem to
be the best way to solve this. Consider catching the IllegalArg and retrying to
get the package?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to