-
-
Notifications
You must be signed in to change notification settings - Fork 42
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 Suspected in y-redis during Repeated WebSocket Connections and Disconnections #24
Comments
After 3 weeks of online observation, there are still some memory leaks. After adding aw.destroy(); at the end of mergeMessages in protocol.js, the memory leak problem seems to have been eradicated. |
@totorofly do you think the worker is also affected by this as its has some awareness information which it dosen't really need and is not destroying the awareness info afterwards? not an expert at all. |
I have noticed this behavior as well and it seems to be happening with the Worker code I deployed both Server and Worker on a docker container in AWS, after running a while with one connection it crashed with the error:
|
Yes, I have been monitoring it and both worker and server have the same memory behavior |
Checklist
Describe the bug
I am observing a potential memory leak in the y-redis module that becomes apparent during repeated connections and disconnections to the same room ID. Memory usage continuously increases with each connect and disconnect cycle, especially when handling large ProseMirror documents over WebSocket connections. This eventually leads to an out-of-memory error in Node.js.
To Reproduce
Expected behavior
I expected that the memory would stabilize after initial allocations given that the connections are being properly closed on the frontend.
Observed Behavior
The heapUsed metric starts at a few tens of megabytes and continuously climbs with each cycle of connecting and disconnecting to the same room ID. This increase does not stabilize or decrease, even after connections are properly closed, leading to a progressive memory buildup. Eventually, the memory usage surpasses 4GB, resulting in a Node.js out-of-memory error and the termination of the program.
Additional context
I have not yet pinpointed the exact cause but am suspecting issues in how resources are handled upon disconnection in the y-redis setup. I am currently unsure how to further investigate and identify the specific root cause of this memory leak, so I am reporting this issue to seek guidance and possibly get more insights into what might be causing this behavior. Any assistance on how to proceed with diagnosing this problem would be greatly appreciated.
The text was updated successfully, but these errors were encountered: