Skip to content

Comments

StorageManager: call shutdown before awaitTermination#3607

Open
f2prateek wants to merge 1 commit intoapache:mainfrom
f2prateek:fix-shutdown
Open

StorageManager: call shutdown before awaitTermination#3607
f2prateek wants to merge 1 commit intoapache:mainfrom
f2prateek:fix-shutdown

Conversation

@f2prateek
Copy link

What changes were proposed in this pull request?

Call saveCommittedFileInfosExecutor.shutdown() before awaitTermination() in saveAllCommittedFileInfosToDB() so the executor shuts down correctly during worker shutdown.

Why are the changes needed?

awaitTermination() only waits for the executor to finish after a shutdown has been requested; without shutdown(), the executor keeps running and can schedule more work.

From ExecutorService documentation:

Blocks until all tasks have completed execution "after a shutdown request", ...

Does this PR resolve a correctness bug?

Possibly, as it could lead to race conditions writing to RocksDB during shutdown, which could cause data loss or correctness issues.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Should be exercised by existing tests to ensure this doesn't introduce a regression.

Call saveCommittedFileInfosExecutor.shutdown() before awaitTermination() in saveAllCommittedFileInfosToDB() so the executor shuts down correctly during worker shutdown.

awaitTermination() only waits for the executor to finish after a shutdown
has been requested.

Without shutdown(), the executor keeps running and can schedule more work.

From ExecutorService documentation
(https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ExecutorService.html#awaitTermination-long-java.util.concurrent.TimeUnit-):

> Blocks until all tasks have completed execution "after a shutdown request", ...
Copy link

@afterincomparableyum afterincomparableyum left a comment

Choose a reason for hiding this comment

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

LGTM as long as CI passes, thanks for your contribution!

@afterincomparableyum
Copy link

afterincomparableyum commented Feb 19, 2026

@f2prateek Could you create new Jira ticket for this PR. Steps to do so are here: #1053? One of the maintainers will run the CI for you when they get the chance to do so.

@SteNicholas
Copy link
Member

@f2prateek, could you please create new jira ticket for this pull request which refers to #1053? I have run the CI of this pull request.

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

LGTM

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants