-
Notifications
You must be signed in to change notification settings - Fork 206
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
Reference : Make m_plugEdits
key more unique
#5506
Reference : Make m_plugEdits
key more unique
#5506
Conversation
This is a good question, and I think we need to answer it before considering the question of whether or not there might be a better solution. Could you remind me of the exact output from the test failure so I can try to wrap my head around it please? |
The full error is
What I found while debugging is that https://github.com/ericmehl/gaffer/blob/cc7c02b15070c373fd16a17eac8d567bd9e9eaed/src/Gaffer/Reference.cpp#L330 is finding an entry for But I also did a check to see if |
That makese sense - |
I think the fundamental issue here is that we're using |
Ah right, I did test against Just to be clear, I'm doing
immediately above https://github.com/ericmehl/gaffer/blob/cc7c02b15070c373fd16a17eac8d567bd9e9eaed/src/Gaffer/Reference.cpp#L348 That never outputs that text or triggers a breakpoint on the |
That's the line where we create a new entry if there's not one there already. The problem in this case is that there is an entry already, created earlier when there was a different plug (with a different name) at that address. I think you want to be putting that check inside the |
Right, putting it in the The test farther down, above line 348, was my attempt to figure out what was adding the plug to the map. That's where I was scratching my head wondering how it ended up in the map without ever being added. |
It won't necessarily have been something called "m1" that was added to the map - it'll have been some other plug that once had the address that "m1" now has, but was destroyed without being removed from |
Based on that I added
to It also worked with just |
That RecursiveIterator approach sounds good - could you update the PR with it please? |
Previously, we were only removing edit entries for the immediate children of a Reference. This could leave stale edits in the edit cache for plugs at the grandchild level and deeper. Usually that does not cause a problem because `m_plugEdits` is keyed using the plug pointer address. But on Windows in particular, the address of a destroyed plug was occasionally (something like 1 in 1000) being reused for a new plug, causing a false positive lookup in `m_plugEdits`.
cc7c02b
to
445a9d1
Compare
Sure thing, that's pushed in commit 445a9d1. |
This fixes a rare (about 1 in 1,000) test failure on Windows of
GafferTest.ReferenceTest.testAddingChildPlugs
. Though it works, there are a few things I'm not certain of :m_plugEdits
map?script.load()
andassertExpectedChildren()
in a loop for something like 1000 iterations? On my workstation this takes about 15 seconds.changes.md
? If so, I assume it's a bug fix but what bug is being fixed? If it triggered in real use, it would attempt to set a value on a plug that shouldn't be set?Thanks to @johnhaddon for pointing me in the direction of the pointer address reuse!
Checklist