Skip to content

[SPARK-58848][SS] Prevent unbounded shuffle reader connection waits - #58089

Open
zeruibao wants to merge 2 commits into
apache:masterfrom
zeruibao:fix-streaming-shuffle-writer-connection-timeout
Open

[SPARK-58848][SS] Prevent unbounded shuffle reader connection waits#58089
zeruibao wants to merge 2 commits into
apache:masterfrom
zeruibao:fix-streaming-shuffle-writer-connection-timeout

Conversation

@zeruibao

@zeruibao zeruibao commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Prevent unbounded shuffle reader connection waits. Instead, timeout after 1 hour.

Why are the changes needed?

unbounded shuffle reader connection waits is unsafe.

Does this PR introduce any user-facing change?

No

How was this patch tested?

UT

Was this patch authored or co-authored using generative AI tooling?

Cursor

@funrollloops funrollloops left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for adding this missing timeout.

Comment on lines +296 to +300
if (newFuture.isCompletedExceptionally) {
// Surface the categorized error instead of the CompletionException from join().
throwErrorIfExists()
}
client = Left(newFuture.join())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is this inconsistent with lines 287 above? And why do we need both this and line 287?

Could we instead consistently unwrap the completion exceptions, if that's really what we want, at the existing exception handling block in write() and in the flush thread?

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.

yeah, I agree it would be nicer.

}
}

test("send throws the structured error when a reader connection times out") {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we instead write 1 row, sleep > the timeout and flush interval, and write a second row? This should test exceptions being inside the flush thread.

As written this test doesn't really cover anything different than the test case above. It also depends on internal implementation details and so is likely to need changes if the code changes.

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.

yaya, let me simulate the real flush trigger route.

@uros-b

uros-b commented Aug 19, 2026

Copy link
Copy Markdown
Member

Thank you @zeruibao! Please add a component tag to the PR title.

@uros-b

uros-b commented Aug 19, 2026

Copy link
Copy Markdown
Member

Also, thank you @jerrypeng and @funrollloops for review!
@zeruibao Please address the outstanding comments.

.createWithDefault(50)

private[spark] val STREAMING_SHUFFLE_WRITER_CONNECTION_TIMEOUT_MS =
ConfigBuilder("spark.shuffle.streaming.writerConnectionTimeoutMs")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it's a timeConf which accepts a human-readable string literal, unnecessary to end with "Ms"

@zeruibao zeruibao changed the title [SPARK-58848] Prevent unbounded shuffle reader connection waits [SPARK-58848][SS] Prevent unbounded shuffle reader connection waits Aug 19, 2026
Unwrap asynchronous failures at thread boundaries and make the flush-thread timeout test deterministic while adopting a duration-style config name.
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.

5 participants