Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Slack Engineering 7 min read Incident mediumAdept

We’re All Just Looking for Connection

Spikes of EOFError on SQL queries in Quip's Python backend (which also powers Slack canvas) traced back to connection-state checks that only tracked closes initiated by the application. AWS's database proxy began closing connections after 24 hours, and because asyncio's StreamWriter.is_closing() doesn't reflect a peer-initiated FIN (a socket in CLOSE_WAIT can still be read), the code never reconnected before issuing queries. Instrumenting the drift between the connected flag and the actual closed state surfaced six more bugs, including websocket false negatives, stale HTTP pool clients and missed Redis cleanup. Fixing them nearly eliminated the errors and unblocked a stalled migration from a custom runtime to asyncio, where an overloaded RPC peer closing pooled connections had caused hanging PDF exports.

Related posts

  • Battling database performance

    incident.io mediumAdept

    Intermittent API timeouts at incident.io over two weeks traced back to requests blocking on Go's database/sql client-side connection pool, with no single slow query or pool to blame. The team shipped 24 changes along the way. These included materialised views, new indexes, query rewrites, a one-second lock timeout on transactions, and moving Slack webhook handling onto PubSub. They also built per-operation tracking of connection-hold time using an ngrok/sqlmw middleware and context counters that avoid double-counting inside transactions. The root cause turned out to be an unnecessary transaction wrapped around every Slack modal submission. Many short transactions added together had exhausted the pools, and removing it ended the timeouts.

  • parking_lot: ffffffffffffffff...

    Fly.io hardMaster

    Fly.io's Rust Anycast router, fly-proxy, kept deadlocking after Catalog state was moved to lazy loading. The cause was traced to parking_lot RwLock words being set to 0xFFFFFFFFFFFFFFFF. The hunt ran from a known if-let lock-lifetime footgun through closure-scoped lock refactors with timeouts and telemetry, parking_lot's deadlock detector, gdb core-dump inspection, read_recursive experiments and miri. Core dumps showed threads waiting on a lock nobody held, and logging the raw lock word revealed every bit set, including the unused UPGRADEABLE flag. The post also covers Corrosion, Fly.io's CRDT-structured SQLite replicated over SWIM gossip, and the watchdog that bounces stuck proxies to keep deadlocks survivable.

  • Incident Report: April 23rd, 2025

    Railway mediumAdept

    A Google Cloud SQL maintenance window took Railway's networking control plane Postgres read replica offline for about 10 minutes, destabilizing edge, private networking and TCP proxy traffic across all regions, worst in Asia. Control plane instances crashed on database connection errors because of improper error handling, and each restart evicted the in-memory routing cache, which could not be refetched while Postgres was down. Slow cache warming delayed recovery until 09:28 UTC. Planned fixes include regional control planes to limit blast radius, graceful handling of DB errors, a persistent routing cache as a fallback, faster startup, and Cloud SQL maintenance settings that keep primary and replica from being maintained at the same time.

  • Data needs its DevOps moment

    Render mediumAdept

    Data pipelines should be treated like any other production service: defined as code in the producing team's repo, with portable SQL logic tested in CI, and run 24x7 against SLOs for lag, freshness and completeness. A SQLFlow pipeline on Render shows the idea. It aggregates the Bluesky Jetstream firehose into one-minute tumbling windows per language before storing anything, which reduced 15 million posts to 6,577 Postgres rows and runs in a 512 MB instance. Render's default memory charts exposed two leaks that tests missed. DuckDB never freed deleted rows from indexed tables after a checkpoint, and the DuckDB Postgres extension copied key columns on every upsert. Fixing these led to a native pgx sink and a 30-minute soak test before each release.

  • Incident Report: June 6th, 2025

    Railway mediumAdept

    Database connection pressure at Railway tripped backend circuit breakers, which set off aggressive websocket reconnects from every connected client at once. Websocket handshakes sat outside the WAF policy, and a vendor contract change had removed permission to edit WAF rules, so the reconnect flood bypassed rate limiting. Timed-out clients fell back to the login page, which cleared sessions and sent enough traffic to GitHub OAuth to trigger a secondary rate limit, leaving users unable to log in for several hours. Fixes include client reconnect backoff, OAuth login rate-limit queues, websocket-aware rate-limiting rules, moving real-time reads to a read replica, WAF rules API testing, and showing login buttons only when the backend is ready.

The quest for software engineering knowledge.

Look:
Layout: