You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SparkStructuredStreamingPipelineResult.cancel() interrupts the execution thread, which does not cancel a Spark job (DAGScheduler.runJob only ends through JobWaiter.cancel), then stops the SparkSession even when SparkSession.Builder.getOrCreate returned a pre-existing default session shared with other pipelines in the JVM. Batch EvaluationContext.stop() is a no-op.
Consequences:
With useActiveSparkSession=true a batch pipeline is never cancelled and cancel() still returns CANCELLED.
Two pipelines sharing the default session: cancelling one stops the SparkContext under the other.
The execution thread keeps translating on a stopped SparkContext. In beam_PreCommit_Java_Spark_Versions on [Spark][#36841] Translate stateless streaming pipelines on the Spark 4 runner #40090 this surfaced as a NoClassDefFoundError: Could not initialize class PipelineTranslatorBatch cascade over 12 batch tests in one fork, the primary trace was not captured.
Fix: job group cancellation in EvaluationContext (setJobGroup on the execution thread, cancelJobGroup in stop()), session ownership with a reference count in SparkSessionFactory, session stop on the execution thread after evaluation, unbounded join in cancel() instead of Future.cancel(true).
Known blocker for declaring the Spark 4 Structured Streaming runner stable, #36841. Found in review of #40090.
SparkStructuredStreamingPipelineResult.cancel()interrupts the execution thread, which does not cancel a Spark job (DAGScheduler.runJobonly ends throughJobWaiter.cancel), then stops the SparkSession even whenSparkSession.Builder.getOrCreatereturned a pre-existing default session shared with other pipelines in the JVM. BatchEvaluationContext.stop()is a no-op.Consequences:
useActiveSparkSession=truea batch pipeline is never cancelled andcancel()still returns CANCELLED.beam_PreCommit_Java_Spark_Versionson [Spark][#36841] Translate stateless streaming pipelines on the Spark 4 runner #40090 this surfaced as aNoClassDefFoundError: Could not initialize class PipelineTranslatorBatchcascade over 12 batch tests in one fork, the primary trace was not captured.Fix: job group cancellation in
EvaluationContext(setJobGroupon the execution thread,cancelJobGroupinstop()), session ownership with a reference count inSparkSessionFactory, session stop on the execution thread after evaluation, unbounded join incancel()instead ofFuture.cancel(true).Known blocker for declaring the Spark 4 Structured Streaming runner stable, #36841. Found in review of #40090.