I'm having a problem where if the server disconnects the Unity client with getAPI().disconnectUser, the client will freeze. The really strange thing is this freeze happens with the Unity Editor, and players for OSX and Linux, but not on iOS.
I think this is happening when the client tries to send a message after the server has disconnected it, but before isConnected gets set to false. Is there something I can check besides isConnected to determine whether the connection is up before I call Send? Any other suggestions for fixing this.
Unity client freezes when disconnected by server.
-
- Posts: 71
- Joined: 19 Oct 2011, 16:40
- Location: Alaska
- Contact:
Re: Unity client freezes when disconnected by server.
We release a Unity API update just a week ago. Can you confirm that you are using the latest?
If not please upgrade and let us know:
http://www.smartfoxserver.com/download/sfs2x#p=updates
Thanks
If not please upgrade and let us know:
http://www.smartfoxserver.com/download/sfs2x#p=updates
Thanks
-
- Posts: 71
- Joined: 19 Oct 2011, 16:40
- Location: Alaska
- Contact:
Re: Unity client freezes when disconnected by server.
I hadn't known that. I will download and try it.
Thanks
Thanks
-
- Posts: 71
- Joined: 19 Oct 2011, 16:40
- Location: Alaska
- Contact:
Re: Unity client freezes when disconnected by server.
I did the update, but I'm still getting the freezes.
Here's a little more detail:
My client sends UDP messages containing character updates ever 150ms. It appears to be this send that is causing the crash when the server disconnects the client rudely, either with disconnectUser or by shutting down the server. This seems to be the only situation where I have the crashes.
I have tried disconnecting the client computer from the network during the play, and this does not happen... it happily reconnects and resumes when I reconnect the network.
In all other situations, my CONNECTION_LOST event fires correctly, and everything works as expected.
Edit:
I devised a workaround that sends a message to the clients telling them a disconnect is coming, and then disconnects after a short delay. This should cover me for anything but the server process crashing, which I don't expect to ever see.
So I'm good.
Here's a little more detail:
My client sends UDP messages containing character updates ever 150ms. It appears to be this send that is causing the crash when the server disconnects the client rudely, either with disconnectUser or by shutting down the server. This seems to be the only situation where I have the crashes.
I have tried disconnecting the client computer from the network during the play, and this does not happen... it happily reconnects and resumes when I reconnect the network.
In all other situations, my CONNECTION_LOST event fires correctly, and everything works as expected.
Edit:
I devised a workaround that sends a message to the clients telling them a disconnect is coming, and then disconnects after a short delay. This should cover me for anything but the server process crashing, which I don't expect to ever see.
So I'm good.
Re: Unity client freezes when disconnected by server.
Thanks for reporting. I will ask ThomasLund to take a looks and see if he can reproduce it.
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
Re: Unity client freezes when disconnected by server.
We have not been able to reproduce any types of crashes on disconnect with the 1.0.3 version.
If you have any repro case, please send it over and I'll take a look! Otherwise will try to repro it with server shutdown (we've tried that several times and not had issues anymore)
/Thomas
If you have any repro case, please send it over and I'll take a look! Otherwise will try to repro it with server shutdown (we've tried that several times and not had issues anymore)
/Thomas
Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund
Follow on twitter: http://twitter.com/thomas_h_lund
Re: Unity client freezes when disconnected by server.
it freezes because you don't close old opened SmartFox connection. You should close old SmartFox(); instance.
- nekokiller
- Posts: 24
- Joined: 23 Oct 2012, 10:13
Re: Unity client freezes when disconnected by server.
How to close old SmartFox(); instance. ?
Make a new one ? ( new SmartFox() ? )
But that will cause the threads number of the application be more and more. The application will be busy and dead soon.
Is there anybody work on Unity crash problem ?
Make a new one ? ( new SmartFox() ? )
But that will cause the threads number of the application be more and more. The application will be busy and dead soon.
Is there anybody work on Unity crash problem ?
Re: Unity client freezes when disconnected by server.
What you need to do is remove the old listeners on the previous SmartFox instance, then create a new instance.
It is actually pretty simple to do if you setup and init() and destroy() methods in which you respectively add and remove the listeners that you need.
All it remains to do is just passing the current SmartFox instance and the problem is solved.
It is actually pretty simple to do if you setup and init() and destroy() methods in which you respectively add and remove the listeners that you need.
All it remains to do is just passing the current SmartFox instance and the problem is solved.
-
- Posts: 25
- Joined: 20 Nov 2012, 10:49
Re: Unity client freezes when disconnected by server.
I too seem to have this problem sometimes. One situation when I observed this, is when I restarted the server (standalone for debugging). The Unity web player crashes. I would have to even force close the browser to end it.
I have just downloaded the new C# API. Will test it on that too and get back.
I have just downloaded the new C# API. Will test it on that too and get back.
Re: Unity client freezes when disconnected by server.
Yes please, let us know.
Re: Unity client freezes when disconnected by server.
same issue here,
i downloaded the new api and now when i shutdown the server my client disconnects and takes me to the login screen, thank you for that fix which was not happening with old api,
but......
after the disconnection and while on the login screen, my client just freezes, am not even able to shut the unity client or reconnect if i start server, have to kill the unity client app process with windows task manager.
hopefully there will be a fix for this issue
i downloaded the new api and now when i shutdown the server my client disconnects and takes me to the login screen, thank you for that fix which was not happening with old api,
but......
after the disconnection and while on the login screen, my client just freezes, am not even able to shut the unity client or reconnect if i start server, have to kill the unity client app process with windows task manager.
hopefully there will be a fix for this issue
Re: Unity client freezes when disconnected by server.
Can you please provide more details?
Which Unity version are you using? Under Mac or Windows?
Are you testing in the Editor or not? If not what kind of client are you building?
Thanks
Which Unity version are you using? Under Mac or Windows?
Are you testing in the Editor or not? If not what kind of client are you building?
Thanks
Re: Unity client freezes when disconnected by server.
using latest up to date unity 4.1.2
Smartfox server 2.6
windows 7 64 platform and running the server on windows aswell
same issue happens while in editor mode and in windows build unity client
hope this helps you.
Smartfox server 2.6
windows 7 64 platform and running the server on windows aswell
same issue happens while in editor mode and in windows build unity client
hope this helps you.
Re: Unity client freezes when disconnected by server.
after the disconnection and while on the login screen, my client just freezes, am not even able to shut the unity client or reconnect if i start server, have to kill the unity client app process with windows task manager.
Over here we don't use Windows very much, mostly MacOS X but I have seen several reports from Windows user (there's another recent thread).
I've now tested using the latest Unity Editor 4.1.2 under both Win 7 and 8 and I have been able to reproduce the editor crash just like you reported, although it seems intermittent.
If we build an executable the problem doesn't show up.
It definitely looks like a Unity editor problem, we'll report the bug to the Unity dev team.
Thanks
Who is online
Users browsing this forum: No registered users and 44 guests