GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — pubsub: "Cannot execute the operation on ended Span" when a subscriber acks before the receipt modack batch is sent · Issue #9972 · googleapis/google-cloud-node

pubsub: "Cannot execute the operation on ended Span" when a subscriber acks before the receipt modack batch is sent #9972

New issue
Copy link
New issue
Copy link
Backlog
#9973
Backlog
pubsub: "Cannot execute the operation on ended Span" when a subscriber acks before the receipt modack batch is sent#9972
#9973
Copy link
Labels
api: pubsubIssues related to the Pub/Sub API.

Description

@mvegter
mvegter
opened on Nov 24, 2026
Issue body actions

Library Name

@google-cloud/pubsub

Environment

@google-cloud/pubsub 6.4.1, @opentelemetry/sdk-node 0.301 / @opentelemetry/sdk-trace 3.1, Node 26. Streaming pull with enableOpenTelemetryTracing, exactly-once delivery off, default ack/modack batching, always-on sampler.

A clear and concise description of what the bug is, and what you expected to happen

The OpenTelemetry diag logger steadily reports Cannot execute the operation on ended Span {traceId: …, spanId: …}, about 500 times a day from one subscriber. Most come from a message published once a minute whose handler finishes in about 10 ms.

  1. On receipt, the receipt modack is queued in ModAckQueue, and the queued entry holds a copy of the subscribe span (tracingSpan: message.parentSpan in message-queues.ts).
  2. The handler acks within the modack batch window. Subscriber.ack() flushes the ack and calls message.endParentSpan(), which ends the subscribe span.
  3. ModAckQueue._sendBatch then runs PubsubSpans.createModackRpcSpan, which calls addLink on the ended subscribe span. createAckRpcSpan has the same pattern.

In Cloud Trace, the span ID named in the warning is the delivery's <subscription> subscribe span, which ended about 60 ms before the warning. Handlers that run longer than the batch window don't trigger it.

Expected: no write to a subscribe span after it has ended, so no diag warning.

A clear and concise description WHY you expect this behavior

An ended span cannot change, so the SDK drops the link and warns. The only effect is warning noise: the modack RPC span still links to the subscribe span.

The Go, Java and Python clients don't reach an ended span here. Go looks up live subscribe spans per ack ID when an RPC is sent (activeSpans). Java sends receipt modacks before acks in each flush. Python sends the receipt modack before it schedules the callback. In all three, the subscribe span ends after the ack RPC completes.

Related: googleapis/nodejs-pubsub#2119 and #2121, where the publisher ended a span more than once.

Root-cause analysis was AI-assisted (Claude Code); I verified the traces and the library source.

Activity

  1. product-auto-label
    added
    api: pubsubIssues related to the Pub/Sub API.
    on Nov 24, 2026
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

    api: pubsubIssues related to the Pub/Sub API.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.