Replies: 3 comments 2 replies
-
|
Hi @heilmela, thank you for your feedback. This could be a nice addition, if it's possible to implement this without an extra overhead for users that don't need it it would be awesome. Just FYI this default behavior for graceful shutdown can be disabled by providing the |
Beta Was this translation helpful? Give feedback.
-
|
@endel would you be open to accept a PR which simply adds a onError hook, such that other lifecycle hooks like onCreate etc. do not throw but let the onError hook decide what to do ? |
Beta Was this translation helpful? Give feedback.
-
|
@endel its a bit hard to contribute because the project throws a couple of errors when i pull main and try to run tests. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Context
Now and then im dealing with bugs in room hooks which throw uncaught errors. Developers in our team sometimes introduces rather harmless bugs which in the worst case scenario introduce inconsistent state.
Current Behaviour
Looking at the following snippet in the Matchmaker, colyseus kill the process when such errors occur
colyseus/packages/core/src/utils/Utils.ts
Line 27 in 27ad5c6
It seems to me that its rather brutal to kill all rooms by ending the process when only a single room might have produced this uncaught error - the nature of developing complex room logic and state updates its absolute unrealistic that none of this stuff ever causes some uncaught exceptions. Given the case that a single colyseus process handles several hundred small rooms this would mean every of this rooms gets killed because of a single problematic room -- Why is that even necessary ?
It degrades the production and dev experience of colyseus imensly since not only we have to implement a lot of logic to prevent errors but at the end production we sometimes have phases until a hotfix where colyseus constantly crashes because of some very lightweight bugs.
Im aware that generally speaking node once considered removing this handler completely since its rather crude to prevent the process from exiting here, but in terms of the long running colyseus process where multiple stateful rooms are hosted by a single process i cant get over the fact that a single malicious room can end other rooms with this.
Beta Was this translation helpful? Give feedback.
All reactions