Page 1 of 1

Crash with latest Unity 2017.2

Posted: 16 Nov 2017, 23:45
by brockemon
Hi,

Been using smartfox to develop our new game for a few years now. After the latest unity update to 2017.2.0f3 the client crashes after closing a game room and closing down the connection to smartfox. The error is:

[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
11-16 15:40:39.389 7092 7218 D Unity : at Sfs2X.Core.Sockets.TCPSocketLayer.Read () [0x00000] in <filename unknown>:0

It happens during the Sfs2X.SmartFox:ProcessEvents().

Is there anything I can to stop this crash? Try, Catch doesn't seem to do anything.

-Brock

Re: Crash with latest Unity 2017.2

Posted: 17 Nov 2017, 08:49
by Lapo
Hi,
when you say "the client" what are you referring to exactly? I mean what platform are building for?
Can you reproduce it in the Editor?

I have to say, unfortunately, if this happens by upgrading Unity I fear the problem is Unity itself which might have changed something in the lower level compiler/transpiler. In any case let us know the details and we'll investigate on our end.

Thanks

Re: Crash with latest Unity 2017.2

Posted: 17 Nov 2017, 17:03
by brockemon
Unity 2017.2.0f3 building for Android. It may be something I am doing wrong, like closing a connection to the server at a wrong time, although I didn't know that was possible.

All I know is that I hadn't changed any of my own code and the only thing that changed was updating to that version of unity.

Re: Crash with latest Unity 2017.2

Posted: 17 Nov 2017, 17:25
by brockemon
When running in the Unity Editor I get no errors

Re: Crash with latest Unity 2017.2

Posted: 17 Nov 2017, 18:19
by brockemon
The problem seemed to be fixed by calling KillConnection vs Disconnect when I was shutting down the connection to Smartfox on the Android Client.

After a game ends I do

sfs.RemoveAllEventListeners();
sfs.KillConnection ();
// sfs.Disconnect ();
sfs = null;

This change stops the crashing but I don't really get why.

Re: Crash with latest Unity 2017.2

Posted: 18 Nov 2017, 09:03
by Lapo
Interesting. Thanks for reporting, we'll investigate.
I fear it has to do with low level changes in the Android runtime, introduced with the latest Unity

We'll report back if we find more clues.

Re: Crash with latest Unity 2017.2

Posted: 20 Nov 2017, 15:05
by Lapo
UPDATE:
We have done a few tests with the latest Unity 2017.2, exporting a simple connector to Android.
Using the BlueStacks emulator we're not able to reproduce any of the issues you have reported, so I am inclined to think this might be an issues with specific versions of the OS or a specific device?

Have you tested on multiple devices? If so which Android do they run?
Also which version of the Android SDK do you use?

Thanks