Make Logger safe from static initialization order fiasco (NGWPC-7168) - #11
Merged
Conversation
PhilMiller
marked this pull request as ready for review
August 26, 2025 04:55
zhengtaocui
pushed a commit
that referenced
this pull request
May 18, 2026
…sco (#11) In dynamic initialization of a global static instance of InterpreterUtil, there was a call to LOG that happened to be running before the dynamic initialization of the class-static members of Logger. This led to invalid memory accesses and hence crashes. These crashes were a symptom of C++ Static Initialization Order Fiasco.
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.
In dynamic initialization of a global
staticinstance ofInterpreterUtil, there was a call toLOGthat happened to be running before the dynamic initialization of the class-staticmembers ofLogger. This led to invalid memory accesses and hence crashes. These crashes were a symptom of C++ Static Initialization Order Fiasco.Changes
Logger: Make most member variables instance members rather thanstatic, and introduce aGetLogger()function to contain astaticpointer to a simple singleton instance that can be initialized safelyTesting
test_bmi_pythonto trigger the failure case regardless of a NumPy version mismatchChecklist