Repository navigation
Backport VDBObject fix - #1574
Merged
ivanimanishi merged 2 commits intoOct 22, 2026
Merged
Conversation
This made lots of interesting sequences of events possible - here's one : 1. Thread A sees `m_hashValid == false` and starts to compute the hash. 2. Thread B also sees `m_hashValid == false` and also starts to compute the hash. 3. Threads A and B merrily stomp over `m_hash` concurrently, so the result won't be deterministic. There are further problems though... 4. Thread A finishes stomping and sets `m_hashValid = true`. Thread B continues stomping. 5. Threads C, D, E etc see `m_hashValid == true` and read whatever the current value of `m_hash` is - all getting different values from different stages of thread B's stomping. This was causing instanced in-memory VDBS to lose their instancing when exported to Arnold, because each instance got a different random version of the hash. This is mitigated by computing the hash in a temporary variable before assigning it. This isn't a full fix though, because the compiler _could_ reorder `m_hashValid = true` before `m_hash = h` from the point of view of a reading thread. Solving that needs some form of synchronisation (mutex, call_once etc), which we can't do without an ABI break.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes
hash()