Fix HTTP transport recovery after domain reload#8
Closed
JOY wants to merge 1 commit into
Closed
Conversation
bcc9846 to
53b9ac7
Compare
Author
|
Additional live verification from the Second Spawn Unity project:
This is the same project that previously reproduced the v0.3.7 failure with |
Member
|
Thanks for the fix and the extra Windows/Unity 6000.5 beta validation. I incorporated the TCP-listener based recovery approach into Local validation before release included:
Closing this PR as shipped. Thank you again for the patch and for confirming the original Windows failure case stayed connected overnight. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HttpListenerwith a loopbackTcpListenerthat serves the same JSON-RPC-over-HTTP surface on127.0.0.1.Root Cause
Live Unity verification on Second Spawn with v0.3.7 still produced a stopped Funplay UI while the Unity process owned port 8766. CoplayDev MCP console output showed the current failure path:
Port 8766 is temporarily in use; retrying for up to 10 seconds.Failed to start HTTP transport: Only one usage of each socket address (protocol/network address/port) is normally permitted.Failed to start transportAt the same time, Windows showed Unity listening on both
127.0.0.1:8766and[::1]:8766, but direct HTTP probes tohttp://127.0.0.1:8766/were actively refused. That means the remaining failure is not a healthy duplicate Funplay server that can be attached to; it is a staleHttpListener/HTTP.sys binding inside the Unity process after script compilation/domain reload. The previous attach-probe approach cannot recover this state because there is no live handler behind the occupied port.The conservative fix is to stop depending on
HttpListenerfor the Unity editor transport. The package already advertises and configureshttp://127.0.0.1:<port>/, so a process-owned loopback TCP listener is enough and avoids the dual localhost HTTP.sys prefix behavior seen in the repro.Verification
git diff --check: passed. Windows reported only expected CRLF normalization warnings.dotnet run --project D:\Projects\funplay-unity-mcp-transport-harness\FunplayTransportHarness.csproj: passed.dotnet run --project D:\Projects\funplay-unity-mcp-lifecycle-harness\FunplayLifecycleHarness.csproj: passed.D:\Projects\Second-Spawn\Unityconfirmed the active v0.3.7 failure before this change: Unity idle, no compilation in progress, Funplay stopped, port still owned by Unity, and Funplay retrying/failing on address-in-use.Notes
Formal Unity EditMode batch tests were still not runnable in this local setup because package tests are not exposed through the current project Test Runner configuration, and previous disposable-project attempts failed during UPM resolution before test import. The included editor tests document the intended behavior for maintainers/CI.