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 leaks in yjs websocket utils implementation? #142

Open
sbavoma opened this issue Jun 25, 2023 · 1 comment
Open

Memory leaks in yjs websocket utils implementation? #142

sbavoma opened this issue Jun 25, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@sbavoma
Copy link

sbavoma commented Jun 25, 2023

I have a editor application made using yjs websocket server implementation.
The code is strictly used as is from the library and it works pretty well.
Until now I didn't had any monitoring tools in place to observe its behaviour but lately I have seen RAM piling up with memory and this is a bit surprising since the application gets around 300-500 traffic on a good day.
Is there anyway to properly debug this like some library to get heap snapshots or is this issue pre-existent cause I saw few threads before but they were fixed. Is something to be done to clear all the event listeners and handlers.

I also see some weird logs that I get in my pm2 service regarding service restarts when there are lot of connections. It seems yjs has some soft limit on no of event emitters/handlers need to know how this can be tackled!

some error logs eg:

[yjs] Tried to remove event handler that doesn't exist.
[yjs] Tried to remove event handler that doesn't exist.
[yjs] Tried to remove event handler that doesn't exist.
[yjs] Tried to remove event handler that doesn't exist.
[Function: Error] { stackTraceLimit: 10, prepareStackTrace: undefined }
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
[Function: Error] { stackTraceLimit: 10, prepareStackTrace: undefined }
[Function: Error] { stackTraceLimit: 10, prepareStackTrace: undefined }
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
[Function: Error] { stackTraceLimit: 10, prepareStackTrace: undefined }
[Function: Error] { stackTraceLimit: 10, prepareStackTrace: undefined }
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
[Function: Error] { stackTraceLimit: 10, prepareStackTrace: undefined }
[Function: Error] { stackTraceLimit: 10, prepareStackTrace: undefined }
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
[Function: Error] { stackTraceLimit: 10, prepareStackTrace: undefined }
[yjs] Tried to remove event handler that doesn't exist.
[yjs] Tried to remove event handler that doesn't exist.
[yjs] Tried to remove event handler that doesn't exist.
[yjs] Tried to remove event handler that doesn't exist.

Attached a ss of the mem leak...
Screenshot 2023-06-26 at 2 46 38 AM

@sbavoma sbavoma added the bug Something isn't working label Jun 25, 2023
@jiangxiaoqiang
Copy link

did you fixed this issue? @sbavoma

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants