Bug 220255 - AJDT build goes into an infinite loop
Summary: AJDT build goes into an infinite loop
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 1.6.0 M2   Edit
Assignee: AJDT-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-25 13:56 EST by Hermann Vosseler CLA
Modified: 2008-02-25 20:12 EST (History)
2 users (show)

See Also:


Attachments
Test case (19.02 KB, application/octet-stream)
2008-02-25 15:49 EST, Hermann Vosseler CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hermann Vosseler CLA 2008-02-25 13:56:50 EST
since at least a year in our team we have problems when building from
within ECLIPSE with the AspectJ-compiler contained in AJDT. At the same
time building with IAJC Ant task works without problems.

Symptoms:

- the first build after starting ECLIPSE allways works flawless.
  (compiles, weaves, updates markers and model)
- starting with some of the subsequent builds (the 2.nd, 3rd or so,
  seemingly random) the build goes into an seemingly infinite loop
  - it happens befor the first "compiling..." message
  - one CPU is permanently at about 100%
  - progress display doesnt show any change
  - building can't be canceled and Eclipse can't be shutdown normally
    because ("..waiting for background work to complete").
    You need to kill the eclipse Process.
- after starting ECLIPSE, the same build again finishes flawless
  (and one of the next builds hangs....)
Comment 1 Hermann Vosseler CLA 2008-02-25 14:03:31 EST
Additional Infos:

We are running 
 - ECLIPSE 3.3.1.1 Build id: M20071023-1652
 - AJDT 1.5.0.200706070619 with AspectJ version: 1.5.4.200705211336
 - Java 1.6.0_03-b05 on Ubuntu Gutsy

We are using HasMember and DeclareAnnotation.


While in the "seemingly looping" state, I allways find the following
situation in the ECLIPSE stacktrace: besides the GUI/GTK thread,
a single thread is running and allways shows the same frames:


"Worker-17" prio=10 tid=0x09d94c00 nid=0x2270 runnable [0x5f695000..0x5f695fc0]
   java.lang.Thread.State: RUNNABLE
        at org.aspectj.weaver.ReferenceType.hasAnnotation(ReferenceType.java:151)
        at org.aspectj.weaver.patterns.ExactAnnotationTypePattern.matches(ExactAnnotationTypePattern.java:82)
        at org.aspectj.weaver.patterns.AnyWithAnnotationTypePattern.matchesExactly(TypePattern.java:470)
        at org.aspectj.weaver.patterns.TypePattern.matchesStatically(TypePattern.java:121)
        at org.aspectj.weaver.patterns.SignaturePattern.matchesExactlyMethod(SignaturePattern.java:375)
        at org.aspectj.weaver.patterns.SignaturePattern.matchesExactly(SignaturePattern.java:325)
        at org.aspectj.weaver.patterns.SignaturePattern.matches(SignaturePattern.java:289)
        at org.aspectj.weaver.patterns.HasMemberTypePattern.hasMethod(HasMemberTypePattern.java:77)
        at org.aspectj.weaver.patterns.HasMemberTypePattern.matchesExactly(HasMemberTypePattern.java:49)
        at org.aspectj.weaver.patterns.TypePattern.matchesStatically(TypePattern.java:121)
        at org.aspectj.weaver.patterns.DeclareAnnotation.matches(DeclareAnnotation.java:254)
        at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.doDeclareAnnotations(AjLookupEnvironment.java:750)
        at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:618)
        at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:519)
        at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1060)
        at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:480)
        at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:190)
        at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:137)
        at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:178)
        at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getPackage(Scope.java:2218)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:62)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.JavadocQualifiedTypeReference.internalResolveType(JavadocQualifiedTypeReference.java:58)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.JavadocQualifiedTypeReference.resolveType(JavadocQualifiedTypeReference.java:81)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.Javadoc.resolveReference(Javadoc.java:222)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.Javadoc.resolve(Javadoc.java:116)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1094)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1137)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:305)
        at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:519)
        at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:329)
        at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:974)
        at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:291)
        at org.aspectj.ajdt.internal.core.builder.AjBuildManager.incrementalBuild(AjBuildManager.java:185)
        at org.aspectj.ajde.core.internal.AjdeCoreBuildManager.doBuild(AjdeCoreBuildManager.java:88)
        at org.aspectj.ajde.core.AjCompiler.build(AjCompiler.java:96)
        at org.eclipse.ajdt.core.builder.AJBuilder.build(AJBuilder.java:198)
Comment 2 Hermann Vosseler CLA 2008-02-25 14:09:33 EST
Am Dienstag, den 19.02.2008, 17:35 -0800 schrieb Andy Clement:

> Have you tried a version of AJDT that includes AspectJ1.6.0?  The core
> dependencies within AspectJ1.6.0 are much more in line with Eclipse
> 3.3 and so it may behave better.  AspectJ1.5.4 is still based on
> Eclipse 3.1 internally.


It is reproducible with the current dev line.

Using ECLIPSE Version: 3.3.1.1  Build id: M20071023-1652
AJDT Version: 1.5.2.200802061816 (with AspectJ version: 1.6.0.20080206212408)


now the stacktrace is as follows:



"Worker-18" prio=10 tid=0x65dcf400 nid=0x59c1 runnable [0x5fefe000..0x5fefedc0]
   java.lang.Thread.State: RUNNABLE
        at org.aspectj.weaver.bcel.BcelObjectType.hasAnnotation(BcelObjectType.java:533)
        at org.aspectj.weaver.ReferenceType.hasAnnotation(ReferenceType.java:152)
        at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.doDeclareAnnotations(AjLookupEnvironment.java:823)
        at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:620)
        at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.weaveInterTypeDeclarations(AjLookupEnvironment.java:521)
        at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.createBinaryTypeFrom(AjLookupEnvironment.java:1102)
        at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:599)
        at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:276)
        at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:139)
        at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:178)
        at org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope.getPackage(Scope.java:2192)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:69)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.JavadocQualifiedTypeReference.internalResolveType(JavadocQualifiedTypeReference.java:65)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.JavadocQualifiedTypeReference.resolveType(JavadocQualifiedTypeReference.java:88)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.Javadoc.resolveReference(Javadoc.java:356)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.Javadoc.resolve(Javadoc.java:223)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1116)
        at org.aspectj.ajdt.internal.compiler.ast.AspectDeclaration.resolve(AspectDeclaration.java:114)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1188)
        at org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366)
        at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:625)
        at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392)
        at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:987)
        at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:293)
        at org.aspectj.ajdt.internal.core.builder.AjBuildManager.incrementalBuild(AjBuildManager.java:187)
        at org.aspectj.ajde.core.internal.AjdeCoreBuildManager.doBuild(AjdeCoreBuildManager.java:97)

....

Comment 3 Hermann Vosseler CLA 2008-02-25 15:49:49 EST
Created attachment 90687 [details]
Test case
Comment 4 Andrew Clement CLA 2008-02-25 17:27:41 EST
Can I ask which file you modify and then save to cause the build to loop?  Is it one of the aspects or a class targeted by the aspects?  Do you need to make just a whitespace change or a structural change?
Comment 5 Hermann Vosseler CLA 2008-02-25 17:56:46 EST
you need to build more than once.
E.g. change one of the string cotents in the MyServiceImpl.
No structural change necessary.

I got the Impression that the ServerCall.aj needs to be
rewoven to trigger the problem, thus you need to change
one of its targets (e.g. MyServiceImpl)


But if you remove in FactoryMarker.aj the line

//    declare parents : @NeedsXYZ * implements BootSpringKontext;

the problem goes away.
Comment 6 Andrew Clement CLA 2008-02-25 19:46:42 EST
thanks for the info.  Just what I needed to create a JUnit test for it.  I've now fixed it - it was continuously applying the declare annotation.  Each time through the loop it should have realised it had already applied but it wasn't - when I interrupted it I had 29332 annotations on the type ;)  

Comment 7 Andrew Clement CLA 2008-02-25 20:12:15 EST
thanks for the info.  Just what I needed to create a JUnit test for it.  I've now fixed it - it was continuously applying the declare annotation.  Each time through the loop it should have realised it had already applied but it wasn't - when I interrupted it I had 29332 annotations on the type ;)  

Fix will be in a build shortly - then in an AJDT build shortly after that.