Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

RocksDB Blog 4 min read Incident mediumAdept

RocksDB development finds a CPU bug

A RocksDB unit test that generated thousands of SST file unique IDs across many threads exposed a hardware bug: the RDSEED instruction on a newer AMD CPU sometimes returned 0 while reporting success, but only on some cores and only under memory load. The failure appeared only through libstdc++'s std::random_device, not through rdrand, /dev/urandom or libc++. It was reproduced by scaling the thread count to roughly the core count, and was mitigated with a Linux kernel patch that marks RDSEED unavailable, followed by an AMD microcode update tracked as a high-severity CVE. The takeaways are to test what you depend on, combine redundant entropy sources, and add sanity checks, because even CPUs can be wrong.

Assumes: random number generation basicsmultithreaded testing

Related posts

  • Core dump epidemiology: fixing an 18-year-old bug

    OpenAI hardMaster

    Mysterious return-to-bogus-address crashes in Rockset's C++ execution layer turned out to be two unrelated bugs: silent register corruption on a single bad Azure host, and an 18-year-old race in GNU libunwind's _Ux86_64_setcontext, which read the synthesized ucontext_t after moving %rsp past it, letting a frequent SIGUSR2 CPU-time signal clobber it during exception unwinding. The breakthrough came from switching from close inspection of individual cores to population analysis: an automated pipeline classified every production core dump from the past year, and the clean data set separated the two crash clusters by region, start date and node age. Fixes included denylisting the host, logging register state in the fatal signal handler, reusing VMs to make bad-node detection easier, and patching libunwind.

  • An adventure in writing compatible systems

    Turso mediumAdept

    Turso, a Rust rewrite of SQLite, hit a bug where every write after the database crossed 1GB made SQLite's integrity checks fail, even though Turso's own checks found the file intact. The cause was the SQLite "pending byte" page: once a file passes the 1GB mark, SQLite reserves a special page tied to file locking, and Turso did not reserve it. The deterministic simulation tests had missed the bug because every profile injected faults, so no test database ever grew to 1GB. Adding fault-free runs fixed that gap, a reminder that compatible rewrites must match undocumented-feeling quirks of the original implementation.

  • Fuzzing rust-minidump for Embarrassment and Crashes – Part 2

    Mozilla Hacks mediumAdept

    Fuzzing rust-minidump with cargo-fuzz and libfuzzer turned up a series of real bugs in a Rust rewrite of Breakpad's minidump processor that had otherwise shipped cleanly. They include an ARM64 stackwalker infinite loop that grew backtraces until OOM, a flipped comparison that silently emptied the MinidumpLinuxMaps RangeMap, OOMs from Vec::with_capacity on untrusted list lengths, and several integer overflows. The OOM fix checks that the remaining section bytes can actually hold the claimed item count, which bounds reservations to O(n) in the dump size. Rust's debug-build overflow panics and liberal assertions made each bug deterministically reproducible as a tiny checked-in test, and well-scoped issue reports with fixes made the fuzzing contributions genuinely useful to maintainers.

  • The effect of switching to TCMalloc on RocksDB memory use

    Cloudflare mediumAdept

    Quicksilver's memory roughly doubled after its storage moved to RocksDB, climbing from about 15GB to 30GB over several days. Heap profiling showed the heap was about a third of RSS, which pointed to the allocator rather than a leak. glibc malloc gives threads independent per-thread arenas (60-80 arenas for about 25 threads), and memory cannot move between them, so fragmentation multiplies. Mitigations such as MALLOC_ARENA_MAX, periodic malloc_trim and M_MMAP_THRESHOLD each cost lock contention or syscalls, while TCMalloc's middle-end moves freed memory between per-core caches and cut memory use by 2.5x.

  • A Higgs-bugson in the Linux Kernel

    Jane Street Tech Blog hardMaster

    Rare EACCES failures during large file copies over Kerberized NFSv3 came from a Linux kernel bug in RPCSEC_GSS reply verification. When an overloaded server caused the client to retransmit a request with the same XID, the kernel assigned a new GSS sequence number, so a late reply HMAC'd over the old sequence number failed checksum validation, which triggered more retransmissions and, after three failures, returned EACCES to userspace. The bug was isolated with an in-memory FUSE filesystem written in Rust, bpftrace probes on auth_rpcgss functions, a custom Wireshark checksum plugin, and an NFQUEUE-based manual packet delayer. Two upstream patches, shipping in Linux 6.16, fix it: one caches prior sequence numbers as RFC 2203 suggests, and one stops retransmitting immediately on a bad checksum.

The quest for software engineering knowledge.

Look:
Layout: