UDP exception when quitting Unity game

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

vkalpias
Posts: 56
Joined: 03 Oct 2011, 09:24

UDP exception when quitting Unity game

Postby vkalpias » 21 May 2013, 15:48

Hello,

We are running a standalone Unity executable in Windows 7 64-bit, smartfox client 1.2.0 and smartfox server 2.6.0.

When we call Application.Quit in the Unity application the game crashes. This is the log:

[SFS - ERROR] UDPSocketLayer: Error reading data from socket: A blocking operation was interrupted by a call to WSACancelBlockingCall.
[SFS - WARN] Unexpected UDP I/O Error. Error reading data from socket: A blocking operation was interrupted by a call to WSACancelBlockingCall.
[Interrupted]
[SFS - ERROR] TCPSocketLayer: General error reading data from socket: Read failure at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00000] in <filename unknown>:0
at Sfs2X.Core.Sockets.TCPSocketLayer.Read () [0x00000] in <filename unknown>:0

When we quit the application we call this code in order to disconnect from the server:
if( Server != null )
{
Server.RemoveAllEventListeners();
Server.Disconnect();
}

Any ideas what that might be?
User avatar
Lapo
Site Admin
Posts: 21602
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: UDP exception when quitting Unity game

Postby Lapo » 21 May 2013, 16:09

I think it's just due to the thread being interrupted in his run cycle. The exception is thrown for debugging reason in case the thread would quit during runtime but in the case of a quit this should not raise any concerns.

In any case I have added a note in our bug database to check it before we release a new update.
Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
vkalpias
Posts: 56
Joined: 03 Oct 2011, 09:24

Re: UDP exception when quitting Unity game

Postby vkalpias » 21 May 2013, 16:24

Ok thank you
vkalpias
Posts: 56
Joined: 03 Oct 2011, 09:24

Re: UDP exception when quitting Unity game

Postby vkalpias » 18 Jul 2013, 10:38

Lapo wrote:I think it's just due to the thread being interrupted in his run cycle. The exception is thrown for debugging reason in case the thread would quit during runtime but in the case of a quit this should not raise any concerns.

In any case I have added a note in our bug database to check it before we release a new update.
Thanks


Hi there, we just downloaded the latest client - version 1.2.6 and we still get the same error when we quit our game:

[SFS - ERROR] UDPSocketLayer: Error reading data from socket: A blocking operation was interrupted by a call to WSACancelBlockingCall.
[SFS - WARN] Unexpected UDP I/O Error. Error reading data from socket: A blocking operation was interrupted by a call to WSACancelBlockingCall.
[Interrupted]

Was the NRE fix in the 1.2.6 release notes refering to this error or something else? Thanks
User avatar
Lapo
Site Admin
Posts: 21602
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: UDP exception when quitting Unity game

Postby Lapo » 18 Jul 2013, 11:02

No the NRE is a different thing, the error you have reported at the top is a network error.

Do you handle the OnApplicationQuit event and call SmartFox.disconnect() ? That should help shutting down the connection gracefully.
Lapo

--

gotoAndPlay()

...addicted to flash games
vkalpias
Posts: 56
Joined: 03 Oct 2011, 09:24

Re: UDP exception when quitting Unity game

Postby vkalpias » 18 Jul 2013, 11:34

Hey

Yes we do handle OnApplicationQuit and call disconnect when that happens. We even tried having an Exit button that first disconnects, waits for 30 seconds and then exits. As soon as the 30 seconds pass and the application is quitting, the exception I told you in the previous post is thrown. For some reason UDP does not seem to stop gracefully?

I think this might also be related to the hang that we get when a user is kicked or when the server is shut down while a player is online.
User avatar
Lapo
Site Admin
Posts: 21602
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: UDP exception when quitting Unity game

Postby Lapo » 18 Jul 2013, 19:55

Why do you say "it might" be related?
It is a very simple thing to reproduce, you just need to kick a user in a test environment and see if there's a problem. If it is reproducible let us know.

For what I can see it should do zero harm, because the error is trapped correctly and sent in the logs output.
During abrupt shutdown it is pretty normal to have some kind of IO error. In any case let me know.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
vkalpias
Posts: 56
Joined: 03 Oct 2011, 09:24

Re: UDP exception when quitting Unity game

Postby vkalpias » 18 Jul 2013, 20:43

As you can see in previous posts of mine (links of which I will provide when i am in front of my computer) we still have the same issues which apparently you cannot reproduce in your tests. And I say that they might be related because I cannot find another reason why they keep happening so I'm speculating in an attempt to help you find the cause.

When the server is shut down all unity clients hang. When a user is kicked his client hangs. When a user exits the game the client crashes. I have given you detailed logs and test cases for every issue and none of these issues have been fixed. So i would appreciate some support for a product that costs 3000 instead of a condescending tone.
User avatar
Lapo
Site Admin
Posts: 21602
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: UDP exception when quitting Unity game

Postby Lapo » 18 Jul 2013, 22:34

I can understand for your frustration, it's equal on our side because we can't help without a reproducible case.

Why don't you send us a small working examples that causes the issue on your side and we can see if we can work with it.
At least we can investigate the reasons why the reproduction is not possible, in case this is what we end up with. Hopefully it will show the problem on our side too.

Use our support@... email box
Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
vkalpias
Posts: 56
Joined: 03 Oct 2011, 09:24

Re: UDP exception when quitting Unity game

Postby vkalpias » 19 Jul 2013, 12:42

Hello,

It turns out that the crash when we exit the game is completely unrelated to SmartFox, but various circumstances lead us to believe that it was related. We still have the hang issues for which I will try to create a stripped out version to send you and see if you can reproduce.

Thank you
User avatar
Lapo
Site Admin
Posts: 21602
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: UDP exception when quitting Unity game

Postby Lapo » 22 Jul 2013, 09:32

Thanks for the update
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 2 guests