Latest articles

Engineering
8
 minutes
Rust: Investigating a Strange Out-of-Memory Error

TL;DR: 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. If you need backtrace only on panic, you must set two environment variables, RUST_BACKTRACE=1, and RUST_LIB_BACKTRACE=0, to avoid the issue.

Romain Gérard
Staff Software Engineer
Engineering
13
 minutes
Common Mistakes with Rust Async

At Qovery, we start to have our fair share of Async Rust and to say the least it is not without caveats. Let’s be honest, Async Rust is hard. It has many more rough edges than Sync Rust and requires a different mindset, but it solves a problem space well, that is hard to tackle otherwise. It allows safer network concurrency than C++ Boost.Asio and I would start this post by giving a big thanks to the Tokio team & ecosystem for the amazing work they provide to the community. So this post is not to rant about Async Rust or to talk about an Async ecosystem fracture, but to share common mistakes to raise awareness and, in turn, help you avoid them.

Romain Gérard
Staff Software Engineer
Engineering
13
 minutes
A Guided Tour of Streams in Rust

When collecting information on how to write GRPC or Websocket servers for our Qovery infrastructure, I came across a lot of resources. But while many guides provided an in-depth insight into futures, they sorely lacked information on how the Stream API works in Rust. And, more importantly, on how to use it properly. Sadly, you can't turn a blind eye on streams. As soon as you go beyond the simple request/response protocol of our beloved REST APIs, the notions of flow, async generator, and so on, inevitably arise. This is especially true when it comes to Rust. When you decide to use tonic for your GRPC or tokio tungstenite for your Websocket, the only usable interfaces with those libraries revolve around streams. This is why this article focuses on introducing streams in the context of Rust.

Romain Gérard
Staff Software Engineer
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.