[Design of POJO Server] - Re: Strange classloading behavior -- thread stuck
by adrian@jboss.org
"bstansberry(a)jboss.com" wrote : I was able to induce the classloading loop quite easily using JDK 6 (u12) a stock 5.0.0.GA. But with the 2.0.3-SNAPSHOT libraries I've been trying for over half an hour without success.
|
| So, something you did helped. :-)
|
| More mysterious is exactly what caused the problem. I have logs from a server that failed and grepped for "Circular" or "LinkageError" and saw nothing. The logs are quite complex so it would probably take hours of detail analysis to get anything out of them. I attached them to JBCL-81 just so they are archived somewhere in case they prove useful.
|
I've been examing your log and I think I understand another way this can happen.
My fix is also correct in that case as well, which is why it helped.
Its failry complicated so bare with me (I'll try and simplify it to the bare minimum :-).
Step 1
Thread1: gets a lock on ClassLoader A to do a normal classloading request on ClassA
Step 2
Thread1: to load ClassA it also needs to load ClassB from ClassLoader B
Thread1: aquires the lock - but hasn't scheduled the task yet
Step 3
Thread2: wants to load ClassC from ClassLoaderA and schedules against Thread1
to do that since it owns the lock
Step 4
Thread1: schedules the load ClassB, but it is behind ClassC
Step 5
Thread1: does the load on ClassC but this requires to load ClassD from ClassLoaderA
(note Thread1 is now the requestingThread even the requestingThread for the inital load
of ClassC - this is the importan part)
Step 6
Thread1: Schedules the load of ClassD
Step 7
Thread1: does the load of ClassB and then tries to reassign the tasks.
But there is still the load of ClassD for the same thread in the list from step (5)
So it loops trying to reassign to itself.
As I noted in step (5) the case I'd missed when trying to determine how it could happen
is when you get a recursive classloading request. Although the load of ClassC
belongs to Thread2, its knock on effect to load ClassD actually belongs to Thread1
So the ClassCircularity bug is not required to reproduce the problem,
just this "jumping the queue" or more correctly, interleaving of recursive requests
that get executed on the same thread.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4206995#4206995
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4206995
15 years, 4 months
[Design of EJB 3.0] - JPA deployers in jboss-ejb3-embedded
by jaikiran
jboss-ejb3-embedded uses its own copy of jpa-deployers-beans.xml:
| <?xml version="1.0" encoding="UTF-8"?>
| <deployment xmlns="urn:jboss:bean-deployer:2.0">
| <bean name="DataSourceDependencyResolver" class="org.jboss.ejb3.embedded.resolvers.EmbeddedDataSourceDependencyResolver"/>
|
| <bean name="JavaEEModuleInformer" class="org.jboss.ejb3.embedded.javaee.SimpleJavaEEModuleInformer"/>
|
| <bean name="PersistenceUnitDependencyResolver" class="org.jboss.jpa.resolvers.DefaultPersistenceUnitDependencyResolver"/>
|
| <bean name="PersistenceParsingDeployer" class="org.jboss.jpa.deployers.PersistenceParsingDeployer"/>
|
| <bean name="PersistenceDeployer" class="org.jboss.jpa.deployers.PersistenceDeployer"/>
| <bean name="PersistenceUnitDeployer" class="org.jboss.jpa.deployers.PersistenceUnitDeployer">
| <property name="defaultPersistenceProperties">
| <map keyClass="java.lang.String" valueClass="java.lang.String">
| <entry>
| <key>hibernate.transaction.manager_lookup_class</key>
| <value>org.hibernate.transaction.JBossTransactionManagerLookup</value>
| </entry>
| </map>
| </property>
| </bean>
| </deployment>
While working on https://jira.jboss.org/jira/browse/EJBTHREE-1716 i had to upgrade the version of jboss-ejb3-core to 1.0.0 in the pom.xml dependency of embedded. This version of ejb3-core expects the PersistenceUnitDependencyResolver to have a search strategy and has various different impls. The ejb3-core by default uses:
| <bean name="PersistenceUnitDependencyResolver" class="org.jboss.jpa.resolvers.DynamicPersistenceUnitDependencyResolver"/>
Which one do we want to use in the ejb3-embedded? Right now i have let it remain at
DefaultPersistenceUnitDependencyResolver with a SpecCompliantSearchStrategy:
<bean name="SpecCompliantSearchStrategy" class="org.jboss.jpa.resolvers.strategy.SpecCompliantSearchStrategy"/>
|
| <!-- DefaultPersistenceUnitDependencyResolver for spec compliant resolving. Uses SpecCompliantSearchStrategy-->
| <bean name="PersistenceUnitDependencyResolver" class="org.jboss.jpa.resolvers.DefaultPersistenceUnitDependencyResolver"/>
|
Is this OK? Or should ejb3-embedded too use the dynamic resolver?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4206994#4206994
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4206994
15 years, 4 months