LemmyNet / lemmy

🐀 A link aggregator and forum for the fediverse
https://join-lemmy.org
GNU Affero General Public License v3.0
13.25k stars 880 forks source link

Removing strip = true from release profile. #5166

Closed dessalines closed 2 days ago

dessalines commented 3 days ago

Adding another profile optimization.

See https://github.com/johnthagen/min-sized-rust?tab=readme-ov-file#abort-on-panic for context.

Nutomic commented 3 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

phiresky commented 3 days ago

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

dessalines commented 3 days ago

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.

Nutomic commented 2 days ago

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" }] }