Closed eholland-banno closed 1 month ago
Thank you for the report and details @eholland-banno
We will take a look.
Filed internally as 246138
@eholland-banno The fix has been released in server common 2.4.2 (Node server 9.4.4). Let me know if you have any challenges with version upgrades.
@eholland-banno The fix has been released in server common 2.4.2 (Node server 9.4.4). Let me know if you have any challenges with version upgrades.
Awesome, will do. Thanks a ton for the fast response @kinyoklion!
Describe the bug It appears that the keyMap used to store indexes for retrieving values is a memory leak. When clear() runs on the cache, it clears out most of the data stored except for the
keyMap
which can grow infinitely as unique keys get added into the cache. It also seems like the indexes stored in thekeyMap
would become stale onclear()
since they would no longer point to the correct index in thevalues
array.To reproduce If you call
client.variation(key, context, defaultValue)
many times passing unique keys, thekeyMap
will continue to grow infinitely even ifclear()
were to be called.Expected behavior I would expect a call to
this.keyMap.clear()
in the LruCache's clear() function like so:Local testing of this has proven to reduce the memory as we're clearing out the
keyMap
periodically.SDK version @launchdarkly/js-server-sdk-common version 1.2.3
Language version, developer tools Node 18.19.0
OS/platform macOS 14.4