We are having issuses using server.fetchSockets() in socket.io redis nodes. When a server call this function the others servers are throwing this exception:
C:\path\node_modules\socket.io-redis\dist\index.js:212
response = JSON.stringify({
^
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Pool'
| property 'config' -> object with constructor 'PoolConfig'
| property 'connectionConfig' -> object with constructor `ConnectionConfig'
--- property 'pool' closes the circle
at JSON.stringify (<anonymous>)
at RedisAdapter.onrequest (C:\Users\pach\Documents\trace gaming\new\node\node_modules\socket.io-redis\dist\index.js:212:33)
at processTicksAndRejections (node:internal/process/task_queues:94:5)
and the server that is calling the function gets a timeout.
Sending and receiving events are working fine.
socket.io 4.1.1 socket.io-redis 6.1.1
I believe it has something to do with the first bit of the TypeError
Converting circular structure to JSON. I am new to socket.io so this is just my assumption but I think each socket instance has references to itself within its data structure. Therefore when trying to parse to json you end up in a recursive loop that the engine notices and errors out of after a while hence the location the error occursprocessTicksAndRejections (node:internal/process/task_queues:94:5).If you log a socket instance to the console you can look through it and see that some of the sockets are valued as
circular. Again this is just my gut feeling on your issue but I am curious to know if you have solved it and what the issue really was!