If you recently upgraded ClickHouse to 25.3 and noticed your server’s memory use kept growing until the whole thing crashed, you’re not alone.
Several users reported this problem in GitHub issue #82627. The server was holding on to memory even when it didn’t need to – especially when it was mostly idle, like on weekends. Eventually, the operating system ran out of memory and killed the ClickHouse® process.
Some people might have assumed their server didn’t have enough RAM and upgraded to bigger machines. But the real problem was that ClickHouse® wasn’t releasing memory properly, so adding more RAM only delayed the crash – it didn’t fix it. This issue likely existed in earlier versions too, though it wasn’t as critical or obvious. So, it’s possible that some users increased their hardware thinking it would help, when really the memory leak was the real culprit.
What Went Wrong?
ClickHouse® uses memory to speed up queries by caching data and keeping buffers ready. Normally, it frees up memory when it’s not needed. But in this case, some internal parts weren’t cleaning up memory during idle times.
This caused the memory usage to slowly creep up, leading to crashes.
How Was It Fixed?
The ClickHouse® developers released a fix in pull request #83607, authored by @azat and reviewed by @al13n321, that:
- Improved how ClickHouse® tracks and frees memory
- Made sure background cleanup jobs run properly even when the server is idle
- Added extra checks so memory doesn’t get stuck in caches
With these changes, ClickHouse® now releases memory correctly and won’t keep growing its memory use when it’s not busy.
What Should You Do?
- Update ClickHouse to a version that includes this fix. (Latest bug fix version of 24.8 LTS, 25.3 LTS and ClickHouse® and >25.3 )
- Check your memory settings to make sure they’re reasonable.
- Watch your server’s memory especially during quiet times, to confirm the problem is gone.
Why This Matters?
If your ClickHouse® server crashes because of memory leaks, it can cause downtime and headaches. This fix helps keep your server stable and running smoothly.
Final Thoughts
Memory leaks can be tricky, but thanks to the ClickHouse® community and developers, this one got fixed quickly. If you’ve been struggling with unexpected crashes or thought you needed more RAM, try this update first!
Looking for expert open-source ClickHouse® managed and migration services? Check out Quantrail ClickHouse Services for reliable, fully managed solutions.
References
- GitHub Issue: ClickHouse #82627
- GitHub Pull Request (Fix): ClickHouse #83607
- Photo by Luis Quintero: https://www.pexels.com/photo/photo-of-gray-faucet-2339722/
