Page 3 of 4
Posted: 29 Nov 2010, 07:43
by ThomasLund
OK - sounds like you all are on Windows. Will need to dust off a copy and give it some love there.
Thanks! Watch out for a new test soon
Anyone on Mac that can confirm the non-crash there? (Still havent had a single issue yet there).
Oh - UDP should have no connection to policy files at all. Running against my local SFS server with a 3.0 webplayer it also works fine.
/Thomas
Posted: 30 Nov 2010, 20:15
by ThomasLund
OK - found the problem and fixed it. Crossing fingers. Confirmed by a few people already, but would like to get more eyes on it before declaring it fixed fixed and ready for release.
So give this a test please!!
http://www.fullcontrol.dk/downloads/SFS ... 101130.dll
Also has a small fix for room.ContainsVariable() which would throw an exception instead of returning false when variable not found.
/Thomas
Posted: 30 Nov 2010, 21:41
by stevets
I tested the SmartFox2-20101130.dll using Unity3.1f4 (windows version)
It appears to work now without crashing the editor.
What fixed the problem Thomas? Just curious.
Thanks Steve
Posted: 30 Nov 2010, 23:52
by tpenn
Tested, and my results were less successful.
My first attempt, I had forgotten to add the socket addresses for UDP in the Server Configurator, and so naturally UDP failed to initialize (the UDP_INIT event had success = false). No attempts to send via UDP were made. However, shutting down Unity triggered this exception: "SocketException: A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied." Attempting to run the game again after receiving this exception would lock up Unity, every time.
So I fixed my goof, and initted UDP successfully. ~10 seconds after the UDP_INIT event was received (with success = true), I received another UDP_INIT, this time with success = false. However, it did appear that sending and receiving via UDP was working fine.
However, after running my game for a brief time (which admittedly generates a quite a bit of traffic), the server became unresponsive, and my clients received no UDP or TCP responses, reminiscent to an issue that was fixed with RC-1a.
The good news is no exception on shutdown when I initted successfully, and no crash.
Posted: 01 Dec 2010, 01:32
by GRIM2594
I don't want to speak too soon, but it does appear to be fixed! I haven't crashed yet, while using UDP on Windows.
Posted: 01 Dec 2010, 05:48
by ThomasLund
Ohhh!!! Sounds like the issue was mostly nailed then!
1)
First - on all the exception messages - many of these are debug mesages. If they say "SFS DEBUG" or similar before the exception message, then the exceptions are caught and not thrown! Some of these exception messages happen on normal shutdown when the socket is closed. That throws some kind of exception inside the API - and I show it at the moment.
If there is NO "SFS DEBUG" or similar in front, then its a real exception.
Its not very end user friendly and can lead to much confusion. So I will remove these messages in the next real release.
2)
So what was wrong!
3 things - first off, the API used some threads inside to read data from the sockets. On shutdown we called Abort() on them - that turns out to be a source of crashes. Reworked that, so that threads terminate themselves without Abort or Interrupt.
The 2 others are more annoying - and possibly mono bugs/issues.
Sockets can be closed in 2 ways - you can call Shutdown on them or you can call Close.
Calling Shutdown - works on one platform and crashes on the other.
Calling Close - crashes on one platform and works on the other
(DUH!!!)
Calling both at the same time turns out to the "the fix".
This is only true for UDP sockets - on TCP it works without issues.
Will send a bug report to Unity about this - see what they can do about it.
Grrrrrr - very annoying.
3) There is now code in place that should not give you multiple UDP_INIT if UDP was successfully initiated. If you get UDP_INIT callback with success = true multiple times, then something else is wrong. Might have lost UDP connection for some reason and the API tries to reconnect.
If you got a small repro case for this - or for the loosing responsiveness, then please send it to me and I'll trace it.
Thanks for testing - and keep reporting if you run into any issues!
/Thomas
Posted: 26 Dec 2010, 15:33
by vooood
This problem is not solved in RC1b+FPSTutorial? I get it crashing all over again...
Posted: 26 Dec 2010, 15:39
by ThomasLund
Should be all fixed with the updated dll - unless we packaged it wrong.
/Thomas
Posted: 26 Dec 2010, 15:56
by vooood
ThomasLund wrote:Should be all fixed with the updated dll - unless we packaged it wrong.
/Thomas
with the original package and dll from sf2x update unity crashes after the demo is stopped. it also won't connect with the latest dll provided in this forum thread...
Posted: 27 Dec 2010, 07:29
by ThomasLund
Will give it a spin later today now that xmas vacation is almost over. I have been fiddling in that part of the code to remove excess debug messages, so might have re-introduced the issue on Windows by accident.
*sigh*
/Thomas
Posted: 30 Dec 2010, 00:51
by matrix211v1
I agree. I had to use the SmartFox2-20101130.dll to get it to connect to 2X.
The one that is packaged with the "new" build doesn't work. I downloaded it 29/12/2010
Posted: 30 Dec 2010, 12:08
by ThomasLund
Try this one:
http://www.fullcontrol.dk/downloads/SFS ... 101230.dll
It fixes a potential problem with shutdown - I was over eager to remove the debug spam on shutdown, so actually sometimes the correct disconnect code would not be called.
Posted: 11 Jan 2011, 18:24
by ghellere
ThomasLund, I think there is stilll a problem when closing the UDP connection, in the the debug log below, I connect to the server, login, initiate UDP, join a room, spawn the character then I use
Code: Select all
smartFox.Send( new LogoutRequest() );
debug log:
Code: Select all
On Connection callback got: True (error : <>)
Sending login request
Logged in successfully
UDP ok
Joined game room Game
Spawn request sent to Game
Player Instantiated
OnLogout
[SFS - ERROR] UDPSocketLayer: Error reading data from socket: A blocking operation was interrupted by a call to WSACancelBlockingCall.
[SFS DEBUG] UDPSocketLayer: Error reading data from socket: A blocking operation was interrupted by a call to WSACancelBlockingCall.
[SFS DEBUG] 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 DEBUG] Unexpected UDP I/O Error. Error reading data from socket: A blocking operation was interrupted by a call to WSACancelBlockingCall.
[Interrupted]
[SFS DEBUG] Unexpected UDP I/O Error. Error reading data from socket: A blocking operation was interrupted by a call to WSACancelBlockingCall.
[Interrupted]
OnConnectionLost
[SFS - ERROR] TCPSocketLayer: Connection closed by the remote side
[SFS DEBUG] TCPSocketLayer: Connection closed by the remote side
[SFS DEBUG] TCPSocketLayer: Connection closed by the remote side
[SFS DEBUG] TCPSocketLayer: Connection closed by the remote side
as you can see I get a "Unexpected UDP I/O Error. Error reading data from socket: A blocking operation was interrupted by a call to WSACancelBlockingCall." when I logout.
I've tried to stop sending packets to the server and then logout but I still got the error.
Client:
Windows 7 64bit
Unity 3.1 (with the latest dll posted by you)
Server:
Windows server 2008
SFS RC1a
Posted: 11 Jan 2011, 18:41
by Secret-V
I've got the same error message, in the FPS demo. I can login, I can chat, I can create a game room, but then it doesn't do anything. I see the red crosshair, but after a few seconds it returns to the login and the debugger says:
Code: Select all
User Left.
[SFS - DEBUG] UDPSocketLayer: Error reading data from socket: A blocking operation was interrupted by a call to WSACancelBlockingCall.
[SFS - DEBUG] Unexpected UDP I/O Error. Error reading data from socket: A blocking operation was interrupted by a call to WSACancelBlockingCall.
I'm also running Windows 7 64-bit with Unity 3.1.0f4
Posted: 11 Jan 2011, 22:47
by ghellere
Secret-V wrote:I've got the same error message, in the FPS demo. I can login, I can chat, I can create a game room, but then it doesn't do anything. I see the red crosshair, but after a few seconds it returns to the login and the debugger says:
Code: Select all
User Left.
[SFS - DEBUG] UDPSocketLayer: Error reading data from socket: A blocking operation was interrupted by a call to WSACancelBlockingCall.
[SFS - DEBUG] Unexpected UDP I/O Error. Error reading data from socket: A blocking operation was interrupted by a call to WSACancelBlockingCall.
I'm also running Windows 7 64-bit with Unity 3.1.0f4
did you load the server Extension correctly? Did you enabled SFS to listen to 9933 UDP, and set the firewall?