Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvalidMessageException after v62.5.3 (PR 537) #555

Closed
Trentish opened this issue Jan 27, 2021 · 3 comments
Closed

InvalidMessageException after v62.5.3 (PR 537) #555

Trentish opened this issue Jan 27, 2021 · 3 comments

Comments

@Trentish
Copy link
Contributor

Describe the bug
Using v62.5.3 or later causes InvalidMessageException when client connects. Tested with 2019.4.18f1 LTS, using Basic sample scene.

  • v62.5.2 works
  • v62.5.3 doesn't (tested with v62.9.1 as well)

To Reproduce

  1. In a blank project, follow standard installation: https://github.com/MirrorNG/MirrorNG#installation
  2. Add sample: Basic
  3. Follow Basic setup steps (build example scene)
  4. Play standalone build & editor, using one as host and the other as client (doesn't matter which).
  5. Observe InvalidMessageException on client.

Desktop (please complete the following information):

  • OS: Windows 10
  • Build target: standalone
  • Unity version: 2019.4.18f1 LTS
  • Mirror branch: MirrorNG

Exception

: Closed connection: connection([::1]:7777). Invalid message Mirror.InvalidMessageException: OnDeserialize failed for: object=Player(Clone) component=Mirror.Examples.Basic.Player sceneId=0. Possible Reasons:
  * Do Mirror.Examples.Basic.Player's OnSerialize and OnDeserialize calls write the same amount of data? 
  * Was there an exception in Mirror.Examples.Basic.Player's OnSerialize/OnDeserialize code?
  * Are the server and client the exact same project?
  * Maybe this OnDeserialize call was meant for another GameObject? The sceneIds can easily get out of sync if the Hierarchy was modified only in the client OR the server. Try rebuilding both.


  at Mirror.NetworkIdentity.OnDeserializeSafely (Mirror.NetworkBehaviour comp, Mirror.NetworkReader reader, System.Boolean initialState) [0x00021] in A:\unity_tests\net_test_2019_4_LTS\Library\PackageCache\com.mirrorng.mirrorng@62.0.0\Runtime\NetworkIdentity.cs:898 
  at Mirror.NetworkIdentity.OnDeserializeAllSafely (Mirror.NetworkReader reader, System.Boolean initialState) [0x0002a] in A:\unity_tests\net_test_2019_4_LTS\Library\PackageCache\com.mirrorng.mirrorng@62.0.0\Runtime\NetworkIdentity.cs:915 
  at Mirror.ClientObjectManager.ApplySpawnPayload (Mirror.NetworkIdentity identity, Mirror.SpawnMessage msg) [0x000db] in A:\unity_tests\net_test_2019_4_LTS\Library\PackageCache\com.mirrorng.mirrorng@62.0.0\Runtime\ClientObjectManager.cs:339 
  at Mirror.ClientObjectManager.OnSpawn (Mirror.SpawnMessage msg) [0x00118] in A:\unity_tests\net_test_2019_4_LTS\Library\PackageCache\com.mirrorng.mirrorng@62.0.0\Runtime\ClientObjectManager.cs:374 
  at Mirror.NetworkConnection+<>c__DisplayClass24_0`1[T].<RegisterHandler>b__0 (Mirror.INetworkConnection _, T value) [0x00001] in A:\unity_tests\net_test_2019_4_LTS\Library\PackageCache\com.mirrorng.mirrorng@62.0.0\Runtime\NetworkConnection.cs:152 
  at Mirror.NetworkConnection+<>c__DisplayClass22_0`1[T].<MessageHandler>g__AdapterFunction|0 (Mirror.INetworkConnection conn, Mirror.NetworkReader reader, System.Int32 channelId) [0x00025] in A:\unity_tests\net_test_2019_4_LTS\Library\PackageCache\com.mirrorng.mirrorng@62.0.0\Runtime\NetworkConnection.cs:121 
  at Mirror.NetworkConnection.InvokeHandler (System.Int32 msgType, Mirror.NetworkReader reader, System.Int32 channelId) [0x00014] in A:\unity_tests\net_test_2019_4_LTS\Library\PackageCache\com.mirrorng.mirrorng@62.0.0\Runtime\NetworkConnection.cs:259 
  at Mirror.NetworkConnection.TransportReceive (System.ArraySegment`1[T] buffer, System.Int32 channelId) [0x00011] in A:\unity_tests\net_test_2019_4_LTS\Library\PackageCache\com.mirrorng.mirrorng@62.0.0\Runtime\NetworkConnection.cs:295 
UnityEngine.Logger:LogError(String, Object)
Mirror.ILoggerExtensions:LogError(ILogger, Object) (at Library/PackageCache/com.mirrorng.mirrorng@62.0.0/Runtime/LogFactory.cs:43)
Mirror.NetworkConnection:TransportReceive(ArraySegment`1, Int32) (at Library/PackageCache/com.mirrorng.mirrorng@62.0.0/Runtime/NetworkConnection.cs:303)
Mirror.<ProcessMessagesAsync>d__40:MoveNext() (at Library/PackageCache/com.mirrorng.mirrorng@62.0.0/Runtime/NetworkConnection.cs:352)
Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1:Run() (at Library/PackageCache/com.cysharp.unitask@7d21a75ea8/Runtime/CompilerServices/StateMachineRunner.cs:189)
Cysharp.Threading.Tasks.AwaiterActions:Continuation(Object) (at Library/PackageCache/com.cysharp.unitask@7d21a75ea8/Runtime/UniTask.cs:21)
Cysharp.Threading.Tasks.UniTaskCompletionSourceCore`1:TrySetResult(Int32) (at Library/PackageCache/com.cysharp.unitask@7d21a75ea8/Runtime/UniTaskCompletionSource.cs:139)
Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`2:SetResult(Int32) (at Library/PackageCache/com.cysharp.unitask@7d21a75ea8/Runtime/CompilerServices/StateMachineRunner.cs:328)
Cysharp.Threading.Tasks.CompilerServices.AsyncUniTaskMethodBuilder`1:SetResult(Int32) (at Library/PackageCache/com.cysharp.unitask@7d21a75ea8/Runtime/CompilerServices/AsyncUniTaskMethodBuilder.cs:201)
Mirror.KCP.<ReceiveAsync>d__35:MoveNext() (at Library/PackageCache/com.mirrorng.mirrorng@62.0.0/Runtime/Transport/Kcp/KcpConnection.cs:248)
Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`2:Run() (at Library/PackageCache/com.cysharp.unitask@7d21a75ea8/Runtime/CompilerServices/StateMachineRunner.cs:313)
Cysharp.Threading.Tasks.AwaiterActions:Continuation(Object) (at Library/PackageCache/com.cysharp.unitask@7d21a75ea8/Runtime/UniTask.cs:21)
Cysharp.Threading.Tasks.UniTaskCompletionSourceCore`1:TrySetResult(AsyncUnit) (at Library/PackageCache/com.cysharp.unitask@7d21a75ea8/Runtime/UniTaskCompletionSource.cs:139)
Cysharp.Threading.Tasks.AutoResetUniTaskCompletionSource:TrySetResult() (at Library/PackageCache/com.cysharp.unitask@7d21a75ea8/Runtime/UniTaskCompletionSource.cs:386)
Mirror.KCP.KcpConnection:InputReliable(Byte[], Int32) (at Library/PackageCache/com.mirrorng.mirrorng@62.0.0/Runtime/Transport/Kcp/KcpConnection.cs:161)
Mirror.KCP.KcpConnection:RawInput(Byte[], Int32) (at Library/PackageCache/com.mirrorng.mirrorng@62.0.0/Runtime/Transport/Kcp/KcpConnection.cs:135)
Mirror.KCP.<ReceiveLoop>d__7:MoveNext() (at Library/PackageCache/com.mirrorng.mirrorng@62.0.0/Runtime/Transport/Kcp/KcpClientConnection.cs:51)
Cysharp.Threading.Tasks.CompilerServices.AsyncUniTaskVoid`1:Run() (at Library/PackageCache/com.cysharp.unitask@7d21a75ea8/Runtime/CompilerServices/StateMachineRunner.cs:104)
Cysharp.Threading.Tasks.AwaiterActions:Continuation(Object) (at Library/PackageCache/com.cysharp.unitask@7d21a75ea8/Runtime/UniTask.cs:21)
Cysharp.Threading.Tasks.UniTaskCompletionSourceCore`1:TrySetResult(Object) (at Library/PackageCache/com.cysharp.unitask@7d21a75ea8/Runtime/UniTaskCompletionSource.cs:139)
Cysharp.Threading.Tasks.DelayPromise:MoveNext() (at Library/PackageCache/com.cysharp.unitask@7d21a75ea8/Runtime/UniTask.Delay.cs:520)
Cysharp.Threading.Tasks.Internal.PlayerLoopRunner:RunCore() (at Library/PackageCache/com.cysharp.unitask@7d21a75ea8/Runtime/Internal/PlayerLoopRunner.cs:175)
Cysharp.Threading.Tasks.Internal.PlayerLoopRunner:Update() (at Library/PackageCache/com.cysharp.unitask@7d21a75ea8/Runtime/Internal/PlayerLoopRunner.cs:145)
Cysharp.Threading.Tasks.Internal.PlayerLoopRunner:Run() (at Library/PackageCache/com.cysharp.unitask@7d21a75ea8/Runtime/Internal/PlayerLoopRunner.cs:104)
@Trentish
Copy link
Contributor Author

Might be connected to: #552 (an issue with PR 537)

@paulpach
Copy link
Contributor

Ok, I reverted #537 in 12a1d73
can you check if this is still happening?

@Trentish
Copy link
Contributor Author

Trentish commented Feb 4, 2021

Tested with most recent version (63.3.2) and it's working again, Thank you!

@Trentish Trentish closed this as completed Feb 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants