Skip to content

test(mq): TestExternalNATS_AcksUnderBothAckSubjectLayouts can fail with context canceled under load #735

Closed

Description

@EricAndrechek

Problem. TestExternalNATS_AcksUnderBothAckSubjectLayouts/v2=false (internal/mq/external_perms_test.go) failed once in a full local make ci integration run. The DoubleAck inside the consume callback in drainsWithAcks returned context canceled:

external_perms_test.go:142:
    Error Trace: internal/mq/external_perms_test.go:142
                 internal/mq/external_consumer.go:565
    Error:       Received unexpected error:
                 context canceled
--- FAIL: TestExternalNATS_AcksUnderBothAckSubjectLayouts/v2=false (1.59s)

Evidence (measured).

  • Seen once in make ci on a busy machine, during the parallel integration stage, on a tree that changed nothing under internal/mq.
  • Running only that test afterwards (-tags integration -race -count=4) passed 4 of 4.
  • An immediate full make ci re-run on the same tree passed.

Context (inferred). The callback acks with m.Ctx, so if that context is cancelled first (e.g. the consumer being stopped, or a deadline under load), the ack fails even though the message was delivered.

Related: #728, #733 (other timing-sensitive integration tests).

Activity

  1. EricAndrechek commented on Oct 6, 2026

    @EricAndrechek
    MemberAuthor

    #734 (merged 2026-10-06) changed this test. It no longer publishes a second row to read the ack subject's layout; it reads the layout off the history stream's copy of the row just drained. Its CHANGELOG entry describes this failure: "no longer fails on an ack that races the end of the test". That looks like the fix for this issue (inferred from the diff; not re-run here). Whoever takes #740 can confirm and close.

  2. EricAndrechek commented on Oct 7, 2026

    @EricAndrechek
    MemberAuthor

    Fixed by #734, which removed the second publish whose ack raced the end of the test (its CHANGELOG entry reports 9 failures in 40 runs before). On main at bf88dba, go test -tags integration -race -count=20 -run TestExternalNATS_AcksUnderBothAckSubjectLayouts ./internal/mq passed all 40 subtest runs. Part of #740.

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