Anyone have UDP issues on Windows?
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
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
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
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
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
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
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.
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.
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
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
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
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
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...
Music was my first love, and it will be my last
Music of the future, and music of the past
To live without my music would be impossible to do
In this world of trauma my music pulls me through
Music of the future, and music of the past
To live without my music would be impossible to do
In this world of trauma my music pulls me through
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
-
- Posts: 61
- Joined: 16 Jan 2009, 14:48
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
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.
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.
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
debug log:
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
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
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:
I'm also running Windows 7 64-bit with Unity 3.1.0f4
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
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?
Who is online
Users browsing this forum: No registered users and 14 guests