Bug 231941 - [plan] [ltw] NullPointerException at ResolvedMemberImpl.matches on ActiveMQ class.
Summary: [plan] [ltw] NullPointerException at ResolvedMemberImpl.matches on ActiveMQ c...
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: LTWeaving (show other bugs)
Version: 1.6.0   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P2 major (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-13 17:10 EDT by Ian Brandt CLA
Modified: 2013-06-24 11:07 EDT (History)
2 users (show)

See Also:


Attachments
Core dump. (186.32 KB, text/plain)
2008-05-13 17:10 EDT, Ian Brandt CLA
no flags Details
Dump with an annotated stack trace (195.16 KB, text/plain)
2009-07-20 09:24 EDT, Frank Pavageau CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Brandt CLA 2008-05-13 17:10:24 EDT
Created attachment 100055 [details]
Core dump.

Core file attached.  Spring 2.5.4.  Happens on startup when I have the following in my spring config:

<jms:listener-container connection-factory="jmsConnectionFactory">
	<jms:listener destination="foo" ref="fooMessageListener" />
	<jms:listener destination="bar" ref="barMessageListener" />
</jms:listener-container>

Happens with activemq-all-5.0.0.jar and again with activemq-all-5.1.0.jar.
Comment 1 Andrew Clement CLA 2008-05-13 19:50:58 EDT
The NPE here is when comparing parameters sets between two methods to see if they match - the names have already matched.  I suspect it is a method accessed via reflection that is returning null rather than a bcel accessed one since we are in the LTW environment.
Comment 2 Andrew Clement CLA 2008-05-14 12:08:31 EDT
Are you able to confirm if these are regressions - did everything used to work fine with this code and Spring2.5.3/AspectJ1.5.4? I'm going to ask the same in the other bug of yours :)
Comment 3 Ian Brandt CLA 2008-05-14 15:50:42 EDT
(In reply to comment #2)
> Are you able to confirm if these are regressions - did everything used to work
> fine with this code and Spring2.5.3/AspectJ1.5.4? I'm going to ask the same in
> the other bug of yours :)

I don't believe so.  I was on 2.5.3/1.5.4 and switched from JBoss to straight Tomcat.  At the same time I switched from the 2.5.3 spring-agent to the 2.5.3 spring-tomcat-weaver.  This is when the core dumps first manifested, on 2.5.3/1.5.4, so I upgraded  everything to 2.5.4/1.6.0.  A spring-tomcat-weaver message about a missing aop.xml disappeared on the upgrade, but otherwise the cores persisted.  This is when I tried to upgrade ActiveMQ from 5.0.0 to 5.1.0, but again no change.  I'll CC this to bug #231945 as well. :)
Comment 4 Ian Brandt CLA 2008-05-14 17:12:52 EDT
I've built 1.6.0 source jars and can debug into this now.  Not sure if this is of any further help, but all the local variables are null on the matches call when the error is raised:

aCandidateMatch		null	
candidateMatchImpl	null	
myParameterTypes	null	
candidateParameterTypes	null	

I might need some guidance on what to step through and what to look for, but if I can be of any further help let me know.
Comment 5 Andrew Clement CLA 2008-06-11 18:22:17 EDT
Was aCandidateMatch definetly null?  Since at line 865 and 867 prior to the failure we access it (the core dump showed a crash at line 868).

if you have a breakpoint at the failure line, you could look at the state of the associated JoinPointSignatureIterator that is a little further up the stack - the 'signaturesOfMember' instance field in there will tell us which method in which type is having trouble.
Comment 6 Andrew Clement CLA 2008-12-02 19:27:24 EST
still getting this problem Ian?
Comment 7 Ian Brandt CLA 2008-12-17 14:34:19 EST
(In reply to comment #6)
> still getting this problem Ian?

We've stopped using JMS in our trunk so I can't test this one off hand.  I'll try to get an old revision setup from when this bug was manifesting.  With the holidays it may take me a bit to get to it so bear with me...
Comment 8 Andrew Clement CLA 2008-12-17 21:13:51 EST
Dont struggle to recreate it if it isn't holding you up at the moment - but I will leave this open so we know there is still an issue here.
Comment 9 Frank Pavageau CLA 2009-07-20 09:22:24 EDT
I've stumbled on the same NPE here, in a completely different context. As it seemed to happen due to the upgrade from 1.6.2 to 1.6.4, I investigated it quite deeply by stepping into a lot of code, before finding out it actually happened with 1.6.2 as well (and with 1.6.5). It's a change in the weaved classes that triggered the bug (probably related to the order in which the classes / methods are processed).

I'm not sure I can package a test case without packaging the entire (and quite large) application, but maybe what I have found out while stepping into the application start will be enough. Otherwise I'll try to create a test case out of our application by removing as much as I can.

In a nutshell: it's a recursive call problem. While inside BcelMethod.unpackGenericSignature(), at line 531 (in 1.6.5)
				genericReturnType = BcelGenericSignatureToTypeXConverter.typeSignature2TypeX(returnTypeSignature, formals,
						bcelObjectType.getWorld());
another class resolution is triggered, etc., which after a long stack ends up in ResolvedMemberImpl.matches() at line 924
		UnresolvedType[] myParameterTypes = getGenericParameterTypes();
on the same BcelMethod, and BcelMethod.getGenericParameterTypes() calls again BcelMethod.unpackGenericSignature() which returns directly since bitflags & UNPACKED_GENERIC_SIGNATURE != 0 (the unpacking is marked as done while it is actually still being done). That's why BcelMethod.getGenericParameterTypes() returns null and we get a NPE in ResolvedMemberImpl.matches() at line 926 when using myParameterTypes.length.

I'm attaching my own dump, with the stack trace annotated for the context (look for comments with "Note on the above line").
Comment 10 Frank Pavageau CLA 2009-07-20 09:24:05 EDT
Created attachment 142010 [details]
Dump with an annotated stack trace
Comment 11 Andrew Clement CLA 2013-06-24 11:07:39 EDT
unsetting the target field which is currently set for something already released