Skip to content

Don't use RUST_BACKTRACE for std::backtrace #79561

@antoyo

Description

@antoyo

Hi.
It can be very useful in a production environment to know where a panic comes from, which you can know by enabling RUST_BACKTRACE.
However, using the same environment variable for error backtrace could lead to performance regression: your production service might require good performance and collecting a backtrace is very expansive.
Since errors are more often recovered than panics, you might not want to pay the cost of collecting backtraces for errors, while still might want to know the path which lead to a panic.
So I suggest you don't use RUST_BACKTRACE for error backtraces, to have the possibility to only get backtraces on panics, not on normal errors.
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-error-handlingArea: Error handlingPG-error-handlingProject group: Error handling (https://github.com/rust-lang/project-error-handling)T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions