Skip to content
This repository was archived by the owner on Mar 4, 2026. It is now read-only.

change: pool.ts: add even more logging#2426

Merged
dconeybe merged 3 commits intomainfrom
dconeybe/EvenMoreClientPoolLogging
Sep 25, 2025
Merged

change: pool.ts: add even more logging#2426
dconeybe merged 3 commits intomainfrom
dconeybe/EvenMoreClientPoolLogging

Conversation

@dconeybe
Copy link
Copy Markdown
Contributor

@dconeybe dconeybe commented Sep 25, 2025

This is a follow-up to PRs #2416 and #2420 to add even more logging to ClientPool.

The new/updated log messages include:

  • an "instance ID" for the ClientPool in each log message, to enable distinguishing log messages from distinct ClientPool instances.
  • the result of this.activeClients.delete(client) in ClientPool.release(), to ensure that it is, indeed, deleting an entry.
  • the active request count for each client in LazyLogStringForAllClientIds.
  • a message from ClientPool.terminate() that is unconditionally logged.

This example log output shows what the log messages look like:

W9mwH [ClientPool[cplcNNlZ].acquire]: Creating a new client [cliGq5Tk] (requiresGrpc: false)
W9mwH [ClientPool[cplcNNlZ].release]: Garbage collected client [cliGq5Tk] activeClientDeleted=true (0 active clients: {}, 0 failed clients: {})
##### [ClientPool[cplUf7qN].terminate]: Closing all active clients (0 active clients: {}, 0 failed clients: {})

The motivation for this PR, and the previous #2416 and #2420 PRs, is to help investigate b/437011084, where ClientPool.acquire() apparently is returning previously-garbage-collected clients, resulting in "GoogleError: The client has already been closed".

BEGIN_COMMIT_OVERRIDE
fix: pool.ts: add even more logging
END_COMMIT_OVERRIDE

The new/updated log messages are:
* an "instance ID" for the ClientPool in each log message, to enable
  distinguishing log messages from distinct ClientPool instances.
* the result of `this.activeClients.delete(client)` in
  ClientPool.release(), to ensure that it is, indeed, deleting an entry.
* the active request count for each client in LazyLogStringForAllClientIds.
* a message from ClientPool.terminate() that is unconditionally logged.
@dconeybe dconeybe self-assigned this Sep 25, 2025
@dconeybe dconeybe requested review from a team as code owners September 25, 2025 21:02
@dconeybe dconeybe added the api: firestore Issues related to the googleapis/nodejs-firestore API. label Sep 25, 2025
@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Sep 25, 2025
Copy link
Copy Markdown
Contributor

@MarkDuckworth MarkDuckworth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm with question for your consideration

@dconeybe
Copy link
Copy Markdown
Contributor Author

lgtm with question for your consideration

Thanks for the review!

@dconeybe dconeybe merged commit c508d1b into main Sep 25, 2025
18 of 19 checks passed
@dconeybe dconeybe deleted the dconeybe/EvenMoreClientPoolLogging branch September 25, 2025 23:48
@MarkDuckworth MarkDuckworth added the release-please:force-run To run release-please label Sep 26, 2025
@release-please release-please bot removed the release-please:force-run To run release-please label Sep 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: firestore Issues related to the googleapis/nodejs-firestore API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants