Skip to content

[fix][auth] Allow natural exit with token suppliers - #510

Draft
equanz wants to merge 2 commits into
apache:masterfrom
equanz:fix/token-supplier-shutdown
Draft

equanz wants to merge 2 commits into
apache:masterfrom
equanz:fix/token-supplier-shutdown

Conversation

@equanz

@equanz equanz commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Motivation

Using a token supplier can keep Node.js running after client.close() completes.
The supplier's thread-safe function keeps the event loop alive while the Authentication object remains reachable.

Modifications

  • Unref the supplier's thread-safe function so it allows natural process exit
  • Keep callback state alive through finalization and avoid releasing an already finalized thread-safe function

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

  • Add process-exit regression tests for synchronous and asynchronous suppliers

Documentation

  • doc-required
    (Your PR needs to update docs and you will update later)

  • doc-not-needed
    Fixes process shutdown behavior without changing the public API or configuration.

  • doc
    (Your PR contains doc changes)

  • doc-complete
    (Docs have been already added)

Token supplier callbacks keep the event loop alive even after a client
is closed. Allow natural exit while preserving callback state through
thread-safe function finalization.
@equanz equanz closed this Oct 15, 2026
@equanz equanz reopened this Oct 15, 2026
@equanz
equanz marked this pull request as draft October 19, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant