Closed dessalines closed 2 days ago
This can make it much harder to debug crashes in production. Though in fact thats already tricky because we set strip = 0
which removes debug info for backtraces. So I would go the other way and disable stripping in release builds.
https://doc.rust-lang.org/cargo/reference/profiles.html#strip
What's the reason that we are trying to optimize binary size so much? I'd generally agree that having more info for debugging release builds is good
Yep I did this because the strip removed the stack trace anyway, but if ppl prefer having them both, I'll go the other way with this.
Confirmed that it works to produce backtraces (with RUST_BACKTRACE=1
).
Error: LemmyError { message: Unknown(""), inner: Unknown
Stack backtrace:
0: anyhow::error::<impl anyhow::Error>::msg
1: <lemmy_utils::error::LemmyError as core::convert::From<lemmy_utils::error::LemmyErrorType>>::from
2: lemmy_server::create_http_server
3: lemmy_server::start_lemmy_server::{{closure}}
4: tokio::runtime::park::CachedParkThread::block_on
5: tokio::runtime::runtime::Runtime::block_on
6: lemmy_server::main
7: std::sys::backtrace::__rust_begin_short_backtrace
8: std::rt::lang_start::{{closure}}
9: std::rt::lang_start_internal
10: main
11: <unknown>
12: __libc_start_main
13: _start, context: Backtrace [{ fn: "<lemmy_utils::error::LemmyError as core::convert::From<lemmy_utils::error::LemmyErrorType>>::from" }, { fn: "lemmy_server::create_http_server" }, { fn: "lemmy_server::start_lemmy_server::{{closure}}" }, { fn: "tokio::runtime::park::CachedParkThread::block_on" }, { fn: "tokio::runtime::runtime::Runtime::block_on" }, { fn: "lemmy_server::main" }, { fn: "std::sys::backtrace::__rust_begin_short_backtrace" }, { fn: "std::rt::lang_start::{{closure}}" }, { fn: "std::rt::lang_start_internal" }, { fn: "main" }, { fn: "__libc_start_main" }, { fn: "_start" }] }
Adding another profile optimization.
See https://github.com/johnthagen/min-sized-rust?tab=readme-ov-file#abort-on-panic for context.