Repository navigation
Conversation
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.
Native logging can access the thread-safe function after it has been finalized. Clear the registered callback during finalization and synchronize native access to prevent use after finalization.
equanz
marked this pull request as ready for review
October 23, 2026 10:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Allowing natural process exit also requires protecting native logging from accessing an already finalized thread-safe function during shutdown.
Modifications
Verifying this change
This change added tests and can be verified as follows:
Documentation
doc-required(Your PR needs to update docs and you will update later)
doc-not-neededFixes process shutdown behavior without changing the public API or configuration.
doc(Your PR contains doc changes)
doc-complete(Docs have been already added)