TCP Crash

Tustvold
edited August 2013 in Native
I have successfully got the native Photon SDKs working and fully incorporated into my game. However, because I am using a step-locked system repeated packet loss can lead to quite a noticeable jerk in simulation. I therefore decided to try out using TCP as its flow control would potentially help mitigate this, however, when I try to enable TCP I get a crash in ExitGame::Common::MemoryManagement just as the client receives the operation response to its join request.

I am enabling TCP simply using the LoadBalancing::Client constructor, is there something else I need to change?

Here is the stack trace
Thread 0 Crashed:
0 TankTrouble 0x00176dd2 ExitGames::Common::MemoryManagement::Internal::MemoryPool::getBlockSize() (MemoryPool.cpp:103)
1 TankTrouble 0x00177212 ExitGames::Common::MemoryManagement::Internal::MemoryPoolManager::dealloc(void*) (MemoryPoolManager.cpp:84)
2 TankTrouble 0x001743d4 void ExitGames::Common::MemoryManagement::deallocateArray<unsigned char>(unsigned char const*) (Allocate.h:317)
3 TankTrouble 0x0018cdf0 ExitGames::Photon::Internal::TPeer::Operation::~Operation() (TPeer.cpp:34)
4 TankTrouble 0x0018cdd0 ExitGames::Photon::Internal::TPeer::Operation::~Operation() (TPeer.cpp:33)
5 TankTrouble 0x0018e820 ExitGames::Common::JVector<ExitGames::Photon::Internal::TPeer::Operation>::removeElementAt(unsigned int) (JVector.h:480)
6 TankTrouble 0x0018da3e ExitGames::Photon::Internal::TPeer::dispatchIncomingCommands() (TPeer.cpp:179)
7 TankTrouble 0x00188e08 ExitGames::Photon::Internal::PeerBase::service(bool) (PeerBase.cpp:198)
8 TankTrouble 0x00178d02 ExitGames::Photon::PhotonPeer::service(bool) (PhotonPeer.cpp:106)
9 TankTrouble 0x00140bba PhotonManager::update(float) (PhotonManager.cpp:139)
10 TankTrouble 0x00086884 cocos2d::CCTimer::update(float) (CCScheduler.cpp:162)
11 TankTrouble 0x0008c70e cocos2d::CCScheduler::update(float) (CCScheduler.cpp:816)
12 TankTrouble 0x000841ae cocos2d::CCDirector::drawScene() (CCDirector.cpp:212)
13 TankTrouble 0x000859a8 cocos2d::CCDisplayLinkDirector::mainLoop() (CCDirector.cpp:923)
14 TankTrouble 0x000b18d4 -[CCDirectorCaller doCaller:] (CCDirectorCaller.mm:93)
15 QuartzCore 0x3bd0806c CA::Display::DisplayLink::dispatch(unsigned long long, unsigned long long) + 156
16 QuartzCore 0x3bd07fc4 CA::Display::IOMFBDisplayLink::callback(__IOMobileFramebuffer*, unsigned long long, unsigned long long, unsigned long long, void*) + 60
17 IOMobileFramebuffer 0x3bb80fd4 IOMobileFramebufferVsyncNotifyFunc + 152
18 IOKit 0x38dc9446 IODispatchCalloutFromCFMessage + 190
19 CoreFoundation 0x380c75d8 __CFMachPortPerform + 116
20 CoreFoundation 0x380d2170 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
21 CoreFoundation 0x380d2112 __CFRunLoopDoSource1 + 134
22 CoreFoundation 0x380d0f94 __CFRunLoopRun + 1380
23 CoreFoundation 0x38043eb8 CFRunLoopRunSpecific + 352
24 CoreFoundation 0x38043d44 CFRunLoopRunInMode + 100
25 GraphicsServices 0x33e1c2e6 GSEventRunModal + 70
26 UIKit 0x3884b2f4 UIApplicationMain + 1116
27 TankTrouble 0x0007778a main (main.m:14)
28 TankTrouble 0x00076bbc start + 36

Inspecting the values in the debugger it appears that it is calling getBlockSize() on a null pointer.

I'm not sure if it is relevant but the values of ctr, ctr2 & ctr3 on the MemoryPoolManager are very large (2250705027044518912, 536873540420, 481036337231)

Here is the relevant log output:
Cocos2d: State Change:1
Cocos2d: 2013-08-05 11:24:24,452080 INFO LoadBalancingClient.cpp onStatusChanged() line: 510 - connected to masterserver
Cocos2d: 2013-08-05 11:24:24,596785 INFO LoadBalancingPeer.cpp opAuthenticate() line: 100 - OperationRequest - operationCode: 230 {224="a803bad3-d12f-45cc-b2cb-c3ca0539dfe8", 220="1.0", 225="Androidtester1"}
Cocos2d: 2013-08-05 11:24:24,654682 INFO LoadBalancingClient.cpp onEvent() line: 579 - EventData - code: 226
Cocos2d: 2013-08-05 11:24:24,684971 INFO LoadBalancingClient.cpp onOperationResponse() line: 306 - OperationResponse - operationCode: 230, returnCode: 0 {}
Cocos2d: 2013-08-05 11:24:24,751137 INFO LoadBalancingClient.cpp onOperationResponse() line: 306 - OperationResponse - operationCode: 229, returnCode: 0 {}
Cocos2d: Connected!
Cocos2d: State Change:2
Cocos2d: 2013-08-05 11:24:24,752547 INFO LoadBalancingClient.cpp onEvent() line: 579 - EventData - code: 230
Cocos2d: State Change:3
Cocos2d: 2013-08-05 11:24:25,518854 ERROR LoadBalancingClient.cpp onOperationResponse() line: 306 - OperationResponse - operationCode: 225, returnCode: 32760 (No match found) {}
Cocos2d: 2013-08-05 11:24:25,520033 ERROR LoadBalancingClient.cpp onOperationResponse() line: 436 - opJoinRandomRoom failed with errorcode 32760: No match found. Client is therefore staying on masterserver!
Cocos2d: Failed to join random room:No match found
Cocos2d: State Change:2
Cocos2d: Creating Random Room
Cocos2d: State Change:3
Cocos2d: 2013-08-05 11:24:25,584935 INFO LoadBalancingClient.cpp onOperationResponse() line: 306 - OperationResponse - operationCode: 227, returnCode: 0 {230="95.211.58.243:4531", 255="5e63f347-c042-4dde-9fbe-0b61761f31dc"}

I have a couple of custom types and have tried disabling them, but that seems to have had no effect. I also think the crash is occurring before they would ever be used.

I have tested this on the iOS simulator, an iOS device and an android device and get the same crash (as you would perhaps expect).

Interestingly this same crash occurs by changing the demo_iphone_loadbalancing_cpp to use TCP.

BTW I feel I must congratulate you on creating such a great product. Whilst the documentation is perhaps a little sparse, I managed to add it to my game and get it up and fully working in just 5 days.

Comments