Skip to content

[spark] Fix flaky SparkStreamingTest by handling interruption when close streaming execution#3141

Open
Yohahaha wants to merge 8 commits intoapache:mainfrom
Yohahaha:fix-issue3129
Open

[spark] Fix flaky SparkStreamingTest by handling interruption when close streaming execution#3141
Yohahaha wants to merge 8 commits intoapache:mainfrom
Yohahaha:fix-issue3129

Conversation

@Yohahaha
Copy link
Copy Markdown
Contributor

Purpose

Linked issue: close #3129

Brief change log

Spark's isInterruptedByStop() only recognizes:

  • InterruptedException
  • InterruptedIOException
  • ClosedByInterruptException
  • ExecutionException (with interrupt cause)
  • SparkException (with "cancelled" message)

Fluss wraps InterruptedException in FlussRuntimeException, which Spark treats as a real error.

Tests

manually run 10 rounds full spark ut in local.

API and Format

Documentation

@Yohahaha Yohahaha marked this pull request as ready for review April 20, 2026 13:32
@Yohahaha Yohahaha changed the title [spark] Fix unstable UT due to uncatched InterruptedException throws when stop streaming execution [spark] Fix flaky SparkStreamingTest by handling interruption when close streaming execution Apr 20, 2026
@Yohahaha
Copy link
Copy Markdown
Contributor Author

@YannByron @wuchong

} catch {
case e: FlussRuntimeException =>
if (e.getCause != null && e.getCause.isInstanceOf[InterruptedException]) {
logWarning(s"Streaming execution thread be interrupted.")
Copy link
Copy Markdown
Contributor

@beryllw beryllw Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thread.currentThread().interrupt()
logWarning(s"Streaming execution thread was interrupted.")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-throw InterruptedException let spark streaming catch it. thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Test] Unstable test SparkStreamingTest read: log table

2 participants