Skip to content

Potential Race Condition in Memory Allocator Initialization #315

@han-ian

Description

@han-ian

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions