Skip to content

Instantly share code, notes, and snippets.

View cornu-ammonis's full-sized avatar

Andrew Jones cornu-ammonis

  • San Francisco
View GitHub Profile
@cornu-ammonis
cornu-ammonis / gist:2a2889429fb9dad8e47abe5869e819f5
Last active May 8, 2023 22:20
Solving a critical bug in the default Rails caching library

An odd coincidence

On March 20th, ChatGPT users reported seeing conversations that were not their own. Just a few weeks earlier I had solved a bug where Rails's default caching library (Dalli) would return incorrect values. I thought "this chatGPT incident sounds a lot like what could happen with that caching bug via returning incorrect cached HTML", but OpenAI doesn't use Rails and I shrugged the thought off as recency bias.

My jaw dropped when I saw the postmortem - it was exactly the same bug concept, just in a different library! A reminder that hard things often transcend particular languages and libraries. And boy is this a hard bug. It sits at the intersection of caching, shared resource management, and state corrupt