Repository navigation
Lock Context - #1603
Merged
Merged
Lock Context#1603
Conversation
* Ported certificate fixes from the compatibility repo * Bumped Hz to 5.7.0 * Wait for RC port to be open before proceeding with tests Passing run: https://github.com/hazelcast/hazelcast-nodejs-client/actions/runs/29926557318
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1603 +/- ##
=========================================
Coverage ? 93.48%
=========================================
Files ? 467
Lines ? 16661
Branches ? 1354
=========================================
Hits ? 15575
Misses ? 792
Partials ? 294 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
emreyigit
reviewed
Jul 23, 2026
emreyigit
left a comment
Member
There was a problem hiding this comment.
I'm ok with PR, just left a small comment. Rest looks nice to me.
emreyigit
approved these changes
Jul 24, 2026
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.
This PR implements the
LockContextAPI to fix lock reentrancy issues.That required me to bump some development time dependencies.
The markdown link checker fails because DDoS protection of hub.docker.com and npmjs.com, please disregard that.
LockContext
AsyncLocalStorage is the only standard mechanism in Node.js that provides the ability to store values in promises and enable access to them. It is used by virtually all of the modern Node.js libraries that need keep context in promise chains (promises that are created in other promises).
In order to solve the data race issue with the Map lock reentrancy behaviour of the Node.js Client, we propose the introduction of the
LockContextclass to the public API. It autogenerates a lock ID and stores it in anAsyncLocalStoragestore.LockContexthas a single static member function called run which is named after the correspondingAsyncLocalStoragefunction. It is defined as follows:It is used as follows:
An internal
getLockIDfunction is used by Map and MultiMap proxies to retrieve the lock ID and use it as the thread ID in corresponding operations. For all Map and MultiMap methods that use a thread ID, we use it instead of the constant thread ID. No other changes are necessary for the proxy code.