Skip to content

Potential MemoryManager Deadlock #4325

@tustvold

Description

@tustvold

Describe the bug

MemoryManager::can_grow_directly makes use of a parking_lot::CondVar. This is a blocking primitive, and as a result will block the current tokio worker thread until such a time as the condition is signalled.

As the tokio worker pool is a bounded thread pool, often with workers equal to the number of threads, this can potentially result in a deadlock where all the worker threads are blocked waiting for memory that will never be freed as all the workers are blocked.

To Reproduce

Expected behavior

It should be a simple case of switching to using https://docs.rs/tokio/latest/tokio/sync/struct.Notify.html instead of a CondVar

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions