Title: mcpx: orphan-session DELETEs from #267 run synchronously on the takeover path, delaying daemon start up to 5s per removed server · Issue #291 · developing-today/code · GitHub
Open Graph Title: mcpx: orphan-session DELETEs from #267 run synchronously on the takeover path, delaying daemon start up to 5s per removed server · Issue #291 · developing-today/code
X Title: mcpx: orphan-session DELETEs from #267 run synchronously on the takeover path, delaying daemon start up to 5s per removed server · Issue #291 · developing-today/code
Description: Finding (from PR diff review of #267) PR #267 ends a removed server's orphaned upstream session with a synchronous HTTP DELETE during takeover — on the critical path, before the successor daemon starts serving. Evidence (verified on curr...
Open Graph Description: Finding (from PR diff review of #267) PR #267 ends a removed server's orphaned upstream session with a synchronous HTTP DELETE during takeover — on the critical path, before the successor daemon st...
X Description: Finding (from PR diff review of #267) PR #267 ends a removed server's orphaned upstream session with a synchronous HTTP DELETE during takeover — on the critical path, before the successor daemo...
Opengraph URL: https://github.com/developing-today/code/issues/291
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"mcpx: orphan-session DELETEs from #267 run synchronously on the takeover path, delaying daemon start up to 5s per removed server","articleBody":"## Finding (from PR diff review of #267)\n\nPR #267 ends a removed server's orphaned upstream session with a synchronous HTTP `DELETE` during takeover — on the critical path, before the successor daemon starts serving.\n\n## Evidence (verified on current main `60f7a634`)\n\n- `pkgs/mcpx/internal/daemon/registry_handoff.go`, `Adoption.Attach()`: loops over `a.orphanSessions` and calls `pool.TerminateOrphanedSession(s.server, s.h)` synchronously, in series.\n- `pkgs/mcpx/internal/daemon/takeover.go` (~line 664): `ad.Attach()` is called *before* `s.startHTTP()` — so every orphan DELETE delays the successor daemon accepting/serving connections.\n- `pool.TerminateOrphanedSession` → `mcpclient.TerminateHTTPSession` → `HTTPTransport.closeSession` (`pkgs/mcpx/internal/mcpclient/http.go`): the DELETE is bounded by `defaults.UpstreamSessionDeleteTimeout` = **5s** (`pkgs/mcpx/internal/defaults/defaults.json`: `upstream.sessionDeleteTimeout: \"5s\"`).\n- Worst case is therefore ~5s **per orphaned session**, in series: removing several servers from the configuration at once, where an upstream is unreachable in the worst way (packets dropped, not refused — a refused connection fails fast, a blackholed one burns the full timeout), delays the takeover by N × 5s. The case that costs the most is exactly the case where the DELETE can never succeed — cleanup for a dead server blocks the live daemon.\n- Termination is explicitly best-effort in the PR's design: failure is already handled by logging `upstream.session.orphaned` and leaving the session to expire upstream. Nothing about correctness requires it to complete before the daemon serves — only the abort path requires that *no* DELETE is sent before commit, which moving the sends to after commit/start preserves.\n\n## Why it matters\n\nA takeover is a daemon upgrade/restart: the window where the daemon is not yet serving is user-visible downtime for every connected client. Best-effort cleanup of sessions for servers that no longer exist should never extend that window, least of all when the upstream is dead.\n\n## Acceptance criteria\n\n- [ ] Orphan-session termination no longer blocks the takeover's serving path: e.g. the DELETEs run after `startHTTP()` (still strictly after handoff commit), or concurrently under one bounded overall budget.\n- [ ] The abort path still sends no DELETE and the predecessor keeps its sessions (existing `TestAbortedTakeoverLeavesARemovedServersSessionAlone` passes).\n- [ ] Exactly one DELETE per orphaned session is still sent after a committed takeover, and `upstream.session.terminated` / `upstream.session.orphaned` lifecycle events are still emitted (existing takeover/orphan tests pass, adapted for any async completion).\n- [ ] A test or benchmark demonstrates a takeover with an unreachable orphan upstream completes serving without waiting out the per-session DELETE timeout.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-18T14:27:01Z","url":"https://github.com/developing-today/code/issues/291"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1d9f3cd8-d55c-cd7e-43ec-8bc8fc8367ef |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BC24:1E80BA:A00CB4:D73BE4:6B0641AA |
| html-safe-nonce | a2fb35932686a23b3539998c755b5beebc4aa6fcf4719f5c975fad3ee6248d3b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQzI0OjFFODBCQTpBMDBDQjQ6RDczQkU0OjZCMDY0MUFBIiwidmlzaXRvcl9pZCI6Ijc2ODI1MDkwMzQ2NjY0NzU5NDYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b5d868882cb599734585cd369fd830077d95453c0109acb7a4f9076cf797efea |
| hovercard-subject-tag | issue:5910533958 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/291/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d510bc871cb33d28d07fc9e0d2d5ac40dd25d86e7b8f09b9de6d4bbe30619e4b/developing-today/code/issues/291 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d510bc871cb33d28d07fc9e0d2d5ac40dd25d86e7b8f09b9de6d4bbe30619e4b/developing-today/code/issues/291 |
| og:image:alt | Finding (from PR diff review of #267) PR #267 ends a removed server's orphaned upstream session with a synchronous HTTP DELETE during takeover — on the critical path, before the successor daemon st... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1bff4f6bfaa96dc9c42cacf315424c24ebb548b06142ced5e3aaccb2a42dd652 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ac613d3698d3d8565651455086e1f74da07bf277 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width