[Bug] /api/issues and /api/issues/summary hang indefinitely on self-hosted (open-branch aggregation never settles; resolved/health fine)
Environment
- Self-hosted Openship 0.7.2 (compose install, ghcr images) — also reproduced on 0.6.9
- Ubuntu 24.04, 2 vCPU/2GB, Docker 29.x, single org, 2 servers (local + 1 remote), 2 projects (compose), 10 services
- Dashboard: https://openship.dev.arsana.cloud, API on loopback (127.0.0.1:4001), edge on 80/443
Symptoms
GET /api/issues and GET /api/issues/summary hang indefinitely (300s+ tested, no response, HTTP client timeout kills it). The dashboard's Overview panel polls /api/issues/summary, so users get repeated "Request timed out" toasts on every poll.
What works fine (same auth, same PAT)
GET /api/issues?status=resolved— fast (~200ms, early-return branch)GET /api/issues/health— fast (31ms, 4 DB transactions)GET /api/updates?behind=1— fastPOST /api/issues/rescan {healthOnly:true}andGET /api/issues/rescan/status— fast- auth/session, projects, deployments — all fast
Diagnostics
- Bisect: hang is in the open-branch of
listOrganizationIssues()(aftercanSeeInfra, which is fast via the resolved branch; before/in the 8-memberPromise.allor the post-await loops). - During a hang,
pg_stat_activityshows no long-running query and no lock waits (only completed/idle connections checked out by the handler; waves of queries complete, e.g. servers/service_incidents/deployments/update_status lookups, then the response still never arrives). - ~310
xact_commitover a 300s hanging request (~1 query/sec — the handler keeps issuing work but never finishes; for comparison/api/issues/health= 4 transactions total). - Not CPU-bound (api container ~0.4%), not memory/swap bound (no si/so), not Postgres
max_connections(100 vs ~10 used). - API container restart does not fix it; happens on 0.6.9 and 0.7.2 → deterministic, not a poisoned-state artifact.
- Container egress to api.github.com works (200, ~100ms) — not an external-fetch hang.
- The API container keeps an idle ESTABLISHED SSH connection to the docker-gateway host IP (
172.17.0.1:22, keyopenship_host_key, user ubuntu@notty) with no child process — possibly related to how "This Server" ops are transported;server_unreachableincidents ("no answer from the docker daemon within 90s") for both servers recur in history, so slow/timeout-prone server execs are in the picture, but the issues endpoints hang far longer than 90s.
Reproduction
# with a PAT or session on a self-hosted instance:
curl -m 60 -H "Authorization: Bearer $PAT" http://127.0.0.1:4001/api/issues/summary # never responds
curl -m 20 -H "Authorization: Bearer $PAT" http://127.0.0.1:4001/api/issues # never responds
curl -m 20 -H "Authorization: Bearer $PAT" http://127.0.0.1:4001/api/issues?status=resolved # responds fineSuspected area
packages/platform/src/engine/modules/issues/issues.service.ts — open-branch of listOrganizationIssues(). All 8 Promise.all members either resolve via DB (repos) or are withTimeout-wrapped, yet the aggregate never settles in our environment; the per-row visible()/visibleIncident() permission checks (DB) also complete. An await in this path appears to never settle for PAT-authenticated org context — possibly checkPermissionOnResource/grant-source resolution on the tokenScope path, or an un-bounded await in getOrgPendingActions/loadOrgContainerIssues downstream behavior.
Impact
Dashboard Overview panel + issues list become unusable with recurring timeout toasts on self-hosted installs; all other monitoring surfaces (rescan pipeline, updates, health-watch) work.
Happy to provide more traces (bun inspect is not available on the prod image, but I can strace/annotate on request).
Source: oblien/openship