Skip to content

Fix loader race poisoning OS-specific virtualnames - #69963

Merged
dwoz merged 1 commit into
saltstack:3006.xfrom
dwoz:dwoz/fix/69806-loader-missing-modules-race
Aug 11, 2026
Merged

dwoz merged 1 commit into
saltstack:3006.xfrom
dwoz:dwoz/fix/69806-loader-missing-modules-race

Conversation

@dwoz

@dwoz dwoz commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes a race in salt.loader.lazy._process_virtual (introduced by b45b721 in 3006.26) that caused OS-specific virtual modules to randomly fail to load. When a sibling module (e.g. deb_postgres.py) evaluated its __virtual__() first and returned False, its __virtualname__ (postgres) was written to missing_modules, blocking the real postgres.py module on subsequent lookups.

The fix stops reassigning module_name to virtualname on failure inside _process_virtual, so missing_modules is keyed only by real file basenames. Per-virtualname failure reasons are tracked in a new missing_virtualnames mapping consulted by missing_fun_string(), preserving the collision-surfacing behavior added for #68625.

Test evidence

Fixes

Since 3006.26 (b45b721) the loader recorded a failed __virtual__() under
the module's __virtualname__ in missing_modules.  When two files share a
virtualname (e.g. deb_postgres.py and postgres.py both use "postgres")
and the failing one was processed first due to non-deterministic
directory iteration, the virtualname was marked missing and the real
module was skipped on subsequent lookups, breaking postgres_user/state
runs on RHEL/Rocky.

Stop reassigning module_name to virtualname on failure in
_process_virtual, so missing_modules is only keyed by the actual file
basename.  Track per-virtualname failure reasons in a new
missing_virtualnames mapping consulted by missing_fun_string(), so
collision error surfacing (issue saltstack#68625) is preserved without the
poisoning race.

Fixes saltstack#69806
@dwoz
dwoz merged commit 6b51de0 into saltstack:3006.x Aug 11, 2026
863 of 870 checks passed
@dwoz
dwoz deleted the dwoz/fix/69806-loader-missing-modules-race branch November 13, 2026 08:30

This branch was previously deployed

1 inactive deployment
ci — 34220f52 Deployed Aug 5, 2026 by dwoz via Build Onedir Packages / Windows (amd64) #26091
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.

2 participants