2015/03/03: Unevaluated thunks

Normally, the term "Heisenbug" refers to a software bug that, usually in a mystical way, goes away, as soon as you closely look at it. In lazy languages you can produce bugs that literally have this behaviour. Ganeti has a daemon that regularly monitors various aspects of the system, e.g., CPU usage, to provide aggregated statistics. Being lazy, all computations are delayed—including those cleaning up values no longer needed for the average over the last 10 minutes. In this way, unevaluated thunks accumulate and the memory footprint grows. As soon as you look at the daemon (in the form of querying for the statistics), however, everything needs to be evaluated and the memory usage goes away.

The solution is, of course, to force evaluation.