Skip to content

Give each deltaproxy sub-proxy its own loader namespace (#70144) - #70211

Open
ggiesen wants to merge 1 commit into
saltstack:3008.xfrom
ggiesen:fix-70144-deltaproxy-loader-namespace
Open

Give each deltaproxy sub-proxy its own loader namespace (#70144)#70211
ggiesen wants to merge 1 commit into
saltstack:3008.xfrom
ggiesen:fix-70144-deltaproxy-loader-namespace

Conversation

@ggiesen

@ggiesen ggiesen commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes #70144. Each deltaproxy sub-proxy now gets its own loader namespace, so the loader stops handing every sub-proxy the same execution-module objects.

What issues does this PR fix?

Fixes #70144

Root cause

Sub-proxies were built without a loaded_base_name, so they all shared one module namespace. Whichever sub-proxy packed a module last owned that module's __opts__ for the life of the process. Minion._load_modules also dropped loaded_base_name on its non-multimaster branch (the multimaster branch passes it), so handing sub-proxies a namespace had no effect on its own -- both changes are required.

With multiprocessing: False -- what a proxy talking to a real device runs, since a live NETCONF/SSH session cannot be forked -- targeting two or more sub-proxies in a single job left every later SLS render resolving grains, pillar, cachedir and id from the wrong sub-proxy, and it stayed wrong until the deltaproxy was restarted.

Execution modules were unaffected because their grains are repopulated per job, which is why the failure only showed up in rendering. __grains__ still read correctly while __opts__ did not, and the SLS render derives grains from opts["grains"], so the rendered identity was the wrong sub-proxy's.

Note for reproducing: multiprocessing: False is required. With the default True each job is forked and the issue does not reproduce.

Previous Behavior

On a deltaproxy running multiprocessing: False, targeting two or more sub-proxies in one job made every later SLS render resolve grains, pillar, cachedir and id from the wrong sub-proxy, silently and until restart.

New Behavior

Each sub-proxy renders with its own identity, in single-target and multi-target jobs alike, and stays correct afterwards.

Merge requirements satisfied?

  • Docs
  • Changelog
  • Tests written/updated

Tests written?

Yes. Two unit tests in tests/pytests/unit/metaproxy/test_deltaproxy.py: each sub-proxy gets a distinct, id-derived loaded_base_name, and _load_modules forwards it to salt.loader.minion_mods. Both fail against unmodified 3008.x. The fix was also verified end to end against a live deltaproxy on 3008.2, where the reporter's four-step reproducer now returns the correct identity at every step.

Commits signed with GPG?

No

)

Sub-proxies were built without a ``loaded_base_name``, so the loader put
their execution modules in one shared namespace and handed every
sub-proxy the same module objects. Whichever sub-proxy packed a module
last then owned that module's ``__opts__`` for the life of the process.

With ``multiprocessing: False`` -- what a proxy talking to a real device
runs, since a live NETCONF/SSH session cannot be forked -- targeting two
or more sub-proxies in a single job left every later SLS render
resolving grains, pillar, ``cachedir`` and ``id`` from the wrong
sub-proxy, and it stayed wrong until the deltaproxy was restarted.
Execution modules were unaffected because their grains are repopulated
per job, which is why the failure only showed up in rendering.

``Minion._load_modules`` also dropped ``loaded_base_name`` on its
non-multimaster branch, so handing sub-proxies a namespace had no effect
on its own; both changes are needed together.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: deltaproxy: targeting two sub-proxies in one job makes them render the same SLS identity, and it persists

2 participants