EGDictionary.m crashes on iPAD
HI,
I using the iOS SDK, and I have the same crash on the iPAD. This crash happens when I disconnect, and I try to reconnect.
iPad is running OS 9.3.5
Here is the error message
frame #0: 0x23597a66 libobjc.A.dylib`objc_msgSend + 6
* frame #1: 0x00b17c6e `-[EGMutableDictionary checkObjectTypes:forKey:](self=0x1c1188d0, _cmd=, anObject=0x17e45a80, aKey=0x1c1184f0) at EGDictionary.m:865:5 [opt]
frame #2: 0x00b1743a `-[EGMutableDictionary setObject:forKey:](self=0x1c1188d0, _cmd=, anObject=0x17e45a80, aKey=0x1c1184f0) at EGDictionary.m:802:2 [opt]
frame #3: 0x00b51b3e `::-[EGLoadBalancingPeer opAuthenticate::::::](self=0x17d57440, _cmd=, appID=, appVersion="1.0", encrypted=, authenticationValues=, lobbyStats=, regionCode=) at EGLoadBalancingPeer.mm:252:3 [opt]
frame #4: 0x00b4bdda `::-[EGLoadBalancingClient onOperationResponse:](self=0x17ee7b00, _cmd=, operationResponse=) at EGLoadBalancingClient.mm:0:6 [opt]
frame #5: 0x00b41eae `ExitGames::Photon::Internal::PeerBase::deserializeOperationResponse(this=0x18a7cc14, inBuff=, isEncrypted=, inBuffBodyLength=, msgType=) at PeerBase.cpp:604:31 [opt]
frame #6: 0x00b41ba8 `ExitGames::Photon::Internal::PeerBase::deserializeOperation(this=0x18a7cc14, inBuff="\363\203N\323$ߣ=7\nu\356$\241r\325\332tϛ\x97\365\227E\253`-\344x\361\376\xa2\x86={\x8fn\x12\334\370>\x15\344!\345j\x1cL\x06", inBuffLength=50) at PeerBase.cpp:530:38 [opt]
frame #7: 0x00b3ca90 `ExitGames::Photon::Internal::EnetPeer::dispatchIncomingCommands(this=0x18a7cc14) at EnetPeer.cpp:506:15 [opt]
frame #8: 0x00b409da `ExitGames::Photon::Internal::PeerBase::service(this=0x18a7cc14, dispatch=) at PeerBase.cpp:206:12 [opt]
frame #9: 0x00b32f34 `ExitGames::Photon::PhotonPeer::service(this=, dispatchIncomingCommands=) at PhotonPeer.cpp:169:17 [opt]
frame #10: 0x0016a4f0 `::-[PhotonEngine run](self=0x17ee7700, _cmd="run") at PhotonEngine.mm:301:9
I using the iOS SDK, and I have the same crash on the iPAD. This crash happens when I disconnect, and I try to reconnect.
iPad is running OS 9.3.5
Here is the error message
frame #0: 0x23597a66 libobjc.A.dylib`objc_msgSend + 6
* frame #1: 0x00b17c6e `-[EGMutableDictionary checkObjectTypes:forKey:](self=0x1c1188d0, _cmd=, anObject=0x17e45a80, aKey=0x1c1184f0) at EGDictionary.m:865:5 [opt]
frame #2: 0x00b1743a `-[EGMutableDictionary setObject:forKey:](self=0x1c1188d0, _cmd=, anObject=0x17e45a80, aKey=0x1c1184f0) at EGDictionary.m:802:2 [opt]
frame #3: 0x00b51b3e `::-[EGLoadBalancingPeer opAuthenticate::::::](self=0x17d57440, _cmd=, appID=, appVersion="1.0", encrypted=, authenticationValues=, lobbyStats=, regionCode=) at EGLoadBalancingPeer.mm:252:3 [opt]
frame #4: 0x00b4bdda `::-[EGLoadBalancingClient onOperationResponse:](self=0x17ee7b00, _cmd=, operationResponse=) at EGLoadBalancingClient.mm:0:6 [opt]
frame #5: 0x00b41eae `ExitGames::Photon::Internal::PeerBase::deserializeOperationResponse(this=0x18a7cc14, inBuff=, isEncrypted=, inBuffBodyLength=, msgType=) at PeerBase.cpp:604:31 [opt]
frame #6: 0x00b41ba8 `ExitGames::Photon::Internal::PeerBase::deserializeOperation(this=0x18a7cc14, inBuff="\363\203N\323$ߣ=7\nu\356$\241r\325\332tϛ\x97\365\227E\253`-\344x\361\376\xa2\x86={\x8fn\x12\334\370>\x15\344!\345j\x1cL\x06", inBuffLength=50) at PeerBase.cpp:530:38 [opt]
frame #7: 0x00b3ca90 `ExitGames::Photon::Internal::EnetPeer::dispatchIncomingCommands(this=0x18a7cc14) at EnetPeer.cpp:506:15 [opt]
frame #8: 0x00b409da `ExitGames::Photon::Internal::PeerBase::service(this=0x18a7cc14, dispatch=) at PeerBase.cpp:206:12 [opt]
frame #9: 0x00b32f34 `ExitGames::Photon::PhotonPeer::service(this=, dispatchIncomingCommands=) at PhotonPeer.cpp:169:17 [opt]
frame #10: 0x0016a4f0 `::-[PhotonEngine run](self=0x17ee7700, _cmd="run") at PhotonEngine.mm:301:9
0
Comments
-
Hi @Vasilis.
As I have already mentioned in the other thread, please provide reproduction code. The two issues might be related and both should definitely not happen and never got reported before. Can you reproduce them with one of our demo projects?0 -
Hi @Kaiserludi,
I did not try to reproduce it with your demo code. Also, I do not have error on iPhone, but only on the iPad. Could it because I am running an old OS on the iPad? Does the report trace help you to identity the error?0 -
Hi @Vasilis.
i have never seen this crash before, so I assume it must be somehow related to your code. That's why I asked for a repro case.
The code at EGDictionary.m:865 looks fine and I can't see how it could crash.0 -
Hi @Kaiserludi,
Then maybe there is something inherent to OS 9.3.5. Because, I do not have this crash on devices that run the latest version of the OS. Also, I can reproduce this crash only when I call the method to disconnect, and after a few seconds I call the method to connect.
The good thing is that I have not heard any complains from my users!0 -
Hi @Kaiserludi,
I have this problem on devices running OS 10.3.1
Then, I found that I have this crash only when I use the release version of the libraries Photon, Common and LoadBalancing.
Is it safe to publish my app with the debug version of those libraries?0 -
Hi @Vasilis.
You could publish with the debug version of the libs, but in that case your app itself and all other libs that it uses should also be debug versions (as otherwise you will probably run into issues with mixing debug and release version of the runtime). This is not ideal for performance.
However if I were you I would really just approach this properly and track down the cause of it. first I woudl figure out if it only happens with your project or if you can manage to reproduce it with one of our demo projects. In the latter case just tell us how we can reproduce it with one of the demo projects and we will look into it and provide a fix. If it is the former, then you should track down which difference between your project and the demos is causing this and fix the issue in your code.0 -
Hi @Kaiserludi,
Thank you for your quick response.
It crashed again, even with the debug version of the libraries. But, now, I have an error that I think will help you to track it:FATAL: EGDictionary.m -[EGMutableDictionary checkObjectTypes:forKey:] line: 875 - An EGDictionary can't hold elements of different types at the same time. Assertion failed: (0), function -[EGMutableDictionary checkObjectTypes:forKey:], file /Development/egp/v4.1.14.x/Common-objc/src/EGDictionary.m, line 875.
0 -
Hi @Kaiserludi,
I was confused by the fact that it was crashing only on devices that run iOS lower than 11.
I think that Photon is crashing when I call opRaiseEvent and the parameter is nil.
It does not crash all the times, but I will make sure that that parameter is not nil.
0 -
Hi @Vasilis.
You need to make sure that you don't attempt to add keys or values of different types to anEGMutableDictionary
than the ones that thatEGMutableDictionary
already holds. If you fail to do that, then the class will assert just like in the error message that you have shown.
So the fix is to find the place in your code where you try to add a key-value pair to anEGMutableDictionary
that does not match the types of any previously added key-value pair or the type that you have specified when initializing the container.
Background info:EGDictionary
,EGArray
and their mutable subclasses are strong-typed variants ofNSDictionary
,NSArray
and their subclasses. They internally just store their content in aNSDictionary
/NSArray
, but they actively prevent the user from mixing keys, values or elements with different types.
Hence once you have added for example a key of typeint
with a value of typeNSString
to anEGDictionary
, all further keys that you add to thatEGDictionary
also need to be ofint
and all further values also need to be of typeNSString
.
AnEGDictionary
is the objective equivalent to anExitGames::Common::Dictionary
in the C++ Client and to aDictionary
in C# on the server, while anNSDictionary
is the equivalent to anExitGames::Common::Hashtable
and to aHastable
in C# on the server. AnEGArray
is equivalent to a C-array, to anExitGames::Common::JVector
and to a strongly-typed array in C# on the Server, while anNSArray
is equivalent to a c-array of typeObject
, to anExitGames::Common::JVector< Object>
and to anObject[]
on the server.
As Cocoa only has weak-typed containers (containers in which you can store objects of different classes), we had to add our own strong-typed containers (containers in which all stored objects are of the same class)EGDictionary
andEGArray
to have matching equivalents in objective C to the containers that we support in C# and C++. Otherwise there would be no way for objective C code to tell Photon if anNSDictionary
should be treated like aHashtable
or like aDictionary
.
The big advantage of aDictionary
over aHashtable
and a typed array over anObject
-array (and hence ofEGDictionary
overNSDictionary
andEGArray
overNSArray
) is that because all keys/values/elements are guaranteed to be of the same type, Photon only has to include the type-information once for the whole container and not once for each element. This saves bandwidth.
1 -
Hi @Kaiserludi,
I am updating the room properties and the player properties. Both of these are NSDictionary. I strongly believe that the issue was that I was passing nil, even though, it is hard to reproduce it.0