pinterest / ktlint

An anti-bikeshedding Kotlin linter with built-in formatter
https://pinterest.github.io/ktlint/
MIT License
6.23k stars 507 forks source link

Ktlint finished with non-zero exit value 137 on CI #661

Closed ScottPierce closed 4 years ago

ScottPierce commented 4 years ago

We have a problem with ktlint failing in our CI build (linux), but runs perfectly locally (mac). I just added a buildSrc, using kotlinscript, but there doesn't seem like a valid reason for this to fail.

Here is our application that is applied from a separate .gradle file.

repositories {
    jcenter()
}

configurations {
    ktlint
}

dependencies {
    ktlint "com.pinterest:ktlint:0.35.0"
}

task ktlint(type: JavaExec, group: "verification") {
    description = "Check Kotlin code style."
    classpath = configurations.ktlint
    main = "com.pinterest.ktlint.Main"
    args "**/src/**/*.kt", "!**/buildSrc/**"
}

task ktlintFormat(type: JavaExec, group: "formatting") {
    description = "Fix Kotlin code style deviations."
    classpath = configurations.ktlint
    main = "com.pinterest.ktlint.Main"
    args "-F", "**/src/**/*.kt", "!**/buildSrc/**"
}

Here is the primary output after running ./gradlew ktlintFormat.

Starting process 'command '/usr/lib/jvm/java-8-openjdk-amd64/bin/java''. Working directory: /home/circleci/workspace Command: /usr/lib/jvm/java-8-openjdk-amd64/bin/java -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/circleci/.gradle/caches/modules-2/files-2.1/com.pinterest/ktlint/0.35.0/33f83457cc6bb0f930f05a3447f84ad2da05d8a2/ktlint-0.35.0.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/com.pinterest.ktlint/ktlint-core/0.35.0/3d95d90a75cb2d09dcf4b97344a186a8764456b6/ktlint-core-0.35.0.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-compiler-embeddable/1.3.50/1251c1768e5769b06c2487d6f6cf8acf6efb8960/kotlin-compiler-embeddable-1.3.50.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/1.3.50/b499f22fd7c3e9c2e5b6c4005221fa47fc7f9a7a/kotlin-reflect-1.3.50.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.3.50/b529d1738c7e98bbfa36a4134039528f2ce78ebf/kotlin-stdlib-1.3.50.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/com.pinterest.ktlint/ktlint-ruleset-standard/0.35.0/12369a46240a439480716889d6006ba2b6f3ae18/ktlint-ruleset-standard-0.35.0.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/com.pinterest.ktlint/ktlint-ruleset-experimental/0.35.0/3b2c1535eea2bc3880cd4d0f23ed92dcf1070649/ktlint-ruleset-experimental-0.35.0.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/com.pinterest.ktlint/ktlint-reporter-plain/0.35.0/e3ad9b91da0158a4731dc11b989a0fe8a2ba2ee3/ktlint-reporter-plain-0.35.0.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/com.pinterest.ktlint/ktlint-reporter-json/0.35.0/a484571abacff949924070fad63e225cbc71279c/ktlint-reporter-json-0.35.0.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/com.pinterest.ktlint/ktlint-reporter-checkstyle/0.35.0/6ae53cb69566ea9afc51baa0cf33897cb5a48c1d/ktlint-reporter-checkstyle-0.35.0.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/com.pinterest.ktlint/ktlint-test/0.35.0/a6a012aa1afed4b8dba1273caecfa09c29f64e87/ktlint-test-0.35.0.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/com.github.shyiko.klob/klob/0.2.1/f6bc8b98c3fcce8a559beb2b6e8ec58efadb5bbe/klob-0.2.1.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/info.picocli/picocli/3.9.6/3638cf9e990d401b0ab6167a360649707a678a18/picocli-3.9.6.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.50/3d9cd3e1bc7b92e95f43d45be3bfbcf38e36ab87/kotlin-stdlib-common-1.3.50.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/org.ec4j.core/ec4j-core/0.2.0/418578f455419fb2b4c24cb8ff6f9af55e7fa4e6/ec4j-core-0.2.0.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/org.assertj/assertj-core/3.12.2/3c9724faa6090ab78a61d4e54011df72de2361c4/assertj-core-3.12.2.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/junit/junit/4.12/2973d150c0dc1fefe998f834810d68f278ea58ec/junit-4.12.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-script-runtime/1.3.50/59492b8dfb92522ba0ddb5dd1c4d0ef0a4fca1af/kotlin-script-runtime-1.3.50.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-daemon-embeddable/1.3.50/5cb93bb33f4c6f833ead0beca4c831668e00cf52/kotlin-daemon-embeddable-1.3.50.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/org.jetbrains.intellij.deps/trove4j/1.0.20181211/216c2e14b070f334479d800987affe4054cd563f/trove4j-1.0.20181211.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/42a25dc3219429f0e5d060061f71acb49bf010a0/hamcrest-core-1.3.jar com.pinterest.ktlint.Main -F **/src/**/*.kt !**/buildSrc/**
Successfully started process 'command '/usr/lib/jvm/java-8-openjdk-amd64/bin/java''
Task :ktlintFormat in app-android Finished

> Task :ktlintFormat FAILED
:ktlintFormat (Thread[Execution worker for ':',5,main]) completed. Took 6.789 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ktlintFormat'.
> Process 'command '/usr/lib/jvm/java-8-openjdk-amd64/bin/java'' finished with non-zero exit value 137
JakeWharton commented 4 years ago

Code 137 is OOM. You need to allocate more RAM or restrict the heap size of the JVMs you're running.

On Wed, Nov 27, 2019 at 1:52 PM Scott Pierce notifications@github.com wrote:

We have a problem with ktlint failing in our CI build (linux), but runs perfectly locally (mac). I just added a buildSrc, using kotlinscript, but there doesn't seem like a valid reason for this to fail.

Here is our application that is applied from a separate .gradle file.

repositories { jcenter() }

configurations { ktlint }

dependencies { ktlint "com.pinterest:ktlint:0.35.0" }

task ktlint(type: JavaExec, group: "verification") { description = "Check Kotlin code style." classpath = configurations.ktlint main = "com.pinterest.ktlint.Main" args "/src//*.kt", "!/buildSrc/" }

task ktlintFormat(type: JavaExec, group: "formatting") { description = "Fix Kotlin code style deviations." classpath = configurations.ktlint main = "com.pinterest.ktlint.Main" args "-F", "/src//*.kt", "!/buildSrc/" }

Here is the primary output after running ./gradlew ktlintFormat.

Starting process 'command '/usr/lib/jvm/java-8-openjdk-amd64/bin/java''. Working directory: /home/circleci/workspace Command: /usr/lib/jvm/java-8-openjdk-amd64/bin/java -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/circleci/.gradle/caches/modules-2/files-2.1/com.pinterest/ktlint/0.35.0/33f83457cc6bb0f930f05a3447f84ad2da05d8a2/ktlint-0.35.0.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/com.pinterest.ktlint/ktlint-core/0.35.0/3d95d90a75cb2d09dcf4b97344a186a8764456b6/ktlint-core-0.35.0.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-compiler-embeddable/1.3.50/1251c1768e5769b06c2487d6f6cf8acf6efb8960/kotlin-compiler-embeddable-1.3.50.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/1.3.50/b499f22fd7c3e9c2e5b6c4005221fa47fc7f9a7a/kotlin-reflect-1.3.50.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.3.50/b529d1738c7e98bbfa36a4134039528f2ce78ebf/kotlin-stdlib-1.3.50.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/com.pinterest.ktlint/ktlint-ruleset-standard/0.35.0/12369a46240a439480716889d6006ba2b6f3ae18/ktlint-ruleset-standard-0.35.0.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/com.pinterest.ktlint/ktlint-ruleset-experimental/0.35.0/3b2c1535eea2bc3880cd4d0f23ed92dcf1070649/ktlint-ruleset-experimental-0.35.0.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/com.pinterest.ktlint/ktlint-reporter-plain/0.35.0/e3ad9b91da0158a4731dc11b989a0fe8a2ba2ee3/ktlint-reporter-plain-0.35.0.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/com.pinterest.ktlint/ktlint-reporter-json/0.35.0/a484571abacff949924070fad63e225cbc71279c/ktlint-reporter-json-0.35.0.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/com.pinterest.ktlint/ktlint-reporter-checkstyle/0.35.0/6ae53cb69566ea9afc51baa0cf33897cb5a48c1d/ktlint-reporter-checkstyle-0.35.0.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/com.pinterest.ktlint/ktlint-test/0.35.0/a6a012aa1afed4b8dba1273caecfa09c29f64e87/ktlint-test-0.35.0.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/com.github.shyiko.klob/klob/0.2.1/f6bc8b98c3fcce8a559beb2b6e8ec58efadb5bbe/klob-0.2.1.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/info.picocli/picocli/3.9.6/3638cf9e990d401b0ab6167a360649707a678a18/picocli-3.9.6.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.50/3d9cd3e1bc7b92e95f43d45be3bfbcf38e36ab87/kotlin-stdlib-common-1.3.50.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/org.ec4j.core/ec4j-core/0.2.0/418578f455419fb2b4c24cb8ff6f9af55e7fa4e6/ec4j-core-0.2.0.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/org.assertj/assertj-core/3.12.2/3c9724faa6090ab78a61d4e54011df72de2361c4/assertj-core-3.12.2.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/junit/junit/4.12/2973d150c0dc1fefe998f834810d68f278ea58ec/junit-4.12.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-script-runtime/1.3.50/59492b8dfb92522ba0ddb5dd1c4d0ef0a4fca1af/kotlin-script-runtime-1.3.50.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-daemon-embeddable/1.3.50/5cb93bb33f4c6f833ead0beca4c831668e00cf52/kotlin-daemon-embeddable-1.3.50.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/org.jetbrains.intellij.deps/trove4j/1.0.20181211/216c2e14b070f334479d800987affe4054cd563f/trove4j-1.0.20181211.jar:/home/circleci/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/42a25dc3219429f0e5d060061f71acb49bf010a0/hamcrest-core-1.3.jar com.pinterest.ktlint.Main -F /src//*.kt !/buildSrc/ Successfully started process 'command '/usr/lib/jvm/java-8-openjdk-amd64/bin/java'' Task :ktlintFormat in app-android Finished

Task :ktlintFormat FAILED :ktlintFormat (Thread[Execution worker for ':',5,main]) completed. Took 6.789 secs.

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':ktlintFormat'.

    Process 'command '/usr/lib/jvm/java-8-openjdk-amd64/bin/java'' finished with non-zero exit value 137

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pinterest/ktlint/issues/661?email_source=notifications&email_token=AAAQIEL4JYDJOGNFFRY4A43QV26XFA5CNFSM4JSK6ISKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H4P3A2A, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAQIEKKHLGSFDK35EC6GZLQV26XFANCNFSM4JSK6ISA .

ScottPierce commented 4 years ago

Thanks @JakeWharton. Overriding memory settings with GRADLE_OPTS: -Xmx1536m seems to do the trick. However we'd already lowered the memory settings, so this is surprising.