Community
Participate
Working Groups
Build Identifier: M20090917-0800 We are using generics in our OSGi services. After upgrading from: org.aspectj.runtime_1.6.7.20091127083600 org.aspectj.weaver_1.6.7.20091127083600 to org.aspectj.runtime_1.6.7.20091214160800 org.aspectj.weaver_1.6.7.20091214160800 we are getting real strange exceptions during startup of the server. See attachments console.log and file.log. Sometimes the server starts up fine but 5 of 4 times it fails. Reproducible: Sometimes
Created attachment 155384 [details] Console output
Created attachment 155385 [details] file output
Created attachment 155386 [details] example (IdentityService) should I add the super classes?
actually the recursion problem is something I'm investigating just now as it was reported here: http://forum.springsource.org/showthread.php?t=82593 Your bug is possibly a dup of bug 290137, but I won't say that until I've investigated a bit more today.
one thing - is this new since you upgraded to 1.6.7? What version were you using previously?
Hi Andy great that you are already on it! All I did was an upgrade from build 1.6.7.20091127083600 to build 1.6.7.20091214160800. If I downgrade back to 1.6.7.20091127083600, the server runs fine again. I tried out the current build 1.6.7.20100105084524, same problem. The issue reported in the spring forum seems to be the same one. Maybe I could help providing more information (e.g. spring bean declaration..)?
Created attachment 155389 [details] Patch for aspectjweaver.jar thanks for including the dates of the two versions, that is really helpful. As this is an issue we seem to have had for a long time, but it has recently started occurring more frequently, I have a suspicion what the problem is. I've attached a patch of class files that replaces a few in the latest AspectJ 1.6.7 builds. If you are on a recent AspectJ, you can apply this as follows (save it in the folder where the weaver jar is) jar -xvf worldpatch.zip jar -uvf aspectjweaver.jar org (Oh probably backup your aspectjweaver.jar first) That will replace about 5 classes. I'd be very keen to hear if it made any difference.
I patched my 1.6.7.20100105084524 build and started my server now 10 times in a row, without exceptions! Awesome that was quick :-) I'll keep an eye on it and will patch my co-developers server too.
thanks for trying that out so quickly. My suspicion seems correct. The patch includes something to alleviate the problem but not prevent it from ever occurring. In 1.6.7 we are more actively discarding types in order to run with a smaller footprint. This means we are now exercising the code that pulls types back in, whereas this code wouldn't typically run until much later (if ever) as types would only get discarded when memory became tight. I think this is why I have trouble recreating this issue, because it relates to memory and when weak references are being cleared by a GC. The world (where types are recorded) should never directly record generic types, it should only record raw types that will themselves point to the generic type. It appears the code to bring types back in sometimes causes generic types to be recorded directly in the world - this causes the infinite loop because the logic is vaguely something like this xxxx(Type ty) { if (ty.isGeneric()) { xxxx(ty.getRawType()) } .. do something else .. } getRawType() actually goes to the world to look up the type, and if it discovers and returns a generic type then code like that will loop endlessly. The patch merely switched back from WEAK references to SOFT references. SOFT references are not gc'd as frequently and so it delays the problem occurring, but doesn't prevent it ever happening.
Created attachment 155456 [details] patch for aspectjweaver.jar Flavio - is there anyway you could try another patch? I've made some progress although I still can't recreate it. I've determined what could lead to the infinite loop and attempted to address it. This patch will apply over the top of the old one, in the same way, and attempt to address the problem properly rather than reverting the weak/soft reference change. This secondary patch is what I'd rather commit into AspectJ.
Great that you found a better/cleaner solution! I patched the jar with the new classes and it looks good. Started over 10 times in a row without an exception. Maybe we could watch it for a week or two and then close this issue?
thanks for trying that out. The guy on the spring forum also confirmed the same fix worked for him too. So I'll get this committed now.
fix is in 1.6.8
*** Bug 301773 has been marked as a duplicate of this bug. ***
Hi, I was hitting this bug (although with a different environment): no osgi and compile time weaving. 1.6.8 fixed it, thanks!
*** Bug 314984 has been marked as a duplicate of this bug. ***