Init Buddy List memory error

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

Moderators: Lapo, Bax

Post Reply
Eugene Ovcharenko
Posts: 5
Joined: 29 Jan 2014, 13:50

Init Buddy List memory error

Post by Eugene Ovcharenko »

Hello.

I have occasional problems with buddy list initialization.
Tried on two latest server version 2.8.2 & 2.8.1 and two latest versions of C# client api 1.5.0 & 1.5.2 - result is the same.
I'm using Unity3D 4.3.3.

Problems reveals itself on iOS, after device is brought from sleeping mode, and reconnection is established.
Bug is very inconsistent, so I've used debug mode to crash the app on Buddy List init.

When client plugin is in debug mode:

Code: Select all

m_sfx = new SmartFox(true);
app crashes once in approximately three launches right on first buddy list init, but there is no certain pattern.

Please see attached screenshots.
It's clear that app tries to allocate 1gb of memory on m_Sfs2X_Controllers_SystemController_FnInitBuddyList_Sfs2X_Bitswarm_IMessage.

Buddy list dump looks the same if app is running normally of crashed, (2 of 28 users showed):

Code: Select all

[SFS - DEBUG] Handling New Packet of size 485
[SFS - DEBUG] Handling Header Size. Length: 484 (small)
[SFS - DEBUG] Data size is 482
[SFS - DEBUG] Handling Data: 482, previous state: 0/482
[SFS - DEBUG] <<< Packet Complete >>>
[SFS - INFO] Message: InitBuddyList { Message id: 200 }
{ Dump: }

	(sfs_array) mv: 
		(sfs_array) 
			(utf_string) $__BV_STATE__
			(byte) 4
			(utf_string) Available
		
	
	(utf_string_array) bs: [System.String[]]
	(sfs_array) bl: 
		(sfs_array) 
			(int) -1
			(utf_string) user5.1393015114019
			(bool) False
			(sfs_array) 
				(sfs_array) 
					(utf_string) $__BV_STATE__
					(byte) 4
					(utf_string) Available
				
			
		
		(sfs_array) 
			(int) -1
			(utf_string) user3.1392503800337
			(bool) False
			(sfs_array) 
				(sfs_array) 
					(utf_string) $__BV_STATE__
					(byte) 4
					(utf_string) Available

Could it be so, that something is not yet initialized when we try to init buddy list?
In non-debug mode, after going back from sleep on ios, it can work just fine for 10 times, and then crash on 11th with very same reason.

Could you please look at things at your end? Or suggest direction to move further on our side..

Thanks.

Update:
Just tested in debug mode with new user, who has no buddies. xCode log just before the crash:

Code: Select all

[SFS - INFO] Data Read: Binary Size: 160
80 00 44 12 00 03 00 01 61 03 00 c8 00 01 63 02 	..D.....a.....c.
00 00 01 70 12 00 03 00 02 6d 76 11 00 00 00 02 	...p.....mv.....
62 73 10 00 03 00 09 41 76 61 69 6c 61 62 6c 65 	bs.....Available
00 04 41 77 61 79 00 08 4f 63 63 75 70 69 65 64 	..Away..Occupied
00 02 62 6c 11 00 00 80 00 56 12 00 03 00 01 61 	..bl.....V.....a
03 00 cc 00 01 63 02 00 00 01 70 12 00 02 00 02 	.....c....p.....
62 6e 08 00 13 55 73 65 72 39 2e 31 34 30 30 34 	bn...User9.14004
31 33 32 39 32 33 33 36 00 02 62 76 11 00 01 11 	13292336..bv....
00 03 08 00 0d 24 5f 5f 42 56 5f 53 54 41 54 45 	.....$__BV_STATE
5f 5f 02 04 08 00 09 41 76 61 69 6c 61 62 6c 65 	__.....Available

[SFS - DEBUG] Handling New Packet of size 160
[SFS - DEBUG] Handling Header Size. Length: 159 (small)
[SFS - DEBUG] Data size is 68
[SFS - DEBUG] Handling Data: 157, previous state: 0/68
[SFS - DEBUG] <<< Packet Complete >>>
[SFS - INFO] Message: InitBuddyList { Message id: 200 }
{ Dump: }

	(sfs_array) mv: 
		
	
	(utf_string_array) bs: [System.String[]]
	(sfs_array) bl: 
		
	
P.S. Could you please move this topic to Unity C# thread? Thanks.
Attachments
Screenshot at May 18 12-35-17.png
(238.44 KiB) Not downloaded yet
Screenshot at May 18 13-48-21.png
(105.95 KiB) Not downloaded yet
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Init Buddy List memory error

Post by Lapo »

[Moved to the C# API Section]

Hi,
does this happen when you run the application in Unity/WebPlayer?

I ask because there are known "glitches" caused by the ARM AOT compilation when Unity exports to iOS and we've have spent quite a lot of time researching and debugging these without much luck. The reason being that the AOT compiler is causing the erratic problem.
Typically these issues are hard to reproduce.

Is there a way to reproduce the problem?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
Eugene Ovcharenko
Posts: 5
Joined: 29 Jan 2014, 13:50

Re: Init Buddy List memory error

Post by Eugene Ovcharenko »

I believe we face it only on iOS. Editor and Android runs are not suffering from this issue.

It reveal itself in runtime builds once in a while during device exit from sleep mode. And almost always in client debug mode on a device on first init.
Behaviour is always the same. Client gets packet that buddy list is initialized, and app crashes as it shown on screenshots.

I understand that this might be because of AOT, but it just bothers me that very same build may, or may not, face this issue from run to run.

Please see PM, I've sent you a link to test build.
Thanks.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Init Buddy List memory error

Post by Lapo »

One of the known issues with the AOT compiler is this:
http://forum.unity3d.com/threads/168019 ... quot-crash

From what I can see in your call tree an Enumerator is involved in your code too. I am not sure if this is exactly the same scenario as described in the article but it seems likely.
Lapo
--
gotoAndPlay()
...addicted to flash games
Eugene Ovcharenko
Posts: 5
Joined: 29 Jan 2014, 13:50

Re: Init Buddy List memory error

Post by Eugene Ovcharenko »

Hi.
Lapo wrote:One of the known issues with the AOT compiler is this:
http://forum.unity3d.com/threads/168019 ... quot-crash

From what I can see in your call tree an Enumerator is involved in your code too. I am not sure if this is exactly the same scenario as described in the article but it seems likely.
We've covered trampolines issue quite long ago, and even if we didn't, I guess we cannot change code in SmartFox2x.dll, because that's the place where it fails, somewhere in Bitswarm Client.
Right now the only solution we have - is to write our own buddy list implementation, and dismiss using embedded one.

I'll try to notify you, in case we have found a solution.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Init Buddy List memory error

Post by Lapo »

If you want we can send the sources and you can experiment with it.
Send us an email to support@... with a reference to this discussion.

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply