This project has moved and is read-only. For the latest updates, please go here.

[en] Exception thrown in the server crashes client (solved)

Topics: Technical Support
Jan 12, 2012 at 9:55 AM

I am just testing your great librrary!

So I started playing a bit with the provided 'MiniChat' example. One thing I noticed is that if the server throws an exception, that any clients will terminate abnormally as well.

Example (all on the same local machine):

- Start the MiniChat.Server

- Start a 1st MiniChat.Client and Login

- Start a 2nd MiniChat.Client and Login

- Let them chat a bit...

Now open the TaskManager and KILL the 2nd MiniChat.Client process (terminate it). This to emulate a situation, where a client suddendly just disappreas without gracefully shutting down its session (e.g. due to a machine crash or whatever other broken connection).

- Now try to send a message (chat) from the (still existing and connected) 1st MiniChat-Client.

The result is, that this client crashes!


I believe this is due to the fact, that the server still has got 2 subscribed message handlers which he is now trying to handle - but this leads to an exception when trying to invoke the message handler for the 'killed' client. As a result an an exception is propagated to the 'existsing/still-alive' client - which now terminates abnormally?!


Why is this? Is there anything to avoid this?

The reason for asking this is, that I believe, that this situation is quite critical - as the current behaviour means: If one client crashes - all clients might crash...a situation not really reliable in a real-world use-case.

Many THX in advance,


(P.S.: If it is easier to answer in German - no problem, I am German too)

Jan 12, 2012 at 10:26 AM

Additional information:

This 'only' seems to happen, if the session manager sweeps the sessions in its 'SweepExpiredSession' method (on the server side).

Meaning the 'killed' client session will be removed automatically (which is good!) - to let this happen a bit more frequently I added the following lines to the MiniChat.Server implementation. As such - after killing the 2nd MiniChat.Client process you would have to wait a bit so that the server sweeped that session:

host.SessionManager.SessionAgeLimit = 1;
host.SessionManager.SessionSweepInterval = 1;
Jan 13, 2012 at 9:02 PM
Edited Jan 13, 2012 at 9:26 PM

Hi Bernd,

thank you for trying Zyan!

>As a result an an exception is propagated to the 'existsing/still-alive' client - which now terminates abnormally?!

At first glance it looks like you're right: chat client doesn't expect an exception thrown at the server-side.

>a situation not really reliable in a real-world use-case.

Real-world applications usually have more advanced error handling logic.
MiniChat is a tiny sample program to demonstrate basic Zyan usage.

Nonetheless, thanks a lot for your report!
It's a bug in either MiniChat sample or Zyan library itself and it should be fixed. I'll investigate the issue this weekend.

>P.S.: If it is easier to answer in German - no problem, I am German too

It's perfectly OK to speak English here so both Rainbird and I would be able to answer.
This way the discussion will also be readable by broader range of developers :)

Regards, yallie.

Jan 13, 2012 at 9:04 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.