Skip to content
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

Can't properly initialize and shutdown GLOG #323

Closed
ChristopherHogan opened this issue Jan 18, 2022 · 0 comments
Closed

Can't properly initialize and shutdown GLOG #323

ChristopherHogan opened this issue Jan 18, 2022 · 0 comments

Comments

@ChristopherHogan
Copy link
Collaborator

#273 added proper initialization and finalization of the GLOG library to silence "GLOG not initialized" warnings. However, explicitly shutting down GLOG causes problems with the Hermes VFD.

The Problem

In Hermes::Finalize we call ShutdownGoogleLogging. In the VFD, Hermes::Finalize is called from H5FD__hermes_term, which is a function registered with atexit(3). It appears that atexit(3)-registered functions run after static global objects are destroyed. So, GLOG's static objects are destroyed, then we get to Hermes::Finalize and ShutdownGoogleLogging, where it tries to access those static objects and segfaults.

The Solution

Use IsGoogleLoggingInitialized to see whether or not GLOG needs to be shut down.

The Problem with That

IsGoogleLoggingInitialized is only available in GLOG v.0.5.0.

The Solution

Require GLOG v0.5.0.

The Problem with That

OR-Tools is hardcoded to required GLOG v0.4.0. In newer (> 8.1) versions of OR-Tools they re-implemented their own version of GLOG, so we could update OR-Tools and use GLOG v0.5.0 in Hermes. However, something about the OR-Tools GLOG re-implementation makes it impossible to use in a library that depends on GLOG (i.e., Hermes). Apparently they're waiting for Abseil developers to update to update their flags API (since GFLAGS is now deprecated?).

The Solution

Don't properly init GLOG. Don't properly shutdown GLOG. Live with the warnings. Once this issue is fixed we can update to a newer OR-Tools and GLOG v0.5.0. Alternatively we can replace OR-Tools and avoid all these headaches. See #321.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

No branches or pull requests

2 participants