Frun1na opened a new pull request, #4649:
URL: https://github.com/apache/rocketmq-dashboard/pull/4649

   ### Which Issue(s) This PR Fixes
   
   - Fixes #<BACKFILL>
   
   ### Brief Description
   
   MCP hosts commonly stop stdio servers with SIGTERM, but `App.Execute` only 
caught
   `os.Interrupt` in its `signal.NotifyContext`. SIGTERM therefore kept its 
default kill
   disposition: the process terminated immediately and the stdio proxy's 
deferred
   `MCPClientSession.Close()` — the `DELETE /api/mcp` session-management call — 
never ran, so the
   server-side session stayed registered until it expired on its own.
   
   The fix catches SIGTERM alongside `os.Interrupt` (extracted into a small 
`signalContext`
   helper), so the proxy exits through the same graceful path as Ctrl-C and 
releases the session.
   Stdin-close shutdown already worked and is unchanged.
   
   ### How Did You Test This Change?
   
   ```
   $ cd rmqctl && go vet ./cmd/ && go test ./...
   # all packages pass, including the new test
   ```
   
   New test `TestSignalContextCancelsOnSigterm` (skipped on Windows): registers 
the command
   context, sends SIGTERM to its own process, and asserts the context is 
cancelled — the exact
   condition `runStdioProxy` needs to run its deferred `session.Close()`. On 
the pre-fix code
   this fails (context never cancelled; the process would have died instead).
   
   - [x] I have added tests for my changes
   - [x] I have run the existing tests and they pass
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to