Skip to content

Failed registration removes exposition names reserved by existing collectors #2667

Open

Description

@yangjj-iso

What happened?

A failed registration can remove exposition-name reservations belonging to collectors that are still registered. A subsequent registration with a conflicting exposition name is then incorrectly accepted.

Reproduced on main at 85d9fb0dca9f064c746470e91b924d253abf8d30.

Reproduction

  1. Register a counter named events.
  2. Try to register another counter with the same name and label schema; registration correctly throws.
  3. Register a gauge named events_total.

Expected: step 3 is rejected because the original counter still owns the events_total time series name.

Actual: step 3 succeeds. The failed registration released the original counter's events_total and events_created reservations.

The same issue occurs after conflicting help metadata, conflicting metric types with overlapping suffixes, partial exposition-name conflicts, and a failing MultiCollector registration.

Cause

claimExpositionNames() treats a reservation already held by the same Prometheus name as reusable. Both its conflict rollback and validateRegistration()'s failure rollback nevertheless release the whole candidate set, including reservations that predate the failed attempt.

A fix should release only reservations acquired by the current attempt, with claiming and rollback kept inside the existing per-name registered.compute() operation so another successful registration of the same name cannot interleave with rollback.

Five regression tests reproduce the loss while the 27 existing registry tests pass. I have a fix prepared.

AI assistance was used for investigation and regression test preparation.

Activity

  1. added a commit that references this issue on Nov 7, 2026
    b8d9863
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