Repository navigation
Conversation
damccorm
force-pushed
the
spawn-models-dedicated-process
branch
from
October 26, 2026 16:58
5c9e479 to
3271020
Compare
damccorm
force-pushed
the
spawn-models-dedicated-process
branch
from
October 26, 2026 17:29
3271020 to
c5e3077
Compare
damccorm
force-pushed
the
spawn-models-dedicated-process
branch
from
October 26, 2026 18:41
c5e3077 to
e7e1768
Compare
damccorm
force-pushed
the
spawn-models-dedicated-process
branch
from
October 26, 2026 19:00
e7e1768 to
8ceb461
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.
Summary
Addresses #40673 using approach (b) from the issue discussion: spawn shared
MultiProcessSharedmodels in dedicated processes (spawn_process=True).Root Cause
When
MultiProcessShared(..., always_proxy=True, spawn_process=False)is used, the process that initializes the shared object both runs the_SingletonRegistrarserver (Server.accepter) on a background thread and connects to its own server viaBaseProxy. If an unreachableBaseProxyis part of a reference cycle and Python's cyclic GC runs during an allocation on theaccepterthread,BaseProxy._decrefopens a blocking client connection to that same server whileaccepteris blocked inside_decref, deadlocking the server (and any callers waiting on_process_local_lock).Changes
apache_beam/ml/inference/base.py:spawn_process=Trueon thealways_proxy=TrueMultiProcessSharedhandles (_RunInferenceDoFn._load_model,_RunInferenceDoFn._run_inference,load_model_status,_SharedModelWrapper, andfinish_bundle'sunsafe_hard_delete).always_proxy=Falsefor worker-localModelManagerso itsprocess_wide=Truemetrics stay in the SDK worker without self-proxying.apache_beam/ml/inference/base_test.py):model_copies > 1.accepterwith reference-cycled model handles, local closures, and side-input model updates ([Bug]: Using MultiProcessShared handle can deadlock when always_proxy=True #40673).