IL-0241 Stripe · 2019-07-10database
A database shard could not elect a new primary, and the Stripe API failed most requests in two periods on one day
Stripe splits data by kind into database clusters and by quantity into shards, and each shard has several redundant nodes. Three months before the incident Stripe upgraded its databases to a new minor version after testing in a quality assurance environment and a phased rollout from less critical to more critical clusters. The version ran well in production, through many successful failovers, but it brought a fault in the database's failover system that showed only when several nodes were stalled. On 10 July one shard was in that state when its primary failed, and the shard could not elect a new primary. The team found that the fastest fix, forcing a new election, required restarting the database cluster; after all nodes were restarted at 17:00 UTC an election succeeded, and the API recovered at 17:02 UTC, 27 minutes after the start.
Looking for the root cause, the team found a code path in the new minor version of the election protocol that was likely behind the fault, and at 20:42 UTC rolled all shards of the cluster back to the previous version of the protocol, which took four minutes. At 21:14 UTC shards became unavailable again. The rolled-back election protocol interacted badly with a configuration setting recently introduced on the production shards, and the result was CPU starvation on every affected shard. Once the CPU starvation was seen, the team found the cause, updated the production configuration and restarted the cluster's nodes by 22:34 UTC, then ramped traffic back up, services needed for user-initiated API requests first, and the API fully recovered at 22:47 UTC.
- Severity
- –
- Scope
- Stripe API: a substantial majority of requests failed from 16:35 to 17:02 UTC and from 21:14 to 22:47 UTC
- Users affected
- Stripe users; those with five or more failed POST requests were sent an email
- Region
- –
- Time to detect
- 1m
- Time to resolve
- 6h 12m
Symptoms
On 10 July 2019 the Stripe API failed a substantial majority of requests twice, from 16:35 to 17:02 UTC and from 21:14 to 22:47 UTC. In the first period automated monitoring detected within a minute that a database cluster had failed to elect a new primary.
The first period began when the primary node of the database cluster failed and one shard could not elect a new primary. Without a primary the shard accepted no writes, and applications that write to it began to time out. Many applications used this shard, the API among them, so the stalled writes starved the API of compute resources. Four days earlier two nodes had stalled for reasons not yet known: they stopped emitting the metrics that report their replication lag but kept answering active health checks as healthy.
At 21:14 UTC automated alerts reported that some shards of the cluster were unavailable, including the shard from the first period, and the database cluster showed high CPU usage. The symptoms looked the same as before, so the team at first assumed the same fault had recurred on several shards and followed the playbook that had worked earlier. The second period had a different cause, and CPU resource contention also slowed the configuration change that ended it.
Symptom High error rateFailover failureWrites rejectedIntermittent timeoutsSustained high node CPU
Root cause
Root cause Software defect
- Trigger
- The primary node of a database cluster failed at 16:35 UTC while one shard had several stalled nodes. The second period was set off by rolling the election protocol back to the previous minor version at 20:42 UTC.
Detection
Automated monitoring detected the failed election within a minute, and the team was alerted at 16:36 UTC. The second period was announced at 21:14 UTC by automated alerts that some shards in the cluster were unavailable.
Remediation
- Restarted all nodes of the database cluster, which forced a successful primary election
- Updated the production configuration and restarted the database cluster's nodes
- Ramped traffic back up, putting services for user-initiated API requests first
Action items
- Alert when nodes stop reporting their replication lag
- Alert when a shard enters a state that could trigger the election fault
- Work with the database maintainers on a fix for the underlying fault
- Add circuit breaking on failed operations to particular database clusters
- Use fault isolation to contain the impact of a single failed shard
- Limit the resources used by clients that keep retrying failed requests
- Add procedures and tooling that make rapid configuration changes during incident response safer
Lessons
–
Sources
Related cases
IL-0310An Aurora PostgreSQL failover to an upsized reader reversed twice and backend writes failed in read-only transactionsHightouch · 2025same root cause · shared Database failover manager, Database
IL-0303GitHub's MySQL master failed over to a node with a cold buffer pool during a schema migration and GitHub.com went downGitHub · 2012same root cause · shared Database failover manager, Database
IL-0451Setting indexes INVISIBLE on Aurora MySQL 3.10 spiked CPU and ReadIOPS on all three readers but not on the writerDaangn · 2026same root cause · shared Database
IL-0313Decagon voice requests stalled for exactly 300 seconds behind self-managed PgBouncer and exhausted the SQLAlchemy poolDecagon · 2026same root cause · shared Database
IL-0281PostHog's Logs ClickHouse cluster silently deleted almost all its S3 data, losing US logs older than 3 daysPostHog · 2026same root cause · shared Database
IL-0150A latent race condition in DynamoDB's DNS automation left an empty DNS record for dynamodb.us-east-1.amazonaws.com, and the DynamoDB and EC2 launch failures that followed caused EKS, ECS and Fargate container launch failures and cluster scaling delays in us-east-1Amazon Web Services · 2025same root cause · shared Database
IL-0436A supremum lock left by ROLLBACK TO SAVEPOINT in a long transaction blocked inserts and filled Aurora MySQL connectionsfreee · 2025same root cause · shared Database
IL-0527OpenStreetMap.org made no replication diffs for 16 hours as PostgreSQL logical decoding failed on a memory alloc errorOpenStreetMap Foundation · 2025same root cause · shared Database
IL-0329A routine migration left PGAudit stuck holding Postgres locks, causing intermittent timeouts and a 2-minute outageincident.io · 2025same root cause · shared Database
IL-0347About 25% of Scaleway FR-PAR-1 hypervisors lost VPC connectivity when both VPC BGP route reflectors got stuckScaleway · 2024same root cause · shared Database
IL-0373Heroku Postgres Essential-tier databases in the EU region ran out of memory and refused connections, twice in four daysHeroku · 2024same root cause · shared Database
IL-0024Expensive cache-backed API calls and uncancelled database requests overloaded MongoDB and took the Hugging Face Hub down three timesHugging Face · 2024same root cause · shared Database
IL-0217Honeycomb's main MySQL database locked up under cache-miss reads and ran out of connections, a 68-minute total outageHoneycomb · 2023same root cause · shared Database
IL-0330Requests timed out for two weeks waiting on Go's database/sql connection pool, one for almost 20 secondsincident.io · 2023same root cause · shared Database
IL-0295Pusher's Channels publish API on the mt1 cluster was largely unavailable for 11 minutes while a Redis master failed overPusher · 2022same root cause · shared Database failover manager
IL-0385GitHub MySQL read replicas hit a semaphore deadlock during a schema migration's table rename and kept crash-recoveringGitHub · 2021same root cause · shared Database
IL-0462Some MySQL pods on Shopify's GKE clusters took up to 30 minutes to start, slowing instance replacementShopify · 2021same root cause · shared Database
IL-0196Adding a second Redis replica and lowering memory limits in one RedisFailover change restarted the only Redis pod that held data, and Sentinel promoted the empty new replica, erasing the dataPalark · 2020same root cause · shared Database
IL-0486Figma's PostgreSQL 9 database on RDS slowed under high write IOPS and lock contention until the site was unavailableFigma · 2020same root cause · shared Database
IL-0439Database access slowed after each block device and filesystem expansion because the Linux kernel dropped the page cacheCybozu · 2018same root cause · shared Database
IL-0388A Google Cloud live migration took a Discord Redis primary offline, and the failover broke API instances and then guildsDiscord · 2017same root cause · shared Database
IL-0454Baemin billing servers could not open new MariaDB connections at the start of a card-discount eventWoowa Brothers · 2016same root cause · shared Database
IL-0536Amazon SimpleDB in US East returned HTTP 500 to nearly all API calls for two hours after its nodes left the clusterAmazon Web Services · 2014same root cause · shared Database
IL-0485Dropbox went down when an OS upgrade script reinstalled active MySQL master-replica pairs and backup restores ran slowDropbox · 2014same root cause · shared Database
IL-0589Every Kickstarter MySQL replica on Amazon RDS stopped replicating on a duplicate-key error in the backings tableKickstarter · 2013same root cause · shared Database
Check your cluster for this
For AI tools and scripts
- This case as JSON: https://incidentlib-api.benchlet.com/cases/IL-0241
- The cases most like it: https://incidentlib-api.benchlet.com/cases/IL-0241/similar
- MCP server (Streamable HTTP, no key):
https://incidentlib-mcp.benchlet.com/mcp
The API needs no key. The MCP server offers search_incidents, get_incident, list_incidents, get_topic and vocab; both are explained on API and MCP.