checkstyle / checkstyle

Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. By default it supports the Google Java Style Guide and Sun Code Conventions, but is highly configurable. It can be invoked with an ANT task and a command line program.
https://checkstyle.org
GNU Lesser General Public License v2.1
8.32k stars 3.66k forks source link

execution of codenarc is failing on grapes very often #12705

Open romani opened 1 year ago

romani commented 1 year ago

https://checkstyle.semaphoreci.com/jobs/a4f70d7c-9969-4e1e-917b-f13e3b735e25

execution of codenarc is failing on grapes very often

./.ci/codenarc.sh Failed in 00:06
WARNING: An illegal reflective access operation has occurred 00:01
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/usr/share/groovy/lib/groovy-2.4.17.jar) to method java.lang.Object.finalize() 00:01
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass 00:01
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations 00:01
WARNING: All illegal access operations will be denied in a future release 00:01
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: 00:06
General error during conversion: Error grabbing Grapes -- [download failed: org.slf4j#slf4j-api;1.7.25!slf4j-api.jar] 00:06
java.lang.RuntimeException: Error grabbing Grapes -- [download failed: org.slf4j#slf4j-api;1.7.25!slf4j-api.jar] 00:06
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 00:06
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 00:06
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 00:06
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) 00:06
    at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83) 00:06
    at org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:77) 00:06
    at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrap.callConstructor(ConstructorSite.java:84) 00:06
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:59) 00:06
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:238) 00:06
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:250) 00:06
    at groovy.grape.GrapeIvy.getDependencies(GrapeIvy.groovy:422) 00:06
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 00:06
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 00:06
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 00:06
    at java.base/java.lang.reflect.Method.invoke(Method.java:566) 00:06
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:169) 00:06
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59) 00:06
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51) 00:06
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:157) 00:06
    at groovy.grape.GrapeIvy.resolve(GrapeIvy.groovy:569) 00:06
    at groovy.grape.GrapeIvy$resolve$1.callCurrent(Unknown Source) 00:06
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51) 00:06
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:157) 00:06
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:193) 00:06
    at groovy.grape.GrapeIvy.resolve(GrapeIvy.groovy:536) 00:06
    at groovy.grape.GrapeIvy$resolve$0.callCurrent(Unknown Source) 00:06
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51) 00:06
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:157) 00:06
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:185) 00:06
    at groovy.grape.GrapeIvy.grab(GrapeIvy.groovy:254) 00:06
    at groovy.grape.Grape.grab(Grape.java:167) 00:06
    at groovy.grape.GrabAnnotationTransformation.visit(GrabAnnotationTransformation.java:376) 00:06
    at org.codehaus.groovy.transform.ASTTransformationVisitor$3.call(ASTTransformationVisitor.java:346) 00:06
    at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:966) 00:06
    at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:626) 00:06
    at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:602) 00:06
    at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:579) 00:06
    at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:323) 00:06
    at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:293) 00:06
    at groovy.lang.GroovyShell.parseClass(GroovyShell.java:677) 00:06
    at groovy.lang.GroovyShell.run(GroovyShell.java:506) 00:06
    at groovy.lang.GroovyShell.run(GroovyShell.java:496) 00:06
    at groovy.ui.GroovyMain.processOnce(GroovyMain.java:597) 00:06
    at groovy.ui.GroovyMain.run(GroovyMain.java:329) 00:06
    at groovy.ui.GroovyMain.process(GroovyMain.java:315) 00:06
    at groovy.ui.GroovyMain.processArgs(GroovyMain.java:134) 00:06
    at groovy.ui.GroovyMain.main(GroovyMain.java:114) 00:06
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 00:06
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 00:06
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 00:06
    at java.base/java.lang.reflect.Method.invoke(Method.java:566) 00:06
    at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:116) 00:06
    at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:138) 00:06
1 error

removal of M2 folder help groovy to avoid this problem and downlaod all from scratch. example: https://github.com/checkstyle/checkstyle/pull/12662

We can put removal of M2 local repository for this job to let it always run without local maven cache.

romani commented 1 year ago

on passing execution with cache it took 33 seconds: codenarc analysis 00:33

without cache 53 seconds.

Better to not use cache and make it more stable.

nrmancuso commented 1 year ago

Ok, PR at https://github.com/checkstyle/checkstyle/pull/12706 will be quick hack for stability. In the long term, to close this issue, we should do:

It is better to create new "no cache" build like so and add codenarc job to it, without restore cache and deleting it:

  - name: "Linux openjdk build (no cache)"
    task:
      prologue:
        commands:
          - checkout
          - sudo apt-get update
          - sudo apt-get install -y ant groovy xsltproc xmlstarlet
          - export GRADLE_OPTS=-Dorg.gradle.console=plain
romani commented 10 months ago

proposed layout will make pipeline and failure of fist task block second task. https://checkstyle.semaphoreci.com/workflows/65ba10a4-7259-4388-b305-d1cbddce09de?pipeline_id=a9dc30f1-cad4-4574-986a-a8ad0e4a51c5 image

semaphore use some concurecy: image

so suggestion is not good. @nrmancuso, please reconsider and lets close this issue if you agree.