I'm running some test code to connect to rooms and assess maxClient handling and I kept running into this error on the server side
(node:70) UnhandledPromiseRejectionWarning: Error: remote room (8re0ooUuxk) timed out, requesting "hasReservedSeat with args [null]"
at Timeout.setTimeout (/usr/src/app/node_modules/colyseus/lib/MatchMaker.js:155:32)
at ontimeout (timers.js:424:11)
at tryOnTimeout (timers.js:288:5)
at listOnTimeout (timers.js:251:5)
at Timer.processTimers (timers.js:211:10)
(node:70) UnhandledPromiseRejectionWarning: Unhandled promise rejection. 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(). (rejection id: 1)
(node:70) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Error: Failed to join invalid room "t3LZfIwlXC"
at MatchMaker.(/usr/src/app/node_modules/colyseus/lib/MatchMaker.js:124:23)
at Generator.next ()
at fulfilled (/usr/src/app/node_modules/colyseus/lib/MatchMaker.js:4:58)
at process._tickCallback (internal/process/next_tick.js:68:7)
Error: Failed to join invalid room "L663L6KfJu"
at MatchMaker.(/usr/src/app/node_modules/colyseus/lib/MatchMaker.js:124:23)
at Generator.next ()
at fulfilled (/usr/src/app/node_modules/colyseus/lib/MatchMaker.js:4:58)
at process._tickCallback (internal/process/next_tick.js:68:7)
Error: Failed to join invalid room "3AzoNlHwA2"
at MatchMaker.(/usr/src/app/node_modules/colyseus/lib/MatchMaker.js:124:23)
at Generator.next ()
at fulfilled (/usr/src/app/node_modules/colyseus/lib/MatchMaker.js:4:58)
at process._tickCallback (internal/process/next_tick.js:68:7)
Is this a bug? as I see no documentation on handling room rejections on the server side? Should this be expected?
I'm running
Hi @karneaud, thanks for reporting. I've just released a new version to work around this issue. (0.9.15).
In the near future I'd like to improve the matchmaking API, as proposed here https://github.com/gamestdio/colyseus/issues/176
Let me know if the latest version works for you!
Cheers
I'll leave this comment as a reference for me to research later. It might be possible to have a better workaround by using Redis distributed locks (https://redis.io/topics/distlock, node client: https://github.com/mike-marcacci/node-redlock)
@endel Worth looking in to making locks a feature within Presence so that Redis doesn't _have_ to be the go-to Presence and to allow for custom Presence interfaces.
Hey there!
I've managed to create a simple project to reproduce this: https://github.com/endel/colyseus-remote-room-timeout, which I believe to have fixed on version 0.9.16-alpha.2.
The changes I've made are:
retry method during match-making, which will retry the matchmaking in case a room stops responding (gets disposed) during the process. (https://github.com/gamestdio/colyseus/commit/4cf565a2b04550c1e3da2677a6f16e6afef6ae37#diff-6c2457f8d2ec445121180785c06fec52R229)_onLeave() now is awaiting for the user-defined async onLeave() method. This ensures the room won't be disposed before all it's task has been complete. (https://github.com/gamestdio/colyseus/commit/785877255f64e54f0c8327df2e98ed60a3b24802#diff-3a176c85fc9ea02dacf20a085eb6eb26R490)I'd appreciate if you can test this out in your projects. I'm going to do the same today.
Most helpful comment
@endel Worth looking in to making locks a feature within
Presenceso that Redis doesn't _have_ to be the go-toPresenceand to allow for customPresenceinterfaces.