Javassist lazy proxy factoring not thread-safe
----------------------------------------------
Key: HIBERNATE-46
URL:
http://jira.jboss.com/jira/browse/HIBERNATE-46
Project: Hibernate
Issue Type: Bug
Environment: JBoss AS 4.0.4 with EJB 3-RC8
Reporter: Ortwin Glück
Assigned To: Steve Ebersole
Multiple threads may simultanously (especially on SMP systems) create proxy classes for
the first time. The JavassistLazyInitializer is not completely thread safe. So the first
thread will successfully create the dynamic class, while a second thread may fail. We saw
this happen a few times at JBoss startup when multiple messages from other systems arrived
via JMS (quite normal when you take your PROD system down for some minutes, as work keeps
queuing up). So multiple MDB threads were running the same transactions (using the same
classes) and thus the probability for this error to occur is close to 100%.
The situation can easily be solved by proper synchronization inside the
JavassistLazyInitializer.
Caused by: java.lang.RuntimeException: by java.lang.LinkageError: duplicate clas
s definition: test/BusinessOrganization_$$_javass
ist_272
at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:173)
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxy(
JavassistLazyInitializer.java:79)
... 136 more
Caused by: javassist.CannotCompileException: by java.lang.LinkageError: duplicat
e class definition: ch/logobject/mlogistics/om/resource/BusinessOrganization_$$_
javassist_272
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:125)
at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:169)
... 137 more
Caused by: java.lang.LinkageError: duplicate class definition:
test/BusinessOrganization_$$_javassist_272
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
at sun.reflect.GeneratedMethodAccessor110.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:117)
... 138 more
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira