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

fix yamlloader.DuplicateKeyWarning leaking #62021

Merged
merged 7 commits into from
Jun 24, 2022
Merged

fix yamlloader.DuplicateKeyWarning leaking #62021

merged 7 commits into from
Jun 24, 2022

Conversation

sakateka
Copy link
Contributor

@sakateka sakateka commented May 4, 2022

yamlloader.DuplicateKeyWarning leaks through the external warnings module,
every time LazyLoader loads the yamlloader module,
yamlloader adds a new DuplicateKeyWarning class (with new address and hash)
to the internal list of warnings of the warnings module.

After this #8589 the code about adding warnings is dead code, so just delete it.

What does this PR do?

Fixing memory leak in yamlloader and yamlloader_old modules.

What issues does this PR fix or reference?

Fixes:
may be #61988

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.

@sakateka sakateka requested a review from a team as a code owner May 4, 2022 06:22
@sakateka sakateka requested review from MKLeb and removed request for a team May 4, 2022 06:22
MKLeb
MKLeb previously approved these changes May 11, 2022
twangboy
twangboy previously approved these changes May 11, 2022
`yamlloader.DuplicateKeyWarning` leaks through the external `warnings` module,
every time `LazyLoader` loads the `yamlloader` module,
`yamlloader` adds a new `DuplicateKeyWarning` class (with new address and hash)
to the internal list of warnings of the `warnings` module.

After this PR#8589 the code about adding warnings is dead code, so just delete it.
@garethgreenaway garethgreenaway dismissed stale reviews from twangboy and MKLeb via 9d13522 May 12, 2022 22:11
@sakateka
Copy link
Contributor Author

Hi, please tell me who will merge it, I can't do it myself.

@sakateka sakateka mentioned this pull request May 18, 2022
3 tasks
@sakateka
Copy link
Contributor Author

@dmurphy18 I don't have the right to merge it, can you merge?

@sakateka sakateka mentioned this pull request Jun 16, 2022
3 tasks
@dmurphy18
Copy link
Contributor

@sakateka I don't have merge rights either, but just re-reviewing this, QQ is the change already covered by existing tests ?, if not, it should have a test to show the fix is working.

@sakateka
Copy link
Contributor Author

change already covered by existing tests ?

This is just removing dead code, there is no impact on existing code.

@dmurphy18
Copy link
Contributor

Updated PR with current master branch and re-running tests, if no fails will push to get it in - got to fix those leaks

@dmurphy18
Copy link
Contributor

@sakateka Can you look at the failing tests on Ubuntu 22.04. I believe this might be due to directory changes on Ubuntu 22.04 from /usr/share to /etc/api. Take a look at @Ch3LL PR #62159, so might have to wait till this goes in and then re-run tests

@sakateka
Copy link
Contributor Author

!merge

@sakateka
Copy link
Contributor Author

4 approvals - It's very cool, but I can't merge, I don't have rights

image

@github-actions
Copy link

Hi! I'm your friendly PR bot!

You might be wondering what I'm doing commenting here on your PR.

Yes, as a matter of fact, I am...

I'm just here to help us improve the documentation. I can't respond to
questions or anything, but what I can do, I do well!

Okay... so what do you do?

I detect modules that are missing docstrings or "CLI Example" on existing docstrings!
When I was created we had a lot of these. The documentation for these
modules need some love and attention to make Salt better for our users.

So what does that have to do with my PR?

I noticed that in this PR there are some files changed that have some of these
issues. So I'm leaving this comment to let you know your options.

Okay, what are they?

Well, my favorite, is that since you were making changes here I'm hoping that
you would be the most familiar with this module and be able to add some other
examples or fix any of the reported issues.

If I can, then what?

Well, you can either add them to this PR or add them to another PR. Either way is fine!

Well... what if I can't, or don't want to?

That's also fine! We appreciate all contributions to the Salt Project. If you
can't add those other examples, either because you're too busy, or unfamiliar,
or you just aren't interested, we still appreciate the contributions that
you've made already.

Whatever approach you decide to take, just drop a comment here letting us know!

Detected Issues (click me)
Check Known Missing Docstrings...........................................Failed
- hook id: invoke
- duration: 1.24s
- exit code: 1

/home/runner/.cache/pre-commit/repo_kavnz8y/py_env-python3/lib/python3.9/site-packages/_distutils_hack/init.py:30: UserWarning: Setuptools is replacing distutils.
warnings.warn("Setuptools is replacing distutils.")
The function 'load' on 'salt/utils/yamlloader.py' does not have a docstring
The function 'load' on 'salt/utils/yamlloader_old.py' does not have a docstring
Found 2 errors


Thanks again!

@sakateka
Copy link
Contributor Author

re-run pr-ubuntu-2204-amd64-py3-m2crypto-pytest
re-run pr-photon-3-x86_64-py3-pytes

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.

None yet

6 participants