Skip to content

test(mq): TestExternalNATS_ResetOrphaned flakes: first reset sees no live holder #799

Description

@EricAndrechek

Flake

TestExternalNATS_ResetOrphaned (internal/mq/external_test.go) failed once in a local make ci (integration backends phase) on a branch that changes no Go code under internal/; the same code passed make ci several times the same day. A re-run is in progress.

What failed (measured)

The first check, right after the two publishes:

external_test.go:879:
    Error:    Expected error with "unit held by a consumer" in chain but got nil.
    Messages: a live holder's rows are its own

So b.ResetOrphaned(unit) returned no error while broker a was supposed to be the unit's live holder, before a is closed.

What the test assumes

The test starts a's unit consumer (unitConsumer(t, a, unit, &hold)), publishes two rows, and immediately asks b to reset the unit, expecting ErrUnitHeld. ResetOrphaned leaves a unit alone while a client holds the pin or was active on it within the quiet window. Nothing in the test waits for a to hold the pin, or to have received a row, before the first ResetOrphaned call, so under load the call can run before the server has pinned a or recorded any delivery to it. That ordering is inferred from the test code, not shown: the failing run's server state was not captured.

Part of #740.

Activity

  1. EricAndrechek commented on Oct 9, 2026

    @EricAndrechek
    MemberAuthor

    Re-run result (measured): make ci on the identical tree passed, including this test. One failure and one pass on the same code.


    — Posted by Claude Code on behalf of @EricAndrechek

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

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions