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

Memory Leak #9

Closed
JohnCMcDonough opened this issue Jul 24, 2017 · 0 comments
Closed

Memory Leak #9

JohnCMcDonough opened this issue Jul 24, 2017 · 0 comments

Comments

@JohnCMcDonough
Copy link

JohnCMcDonough commented Jul 24, 2017

It appears that the keys in the context map that are set, but never removed. In context.js, _contexts keys are set using namespace._contexts.set(asyncId, namespace.active); and deleted using namespace._contexts.delete(currentUid); where currentUid is the executionAsyncId, not the id passed into the async hook handler.

A sample of one of the crashes observed due to this issue is given below.

<--- Last few GCs --->

[1:0x5595a7ffd9c0] 19367966 ms: Scavenge 1154.7 (1414.3) -> 1141.3 (1414.3) MB, 17.0 / 0.5 ms  allocation failure 
[1:0x5595a7ffd9c0] 19370410 ms: Scavenge 1155.5 (1414.3) -> 1143.5 (1414.3) MB, 40.5 / 0.8 ms  allocation failure 
[1:0x5595a7ffd9c0] 19375363 ms: Scavenge 1157.7 (1414.3) -> 1145.2 (1414.3) MB, 19.9 / 0.5 ms  allocation failure 
[1:0x5595a7ffd9c0] 19375870 ms: Scavenge 1159.7 (1414.3) -> 1147.3 (1414.3) MB, 43.5 / 0.7 ms  allocation failure 


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x16617801bbd9 <JS Object>
    1: set [native collection.js:~247] [pc=0x661da70922b](this=0x4840a2843c1 <a Map with map 0x3dfb28a94319>,p=25597058,x=0x6c3ab1fb699 <an Object with map 0x7c2351f0fc1>)
    2: 0x1bf1c91c2ed9 <Symbol: init>(aka init) [/src/node_modules/cls-hooked/context.js:~290] [pc=0x661da7bfffd](this=0x1fd338a7e599 <an AsyncHook with map 0x3dfb28af8d91>,asyncId=25597058,type=0x166178074701 <String[7]: PROM...

FATAL ERROR: invalid table size Allocation failed - JavaScript heap out of memory

fix: #10

Jeff-Lewis added a commit that referenced this issue Jul 24, 2017
Fix for issue #9 - Dispose of contexts references in destroy()
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

No branches or pull requests

1 participant