Make deltaproxy parallel_startup behave like serial startup (#70213) - #70214
Open
ggiesen wants to merge 1 commit into
Open
Make deltaproxy parallel_startup behave like serial startup (#70213)#70214ggiesen wants to merge 1 commit into
ggiesen wants to merge 1 commit into
Conversation
…k#70213) Two ways the parallel startup path diverged from the serial one. A sub-proxy that failed to initialise took the whole control proxy with it. An unloadable proxytype raises KeyError from the proxy loader, which propagated out of asyncio.gather into the except/raise below it and aborted post_master_init, so the daemon could not connect and every healthy sub-proxy went down too. The serial branch has always caught per sub-proxy and carried on. Collect the results with return_exceptions and skip the failures the same way. Sub-proxy schedules, beacons and subprocess cleanup never fired. threaded_subproxy_tune_in installs a brand new asyncio loop as the worker thread's current loop, and PeriodicCallback.start() binds to IOLoop.current(), so every timer bound to a loop that is never run and dies with the worker. schedule.list still reported the job, which made it look configured. Hand the registration to the sub-proxy's own io_loop with call_soon_threadsafe instead, and close the throwaway loop rather than leaking it once per sub-proxy. Note that opts["io_loop"] here is a plain asyncio loop, not a tornado IOLoop, so call_soon_threadsafe is the thread-safe hand-off rather than add_callback.
twangboy
approved these changes
Sep 2, 2026
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?
Brings deltaproxy's
parallel_startuppath to parity with the serial one. Fixes two independent defects that both only appear whenparallel_startup: True.What issues does this PR fix?
Fixes #70213
Root cause
One sub-proxy failing killed the whole control proxy. An unloadable
proxytypemakes the proxy loader raiseKeyErroron<proxytype>.init. That propagated out ofasyncio.gatherinto theexcept Exception: log.error(...); raiseimmediately below it, abortingpost_master_initso the daemon could not connect -- taking every healthy sub-proxy down with it. The non-parallel branch has always caught per sub-proxy and carried on.Sub-proxy schedules, beacons and subprocess cleanup never fired.
threaded_subproxy_tune_ininstalls a brand new asyncio loop as the worker thread's current loop, andPeriodicCallback.start()binds toIOLoop.current(). So every timer bound to a loop that is never run and dies when theThreadPoolExecutorworker exits.schedule.liststill reported the job, which made it look correctly configured. Each sub-proxy also leaked that loop's descriptors.One note for reviewers:
io_loophere is a plain asyncio loop, not atornado.ioloop.IOLoop, so the thread-safe hand-off iscall_soon_threadsaferather thanadd_callback(the latter raisesAttributeErrorand breaks startup).Previous Behavior
With
parallel_startup: True, a single sub-proxy with a badproxytypeleft the salt-proxy daemon dead and no sub-proxy reachable; and no sub-proxy's schedule, beacons or subprocess cleanup ever ran.New Behavior
The parallel path degrades exactly like the serial path: the failing sub-proxy is logged and skipped, the healthy ones come up, and sub-proxy schedules, beacons and cleanup run normally.
Merge requirements satisfied?
Tests written?
Yes. Three unit tests in
tests/pytests/unit/metaproxy/test_deltaproxy.py, each with its inverse case:gather_subproxiesskips the failure and keeps the healthy results, passes everything through untouched when all succeed, andsubproxy_tune_inqueues the periodic registration on the sub-proxy's own loop rather than running it inline. All three fail against unmodified 3008.x.Verified end to end against a live deltaproxy on 3008.2 (one control proxy, three
dummysub-proxies,multiprocessing: False):proxytypeon one sub-proxy, parallel startuptest.pingevery 10s), parallel startupproxytype, serial startupCommits signed with GPG?
No