Skip to content

Don't mask await_lock body exceptions as FileLockError - #70435

Open
pujitha24 wants to merge 1 commit into
saltstack:masterfrom
pujitha24:auto/issue-70229
Open

pujitha24 wants to merge 1 commit into
saltstack:masterfrom
pujitha24:auto/issue-70229

Conversation

@pujitha24

Copy link
Copy Markdown

What does this PR do?

salt.utils.files.await_lock no longer converts exceptions raised inside its async with body into FileLockError; they propagate unchanged (lock-acquire failures still raise FileLockError). The minion's "Failed to acquire job_queue lock" warning now includes the traceback. The retry limit for the disk job queue from the issue is not part of this PR.

What issues does this PR fix or reference?

Relates to #70229

Previous Behavior

A body exception was reported as a lock failure and its traceback was lost.

New Behavior

Body exceptions propagate with their original type and traceback.

Merge requirements satisfied?

  • Docs (n/a)
  • Changelog
  • Tests written/updated

New test fails before and passes after the change. test_minion.py has 2 failures that are identical without the change. I did not reproduce the live log flood.

Commits signed with GPG?

No (DCO sign-off only)

This PR was written in part with the assistance of generative AI.

Fixes #70229

Motivation: salt.utils.files.await_lock yields inside a try whose broad
`except Exception` re-raised everything as FileLockError. Any exception
raised by the body of `async with await_lock(...)` was therefore reported
by the minion as "Failed to acquire job_queue lock ... queuing anyway",
with the real traceback lost. The minion's handler also logged without
the exception.

Approach: track whether control was handed to the with-body and re-raise
body exceptions unchanged; lock-acquire failures still become
FileLockError. The minion's warning now logs with exc_info=True. Adds a
changelog entry.

Not addressed: the issue's third point (retry limit / max age for the
disk job queue) is a larger design change and is left out. The sync
wait_lock has the same pattern and is left unchanged here.

Validation: added test_await_lock_does_not_mask_body_exceptions in
tests/pytests/unit/utils/test_files.py. It fails before the change (the
ValueError is converted to FileLockError) and passes after; the whole
test_files.py module passes (18 passed, 2 skipped). tests/pytests/unit/test_minion.py
shows the same 2 failures with and without this change (49 passed).
Not run: a live minion reproduction of the log flood.

Report: saltstack#70229
Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com>
@pujitha24
pujitha24 requested a review from a team as a code owner October 18, 2026 02:34
@welcome

welcome Bot commented Oct 18, 2026

Copy link
Copy Markdown

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here's some information that may help as you continue your Salt journey.
Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
If you have additional questions, email us at saltproject.pdl@broadcom.com. We're glad you've joined our community and look forward to doing awesome things with you!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: await_lock masks exceptions as FileLockError; minion job_queue requeues forever ("Failed to acquire job_queue lock" log flood)

1 participant