Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detekt parallel crash #3248

Closed
VladislavSumin opened this issue Nov 25, 2020 · 29 comments · Fixed by #3799
Closed

Detekt parallel crash #3248

VladislavSumin opened this issue Nov 25, 2020 · 29 comments · Fixed by #3799
Labels

Comments

@VladislavSumin
Copy link

VladislavSumin commented Nov 25, 2020

Observed Behavior

Detekt crashes when executed in a project with multiple modules and enabled org.gradle.parallel with java.lang.ClassNotFoundException: kotlin.ExceptionsKt

The problem is reproducible with 100 percent probability.
I found similar closed issue #2629

Detekt configuration
plugins {
  id("io.gitlab.arturbosch.detekt").version("1.15.0-RC1")
}

subprojects {

  apply { plugin("io.gitlab.arturbosch.detekt") }
  detekt {
      failFast = true
      buildUponDefaultConfig = true
      baseline = file("${rootProject.projectDir}/static_analysis/config/detekt/baseline.xml")
      config = files("${rootProject.projectDir}/static_analysis/config/detekt/config.yml")
      autoCorrect = true
      ignoreFailures = false
      parallel = true

      reports {
          html.enabled = true
          xml.enabled = true
          txt.enabled = true
      }
  }

  tasks {
      withType<io.gitlab.arturbosch.detekt.Detekt> {
          this.jvmTarget = "1.8"
          description = "Overrides current baseline."

          setSource(files(rootDir))
          include("**/*.kt")
          include("**/*.kts")
          exclude("**/resources/**")
          exclude("**/build/**")
      }
  }
}
Full stack trace

[2020-11-25 12:43:19.016616] FAILURE: Build failed with an exception.
[2020-11-25 12:43:19.016624]
[2020-11-25 12:43:19.016630] * What went wrong:
[2020-11-25 12:43:19.016635] Execution failed for task ':core:detekt'.
[2020-11-25 12:43:19.016640] > kotlin/ExceptionsKt
[2020-11-25 12:43:19.016645]
[2020-11-25 12:43:19.016650] * Try:
[2020-11-25 12:43:19.016655] Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[2020-11-25 12:43:19.016660]
[2020-11-25 12:43:19.016665] * Exception is:
[2020-11-25 12:43:19.016670] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':core:detekt'.
[2020-11-25 12:43:19.016675] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:208)
[2020-11-25 12:43:19.016680] at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:263)
[2020-11-25 12:43:19.016684] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:206)
[2020-11-25 12:43:19.016689] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:187)
[2020-11-25 12:43:19.016694] at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:114)
[2020-11-25 12:43:19.016699] at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
[2020-11-25 12:43:19.016704] at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
[2020-11-25 12:43:19.016708] at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
[2020-11-25 12:43:19.016713] at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
[2020-11-25 12:43:19.016718] at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
[2020-11-25 12:43:19.016723] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
[2020-11-25 12:43:19.016728] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
[2020-11-25 12:43:19.016732] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
[2020-11-25 12:43:19.016737] at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:409)
[2020-11-25 12:43:19.016761] at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:399)
[2020-11-25 12:43:19.016767] at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:157)
[2020-11-25 12:43:19.016772] at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:242)
[2020-11-25 12:43:19.016776] at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:150)
[2020-11-25 12:43:19.016781] at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:94)
[2020-11-25 12:43:19.016786] at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
[2020-11-25 12:43:19.016791] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
[2020-11-25 12:43:19.016796] at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
[2020-11-25 12:43:19.016801] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:372)
[2020-11-25 12:43:19.016805] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:359)
[2020-11-25 12:43:19.016810] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:352)
[2020-11-25 12:43:19.016815] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:338)
[2020-11-25 12:43:19.016820] at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
[2020-11-25 12:43:19.016825] at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
[2020-11-25 12:43:19.016829] at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
[2020-11-25 12:43:19.016834] at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
[2020-11-25 12:43:19.016839] at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
[2020-11-25 12:43:19.016843] at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
[2020-11-25 12:43:19.016848] at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
[2020-11-25 12:43:19.016853] Caused by: org.gradle.api.GradleException: kotlin/ExceptionsKt
[2020-11-25 12:43:19.016858] at io.gitlab.arturbosch.detekt.invoke.DefaultCliInvoker.invokeCli(DetektInvoker.kt:63)
[2020-11-25 12:43:19.016863] at io.gitlab.arturbosch.detekt.Detekt.check(Detekt.kt:208)
[2020-11-25 12:43:19.016867] at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
[2020-11-25 12:43:19.016872] at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:58)
[2020-11-25 12:43:19.016877] at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)
[2020-11-25 12:43:19.016882] at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)
[2020-11-25 12:43:19.016887] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.run(ExecuteActionsTaskExecuter.java:570)
[2020-11-25 12:43:19.016892] at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:395)
[2020-11-25 12:43:19.016896] at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:387)
[2020-11-25 12:43:19.016906] at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:157)
[2020-11-25 12:43:19.016912] at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:242)
[2020-11-25 12:43:19.016916] at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:150)
[2020-11-25 12:43:19.016921] at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:84)
[2020-11-25 12:43:19.016926] at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
[2020-11-25 12:43:19.016930] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:555)
[2020-11-25 12:43:19.016935] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:538)
[2020-11-25 12:43:19.016940] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$300(ExecuteActionsTaskExecuter.java:109)
[2020-11-25 12:43:19.016945] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:279)
[2020-11-25 12:43:19.016950] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:268)
[2020-11-25 12:43:19.016955] at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$1(ExecuteStep.java:33)
[2020-11-25 12:43:19.016959] at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:33)
[2020-11-25 12:43:19.016964] at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
[2020-11-25 12:43:19.016969] at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:67)
[2020-11-25 12:43:19.016973] at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:36)
[2020-11-25 12:43:19.016978] at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:49)
[2020-11-25 12:43:19.016983] at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:34)
[2020-11-25 12:43:19.016988] at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:43)
[2020-11-25 12:43:19.016992] at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
[2020-11-25 12:43:19.016997] at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
[2020-11-25 12:43:19.017002] at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:34)
[2020-11-25 12:43:19.017007] at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:44)
[2020-11-25 12:43:19.017011] at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:54)
[2020-11-25 12:43:19.017016] at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:38)
[2020-11-25 12:43:19.017021] at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49)
[2020-11-25 12:43:19.017026] at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:159)
[2020-11-25 12:43:19.017030] at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:72)
[2020-11-25 12:43:19.017037] at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:43)
[2020-11-25 12:43:19.017171] at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:44)
[2020-11-25 12:43:19.017181] at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:33)
[2020-11-25 12:43:19.017192] at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
[2020-11-25 12:43:19.017197] at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
[2020-11-25 12:43:19.017202] at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:92)
[2020-11-25 12:43:19.017207] at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:85)
[2020-11-25 12:43:19.017212] at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:55)
[2020-11-25 12:43:19.017217] at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:39)
[2020-11-25 12:43:19.017222] at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:76)
[2020-11-25 12:43:19.017227] at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
[2020-11-25 12:43:19.017231] at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
[2020-11-25 12:43:19.017236] at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
[2020-11-25 12:43:19.017241] at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:94)
[2020-11-25 12:43:19.017246] at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:49)
[2020-11-25 12:43:19.017251] at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:79)
[2020-11-25 12:43:19.017256] at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:53)
[2020-11-25 12:43:19.017261] at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:74)
[2020-11-25 12:43:19.017265] at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:78)
[2020-11-25 12:43:19.017270] at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:78)
[2020-11-25 12:43:19.017275] at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:34)
[2020-11-25 12:43:19.017280] at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:39)
[2020-11-25 12:43:19.017285] at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:40)
[2020-11-25 12:43:19.017289] at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:28)
[2020-11-25 12:43:19.017294] at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
[2020-11-25 12:43:19.017299] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:195)
[2020-11-25 12:43:19.017304] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:187)
[2020-11-25 12:43:19.017309] at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:114)
[2020-11-25 12:43:19.017313] at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
[2020-11-25 12:43:19.017318] at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
[2020-11-25 12:43:19.017323] at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
[2020-11-25 12:43:19.017328] at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
[2020-11-25 12:43:19.017332] at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
[2020-11-25 12:43:19.017342] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
[2020-11-25 12:43:19.017347] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
[2020-11-25 12:43:19.017352] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
[2020-11-25 12:43:19.017356] at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:409)
[2020-11-25 12:43:19.017361] at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:399)
[2020-11-25 12:43:19.017366] at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:157)
[2020-11-25 12:43:19.017371] at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:242)
[2020-11-25 12:43:19.017376] at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:150)
[2020-11-25 12:43:19.017380] at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:94)
[2020-11-25 12:43:19.017385] at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
[2020-11-25 12:43:19.017390] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
[2020-11-25 12:43:19.017395] at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
[2020-11-25 12:43:19.017399] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:372)
[2020-11-25 12:43:19.017404] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:359)
[2020-11-25 12:43:19.017409] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:352)
[2020-11-25 12:43:19.017414] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:338)
[2020-11-25 12:43:19.017418] at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
[2020-11-25 12:43:19.017423] at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
[2020-11-25 12:43:19.017428] at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
[2020-11-25 12:43:19.017433] at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
[2020-11-25 12:43:19.017437] at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
[2020-11-25 12:43:19.017442] at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
[2020-11-25 12:43:19.017447] at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
[2020-11-25 12:43:19.017452] Caused by: java.lang.NoClassDefFoundError: kotlin/ExceptionsKt
[2020-11-25 12:43:19.017457] at kotlin.io.CloseableKt.closeFinally(Closeable.kt:62)
[2020-11-25 12:43:19.017461] at io.gitlab.arturbosch.detekt.core.tooling.ProcessingSpecSettingsBridgeKt.withSettings(ProcessingSpecSettingsBridge.kt:24)
[2020-11-25 12:43:19.017466] at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade.runAnalysis$detekt_core(AnalysisFacade.kt:42)
[2020-11-25 12:43:19.017471] at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade.run(AnalysisFacade.kt:25)
[2020-11-25 12:43:19.017476] at io.gitlab.arturbosch.detekt.cli.runners.Runner.call(Runner.kt:33)
[2020-11-25 12:43:19.017485] at io.gitlab.arturbosch.detekt.cli.runners.Runner.execute(Runner.kt:23)
[2020-11-25 12:43:19.017490] at io.gitlab.arturbosch.detekt.invoke.DefaultCliInvoker.invokeCli(DetektInvoker.kt:56)
[2020-11-25 12:43:19.017495] ... 91 more
[2020-11-25 12:43:19.017499] Caused by: java.lang.ClassNotFoundException: kotlin.ExceptionsKt
[2020-11-25 12:43:19.017504] ... 98 more

Environment

  • Version of detekt used: 1.15.0-RC1 or 1.14.0
  • Version of Gradle used: 6.6.1 or 6.4.1
  • Version of Kotlin 1.4.10
@arturbosch
Copy link
Member

Thanks for reporting this.
Have you already updated Kotlin to 1.4.20?
Does this crash even with Kotlin 1.4.10?
I assume you restarted the Gradle daemon when updating detekt?

@VladislavSumin
Copy link
Author

@arturbosch

Good day
I only tried with Kotlin 1.4.10 version, on Monday I will check the behavior with Kotlin 1.4.20.
I added the kotlin version to the issue description.
Yes, the gradle daemon restarted between attempts (the build was started on a build agent that restores its configuration between runs)

@VladislavSumin
Copy link
Author

I checked for kotlin version 1.4.20 (use kotlin-dsl 1.4.4 on buildSrc) but nothing changed

@sschuberth
Copy link
Contributor

I seem to have the same problem in https://github.com/sschuberth/stan/tree/upgrades. I can reproduce it with detekt 1.14.2 and Kotlin 1.4.20, but reverting to Kotlin 1.4.10 seems to make the issue go away.

@To-da
Copy link

To-da commented Dec 9, 2020

Observed Behavior
Exactly the same problem (crash only on project with multiple modules and enabled org.gradle.parallel) but nto found classes vary on every run - like kotlin/jvm/internal/Intrinsics, kotlin/io/CloseableKt, kotlin.ExceptionsKt

Environment
detekt: 1.14.2
kotlin: 1.4.20
gradle: 6.7

@sschuberth
Copy link
Contributor

For me, it often fails with

Caused by: java.lang.NullPointerException: configUrl must not be null
        at io.gitlab.arturbosch.detekt.core.config.DefaultConfig.newInstance(DefaultConfig.kt:12)
        at io.gitlab.arturbosch.detekt.core.config.ConfigurationsKt.loadConfiguration(Configurations.kt:25)
        at io.gitlab.arturbosch.detekt.core.tooling.ProcessingSpecSettingsBridgeKt$withSettings$configuration$1.invoke(ProcessingSpecSettingsBridge.kt:15)
        at io.gitlab.arturbosch.detekt.core.tooling.ProcessingSpecSettingsBridgeKt$withSettings$configuration$1.invoke(ProcessingSpecSettingsBridge.kt)
        at io.gitlab.arturbosch.detekt.core.util.PerformanceMonitor.measure(PerformanceMonitor.kt:42)
        at io.gitlab.arturbosch.detekt.core.tooling.ProcessingSpecSettingsBridgeKt.withSettings(ProcessingSpecSettingsBridge.kt:15)
        at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade.runAnalysis$detekt_core(AnalysisFacade.kt:42)
        at io.gitlab.arturbosch.detekt.core.tooling.AnalysisFacade.run(AnalysisFacade.kt:25)
        at io.gitlab.arturbosch.detekt.cli.runners.Runner.call(Runner.kt:33)
        at io.gitlab.arturbosch.detekt.cli.runners.Runner.execute(Runner.kt:23)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at io.gitlab.arturbosch.detekt.invoke.DefaultCliInvoker.invokeCli(DetektInvoker.kt:53)
        ... 103 more

@chao2zhang
Copy link
Member

My hunch is that this problem will be addressed once #3254 is merged and published.

@tomasAlabes
Copy link

I'm getting the error using:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':my-project:detekt'.
> kotlin/ExceptionsKt
  • Version of detekt used: 1.16.0-RC1
  • Version of Gradle used: 6.8.1
  • Version of Kotlin 1.4.20

@sschuberth
Copy link
Contributor

I was hoping this to be fixed with 1.16.0-RC1. Or can you update your project to Kotlin 1.4.21 to see if that patch level version change really makes a difference, @tomasAlabes?

@tomasAlabes
Copy link

Besides getting:

WARNING: Unsupported Kotlin plugin version.
The `embedded-kotlin` and `kotlin-dsl` plugins rely on features of Kotlin `1.4.20` that might work differently than in the requested version `1.4.21`.

and many:

> Task :my-project:ktlintKotlinScriptCheck
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jetbrains.kotlin.com.intellij.util.ReflectionUtil (file:/~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-compiler-embeddable/1.4.21/87db94500aaf883536ae8c8efdee76bdc839d582/kotlin-compiler-embeddable-1.4.21.jar) to method java.util.ResourceBundle.setParent(java.util.ResourceBundle)
WARNING: Please consider reporting this to the maintainers of org.jetbrains.kotlin.com.intellij.util.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

I think it works. I ran it 3 times.

@chao2zhang
Copy link
Member

I would recommend stopping all gradle daemons by ./gradlew --stop and rerun the detekt atsk again. Run 3 times to succeed is dubious.

@chao2zhang
Copy link
Member

@tomasAlabes I think ktlintKotlinScriptCheck may be added by ktlint. If there is no secret in your file path / environment, we can help check your gradle scans if you run the gradle with --scan

@tomasAlabes
Copy link

Sorry I can't 😕 .
Yes, I'm also using org.jlleitschuh.gradle:ktlint-gradle:9.4.1. Those warnings come from there.

I tried another 3 times stopping the daemons before each time and it worked.
But I also went back to 1.4.20 and it worked, but it was always intermittent anyway. I reproduced it the 1st time when running gradlew build --parallel.

Maybe we need more data points... After 10 hours working I'm not trustworthy enough 😋

@sschuberth
Copy link
Contributor

Yes, I'm also using org.jlleitschuh.gradle:ktlint-gradle:9.4.1.

Any particular reason why you're not using the io.gitlab.arturbosch.detekt:detekt-formatting plugin for detekt instead, which internally uses ktlint?

@Dominick1993
Copy link
Contributor

Hi guys, I tried executing

$ ./gradlew --stop
$ pkill -f '.*GradleDaemon.*' # to be really sure
$ ./gradlew clean build -x test --no-build-cache

with the combinations of

  • Kotlin: 1.4.20 / 1.4.21
  • Detekt: 1.16.0-RC1
  • Gradle: 6.8

Both ended up with the same error on my first tries:

Execution failed for task ':tests:detekt'.
> kotlin/ExceptionsKt

@tomasAlabes
Copy link

Yes, I'm also using org.jlleitschuh.gradle:ktlint-gradle:9.4.1.

Any particular reason why you're not using the io.gitlab.arturbosch.detekt:detekt-formatting plugin for detekt instead, which internally uses ktlint?

We started like that and never changed it, I switched to detekt-formatting but I'm blocked by #3250, by the

The original exception message was: Wrong offset: XXXX. Should be in range: [0, YYYY]

Hopefully PR #3446 will help when it's out.

@AlinaRakhimova
Copy link
Contributor

AlinaRakhimova commented Feb 24, 2021

@arturbosch Hi!
Are there any news?

I also have

Execution failed for task ':tests:detekt'.
> kotlin/ExceptionsKt

Checked with
Kotlin: 1.4.20 / 1.4.21
Detekt: 1.16.0-RC2

@AlinaRakhimova
Copy link
Contributor

AlinaRakhimova commented Mar 1, 2021

@VladislavSumin Hi!
Is there any changes?

@VladislavSumin
Copy link
Author

@AlinaRakhimova
I rolled back to version 1.14.2. Everything works stably on this version.

@chao2zhang
Copy link
Member

For anyone in this thread, I am wondering which OS are you using when hitting the crash?

@sschuberth
Copy link
Contributor

sschuberth commented Mar 13, 2021

Windows 10 64-bit on my side (also see the build scan from #3544).

@tomasAlabes
Copy link

Mac Catalina 10.15.7

@AlinaRakhimova
Copy link
Contributor

Mac Catalina 10.15.6

@Dominick1993
Copy link
Contributor

For anyone in this thread, I am wondering which OS are you using when hitting the crash?

We've experienced the same issue on macOS Catalina, macOS BigSur and various Linux distros.

@RomanMinenok
Copy link

Happens for me also, not sure which OS our Jenkins is running though.
./gradlew ... -Porg.gradle.parallel=false helped to resolve the issue.

@RomanMinenok
Copy link

It didn't help after all, so I'm not sure I'm facing the same issue anymore

@sschuberth
Copy link
Contributor

Happens for me also, not sure which OS our Jenkins is running though.
./gradlew ... -Porg.gradle.parallel=false helped to resolve the issue.

That should be ./gradlew ... -Dorg.gradle.parallel=false (note the -D instead of the -P), or?

Dominick1993 added a commit to Dominick1993/detekt that referenced this issue May 19, 2021
Previous caching mechanism didn't work properly when multiple projects
were running detekt task in parallel and differed in classpath. Due to
the broken locking mechanism the classpath files would not much the
content in the classloader.

The new implementation uses ConcurrentHashMap which handles locking by
itself and allows us to store classloader for any combination of files.
@Dominick1993
Copy link
Contributor

Dominick1993 commented May 19, 2021

So, I've finally found some spare time to look into this issue and I did a fair bit of digging. Not having a prior experience with detekt codebase and Gradle plugins was an interesting personal challenge ;)

The java.lang.ClassNotFoundException: kotlin/ExceptionsKt messages were very misleading, but by slowly debugging my way through the stack I've noticed that ExtensionFacade and EnvironmentFacade could not be properly initialized in ProcessingSettings and ended up in IllegalState. In that case, the message in stack trace in debugger was java.lang.ClassNotFoundException: org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment. Continuing with my efforts I've got a hunch that this might be a class loading issue. I've searched for it and stumbled upon DefaultClassLoaderCache.

I've removed the caching (created new class loader every time) and bingo! - project that was previously failing in parallel now worked, but ./gradlew clean detekt --no-daemon --no-build-cache --stacktrace took around 28s for a project with ~25 Gradle subprojects.

I've implemented a simpler caching mechanism involving ConcurrentHashMap which now holds class loaders for every set of class path files (in #3799) to make the detekt task faster again and ./gradlew clean detekt --no-daemon --no-build-cache --stacktrace on the same project now takes around 18s and involves just 2 different class loaders. This solution might however have some drawbacks, that I didn't recognize, please let me know in the review, I'm looking forward to it.

Dominick1993 added a commit to Dominick1993/detekt that referenced this issue May 19, 2021
Previous caching mechanism didn't work properly when multiple projects
were running detekt task in parallel and differed in classpath. Due to
the broken locking mechanism the classpath files would not match the
content in the classloader.

The new implementation uses ConcurrentHashMap which handles locking by
itself and allows us to store classloader for any combination of files.
@sschuberth
Copy link
Contributor

Great analysis @Dominick1993! I'm eager to test whether your PR also fixes #3544, so I'm looking forward to an RC with your change.

Dominick1993 added a commit to Dominick1993/detekt that referenced this issue May 20, 2021
Dominick1993 added a commit to Dominick1993/detekt that referenced this issue May 20, 2021
Dominick1993 added a commit to Dominick1993/detekt that referenced this issue May 20, 2021
Dominick1993 added a commit to Dominick1993/detekt that referenced this issue May 20, 2021
Previous caching mechanism didn't work properly when multiple projects
were running detekt task in parallel and differed in classpath. Due to
the broken locking mechanism the classpath files would not match the
content in the classloader.

The new implementation uses ConcurrentHashMap which handles locking by
itself and allows us to store classloader for any combination of files.
Dominick1993 added a commit to Dominick1993/detekt that referenced this issue May 21, 2021
Previous caching mechanism didn't work properly when multiple projects
were running detekt task in parallel and differed in classpath. Due to
the broken locking mechanism the classpath files would not match the
content in the classloader.

The new implementation uses ConcurrentHashMap which handles locking by
itself and allows us to store classloader for any combination of files.
@chao2zhang chao2zhang linked a pull request May 21, 2021 that will close this issue
Dominick1993 added a commit to Dominick1993/detekt that referenced this issue May 24, 2021
Previous caching mechanism didn't work properly when multiple projects
were running detekt task in parallel and differed in classpath. Due to
the broken locking mechanism the classpath files would not match the
content in the classloader.

The new implementation uses ConcurrentHashMap which handles locking by
itself and allows us to store classloader for any combination of files.
chao2zhang pushed a commit that referenced this issue May 24, 2021
Previous caching mechanism didn't work properly when multiple projects
were running detekt task in parallel and differed in classpath. Due to
the broken locking mechanism the classpath files would not match the
content in the classloader.

The new implementation uses ConcurrentHashMap which handles locking by
itself and allows us to store classloader for any combination of files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants