Fix race condition in table initialization with multiple threads#243
Fix race condition in table initialization with multiple threads#243brechtvl wants to merge 1 commit intoaous72:masterfrom
Conversation
This caused wrong encoding in the OpenEXR integration, which then resulted in "Error decoding a codeblock" while decoding. Use std::call_once to avoid this. Signed-off-by: Brecht Van Lommel <brecht@blender.org>
|
This issue was found integrating the new OpenEXR HTJ2K encoding in Blender, and I confirmed that a randomly failing test now reliably passes. The bug was found and fixed by Gemini CLI, but I did review the fix carefully. A program to reproduce the issue using thread sanitizer was also generated, I've attached that. The fix resolves all thread sanitizer warnings in that program. I didn't see a way to reproduce this with existing programs included with OpenJPH. Potentially related issues: |
|
Dear Brecht, Thank you for this important discovery and for the PR. I am well with the suggested changes, but I am allergic to opaque C++ code. I am happy to do the changes if that is alright with you. Thanx again. Kind regards, |
|
Thanks for the quickly reply. Feel free to make changes. |
This caused intermittent wrong encoding in the OpenEXR integration, which then resulted in "Error decoding a codeblock" while decoding.
Use std::call_once to resolve this.