Fix duplicate HTTP transport start on active Funplay server#7
Conversation
b49dca0 to
08cbdc4
Compare
08cbdc4 to
814ff47
Compare
|
Thanks for the follow-up and the Windows/Unity 6 verification. The direction is useful: detecting an already-running Funplay endpoint and making attached I do not want to merge this draft as-is yet, mainly because the attach criteria and lifecycle semantics need to be stricter:
The test you added is valuable, but before merging I would like it to cover these cases too:
So I would keep this PR draft for now. We can either iterate here, or I can absorb the idea into a follow-up implementation that adds project identity to |
|
Closing this draft as superseded by upstream v0.3.7. The release implements the safer project-identity attach path requested in review and passed the live Second Spawn verification on my side: initialize returns version 0.3.7 with projectIdentity, tools/list responds, request_recompile reports no compilation errors, and the listener remains healthy after a forced compile check. Thanks for the quick follow-up fix. |
|
Thanks for verifying v0.3.7 on your side and for closing the draft. Your repro and PR were very helpful for shaping the safer project-identity attach path. Appreciate the quick follow-up testing. |
Summary
initializeprobe afterHttpListenerreports address-in-use.serverInfo.namematches the current Unity project, so unrelated listeners still fail normally.MCPServerServiceinto the transport, avoiding Unity API calls from background transport code.Root cause
MCPServerService.StartAsyncis idempotent for one service instance, butHttpMCPTransport.StartAsyncstill treated any address-in-use result as an external conflict. When Unity ended up with an already-running Funplay listener in the same project/process and another start path created a fresh transport, the second start retried for 10 seconds and then logged a fatal startup failure even though the configured endpoint was already usable.Verification
git diff --check: passed.PASS: duplicate start attached in 58 ms and attached stop left listener alive.D:\Projects\Second-Spawn\Unityon Unity 6.5 beta6000.5.0b8with package-cache test patch:started=True isRunning=True port=8766.initializeprobe after restart: HTTP 200,serverInfo.name = Funplay MCP Server - Second Spawn.HttpMCPTransportinside Unity on port8766:duplicateStarted=True; elapsedMs=114; port=8766.initializeprobe after stopping the duplicate transport: HTTP 200, confirming attachedStop()did not close the owning service.The "path" argument must be of type string. Received undefined.Merge status
Keeping this PR draft until a maintainer or CI can run the formal Unity EditMode test assembly, but the live Second Spawn integration repro now passes.