IL-0444 Repro · 2024-10-23 (published)databaseaws
Reader connections to Repro's Aurora MySQL cluster were cut with Lost connection errors every time ALTER TABLE ran
Every schema change on Repro's Aurora MySQL cluster caused application errors from the time the cluster was on Aurora MySQL 5.7: an ALTER TABLE on the writer cut the reader connections that were reading the altered table, and the clients saw `Lost connection to MySQL server during query`. The development cluster had no reader, so the failure could not be reproduced until one was added. AWS Support explained that this is documented behaviour: DDL on the primary interrupts Aurora Replica connections that are using the changed object.
Repro made the applications retry once after a connection error. For the Rails applications, a monkey patch module ActiveRecord::RetryOnLostConnection prepended to ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter catches ActiveRecord::StatementInvalid whose message includes "Lost connection to MySQL server", logs a warning, reconnects and retries the query one time. It does not retry inside an open transaction, because a retry in a new reader session could return a different result than the earlier reads of the same transaction, and it does not retry on the writer connection. The patch has since been refined by other engineers.
Repro also mentions a separate problem with the same trigger: during an ALTER TABLE, a reader can briefly fail to see the altered table and return "Error 1146: Table '...' doesn't exist". That one is a bug, fixed in Aurora MySQL 3.05.0.
- Severity
- –
- Scope
- Application processes that read a table through an Aurora reader while ALTER TABLE ran on it got connection errors
- Users affected
- –
- Region
- –
- Time to detect
- –
- Time to resolve
- –
Symptoms
After Repro moved to Aurora MySQL 5.7, running an ALTER TABLE in production, even one that finished in under a second, made the processes reading that table fail with `Lost connection to MySQL server during query`. MySQL client connections were cut right after the ALTER TABLE ran, and many application errors followed. By 8 January 2021 this had happened three times in a row.
The failure did not reproduce in the development environment, because the development Aurora MySQL cluster had no reader. After a reader was added there, it reproduced: right after an ALTER TABLE ran on a cluster with a reader, MySQL client connections that were sending SQL referring to the altered table to the reader were closed, with a FIN coming back.
The team first thought this was a bug and sent the reproduction steps to AWS Support. AWS Support pointed to documented Aurora behaviour: DDL statements run on the primary instance can interrupt connections on the Aurora Replicas, and a replica connection that is actively using a table is interrupted when that table is changed by DDL on the primary.
Symptom Connection resetsHigh error rate
Root cause
Root cause Breaking change in an upgrade
- Trigger
- Running ALTER TABLE on the Aurora MySQL writer while readers were running queries that used the same table.
Detection
–
Remediation
- Made the applications retry once after a connection error, with a monkey patch in the Rails applications
Action items
–
Lessons
–
Sources
Related cases
IL-0572About 10 million Pub/Sub messages backed up and Merpay accounting data was not written to Cloud Spanner for over a dayMercari · 2026same root cause · shared Database
IL-0569After an MHA master failover, one of three MySQL replicas failed with a malformed binlog error and could not catch upDeNA · 2026same root cause · shared Database
IL-0304Intercom's US region was fully down for 71 minutes when its Vitess VTGates dropped all routes to the database shardsIntercom · 2026same root cause · shared Database
IL-0316Railway's control plane slowed and deployments stopped after a PgBouncer version jump used abnormal CPU and memoryRailway · 2025same root cause · shared Database
IL-0498Clerk's Postgres database had load spikes every 15 minutes and requests failed and slowed intermittently for four daysClerk · 2025same root cause · shared Database
IL-0117A scheduled maintenance and an ingress upgrade on OpenAI's user-facing clusters caused a networking control plane regression that briefly broke the data plane, and the services that restarted then overwhelmed a backend persistence store with a heavy first-start queryOpenAI · 2024same root cause · shared Database
IL-0314Daily's newly upgraded Aurora MySQL database deadlocked on meeting-event queries and its call servers kept restartingDaily · 2023same root cause · shared Database
IL-0308Most RevenueCat backend systems failed after cutover to a new Aurora PostgreSQL 14 cluster as queries became very slowRevenueCat · 2022same root cause · shared Database
IL-0294CircleCI Docker and machine jobs stalled for nearly 12 hours after a VM cleanup queue lost all its RabbitMQ consumersCircleCI · 2021same root cause · shared Database
IL-0372Heroku apps could not connect to about 1% of hobby-tier Postgres databases after the databases' host names changedHeroku · 2021same 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-0444
- The cases most like it: https://incidentlib-api.benchlet.com/cases/IL-0444/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.