Data Loss: a sad tale with a happy ending
Replit silently lost or corrupted user repl data for months. The root cause was a combination of three things: Go's exec.Cmd connecting stdin/stdout directly to child processes, a filesystem snapshot tool that ignored rare failures in its final write(2)/splice(2) calls under heavy load, and low disk space. Together these truncated snapshot streams without raising any error. The team reverted the triggering deploy, added monitoring at suspected loss points, salvaged corrupt data on load, validated snapshot output before persisting, and ran a batch Dataflow pipeline over old repls. Afterwards they refactored snapshotting and Operational Transformation history persistence, which made repls both more reliable and faster to load.
Related posts
- May 18 Replit downtime
Replit mediumAdeptA latent Go bug leaked RWMutex read-locks whenever a configuration kind had no handler. The first write-lock attempt, during a configuration push to all clusters at once, deadlocked every Repl VM and caused about two hours of total downtime. Recovery was slowed by liveness probes that failed open, a rollback that took two tries and reset the added capacity, and an autoscaler that ignored request volume and shrank instance groups. Fixes include fast, reliable rollbacks, staggered config rollouts with jitter, self-healing health and liveness logic, and more static analysis.
- Break Stuff on Purpose
Slack Engineering mediumAdeptSlack's internal Kibana cluster failed in January 2024 after running out of disk, a consequence of co-locating its Elasticsearch storage on the same hosts as the application. The rebuild exposed a nearly two-year-old unmonitored backup that failed to restore and an outdated runbook, so users' dashboards and visualizations were lost. The team added scheduled backups, checked S3 retention, rewrote runbooks, and then deliberately filled the disks on a development cluster to rehearse recovery. The drill succeeded but missed the one-hour recovery goal and surfaced missing firewall rules in infrastructure as code. A later Kubernetes migration finished with about 30 minutes of downtime, and the backup script became a CLI that restores from cloud storage with a single command.
- Welcome to the Wonderful World of Clusters
Replit mediumAdeptReplit split its infrastructure into multiple independent clusters (failure domains) after two load-related site-wide outages, moving paid Hacker users into their own cluster so future incidents affect only a subset of users. A cluster resolution service exposed as an external DNS server maps repls to clusters for both the web server and `.repl.co` hosting, adding no extra lookup latency. Because DNS answers are cached, users moved between clusters leave tombstones in the old cluster that transparently proxy connections to the new one until the record's TTL expires. The new cluster also became a tool for shedding load during incidents and lets Replit run Hacker repls on beefier machines.
- How We Found and Fixed a Filesystem Corruption Bug
Heroku Engineering mediumAdeptA failed Cedar-14 stack image rollback caused Heroku's container tools to truncate and overwrite a disk image while it was still mounted read-only as dynos' root filesystem. A container-tools upgrade had changed checksum filenames and digests, so the safety check that skips already-present images missed the existing image. Because the page cache still held old pages while the backing file was truncated or half-written, newly loaded binaries mixed cached and missing data and segfaulted for about five hours. A loop-mount reproduction shows the effect, and the fix was migrating dynos to fresh hosts and marking installed images read-only on the host.
- Sharding Infrastructure: The Regional Goval Project
Replit mediumAdeptReplit re-sharded the infrastructure that runs Repls (Goval) from a few unbalanced, multi-region clusters partitioned by user membership into uniformly sized, single-region clusters with Repls distributed by consistent hashing, shrinking failure domains and removing cross-region traffic. The clusters are now defined with CDK for Terraform in TypeScript as reusable modules, replacing a monolithic Terraform state, codegen tooling and Ansible-managed config, so clusters (including single-tenant ones in separate GCP projects) can be provisioned on demand. Migration happened with no downtime: new Repls were created in new clusters, existing Repls were lazily transferred on connection behind feature flags with rollback capability, and old clusters were deprovisioned while untransferred Repls stayed in storage.