Bug 148367 - [ltw] Deadlock in Loading Reflection Delegate with LTWWorld
Summary: [ltw] Deadlock in Loading Reflection Delegate with LTWWorld
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: LTWeaving (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-23 06:46 EDT by Ron Bodkin CLA
Modified: 2006-07-28 10:22 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ron Bodkin CLA 2006-06-23 06:46:21 EDT
I was using a fairly recent dev build of AspectJ on WebSphere 5.0, using my contributed ClassLoader plugin for load-time weaving (*) and I hit a case where the server deadlocked. On connecting to the server in debug mode, one thread was hanging with this stack trace, trying to load java.sql.ResultSet:

Class.forName0(String, boolean, ClassLoader) line: not available [native method]         
Class.forName(String, boolean, ClassLoader) line: 220         
ReflectionBasedReferenceTypeDelegateFactory.createDelegate(ReferenceType, World, ClassLoader) line: 40         
LTWWorld.resolveReflectionTypeDelegate(ReferenceType, ClassLoader) line: 126         
LTWWorld.resolveIfBootstrapDelegate(ReferenceType) line: 108         
LTWWorld.resolveDelegate(ReferenceType) line: 85         
LTWWorld(World).resolveToReferenceType(UnresolvedType) line: 343         
LTWWorld(World).resolve(UnresolvedType, boolean) line: 259         
LTWWorld(World).resolve(UnresolvedType) line: 179         
UnresolvedType.resolve(World) line: 652         
BcelMethod(ResolvedMemberImpl).resolve(World) line: 480         
JoinPointSignatureIterator.addSignaturesUpToFirstDefiningMember() line: 109         
JoinPointSignatureIterator.<init>(Member, World) line: 51         
BcelMethod(MemberImpl).getJoinPointSignatures(World) line: 909         
SignaturePattern.matches(Member, World, boolean) line: 286         
KindedPointcut.matchInternal(Shadow) line: 103         
KindedPointcut(Pointcut).match(Shadow) line: 144         
AndPointcut.matchInternal(Shadow) line: 53         
AndPointcut(Pointcut).match(Shadow) line: 144         
AndPointcut.matchInternal(Shadow) line: 51         
AndPointcut(Pointcut).match(Shadow) line: 144         
AndPointcut.matchInternal(Shadow) line: 51         
AndPointcut(Pointcut).match(Shadow) line: 144         
AndPointcut.matchInternal(Shadow) line: 51         
AndPointcut(Pointcut).match(Shadow) line: 144         
AndPointcut.matchInternal(Shadow) line: 51         
AndPointcut(Pointcut).match(Shadow) line: 144         
OrPointcut.matchInternal(Shadow) line: 50         
OrPointcut(Pointcut).match(Shadow) line: 144         
OrPointcut.matchInternal(Shadow) line: 50         
OrPointcut(Pointcut).match(Shadow) line: 144         
BcelAdvice(ShadowMunger).match(Shadow, World) line: 64         
BcelAdvice(Advice).match(Shadow, World) line: 109         
BcelAdvice.match(Shadow, World) line: 105         
BcelClassWeaver.match(BcelShadow, List) line: 2210         
BcelClassWeaver.match(LazyMethodGen) line: 1752         
BcelClassWeaver.weave() line: 479         
BcelClassWeaver.weave(BcelWorld, LazyClassGen, List, List, List) line: 109         
BcelWeaver.weave(UnwovenClassFile, BcelObjectType, boolean) line: 1574         
BcelWeaver.weaveWithoutDump(UnwovenClassFile, BcelObjectType) line: 1525         
BcelWeaver.weaveAndNotify(UnwovenClassFile, BcelObjectType, IWeaveRequestor) line: 1305         
BcelWeaver.weave(IClassFileProvider) line: 1127         
ClassLoaderWeavingAdaptor(WeavingAdaptor).getWovenBytes(String, byte[]) line: 279         
ClassLoaderWeavingAdaptor(WeavingAdaptor).weaveClass(String, byte[]) line: 212         
Aj.preProcess(String, byte[], ClassLoader) line: 65         
WasWeavingPlugin.preDefineApplicationClass(String, byte[]) line: 40         
CompoundClassLoader.findClass(String, boolean) line: 355         
CompoundClassLoader.loadClass(String, boolean) line: 261         
CompoundClassLoader(ClassLoader).loadClass(String) line: 448         
Class.forName1(String) line: not available [native method]         
Class.forName(String) line: 142         
<... application code>
StrictServletInstance.doInit() line: 82         
StrictServletInstance(StrictLifecycleServlet)._init(ServletConfig) line: 147         
PreInitializedServletState.init(StrictLifecycleServlet, ServletConfig) line: 270         
StrictServletInstance(StrictLifecycleServlet).init(ServletConfig) line: 113         
ServletInstance.init() line: 189         
ServletInstance(GenericServlet).init(ServletConfig) line: 258         
WebAppServletManager.addServlet(String, Servlet, Properties) line: 870         
WebAppServletManager.loadServlet(String, Servlet) line: 224         
WebAppServletManager.loadAutoLoadServlets() line: 542         
WebApp.loadServletManager() line: 1270         
WebApp.init(WebApp, WebAppExtension, WebAppContext, WebAppInitializationCollaborator[], WebAppInvocationCollaborator[]) line: 277         
WebGroup.loadWebApp() line: 396         
WebGroup.init(WebContainer, WebAppHost, DeployedModule, WebAppInitializationCollaborator[], WebAppInvocationCollaborator[]) line: 216         
WebContainer.addWebApplication(DeployedModule) line: 984         
WebContainerImpl.install(DeployedObject) line: 136         
WebContainerImpl.start(DeployedObjectEvent) line: 356         
ApplicationMgrImpl.start(DeployedObjectEvent) line: 415         
DeployedApplicationImpl.fireDeployedObjectStart(DeployedObjectEvent) line: 787         
DeployedModuleImpl.start() line: 351         
DeployedApplicationImpl.start() line: 575         
ApplicationMgrImpl.startApplication(DeployedApplicationImpl) line: 268         
ApplicationMgrImpl.start() line: 246         
ApplicationServerImpl(ContainerImpl).startComponents() line: 543         
ApplicationServerImpl(ContainerImpl).start() line: 418         
ApplicationServerImpl.start() line: 117         
ServerImpl(ContainerImpl).startComponents() line: 543         
ServerImpl(ContainerImpl).start() line: 418         
ServerImpl.start() line: 183         
WsServer.start(String[]) line: 128         
WsServer.main(String[]) line: 225         
Method.invoke(Object, Object[]) line: not available [native method]         
WSLauncher.main(String[]) line: 94        

I don't have regular access to the server to better debug the problem, but wanted to report the issue quickly before 1.5.2 goes out. I believe some other thread has a lock on the bootstrap ClassLoader but that this thread has a lock on something else (perhaps the application ClassLoader).

(*) I added recursion protection to my WAS weaving plugin using a similar technique to Matthew's for the JRockIt one. I submit this as a patch.
Comment 1 Matthew Webster CLA 2006-06-26 09:00:25 EDT
Fairly recently I changed LTWWorld to use the bootloader i.e. null rather than the application loader i.e. the one with which the world was created to resolve types. I was made aware of a problem in WAS after moving to LTWWorld and this changed seemed to fix it. I suggest you take a build after 21st June.
Comment 2 Ron Bodkin CLA 2006-06-26 13:42:20 EDT
Thanks: we will test the updated version and close this out once verified. 

Loading the reflection type on the application loader is clearly a bug: it's important that the type in question be actually resolvable using the reflection loader and not some other loader! I hadn't seen change 1.4 that changed the loader from null (which I had submitted in the patch) to the app loader - but it's good that the working code has restored the use of the bootstrap loader.
Comment 3 Matthew Webster CLA 2006-07-28 10:22:49 EDT
Heard nothing for 1 month.