[GH-ISSUE #315] Potential Race Condition in Memory Allocator Initialization #195

Open
opened 2026-10-26 09:46:54 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @han-ian on GitHub (Jul 22, 2025).
Original GitHub issue: https://github.com/deepseek-ai/3FS/issues/315

Code:
https://github.com/deepseek-ai/3FS/blob/main/src/memory/common/GlobalMemoryAllocator.cc#L76C2-L76C4

Image

Issue Details:
Instruction reordering: gAllocatorInited = true may execute before std::call_once
Memory visibility: gAllocatorInited is not atomic, causing visibility issues across cores
Race condition: Other threads may see gAllocatorInited = true while the allocator is still uninitialized

May be this is an issue.

Originally created by @han-ian on GitHub (Jul 22, 2025). Original GitHub issue: https://github.com/deepseek-ai/3FS/issues/315 Code: https://github.com/deepseek-ai/3FS/blob/main/src/memory/common/GlobalMemoryAllocator.cc#L76C2-L76C4 <img width="566" height="308" alt="Image" src="https://github.com/user-attachments/assets/a4674bfb-2a97-430e-97f8-626e5546e53d" /> Issue Details: Instruction reordering: gAllocatorInited = true may execute before std::call_once Memory visibility: gAllocatorInited is not atomic, causing visibility issues across cores Race condition: Other threads may see gAllocatorInited = true while the allocator is still uninitialized May be this is an issue.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/3FS#195
No description provided.