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 — Shutdown option `WaitForProcessing` never entered on subscription close · Issue #2117 · googleapis/nodejs-pubsub

This repository was archived by the owner on Oct 21, 2026. It is now read-only.
This repository was archived by the owner on Oct 21, 2026. It is now read-only.

Shutdown option WaitForProcessing never entered on subscription close #2117

Copy link
Copy link
Closed
#2118
Closed
Shutdown option WaitForProcessing never entered on subscription close#2117
#2118
Copy link
Labels
api: pubsubIssues related to the googleapis/nodejs-pubsub API.

Description

@nico-kn
nico-kn
opened on Dec 8, 2025
Issue body actions

Please make sure you have searched for information in the following guides.

  • Search the issues already opened: https://github.com/GoogleCloudPlatform/google-cloud-node/issues
  • Search StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js
  • Check our Troubleshooting guide: https://github.com/googleapis/google-cloud-node/blob/main/docs/troubleshooting.md
  • Check our FAQ: https://github.com/googleapis/google-cloud-node/blob/main/docs/faq.md
  • Check our libraries HOW-TO: https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md
  • Check out our authentication guide: https://github.com/googleapis/google-auth-library-nodejs
  • Check out handwritten samples for many of our APIs: https://github.com/GoogleCloudPlatform/nodejs-docs-samples

A screenshot that you have tested with "Try this API".

Not available, this bug is part of the client shutdown behavior and not part of the pubsub API.

Link to the code that reproduces this issue. A link to a public Github Repository or gist with a minimal reproduction.

https://github.com/googleapis/nodejs-pubsub/blob/main/samples/closeSubscriptionWithTimeout.js#L60-L69

A step-by-step description of how to reproduce the issue, based on the linked reproduction.

  1. Create a new subscription with
closeOptions: {
      behavior: SubscriptionCloseBehaviors.WaitForProcessing,
      timeout: Duration.from({seconds: 10}),
    },
  1. Let the message processing callback of that subscription perform work that takes a couple of seconds to finalize. Does not need to exceed the closeOption timeout.
  2. Publish messages to the topic that this subscription is bound to.
  3. Call await subscription.close() during message processing
  4. You will see that the promise is returned immediately and the WaitForProcessing closeOption was never entered

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

There seems to be a bug in the implementation of the condition during subscription close that decides to enter the waitForProcessing behavior in

nodejs-pubsub/src/subscriber.ts

Lines 1001 to 1004 in abeeb6c

if (
behavior === SubscriberCloseBehaviors.WaitForProcessing &&
!this._inventory.isEmpty
) {
. The access to this._inventory.isEmpty seems to be undefined and would need to be changed to this._inventory.isEmpty() as also suggested in the comment of the PR originally introducing this functionality: #2068 (review)

It seems that with this bug, the waitForProcessing graceful shutdown feature introduced with #2068 is not working as expected and the shutdown behavior is never initiated.

A clear and concise description WHY you expect this behavior, i.e., was it a recent change, there is documentation that points to this behavior, etc. **

The WaitForProcessing closeOption was recently introduced in version 5.2.0 with #2068. In the supplied tests, the isEmpty field check is set on test level, hence letting the tests pass. However, in the source code of

Activity

  1. product-auto-label
    added
    api: pubsubIssues related to the googleapis/nodejs-pubsub API.
    on Dec 8, 2025
  2. feywind
    closed this as completedin #2118on Jan 14, 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 googleapis/nodejs-pubsub 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.