"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#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...