0

I'm aware of Why are my Gradle builds dying with exit-code 137? but that deals with the test target? In my case, my unit tests pass, but the integrationTest target fails with exit code 137.

$ ./gradlew --version    
Welcome to Gradle 4.7!

Here are the highlights of this release:
 - Incremental annotation processing
 - JDK 10 support
 - Grouped non-interactive console logs
 - Failed tests are re-run first for quicker feedback

For more details see https://docs.gradle.org/4.7/release-notes.html


------------------------------------------------------------
Gradle 4.7
------------------------------------------------------------

Build time:   2018-04-18 09:09:12 UTC
Revision:     b9a962bf70638332300e7f810689cb2febbd4a6c

Groovy:       2.4.12
Ant:          Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM:          1.8.0_191 (Oracle Corporation 25.191-b12)
OS:           Linux 4.14.94-89.73.amzn2.x86_64 amd64

$ ./gradlew :project:integrationTest
...
> Process 'Gradle Test Executor 1' finished with non-zero exit value 137

I have the following JvmArgs settings, but they don't see to affect the integrationTest target, only the test target?

apply plugin: 'java'
test {
    failFast = true
    maxParallelForks = 2
    maxHeapSize = '2g'
    forkEvery = 100   // helps when tests leak memory
    jvmArgs '-Xss1m', '-Xms128m', '-Xmx2g',
            '-XX:+UnlockExperimentalVMOptions',
            '-XX:+UseCGroupMemoryLimitForHeap',
            '-XX:+PrintGCDetails',
            '-XX:+PrintGCDateStamps',
            '-XX:+PrintTenuringDistribution',
            '-XX:+PrintGCCause',
            '-XX:+UseGCLogFileRotation',
            '-XX:NumberOfGCLogFiles=10',
            '-XX:GCLogFileSize=5M',
            '-Xloggc:/tmp/fs_oom.log',
            '-XX:+HeapDumpOnOutOfMemoryError',
            '-XX:HeapDumpPath=/tmp/fs_oom_err_pid<pid>.hprof',
            '-XX:+UseGCOverheadLimit',
            '-XX:OnError=cat /tmp/fs_oom.log',
            '-XX:OnOutOfMemoryError=cat /tmp/fs_oom_err_pid<pid>.hprof'
}
integrationTest.failFast = test.failFast
integrationTest.maxParallelForks = test.maxParallelForks
integrationTest.maxHeapSize = test.maxHeapSize
integrationTest.forkEvery = test.forkEvery
integrationTest.jvmArgs = test.jvmArgs

What else can I do to workaround this?

Chris F
  • 14,337
  • 30
  • 94
  • 192

1 Answers1

0

Without seeing your build.gradle configuration it’s hard to tell what you need to change. I assume your integrationTest task is of type Test (like the default test task)? And you have something like the following in your configuration?

test {
    …
    jvmArgs '-Xss1m', '-Xms128m', '-Xmx2g', …
    …
}

In case you haven’t similarly configured the integrationTest task, yet, you should be able to copy the JVM args configuration from the test task like so:

test {
    …
    jvmArgs '-Xss1m', '-Xms128m', '-Xmx2g', …
    …
}
integrationTest.jvmArgs = test.jvmArgs
Chriki
  • 15,638
  • 3
  • 51
  • 66
  • I hope this helps. If not, you might have to provide a [mcve]. – Chriki Mar 19 '19 at 22:26
  • The jvmArgs I provided in my OP are inside the test{} block of my build.gradle. I will put the integrationTest line and hope it helps. – Chris F Mar 20 '19 at 16:22
  • I updated my OP. Adding the integrationTest.* = test.* line in my build.gradle file did not work for me. – Chris F Mar 20 '19 at 17:13