Odd problem

More
3 years 5 months ago #4182 by GuruGurra
Odd problem was created by GuruGurra
I have a very odd problem in my Android app. When I stress test my network solution (Mirror) I sometimes get a problem that ends up with the app looping forever and is unresponsive. I have searched for this problem for a long time without success. The only thing I can see is some log entries in logcat and they doesn't say much.

But I did finally realize that I2.Localizer is mentioned in the call stack of the exception logging, I haven't a clue why. Does the following log entries give any ideas for what is going on?

2020/11/14 00:21:16.775 19103 19585 Error Unity EndOfStreamException: ReadByte out of range:NetworkReader pos=0 len=0 buffer=
2020/11/14 00:21:16.775 19103 19585 Error Unity   at Mirror.NetworkReader.ReadByte () [0x00000] in <00000000000000000000000000000000>:0 
2020/11/14 00:21:16.775 19103 19585 Error Unity   at Mirror.NetworkReader.ReadUInt64 () [0x00000] in <00000000000000000000000000000000>:0 
2020/11/14 00:21:16.775 19103 19585 Error Unity   at I2.Loc.LocalizeTarget`1[T]..ctor () [0x00000] in <00000000000000000000000000000000>:0 
2020/11/14 00:21:16.775 19103 19585 Error Unity   at System.Threading.ContextCallback.Invoke (System.Object state) [0x00000] in <00000000000000000000000000000000>:0 
2020/11/14 00:21:16.775 19103 19585 Error Unity   at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 
2020/11/14 00:21:16.775 19103 19585 Error Unity   at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run () [0x00000] in <00000000000000000000000000000000>:0 
2020/11/14 00:21:16.775 19103 19585 Error Unity   at System.Action.Invoke () [0x00000] in <00000000000000000000000000000000>:0 
2020/11/14 00:21:16.775 19103 19585 Error Unity   at System.Threading.SendOrPostCallback.Invoke (System.Object state) [0x00000] in <0000000

2020/11/14 00:21:16.782 19103 19585 Error Unity NullReferenceException: Object reference not set to an instance of an object.
2020/11/14 00:21:16.782 19103 19585 Error Unity   at I2.Loc.LocalizeTarget`1[T]..ctor () [0x00000] in <00000000000000000000000000000000>:0 
2020/11/14 00:21:16.782 19103 19585 Error Unity   at System.Array.Sort[T] (T[] array, System.Int32 index, System.Int32 length, System.Collections.Generic.IComparer`1[T] comparer) [0x00000] in <00000000000000000000000000000000>:0 
2020/11/14 00:21:16.782 19103 19585 Error Unity   at Mirror.Discovery.NetworkDiscoveryBase`2[Request,Response].ReceiveGameBroadcastAsync (System.Net.Sockets.UdpClient udpClient) [0x00000] in <00000000000000000000000000000000>:0 
2020/11/14 00:21:16.782 19103 19585 Error Unity   at I2.Loc.LocalizeTarget`1[T]..ctor () [0x00000] in <00000000000000000000000000000000>:0 
2020/11/14 00:21:16.782 19103 19585 Error Unity   at System.Threading.ContextCallback.Invoke (System.Object state) [0x00000] in <00000000000000000000000000000000>:0 
2020/11/14 00:21:16.782 19103 19585 Error Unity   at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 
2020/11/14 00:21:16.782 19103 19585 Error Unity   at System.Runtime.CompilerS

The first problem seems to be the EndOfStreamException (logged once), after that there is an eternal loop where the NullReferenceException is logged about 3-4 times a second.

The "I2.Loc.LocalizeTarget" mentioned in the log entries - is that the normal call for localizing a text or is it some internal housekeeping thing?

By some reason I can't debug the code remote and the problem is not present when I run in the Unity editor. I haven't a clue where to start look for this problem. My guess is that it is a Mirror problem, but if someone can explain why I2.Localizer is involved in the logging I might have a chance to get closer to where the problem is.

Please Log in or Create an account to join the conversation.

More
3 years 5 months ago #4183 by Frank
Replied by Frank on topic Odd problem
Hi,
It looks like you serializing an object into a stream and then de-serializing the object in the client.

But the stream got corrupted, because the object was created (and that object has a Localize component inside), But the stream was empty (len=0) so the de-serializer was unable to initialize the object values.

It just happened that the LocalizeTarget is one of the first components in that object.

Hope that helps,
Frank

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out

Please Log in or Create an account to join the conversation.

More
3 years 5 months ago #4184 by GuruGurra
Replied by GuruGurra on topic Odd problem
Hi,

None of the objects that are serialized/de-serialized include a Localize component. And in the situation where the problem arise there is only a very basic poll/response thing with static text going on.

The odd thing is that LocalizeTarget is mentioned at all, and the Sort() method is also mentioned. The only place in my entire solution where the Sort() method is used is in I2 in the Editor and in the Google sections.

The problem is most likely to appear when the app in just started which make me suspect that the synchronization of the Google sheet somehow interferes with my Mirror based device communication. What port(s) do you use for the Google communication?

Please Log in or Create an account to join the conversation.

More
2 years 11 months ago #4292 by junaid
Replied by junaid on topic Odd problem
Hi,

I'm having a similar problem. Did you find the solution to this issue? Please do respond.

The app works completely fine on the editor but it's causing the trouble on Android and iOS devices.

"type" : "System.NullReferenceException",
"stackTrace" : " at I2.Loc.LocalizeTarget`1[T]..ctor () [0x00000] in <00000000000000000000000000000000>:0 \n at System.Threading.ContextCallback.Invoke (System.Object state) [0x00000] in <00000000000000000000000000000000>:0
\n at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 \n at
System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run () [0x00000] in <00000000000000000000000000000000>:0 \n at System.Action.Invoke () [0x00000] in
<00000000000000000000000000000000>:0 \n at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00000] in <00000000000000000000000000000000>:0 "

Please Log in or Create an account to join the conversation.

Time to create page: 0.361 seconds
Template by JoomlaShine