-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
address circular reference in LazyLoader with ThreadLocalProxy #51499
Conversation
I think the whole reason was to make the context dicts thread-safe. @smarsching should probably have some input here. |
@thatch45 @terminalmage @smarsching figured out what was going on, pushed a proper fix. Would still appreciate a review but I'm fairly confident this fix is good for merge. |
400067a
to
45c7994
Compare
This does make more sense but I'd still appreciate eyes on this from @smarsching. I'm also kind of worried about what other areas of Salt's code could potentially be affected by similar issues. |
e3adec2
to
d18f124
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor style change.
I don't know enough about the ThreadLocalProxy to have a good opinion on what's going on with the rest of the change(s). I don't see anything that strikes me as obviously wrong, though.
salt/loader.py
Outdated
@@ -35,7 +35,7 @@ | |||
import salt.utils.lazy | |||
import salt.utils.odict | |||
import salt.utils.platform | |||
import salt.utils.thread_local_proxy | |||
from salt.utils.thread_local_proxy import ThreadLocalProxy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll want to move this from
import down with the rest of the from
(somewhere below line 41).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
I am sorry for being so so quiet about this issue, I am currently preoccupied with some other projects. @mattp Basically, your changes look good to me. I only wondered, why you used
when
is simpler and would achieve nearly the same thing (the only difference is that On a more general note: I am not quite sure I understand why this issue exists in the first place and whether this is the best way to fix it. From the stack trace, it looks like there is a As far as I understand the problem, this issue appears when a However, there is one thing, that I do not understand about this: Even without the |
when lazyLoader was getting instantiated from inside already lazyloaded modules (ie state), pillar/grain (and probably other) globals were already populated. In this case they weren't getting dereferenced properly when wrapped via the NamespacedDict wrapper, causing an infinite loop. This should fix that scenario. Fixes saltstack#50655 (comment)
@smarsching no worries, wrt get_reference vs unproxy, it wasn't a conscious choice - I can update that.
|
@waynew Are we good here? |
What does this PR do?
when lazyLoader was getting instantiated from inside already lazyloaded
modules (ie state), pillar/grain (and probably other) globals were
already populated. In this case they weren't getting dereferenced
properly when wrapped via the NamespacedDict wrapper, causing an
infinite loop. This should fix that scenario.
What issues does this PR fix or reference?
#50655 (comment)
pushing this to see what jenkins has to say
Previous Behavior
Remove this section if not relevant
New Behavior
Remove this section if not relevant
Tests written?
Yes/No
Commits signed with GPG?
Yes/No
Please review Salt's Contributing Guide for best practices.
See GitHub's page on GPG signing for more information about signing commits with GPG.