/plushcap/analysis/fly-io/rust-memory-leak

How to Make Rust Leak Memory (Also: How to Make It Stop)

What's this blog post about?

The text discusses how loading a web page works and provides an overview of Fly.io's Rust-based proxy, fly-proxy. It explains that when typing https://fly.io in your browser address bar and hitting enter, the computer processes events in-order through various stages including DNS lookup, TCP connection establishment, and HTTP/2 request handling. The text also discusses memory leaks in fly-proxy and how they were fixed using a Rust profiler called Bytehound. It highlights that even though RAII is working as expected in Rust, there can still be leaks due to improper resource management or cancellation of background tasks before shutting down the application. The issue was resolved by removing custom Honeycomb tracer implementation and optimizing memory usage for queues and latency tracking.

Company
Fly.io

Date published
June 15, 2022

Author(s)
Amos Wenger

Word count
3493

Hacker News points
None found.

Language
English


By Matt Makai. 2021-2024.