Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for empty pillar cache disk file and not call msgpack to load it, with test #63732

Merged
merged 4 commits into from
Feb 28, 2023

Conversation

dmurphy18
Copy link
Contributor

@dmurphy18 dmurphy18 commented Feb 17, 2023

What does this PR do?

Check file is not empty before attempting to read pillar disk cache file

What issues does this PR fix or reference?

Fixes: #63729

Previous Behavior

Would have errors in the log file

File "msgpack/_unpacker.pyx", line 200, in msgpack._unpacker.unpackb
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfe in position 0: invalid start byte

New Behavior

No errors since don't ask msgpack to load an empty file

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

Yes

Please review Salt's Contributing Guide for best practices.

See GitHub's page on GPG signing for more information about signing commits with GPG.

@dmurphy18 dmurphy18 requested a review from a team as a code owner February 17, 2023 00:15
@dmurphy18 dmurphy18 requested review from dwoz and removed request for a team February 17, 2023 00:15
@dmurphy18 dmurphy18 force-pushed the fix_issue_63729 branch 2 times, most recently from 4dcf522 to de574c2 Compare February 21, 2023 16:50
@anilsil anilsil added this to the Sulphur v3006.0 milestone Feb 22, 2023
@Ch3LL
Copy link
Contributor

Ch3LL commented Feb 24, 2023

Why are there empty files in the first place? Would a better fix be to ensure we aren't adding empty files into the cache?

@dmurphy18
Copy link
Contributor Author

@Ch3LL This is the pillar cache on disk that is causing the issue to occur, the file has been created but has not been filled with contents, hence it is empty and when the code requests the msgpack to load it, the error is thrown by msgpack since it doesn't handle a file with no contents.
Easiest solution is to not ask msgpack to load an empty file.

@s0undt3ch s0undt3ch merged commit 7413acc into saltstack:master Feb 28, 2023
@dmurphy18 dmurphy18 deleted the fix_issue_63729 branch June 15, 2023 17:15
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] Check file is not empty before attempting to read pillar disk cache file
5 participants