From 7830b78096def05609902e83d0d4326e9bff3026 Mon Sep 17 00:00:00 2001 From: MonoFinity Date: Mon, 27 Jul 2026 03:18:06 -0700 Subject: [PATCH] Bound the TCP client's connect timeout instead of int.MaxValue TCPCommunicationLayer.CreateClient() passed int.MaxValue as VoltRpc's connectionTimeout, i.e. roughly 24 days of retrying. Against an engine process that is already gone the connect loop therefore never terminates, and because a Unity domain reload has to tear the client down, the reload blocks on it - the Editor hangs on "Reloading Domain (busy for HH:MM)" indefinitely instead of reporting a failed connection. Make it a serialized field defaulting to 30000 ms, so a dead engine surfaces as a connection failure and a domain reload can always complete. The range is 1000-600000 ms for anyone who needs a longer wait on a slow cold start. CreateHost() is left alone: it is the listening side rather than a retry loop, and has not been observed blocking a reload. Co-Authored-By: Claude Opus 5 --- .../Communication/TCPCommunicationLayer.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Packages/UnityWebBrowser/Runtime/Communication/TCPCommunicationLayer.cs b/src/Packages/UnityWebBrowser/Runtime/Communication/TCPCommunicationLayer.cs index a36eb695..2e234589 100644 --- a/src/Packages/UnityWebBrowser/Runtime/Communication/TCPCommunicationLayer.cs +++ b/src/Packages/UnityWebBrowser/Runtime/Communication/TCPCommunicationLayer.cs @@ -28,10 +28,23 @@ public sealed class TCPCommunicationLayer : CommunicationLayer [Range(1024, 65353)] [Tooltip("The out port to communicate on")] public int outPort = 5556; + /// + /// How long the client keeps trying to reach the engine before giving up, in milliseconds + /// + /// + /// This was previously hardcoded to , i.e. roughly 24 days of + /// retrying. If the engine process is already gone the connect loop therefore never + /// terminates, and because a Unity domain reload has to tear the client down, the reload + /// blocks on it - the editor hangs on "Reloading Domain (busy for ...)" indefinitely + /// rather than reporting a failed connection. + /// + [Range(1000, 600000)] [Tooltip("Give up connecting to the engine after this long (ms)")] + public int connectionTimeout = 30000; + public override Client CreateClient() { IPEndPoint ipEndPoint = new(IPAddress.Loopback, inPort); - return new TCPClient(ipEndPoint, int.MaxValue); + return new TCPClient(ipEndPoint, connectionTimeout); } public override Host CreateHost()