Skip to content

fix: prevent glog crash on concurrent initialization#6

Merged
lxy-9602 merged 4 commits intoalibaba:mainfrom
lxy-9602:fix-multi-thread-init-glog
Dec 16, 2025
Merged

fix: prevent glog crash on concurrent initialization#6
lxy-9602 merged 4 commits intoalibaba:mainfrom
lxy-9602:fix-multi-thread-init-glog

Conversation

@lxy-9602
Copy link
Collaborator

Purpose

Fix crash in multi-threaded FileStoreWrite::Create due to unsafe glog initialization.

google::InitGoogleLogging() is not thread-safe and must be called only once in a single-threaded context. However, when multiple threads concurrently call FileStoreWrite::Create, they may trigger InitGoogleLogging() simultaneously, leading to undefined behavior and occasional core dumps.

This PR fixes the issue by locking for ensuring it is executed exactly once—even under heavy concurrency.

Tests

logging_test.cpp

API and Format

Documentation

@CLAassistant
Copy link

CLAassistant commented Dec 15, 2025

CLA assistant check
All committers have signed the CLA.

@lxy-9602 lxy-9602 requested a review from zjw1111 December 16, 2025 01:50
@lxy-9602 lxy-9602 merged commit 3f03070 into alibaba:main Dec 16, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants