crash when receive message

Post here your questions about the Objective-C API for SFS2X

Moderators: Lapo, Bax

hujian2009
Posts: 2
Joined: 10 Oct 2017, 07:59

crash when receive message

Postby hujian2009 » 10 Oct 2017, 08:08

Hi guys,

Lately we are experiencing a lot of crashes on our client (iOS devices, all using the SFS API [1.6.2]).

Do you guys have any idea why this exception occurs?

Thanks!

Code: Select all

NSRangeException
*** -[NSConcreteMutableData getBytes:range:]: range {308, 79} exceeds data length 317

0 CoreFoundation   ___exceptionPreprocess + 124
1 libobjc.A.dylib   objc_exception_throw + 56
2 CoreFoundation   -[NSException initWithCoder:]
3 Foundation   -[NSData(NSData) getBytes:range:] + 276
4 Bocai   -[Data readUTF] (Data.m:127)
5 Bocai   -[DefaultSFSDataSerializer decodeSFSObject:] (DefaultSFSDataSerializer.m:350)
6 Bocai   -[DefaultSFSDataSerializer binary2object:] (DefaultSFSDataSerializer.m:773)
7 Bocai   +[SFSObject newFromBinaryData:] (SFSObject.m:36)
8 Bocai   -[SFSProtocolCodec onPacketRead:] (SFSProtocolCodec.m:88)
9 Bocai   -[SFSIOHandler handlePacketData:] (SFSIOHandler.m:94)
10 Bocai   -[SFSIOHandler onDataRead:] (SFSIOHandler.m:244)
11 Bocai   -[BitSwarmClient stream:handleEvent:] (BitSwarmClient.m:464)



Thanks!
User avatar
Lapo
Site Admin
Posts: 19609
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: crash when receive message

Postby Lapo » 10 Oct 2017, 13:38

Hi,
it's difficult to say. Clearly there seem to be a decoding problem on the client API side, though it's not clear what would cause it.
A generic network error could be the cause, but if it's happening often it might be something else.

Are you using UDP as protocol? UDP packets can get lost or corrupt.
Any idea on how to trigger the issue?

Another possibility is excessive pressure on the client, in other words if you're pushing too many packets too fast to the mobile clients it may cause errors similar to packet corruption. We've seen it in the past, though it's quite rare.

If you have any extra details let us know.
Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
hujian2009
Posts: 2
Joined: 10 Oct 2017, 07:59

Re: crash when receive message

Postby hujian2009 » 11 Oct 2017, 01:57

@Lapo, thanks for answering

we are using TCP as protocol.

Right now best guess is excessive pressure on the client like you said, because we also have crash like this
thread http://www.smartfoxserver.com/forums/viewtopic.php?f=21&t=15279#p64486, so we are try to optimizing messages right now.

I will reply with updates.
User avatar
Lapo
Site Admin
Posts: 19609
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: crash when receive message

Postby Lapo » 11 Oct 2017, 07:18

The post you mentioned is exactly what I was thinking of.
Pushing too many packets per second can indeed result in strange behavior at OS level. I am not sure we've ever seen it happen in Android but indeed there are instances in iOS.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X iPhone / iPad / OSX API”

Who is online

Users browsing this forum: No registered users and 3 guests