#1954

[Bug]: Control-plane dashboard intermittently returns edge 502 with upstream resets (self-hosted Compose, v1.0.2)

OpenMahmoudHousamopened 2d ago

Existing issue

  • I have searched the existing issues and found no duplicate.

Problem description

On a self-hosted OpenShip 1.0.2 installed with openship up --compose, the control-plane dashboard hostname intermittently returns the edge’s “Application unavailable” 502 page during normal navigation.

The dashboard container stays healthy and serves requests directly on 127.0.0.1:3001, but the edge reports upstream connection resets:

recv() failed (104: Connection reset by peer) while reading response header from upstream
upstream prematurely closed connection while reading response header from upstream

Restarting only openship-dashboard-1 restores the panel. Deployed applications are unaffected; this is the management UI only.

ENvironment OpenShip | 1.0.2 (latest at time of writing) Install mode | openship up --compose Edge image | ghcr.io/oblien/openship-edge:1.0.2 Dashboard image | ghcr.io/oblien/openship-dashboard:1.0.2 API image | ghcr.io/oblien/openship-api:1.0.2 OS | Ubuntu 24.04.4 LTS Docker | 29.5.1 Docker Compose | v5.1.3 Host | 8 GB RAM / 4 vCPU Edge | OpenResty 1.27.1.1 Panel DNS | DNS-only, direct to the edge, Let’s Encrypt certificate

Steps to reproduce

  • Open https://panel.example.com/ and log in.
  • Navigate between project pages: overview, backups, audit, settings, servers.
  • After some navigation, an edge 502 page appears:
Temporarily unavailable
Application unavailable
The application at this address is not responding.
It may be starting up or restarting. Please try again in a moment.
Served by Openship
  • Reloading may work, then fail again later.

It also reproduces under concurrent requests to /login

seq 1 100 \
  | xargs -P 20 -I{} curl -sS -o /dev/null -w "%{http_code}\n" \
      https://panel.example.com/login \
  | sort | uniq -c

Example result

51 200
49 502

50 concurrent requests often pass (50 × 200), so the failure looks threshold/concurrency-related.

Evidence The dashboard is healthy and has resources

openship-dashboard-1   Up 17 hours (healthy)
restarts=0
health=healthy
memory=141.6 MiB / 7.755 GiB
VPS free memory=5.2 GiB
OOM killer events=none

Direct upstream works, edge returns 502

curl http://127.0.0.1:3001/login        → 200
curl https://panel.example.com/login    → 502

Edge logs

[error] recv() failed (104: Connection reset by peer) while reading response header from upstream,
client: 203.0.113.10,
server: panel.example.com,
request: "GET /login HTTP/1.1",
upstream: "http://127.0.0.1:3001/login"
[error] upstream prematurely closed connection while reading response header from upstream,
client: 203.0.113.10,
server: panel.example.com,
request: "GET /login HTTP/1.1",
upstream: "http://127.0.0.1:3001/login"

These occur during normal dashboard navigation, including paths like:

/api/proxy/api/projects/.../connections
/api/proxy/api/projects/.../commit-status
/backups?_rsc=...
/settings
/audit?_rsc=...
/site.webmanifest
/icons/...

Generated edge vhost The generated panel vhost contains:

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

The Connection "upgrade" header appears to be emitted for every request, not only WebSocket requests. The generator is:

packages/adapters/src/infra/nginx.ts:171

I also tested replacing it with Connection "close" in the generated vhost and reloading the edge; this did not resolve the resets and was reverted.

Dashboard logs The dashboard logs also show repeated Next.js server-action errors:

Error: The Server Reference ID did not match the expected format. Received "x".
Read more: https://nextjs.org/docs/messages/failed-to-find-server-action

I am not sure whether these are a cause or a symptom, but they appear alongside the failures.

Restarting the dashboard restores the panel

docker restart openship-dashboard-1
# panel.example.com/login → 200

No application container, database, or Cloudflare change is involved.

Why the existing healthcheck does not catch it The dashboard healthcheck in the generated Compose stack checks /, not /login:

fetch('http://127.0.0.1:' + PORT + '/', { redirect: 'manual' })

/ can still return a redirect while /login is resetting, so Docker continues to report healthy.

Expected behavior

  • Normal dashboard navigation should not return edge 502s from a healthy dashboard container.
  • The edge should handle a dashboard connection reset without failing the page, or the dashboard should not reset those connections.
  • The dashboard healthcheck should detect the unusable state.

Possible areas to investigate

  • Unconditional Connection "upgrade" on non-WebSocket requests, or missing upstream keepalive/retry handling.
  • Next.js server-action errors causing the dashboard listener to close some connections.
  • Dashboard healthcheck should probe /login or another endpoint that reflects real usability.
  • Whether this is reproducible under concurrent RSC/server-action requests.

Workaround When the panel shows “Application unavailable”:

docker restart openship-dashboard-1

A more durable mitigation is to monitor https://panel.example.com/login and restart the dashboard when it stops returning 200.

I can provide the full docker inspect, generated vhost, and a larger log excerpt if useful.

Environment

  • OpenShip version/commit:
  • Deployment method:
  • Operating system:
  • Browser (if applicable):

Logs and screenshots

undefined

Additional context

No response

Activity

0

No activity yet.