Skip to content

GC race: dynamic pool can be removed before first connection #209

@vadv

Description

@vadv

Problem

create_dynamic_pool() inserts a pool into POOLS with size == 0. Between insertion and the first server connection (created by get_server_parameters()), GC can remove the pool, causing No pool configured errors.

Currently mitigated with a 2-second grace period (created_at field on ConnectionPool, checked in gc.rs). This works but is a timing-based workaround.

Root cause

The pool is registered in POOLS before its first connection exists. GC sees size == 0 and removes it.

Failed structural fix

Attempted to split create_dynamic_pool into create + register phases (insert into POOLS only after get_server_parameters). This caused protocol hangs on second connection — root cause of the hang was not identified. Reverted in 760ac60.

Desired fix

Insert pool into POOLS only after the first connection is established, without breaking the auth flow for subsequent connections.

Reproduction

Only reproduced in CI (GitHub Actions runners). The SSLRequest roundtrip in prefer mode widens the GC window enough to trigger. With allow mode (default, no SSLRequest) the window is smaller but still exists in theory.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions