Skip to content

GIL=0 P2P policy reconfiguration can cache a stale peer-access verdict #3947

Closed

Description

@Qubitium

Reproduction (main at 221cd564)

configure_p2p replaces the process-wide policy, then clears _STATUS_CACHE after releasing _CONFIG_LOCK (source). A concurrent enable_peer_access captures the previous threshold, runs a potentially long link validation, and inserts its result into _STATUS_CACHE under a key that contains mode/probe/device indices but not the threshold or a policy generation (lookup, write).

A bounded Python 3.14 free-threaded (PYTHON_GIL=0, sys._is_gil_enabled() == False) test with mocked capability and bandwidth probes paused thread A while it measured 10 GB/s under min_gbps=5. Thread B installed min_gbps=20 and cleared the cache. After A resumed, it cached enabled; B's next enable_peer_access([0,1]) reused that exact object and also returned enabled under the active 20 GB/s policy. A fresh 20 GB/s policy run with the same mocked 10 GB/s probe correctly returns degraded.

The result is a persistent stale classification after concurrent reconfiguration. It can make the current policy's direct-copy gate ineffective for that device pair. This race matters when free-threaded model loads/quantization runs set different P2P policies in one process.

Expected

Bind each status to an immutable policy generation or full policy values, and publish a completed probe only if its generation is still active. Protect configuration, cache lookup/clear, and result publication consistently; add a deterministic interleaving test.

The reproduction executes the actual policy/cache code but mocks two-device capability and bandwidth probing, because the review host has only one NVIDIA GPU. No actual cross-GPU transfer was claimed.

Activity

  1. added a commit that references this issue on Nov 18, 2026
    7e7bd07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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