TCP Proxy dropping PostgreSQL connections since Jul 18 ~04:00 UTC — server closed the connection unexpectedly
leoparipiranga
PROOP

a month ago

We've been running a production Django app on Railway since February 2026 — same setup, zero config changes — and starting July 18 at ~04:00 UTC, our external PostgreSQL connections through the TCP Proxy began failing with server closed the connection unexpectedly. Internal connections (web service → PostgreSQL) are unaffected.

Symptoms:

psycopg2.OperationalError: server closed the connection unexpectedly on external connections via the public TCP proxy

Sometimes the first query succeeds; subsequent queries fail after 10–60 seconds

ECONNREFUSED occurs intermittently

PostgreSQL itself is healthy (0% CPU/memory pressure, 5/100 connections, all timeouts at default)

What we tried:

Recreated the TCP Proxy (changed from tramway.proxy.rlwy.net to tokaido.proxy.rlwy.net) — problem persists

CONN_MAX_AGE=0 (no Django connection pool) — helps but still fails

TCP keepalives (keepalives_idle=1) — no improvement

Explicit connection.close() before each database operation — most reliable, but failures still occur mid-query

Retry wrapper (close broken connection, open fresh one, retry up to 3×) — mitigates but doesn't eliminate

Region: us-east4

This aligns with other reports today about PgBouncer and TCP Proxy degradation in us-east4. Would appreciate a root cause analysis and ETA.

$20 Bounty

3 Replies

Railway
BOT

a month ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway about 1 month ago


d-y-church
PRO

a month ago

Same here. Just started happening: CONNECTION_CLOSED switchyard.proxy.rlwy.net - tried updating my connection pool but no change. In an SPA, it is quite visible. We've been running railway for almost 6 months with no issues until just a couple days ago with no server configuration changes whatsoever.


kapiushon8
HOBBY

a month ago

+1 i'm hoping someone on the railway team is working on a fix lol


leoparipiranga
PROOP

a month ago

I had to creat a supabase pro account, because it was impossible to update the data as before and I can't stop the service.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...