detekt: Non-deterministic exceptions in parallel builds when switching from 1.16.0-RC3 to 1.16.0

Expected Behavior

./gradlew detekt should not crash in version 1.16.0 for a project using Kotlin 1.4.31.

Observed Behavior

./gradlew detekt crashes in version 1.16.0, which rather non-deterministic exceptions. At first I thought I would be affected by https://github.com/detekt/detekt/issues/3248 as the exception messages are sometimes similar, but I cannot see any relation to parallel builds (as disabling parallel builds doe not help).

Note that detekt version 1.16.0-RC3 actually works!

Steps to Reproduce

  1. Clone https://github.com/sschuberth/stan
  2. Checkout the detekt-1.16.0 branch
  3. Run ./gradlew detekt --no-build-cache --rerun-tasks
  4. Observe:
sebastian@passau MINGW64 ~/Development/GitHub/sschuberth/stan (detekt-1.16.0)
$ ./gradlew detekt --no-build-cache --rerun-tasks

> Configure project :gui
Project :gui => no module-info.java found

> Task :lib:detekt FAILED
> Task :gui:detekt FAILED
> Task :detekt FAILED

FAILURE: Build completed with 3 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':lib:detekt'.
> Collection is empty.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':gui:detekt'.
> kotlin/KotlinNullPointerException

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

3: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':detekt'.
> io/github/detekt/tooling/api/InvalidConfig

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.8.3/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 5s
4 actionable tasks: 4 executed

Now do the same on the detekt-1.16.0-RC3 branch and observe:

sebastian@passau MINGW64 ~/Development/GitHub/sschuberth/stan (detekt-1.16.0-RC3)
$ ./gradlew detekt --no-build-cache --rerun-tasks

> Configure project :gui
Project :gui => no module-info.java found

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.8.3/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 7s
4 actionable tasks: 4 executed

Context

I’m trying to upgrade from detekt 1.15.0 / 1.16.0-RC3 to version 1.16.0 final.

Your Environment

  • Version of detekt used: 1.15.0 / 1.16.0-RC3 and 1.16.0
  • Version of Gradle used (if applicable): 6.8.3
  • Gradle scan link (add --scan option when running the gradle task): n/a
  • Operating System and version: Windows 10 64-bit
  • Link to your project (if it’s a public repository): https://github.com/sschuberth/stan

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 29 (28 by maintainers)

Commits related to this issue

Most upvoted comments

I just tried with versions 1.18.0-RC1 and 1.18.0-RC2, and both seem to finally fix the issue! 🎉

I can reproduce some failure when running with -Dorg.gradle.parallel=true https://gradle.com/s/pghkg5ndnfdgu