@@ -176,8 +176,24 @@ jobs:
176176 run : |
177177 cd apache-spark
178178 rm -rf /root/.m2/repository/org/apache/parquet # somehow parquet cache requires cleanups
179+ # SERIAL_SBT_TESTS gates SparkParallelTestGrouping in
180+ # project/SparkBuild.scala. For Spark 4.0.2 on JDK 21 we
181+ # leave it unset so the grouping is installed and
182+ # DEDICATED_JVM_SBT_TESTS below actually forks a dedicated
183+ # JVM per listed suite, working around the V1/V2 Parquet and
184+ # Orc source-suite cross-suite file-stream leak under JDK 21
185+ # (issue #4327). For other rows we keep it set to reduce
186+ # peak memory on standard 7 GB runners.
187+ if [ "${{ matrix.config.spark-short }}" != "4.0" ] || [ "${{ matrix.config.java }}" != "21" ]; then
188+ export SERIAL_SBT_TESTS=1
189+ fi
190+ # Cap parallel forked test JVMs at 1 so that even when
191+ # SparkParallelTestGrouping is enabled we don't blow the
192+ # 7 GB runner budget (each forked test JVM has -Xmx2g).
179193 NOLINT_ON_COMPILE=true ENABLE_COMET=true ENABLE_COMET_ONHEAP=true COMET_PARQUET_SCAN_IMPL=${{ matrix.config.scan-impl }} ENABLE_COMET_LOG_FALLBACK_REASONS=${{ github.event.inputs.collect-fallback-logs || 'false' }} \
180- build/sbt -Dsbt.log.noformat=true -mem $SBT_MEM ${{ matrix.module.args1 }} "${{ matrix.module.args2 }}"
194+ build/sbt -Dsbt.log.noformat=true -mem $SBT_MEM \
195+ 'set Global / concurrentRestrictions := Seq(Tags.limit(Tags.ForkedTestGroup, 1))' \
196+ ${{ matrix.module.args1 }} "${{ matrix.module.args2 }}"
181197 if [ "${{ github.event.inputs.collect-fallback-logs }}" = "true" ]; then
182198 find . -type f -name "unit-tests.log" -print0 | xargs -0 grep -h "Comet cannot accelerate" | sed 's/.*Comet cannot accelerate/Comet cannot accelerate/' | sort -u > fallback.log
183199 fi
@@ -186,9 +202,6 @@ jobs:
186202 # Standard GitHub runners have 7 GB RAM; cap SBT heap so forked test
187203 # JVMs fit alongside it.
188204 SBT_MEM : " 3072"
189- # Disable parallel test execution to reduce peak memory usage —
190- # mirrors what apache/spark does on GitHub Actions.
191- SERIAL_SBT_TESTS : " 1"
192205 # Mirror Spark's own JDK 21 / 25 CI workaround. apache/spark's
193206 # build_java21.yml and build_java25.yml set this same env var to
194207 # process-isolate the V1/V2 Parquet and Orc source suites because
0 commit comments