Cloudflare

Creative foot-shooting with Go RWMutex

Oct 29, 2015Filippo Valsorda
Creative foot-shooting with Go RWMutex
SummaryAI, from the source post

This post details a bug in the Go RWMutex implementation within Cloudflare's RRDNS server. A background goroutine periodically reloaded an IP table, acquiring a write lock. A consumer function used read locks. When the table reload function ran while queries were being processed, its pending write lock call blocked subsequent read lock calls, causing a deadlock. This highlights a subtle concurrency bug where a blocked Lock call can prevent new readers from acquiring the RLock, leading to a deferred deadlock. The post suggests improvements in tooling for static and dynamic analysis of mutex usage.

More from the DNS Infrastructure & Naming Conventions trail