Bug 392311 - NPE during load time weaving (spurious)
Summary: NPE during load time weaving (spurious)
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Runtime (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-18 05:24 EDT by Iulian Dragos CLA
Modified: 2012-10-30 07:23 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Iulian Dragos CLA 2012-10-18 05:24:52 EDT
I get the following NPE when Eclipse starts up. It happens fairly rarely, maybe one in ten starts.

java.lang.NullPointerException
	at org.aspectj.weaver.bcel.LazyMethodGen.<init>(LazyMethodGen.java:205)
	at org.aspectj.weaver.bcel.LazyClassGen.<init>(LazyClassGen.java:306)
	at org.aspectj.weaver.bcel.BcelObjectType.getLazyClassGen(BcelObjectType.java:558)
	at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1690)
	at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1641)
	at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1404)
	at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1190)
	at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:469)
	at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:320)
	at org.eclipse.equinox.weaving.aspectj.loadtime.OSGiWeavingAdaptor.weaveClass(OSGiWeavingAdaptor.java:121)
	at org.eclipse.equinox.weaving.aspectj.AspectJWeavingService.preProcess(AspectJWeavingService.java:151)
	at org.eclipse.equinox.weaving.adaptors.WeavingAdaptor.weaveClass(Unknown Source)
	at org.eclipse.equinox.weaving.hooks.WeavingHook.processClass(Unknown Source)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:594)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:562)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:486)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:459)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
	at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:476)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
	at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4887)
	at org.eclipse.jdt.internal.launching.LaunchingPlugin$VMChanges.doit(LaunchingPlugin.java:270)
	at org.eclipse.jdt.internal.launching.LaunchingPlugin$JREUpdateJob.run(LaunchingPlugin.java:366)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 1 Thomas Watson CLA 2012-10-18 08:29:23 EDT
Moving to AspectJ for comment.
Comment 2 Andrew Clement CLA 2012-10-22 12:02:13 EDT
Can you tell me what versions of the components you are using? equinox/JDT weaving and AspectJ?

We recently (within the last 6months) did have to make some important fixes in that area due to a change in locking strategies below us. Without the change sometimes two threads got into the weaver and strange exceptions would come out.
Comment 3 Iulian Dragos CLA 2012-10-23 03:29:23 EDT
I am not sure if this is what you need, but here are the weaving-related plugin versions:

org.aspectj.weaver/1.6.12.20110613132200
org.eclipse.equinox.weaving.hook/1.0.100.v20110502
org.eclipse.equinox.weaving.aspectj/1.0.1.v20110502
Comment 4 Andrew Clement CLA 2012-10-23 11:59:13 EDT
Those versions do look quite old. The most recent discussion I think we had around equinox/jdt weaving versions was in bug 338033.  If you have the weaving stuff because you have AJDT installed, I'd recommend updating AJDT to a recent version. (Similarly if you have it because you have the scala tools installed, I'd recommend updating those).

This kind of NPE can happen if two threads get lose in the same weaver, one is half way through initializing something whilst the other thinks it is initialized and is using it.