API v1.1.0 released

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

Moderators: Lapo, Bax

User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

API v1.1.0 released

Postby Bax » 12 Mar 2013, 10:11

We just released an important update of the C# API.
It fixes several issues discussed in the forum recently, improving the threads and memory management.
Updating is strongly recommended.
You can get the new version and read the release notes here: http://www.smartfoxserver.com/download/sfs2x#p=updates
Paolo Bax
The SmartFoxServer Team
Ferz
Posts: 21
Joined: 27 Aug 2011, 08:17

Re: API v1.1.0 released

Postby Ferz » 22 Mar 2013, 13:16

We have found bug in new version:
1. Connect to server from client.
2. Destroy internet connection, client fired OnConnectionLost event.
3. Try to reconnect to server.
4. SmartFox.dll fired exception:

Object reference not set to an instance of an object
at Sfs2X.Bitswarm.BitSwarmClient.Connect (System.String ip, Int32 port) [0x00000] in <filename unknown>:0 //SmartFox.dll
at Sfs2X.SmartFox.Connect (System.String host, Int32 port) [0x00000] in <filename unknown>:0 // SmartFox.dll
at SFSConnector.Connect (.ServerConfigurationHolder server) [0x00000] in <filename unknown>:0 //our client code

Another issue, that is 100% reproducable, bothering us for a year:
1. Connect to sercer from client.
2. Init UDP.
3. Destroy internet connection, client fired OnConnectionLost event.
4. Try to close client. Client will hang out.

This issue presents only if UDP is initialized.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: API v1.1.0 released

Postby Lapo » 22 Mar 2013, 13:48

Hi,
thanks for reporting.

Are you recreating the SmartFox object once the client gets disconnected. This is the one and only way to start a new connection.

1. Connect to sercer from client.
2. Init UDP.
3. Destroy internet connection, client fired OnConnectionLost event.
4. Try to close client. Client will hang out.

What client are we talking about exactly? The web player? Mobile device? Under which OS?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
Ferz
Posts: 21
Joined: 27 Aug 2011, 08:17

Re: API v1.1.0 released

Postby Ferz » 22 Mar 2013, 14:25

Are you recreating the SmartFox object once the client gets disconnected. This is the one and only way to start a new connection.

No. We did not do it since start of the project (more then one year ago) and everything was fine.
If it is necessary - we will recreate SmartFox object before reconnect.

What client are we talking about exactly? The web player? Mobile device? Under which OS?

PC Standalone, Windows 7, 64 bit.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: API v1.1.0 released

Postby Lapo » 22 Mar 2013, 14:57

Yes, a new instance of the SmartFox object is the way to go.
See if it helps with the Windows crash too. That problem might be more difficult to pinpoint and it's likely to be due to problems with Unity release resources than anything else.

If you have a crash report of some sort we could take a look.
Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
Ferz
Posts: 21
Joined: 27 Aug 2011, 08:17

Re: API v1.1.0 released

Postby Ferz » 22 Mar 2013, 15:00

Thank you, we will try.
Ferz
Posts: 21
Joined: 27 Aug 2011, 08:17

Re: API v1.1.0 released

Postby Ferz » 04 Apr 2013, 13:00

We have tried to clean Smartfox object in OnConnectionLost event. Now we can recconnect to server, if we create new Smartfox object. But issue with closing application is actual anyway. If disconnect happened, application hangs when we try to close it. It does not seem to be an Unity bug, because issue presents only if UDP was initialized. It looks like something goes wrong with UDP stuff, when disconnect happens.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: API v1.1.0 released

Postby Lapo » 05 Apr 2013, 08:30

The problem you are describing actually sounds like a Unity bug, because a disconnection from socket should in no way crash the application unless there's some memory leak or bad pointers, behind the scenes, the causes the failure. If this is the case there's not much we can do, but let's not be pessimistic.

We will have to check this on our side and see if there is a workaround.
I will post an update soon.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
Ferz
Posts: 21
Joined: 27 Aug 2011, 08:17

Re: API v1.1.0 released

Postby Ferz » 05 Apr 2013, 09:31

The problem you are describing actually sounds like a Unity bug, because a disconnection from socket should in no way crash the application unless there's some memory leak or bad pointers, behind the scenes, the causes the failure. If this is the case there's not much we can do, but let's not be pessimistic.

As I understand Unity does not work with sokets itself, am I right?. If all work with sokets are located in Smartfox.dll is it possible that Smartfox does not close correctly some threads, connected with UDP stuff?

We will have to check this on our side and see if there is a workaround.
I will post an update soon.


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

Re: API v1.1.0 released

Postby Lapo » 05 Apr 2013, 09:39

We'll check and let you know
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: API v1.1.0 released

Postby Lapo » 08 Apr 2013, 10:01

I have tested the scenario you have reported and I can tell you with good confidence that this is not an SFS related issue.
Unfortunately it depends on the Unity engine more than anything else.

The reason is that exporting an executable for Mac works and behaves as expected with no crashes whatsoever, on the other hands the Windows executable does display the problem you have reported. It freezes after a sudden disconnection. At least it does under Windows XP (sp3) although I wouldn't be surprised to see different outcomes under Windows 7 or 8.

I tested using Unity 3.5.x under MacOSX Lion.
I would suggest to try exporting with the latest Unity Editor (as of today should be v4.1) and see if they have fixed the issue.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
Ferz
Posts: 21
Joined: 27 Aug 2011, 08:17

Re: API v1.1.0 released

Postby Ferz » 11 Apr 2013, 12:12

I would suggest to try exporting with the latest Unity Editor (as of today should be v4.1) and see if they have fixed the issue.

We are using Unity v4.1. The problem is still here.

I have tested the scenario you have reported and I can tell you with good confidence that this is not an SFS related issue.
Unfortunately it depends on the Unity engine more than anything else.


Could you explain, why do you think so? Why this issue presents only when UDP is active?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: API v1.1.0 released

Postby Lapo » 11 Apr 2013, 12:51

We will have to do some specific tests under Windows.
The reason why I am saying that it is most likely a Windows issue is because the problem doesn't appear under MacOSX, which is the expected behavior. When a multiplatform SDK such as Unity starts to show contradicting behaviors on different platforms it is typically due to specific issues in the native implementation, where we don't have access.

In any case we'll run some more tests under Windows and see if we can work around the problem, somehow.
If not, we'll file a bug report for the Unity dev team.

I will keep you updated.
Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
Ferz
Posts: 21
Joined: 27 Aug 2011, 08:17

Re: API v1.1.0 released

Postby Ferz » 11 Apr 2013, 13:43

Thank you!
Ferz
Posts: 21
Joined: 27 Aug 2011, 08:17

Re: API v1.1.0 released

Postby Ferz » 19 Apr 2013, 11:48

Any news?

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 28 guests