I've been building a C++20 service on Seastar and catalogued every class of bug that burned me into a set of rules I check on every commit. Each one cost at least a day to diagnose.
A few examples:
Lambda coroutines in `.then()` are use-after-free (the coroutine frame outlives the lambda that created it)
Coroutine reference parameters dangle (caller's scope ends before the coroutine resumes)
`std::shared_ptr` destructs on the wrong shard in Seastar's shared-nothing model
Missing
& in do_with lambdas gives you a copy that dies while the future is still runningSome are Seastar-specific, but most apply to any coroutine-based async C++. The post covers the anti-pattern, why it breaks, and the fix for each.
https://ranvier.systems/2026/03/29/24-hard-rules-for-writing-correct-async-cpp.html
Curious if others have hit similar issues or have rules I'm missing.
https://redd.it/1s85qf1
@r_cpp