Skip to content

Conversation

@AngersZhuuuu
Copy link
Contributor

What changes were proposed in this pull request?

During spark commit file process, if spark exit,
may remain temporary staging dir under table path, This is very troubling.
After setupJob, we should mark stagingDir as deleteOnExit()

Why are the changes needed?

Fix bug

Does this PR introduce any user-facing change?

Clean remaining staging dir automatic when unexpected exit

How was this patch tested?

No

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

No

@github-actions github-actions bot added the CORE label Dec 9, 2025
@AngersZhuuuu
Copy link
Contributor Author

Gentle. ping @cloud-fan @HyukjinKwon @dongjoon-hyun Could you take a look?

committer.setupJob(jobContext)
try {
val fs = stagingDir.getFileSystem(jobContext.getConfiguration)
fs.deleteOnExit(stagingDir)
Copy link
Member

Choose a reason for hiding this comment

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

For the streaming Spark jobs, this increases indefinitely, doesnt' it, @AngersZhuuuu ?

IMO, we had better consider this kind of behavior change as Improvement instead of Bug to avoid any side-effect. WDYT?

cc @mridulm

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think streaming job need to look at file source staging dir when restarting, this is not state store or checkpoint, cc @HeartSaVioR

Copy link
Contributor

@mridulm mridulm Dec 11, 2025

Choose a reason for hiding this comment

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

For streaming jobs, given their really long duration and large number of commits, we will keep accumulating the deleteOnExit metadata to be tracked - and eventually OOM.
I am assuming that is what @dongjoon-hyun is referring to - and I agree it is a risk.

At a minimum, we can derisk it by calling cancelDeleteOnExit for successful commits.

Btw, please do not catch Throwable

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants