Page 1 of 1

ios send extension request error

Posted: 21 Dec 2013, 08:22
by tracy
unity3d export ios app package, throw exception when running.
It can connect, login , and join room.
then, send extension request to smartfoxserver, smartfoxserver throw exception such as below messages.
it has no problem on other platform, such as Android, webplayer, Widowns, and Editor.


15:34:30,216 WARN [com.smartfoxserver.v2.controllers.ExtensionController-1] con
trollers.ExtensionController - com.smartfoxserver.v2.controllers.ExtensionC
ontroller:83 -
com.smartfoxserver.v2.exceptions.SFSExtensionException: Extension Request refuse
d. Missing CMD. ( User Name: 111@qq.com, Id: 5, Priv: 0, Sess: 192.168.1.219:555
27 )
com.smartfoxserver.v2.controllers.ExtensionController.processRequest(Ext
ensionController.java:77)
com.smartfoxserver.bitswarm.controllers.AbstractController.run(AbstractC
ontroller.java:96)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecuto
r.java:886)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.ja
va:908)
java.lang.Thread.run(Thread.java:662)

Re: ios send extension request error

Posted: 21 Dec 2013, 10:07
by Lapo
Wow, pretty weird, indeed :shock:
I would recommend to turn on the DEBUG log level on the server side and watch the packet dump to see if there's really any difference between one version of the application and the other.

To turn on the DEBUG you need to edit the config/log4j.properties file. Go at the bottom and change INFO to DEBUG in the following line:

Code: Select all

log4j.category.sfs2x=INFO,consoleAppender,fileAppender
2) Restart the server

At this point the server will log every incoming / outgoing packet with a binary dump and an object dump of each. You will be able exactly what's going on.

thanks

Re: ios send extension request error

Posted: 29 Jan 2014, 22:01
by Eugene Ovcharenko
Have you been able to fix the issue?

(short) a: 13
(byte) c: 1
(sfs_object) p:
(int) r: -1
(sfs_object) p:

That mine output from server debug console, yet I've double checked that data is in sfserver.sent( e ).

Using e = new ExtensionRequest( cmd, sfsobject, room ), unity3d 4.2.2, smartfox plugin 1.5.0.0, server is 2.8.1, Stripping level - strip assemblies.

Any info would help.
Thanks.

Re: ios send extension request error

Posted: 30 Jan 2014, 15:03
by Lapo
Hi, it's difficult to understand what the issue is in the first place, especially if it happens only when you export for iOS.
Can you show me the C# code that builds the Extension request and all its parameters?

Re: ios send extension request error

Posted: 01 Feb 2014, 22:38
by Eugene Ovcharenko
Hi, first of all I must say that we've been able to eliminate this particular bug.

Let me explain it:

We have simple extension response with switch:

Code: Select all

public void OnExtensionResponse(BaseEvent evt) {
			
			string cmd = (string)evt.Params["cmd"];
			SFSObject data = (SFSObject)evt.Params["params"];
			switch(cmd)
			{
				case "OnPlayerMove": this.PlayerMove_Resp(data); break;
				case..
				case..
			}
}
And we have the response code itself:

Code: Select all

protected void PlayerMove_Resp(SFSObject data)
{
	Debug.Log( "PlayerMove_Resp: " + data );
	string guid = data.GetUtfString("guid");
	string error = data.GetUtfString("error");
	CallbackWrapper callback;
	try
	{
		//game code here
	}
}
We had this line for test purposes

Code: Select all

Debug.Log( "PlayerMove_Resp: " + data );
and it was causing random crashes on iOS only. Nine similar lines were commented to eliminate the bug.

We could not find it initially because game is not crashing on this particular line, it just stops working properly, and as I highlighted in my previous post we were sending proper data with SFServer.Send, yet it was not able to sent it. Showing empty binary data for the extension command.

It worked on Android, Windows, MAC, and in Unity3d editor.
We had to go back to our old commits, applying one by one to find this. Yet while it fixed error with sending data, we still receive occasional memory errors in iOS.

Also, before this fix, instead of array of users from room (room.UserList) we were receiving object of Room type in it. Which obviously is not intended behavior.

Code: Select all

userlist = room.UserList;
Debug.Log( userlist.getType() ) -> would return Room type. 
Please share any thoughts related to this issue. (threadsafe mode is ON)

Re: ios send extension request error

Posted: 03 Feb 2014, 09:46
by Lapo
HI,
thank you for your update.
As regards the last issues you have mentioned it is very difficult for us to provide any meaningful answer because the C# code in our API is working fine. The unexpected behavior only happens after the Unity exporter has translated the code into native ARM code for iOS.

As I have explained in another similar post this export process is entirely outside of our control, literally a black box. We have no idea what Unity does and why it screws up some of the code. Just like we have no idea why a simple Debug.Log(...) call causes the app to fail.

Have you informed the Unity team about these issues?

Re: ios send extension request error

Posted: 03 Feb 2014, 09:55
by Lapo
We'll run some more tests on iOS and see if we can reproduce the problems. If we can we'll prepare some bug reports for the Unity guys.
Do you see those issues appearing on both the emulator and the phone? Are there any differences?

Thanks