Getting this error in node logs: MaxListenersExceededwarning: Possible EventEmitter memory leak detected

I am using y-websocket package and in the node logs I am currently getting this error, can someone please tell me what would be the solution for this?

Hi @gondar,

please open issues in the respective repositories. I can’t debug this issue without knowing which Yjs/nodejs/etc… versions you are using, I also need some steps to reproduce this issue.

So far I can say that I’ve never seen an error message like this. So this might be because of your customizations.

Hi @dmonad, Thanks for the quick reply

What I am trying to do?
I am trying to run a yjs-websocket server alongside nestjs server

I have created a reproducable demo here

Once we got the client and server running, when I open 2 tabs (http://localhost:5420) I can see this error logged in the nestjs server logs.

node version: v14.17.3
yjs version: v13.5.32
y-websocket version: v1.4.0

Maybe it’s due to the way I have called setupWSConnection, could you please take a look and help me resolve this issue

this is where I have called setupWSConnection which spins up the y-websocket server from ‘y-websocket/bin/utils’;

I am trying to run a yjs-websocket server alongside nestjs server

Well… that would have been helpful information ^^

I’m sure you understand that I can’t help you debug this issue. This seems to be very related to nestjs’ websockets. I’m using ws websockets.

I can only say that I never saw an issue like this. You are using a different websocket implementation that seems to have different restrictions. You might have more luck asking in a nestjs channel, but I think the issue is pretty clear. Apparently, your adaption adds too many listeners. I’d start by finding out why so many listeners are added.

1 Like

Ok cool thanks for your time