Reproducing Go reportZombies by editting ELF
0x01 Intro
I randomly see some reportZombies
‘ in Go1.17. The program does have some data race of the following kinds:
- When logging, the upper layer using the same log object in multiple Goroutines, causing a string is raced by multiple Goroutines.
- Using global struct, maybe write by one Goroutine and read by many Goroutines.
Those kind of data race really can cause a memory corruption. But in my tests, it can’t be stably reproduced. While the race detector can easily find those data race, but the GC not reportZombies as expected. In out team, what you can prove you can’t call it guilty. So I start my not very long journey to reproduce that issue.