Get the latest tech news
Rust: Investigating an Out of Memory Error
We discovered the hard way that when backtrace is enabled, the anyhow library is capturing a backtrace on every error. Only when printing this error in debug format!(”err: {:?}”, error) backtrace’s symbols are resolved to human-friendly names, thus leading to a significant memory increase for your application.
This service runs on Kubernetes, so we checked the pod's status and found out the last reason for the restart was an out-of-memory (OOM), meaning that the application used more memory than the limit we set. We control both ends of the service, so we don’t expect any big payload that would cause such an abrupt spike, and clients are able to resume even after an error. Your monitoring can lie to you if events happen in between its sampling frequency The documentation you don’t understand is going to bite you in the future Surprisingly, anyhow/eyre library is leaning by default to capture a backtrace on every error when not explicitly disabled
Or read this on Hacker News