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

Client Transport Error Timeout: kcp2k.KcpClient: ReceiveNextReliable() msgSize returns -1 #3700

Closed
simoncabansag opened this issue Dec 13, 2023 · 5 comments

Comments

@simoncabansag
Copy link

Client Transport Error: Timeout: kcp2k.KcpClient: Connection timed out after not receiving any message for 10000ms. Disconnecting.. This is fine.

Screenshot 2023-12-13 at 14 35 47

Hi there, been dealing with this for a while now, looked at the stack trace over the mirror code, but still confused, After successfully deploying the build to PlayfabMultiplayer Services build is healthy and remains healthy on that platform. Upon starting the game. I log in with PlayFabClientAPI.LoginWithCustomID which always grants a successful login, (whether or not I do this, the issue persists)
On Playfab if there is no server made under builds, my code sends API request to playfab to create a new server with new SessionID, normally there already is a preexisting server and automatically binds the IP and port but if it already exists then I just copy and paste its IP and port(30000) into the NetworkManagerHUD, after clicking 'Client' button with the details on the network manager HUD, the console verbose appears (shown above) with the error everytime after "KcpClient send[s] handshake to other end"

I have looked at the mirror code and the bool statement ReceiveNextReliable that sends the KcpHeader.Hello back is never entered in this on line 290 of KcpPeer "msgSize" returns -1 which always returns false which means that instead of code going inside bool statement calls HandleTimeout instead

Screenshot 2023-12-13 at 15 39 39

Expected Behaviour
Screenshot 2023-12-13 at 15 14 28
KcpClient not meant to timeout and KcPeer meant to receive handshake on line KcpPeer line 343, and then call OnClientConnected in my clientstartup code that calls Connect()

Darwin MacBook-Pro.local 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:39:46 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6020 arm64
Target Platform: MacOS, ------- but also tried with Dedicated Server Linux also but did not work
Architecture: Intel 64-bit + Apple Silicon
Unity Version: Unity 2022.3.11f1
Mirror branch: from asset store, 86.13.0,

@simoncabansag simoncabansag changed the title Client Transport Error Timeout: kcp2k.KcpClient: Connection timed out after not receiving any message for 10000ms. Client Transport Error Timeout: kcp2k.KcpClient: ReceiveNextReiable() msgSize returns -1 Dec 13, 2023
@simoncabansag simoncabansag changed the title Client Transport Error Timeout: kcp2k.KcpClient: ReceiveNextReiable() msgSize returns -1 Client Transport Error Timeout: kcp2k.KcpClient: ReceiveNextReliable() msgSize returns -1 Dec 13, 2023
@MrGadget1024
Copy link
Collaborator

Can you reproduce this with any of the examples that ship with Mirror, e.g. the Basic example?

@simoncabansag
Copy link
Author

Can you reproduce this with any of the examples that ship with Mirror, e.g. the Basic example?

Can you please link the Basic Example, I will reproduce it on there

@MrGadget1024
Copy link
Collaborator

Can you please link the Basic Example, I will reproduce it on there

It's included in Mirror...Examples / Basic folder.

@simoncabansag
Copy link
Author

I've reproduced the error on the Mirro Basic example you mentioned, it resulted in the same, one thing that I forgot to say was that I'm using PlayFabSDK, GSDK, this server I deployed is built with PlayFabMultiplayerServer in mind, and Mirror is trying to communicate to that server without any luck, so it could be on their end,
Originally I have been following this person's tutorial https://www.youtube.com/watch?v=YTNdsvTBEcA&t=806s, but of course it is outdated

@simoncabansag
Copy link
Author

Hey, I've fixed it now already thank you so much for your assistance was from debugging and using the LocalMultiplayerAgent that I found the error, this was the server output

2023-12-15 19:42:40 KcpServer: already started!
2023-12-15 19:42:40 NetworkServer.RegisterHandler replacing handler for Mirror.ReadyMessage, id=40252. If replacement is intentional, use ReplaceHandler instead to avoid this warning.
2023-12-15 19:42:40 NetworkServer.RegisterHandler replacing handler for Mirror.CommandMessage, id=46228. If replacement is intentional, use ReplaceHandler instead to avoid this warning.
2023-12-15 19:42:40 NetworkServer.RegisterHandler replacing handler for Mirror.NetworkPingMessage, id=33151. If replacement is intentional, use ReplaceHandler instead to avoid this warning.
2023-12-15 19:42:40 NetworkServer.RegisterHandler replacing handler for Mirror.NetworkPongMessage, id=10297. If replacement is intentional, use ReplaceHandler instead to avoid this warning.
2023-12-15 19:42:40 NetworkServer.RegisterHandler replacing handler for Mirror.EntityStateMessage, id=1041. If replacement is intentional, use ReplaceHandler instead to avoid this warning.
2023-12-15 19:42:40 NetworkServer.RegisterHandler replacing handler for Mirror.TimeSnapshotMessage, id=53182. If replacement is intentional, use ReplaceHandler instead to avoid this warning.

from this I found this help post where I found the solution, https://community.playfab.com/questions/60882/bug-in-localmultiplayeragent.html

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