Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PROCESS_MEMORY_CACHE_TTL cannot be large than int32 #666

Open
TillaTheHun0 opened this issue May 2, 2024 · 2 comments
Open

PROCESS_MEMORY_CACHE_TTL cannot be large than int32 #666

TillaTheHun0 opened this issue May 2, 2024 · 2 comments
Labels
bug Something isn't working cu ao Compute Unit good first issue Good for newcomers help wanted Extra attention is needed

Comments

@TillaTheHun0
Copy link
Member

TillaTheHun0 commented May 2, 2024

Background

The CU LRU In-Memory cache TTL can be configured using the PROCESS_MEMORY_CACHE_TTL. Underneath the hood, a cached record's ttl is implemented using a simple setTimeout

Problem

NodeJS' setTimeout is implemented as a subroutine that uses a signed 32 bit integer to store the timeout time, in milliseconds. This means the maximum value for PROCESS_MEMORY_CACHE_TTL is 2^31 - 1 or ~25 days.

Setting PROCESS_MEMORY_CACHE_TTL to a higher value will cause Node to emit a warning and then implicitly overflow the integer. Subsequently, the setTimeout will be given a negative value and immediately be invoked. Basically disabling the LRU In-Mmeory cache.

Solution

We'd like to allow larger values for PROCESS_MEMORY_CACHE_TTL. Can probably use something like long-timeout which abstracts recursively calling setTimeout to allow for setting longer timeouts.

Developer Notes

Code to modified is here

@TillaTheHun0 TillaTheHun0 added bug Something isn't working cu ao Compute Unit help wanted Extra attention is needed good first issue Good for newcomers labels May 2, 2024
@dtfiedler
Copy link
Contributor

i'l pick this up @TillaTheHun0

@TillaTheHun0
Copy link
Member Author

Awesome, thanks @dtfiedler !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cu ao Compute Unit good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants