fix(executor): support destruction from worker threads - #233
Open
mrdrivingduck wants to merge 1 commit into
Open
fix(executor): support destruction from worker threads#233mrdrivingduck wants to merge 1 commit into
mrdrivingduck wants to merge 1 commit into
Conversation
mrdrivingduck
force-pushed
the
codex/fix_default_executor_shutdown
branch
from
August 21, 2026 06:04
29b72fb to
9d7ba65
Compare
mrdrivingduck
marked this pull request as ready for review
August 21, 2026 07:00
Decouple worker state from the executor object so that a task can safely destroy its final executor owner from a worker thread. Cover the lifecycle with executor and S3 asynchronous range-read tests. Co-authored-by: GPT-5.6 Terra <codex@users.noreply.github.com>
mrdrivingduck
force-pushed
the
codex/fix_default_executor_shutdown
branch
from
August 22, 2026 04:55
9d7ba65 to
c8ae8cb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
While testing the OSS filesystem asynchronous read path, we found a lifecycle issue in
DefaultExecutor. The issue is not OSS-specific: S3 asynchronous reads use the same ownership pattern and can trigger it as well.The sequence is:
shared_ptrto its client.join()the current worker thread.Without this fix, joining the current thread throws
std::system_errorwithResource deadlock avoided. Since this happens during destruction, it can terminate the process.This PR separates the executor's shared scheduling state from the executor object. Workers retain the shared state rather than accessing the executor through
this. When destruction happens on a worker, shutdown stops the shared state, joins the other workers, and detaches the current one. The current worker then finishes its task and exits normally.The PR adds a generic executor regression test and an S3 asynchronous range-read test covering this lifecycle.