Spock: Bug: Heap error is swallowed in Spock 2, feature is skipped, subsequent features don't run

Created on 11 Mar 2021  路  1Comment  路  Source: spockframework/spock

Issue description

A Spock feature that throws an java.lang.OutOfMemoryError: Java heap space exception will have its exception apparently swallowed by Spock 2.0 (I tried both M2 and M4). The offending feature will be returned as skipped, and no subsequent features in the specification are executed.

By comparison, Spock 1.3 will throw the heap error, fail the offending feature, and still execute subsequent features, which are all more desireable behaviors.

I am happy to explain this or the MRE linked below further if/as needed.

How to reproduce

Here is a minimal reproducible example in the form of a Gradle project, which has subprojects for Spock 1.3 and Spock 2.0 so you can easily see the difference:

https://github.com/treyturner/spock-2-silent-heap-error-skips-tests

Java/JDK

java version "10.0.2" 2018-07-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)

Groovy version

3.0.6 and 3.0.7 - affected
2.5.14 - unaffected

Gradle

Gradle 6.7

Operating System

Windows 10 1909 (18363.1316)

IDE

IntelliJ IDEA Community Edition 2020.3.2

Build-tool dependencies used

implementation "org.apache.poi:poi:5.0.0"
implementation "org.apache.poi:poi-ooxml:5.0.0"
bug

Most helpful comment

Thanks @treyturner, btw the MCVE was just

class OomSpec extends Specification {
  def a() {
    expect:
    throw new OutOfMemoryError()
  }
}

but thanks for providing that example project.

>All comments

Thanks @treyturner, btw the MCVE was just

class OomSpec extends Specification {
  def a() {
    expect:
    throw new OutOfMemoryError()
  }
}

but thanks for providing that example project.

Was this page helpful?
0 / 5 - 0 ratings