Incident Library

IL-0385 GitHub · 2021-11-27database

GitHub MySQL read replicas hit a semaphore deadlock during a schema migration's table rename and kept crash-recovering

GitHub's MySQL clusters have a primary node for writes, several read replicas for production traffic, and several replicas that serve internal reads for backups and analytics. During the final rename step of a schema migration on a large table, a significant portion of the read replicas entered a semaphore deadlock, a failure mode GitHub had not seen before. Those replicas went into crash recovery, the remaining replicas took their load, and the cascade left too few active read replicas for production requests, which degraded core GitHub services for 2 hours and 50 minutes.

To add capacity, the team moved every healthy internal replica into the production path, but that was not enough. Replicas serving production traffic kept recovering and crashing again under load, so the team chose data integrity over availability and took production traffic off the broken replicas until each one had processed the table rename. Once the replicas recovered they were put back into production and capacity returned to normal. Writes stayed healthy and GitHub verified that no data was corrupted. GitHub paused schema migrations while it investigated the failure.

Severity
–
Scope
Core GitHub services were degraded: GitHub Actions, API Requests, Codespaces, Git Operations, Issues, GitHub Packages, GitHub Pages, Pull Requests and Webhooks; write operations stayed healthy
Users affected
–
Region
–
Time to detect
–
Time to resolve
2h 50m

Symptoms

On 27 November 2021 at 20:40 UTC, a significant part of GitHub's MySQL read replicas entered a semaphore deadlock while a schema migration on a large MySQL table ran its final step, the rename that moves the updated table into place. Core GitHub services, including GitHub Actions, API Requests, Codespaces, Git Operations, Issues, GitHub Packages, GitHub Pages, Pull Requests and Webhooks, became degraded.

The replicas that hit the deadlock went into crash recovery, which put more load on the healthy read replicas. Too few read replicas were left active to handle production requests. Replicas serving production traffic recovered from crash recovery for a while and then crashed again under the load. Write operations stayed healthy throughout.

Symptom Lock contention or deadlockDatabase overload

Root cause

Trigger
The final rename step of a schema migration on a large MySQL table. Schema migrations are a common task at GitHub and often take weeks to complete.

Detection

–

Remediation

Action items

Lessons

–

Sources

Related cases

Check your cluster for this

kubegap audits a Kubernetes cluster for conditions like the ones in this case, Database, Schema migration among them, read-only, from Claude Code or Codex. Its checks cite public reports like this one.

For AI tools and scripts

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.