[python] Avoid concurrent import failures during split deserialization - #9250
Open
XiaoHongbo-Hope wants to merge 3 commits into
Open
[python] Avoid concurrent import failures during split deserialization#9250XiaoHongbo-Hope wants to merge 3 commits into
XiaoHongbo-Hope wants to merge 3 commits into
Conversation
XiaoHongbo-Hope
marked this pull request as ready for review
August 16, 2026 11:51
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.
Problem
A production Ray job using the REST/DLF catalog failed while workers first deserialized query_auth_split and DataFileMeta objects concurrently. The reported error was:
All 18 workers in the reported job failed. Pre-importing PyPaimon through worker_process_setup_hook avoided the race. A FULL global-index fallback can amplify the problem by scheduling many splits, but the import race is not specific to FULL mode.
Root cause
Importing any low-level pypaimon submodule executes the package root first. Its eager public exports load the catalog, filesystem, schema, and read dependency graph while the requested split module is still being initialized. Concurrent deserialization can therefore observe partially initialized modules or hit a Python module-lock deadlock.
Fix
Resolve the existing root-level public exports lazily on Python 3.7 and newer, while retaining the eager compatibility path for Python 3.6. Public imports such as from pypaimon import CatalogFactory remain unchanged.
Add a fresh-process regression test that concurrently imports and deserializes a real QueryAuthSplit containing DataFileMeta instances across 24 threads.
Validation