Terminating the process with `panic` takes longer with `panic="abort"`?

⚓ Rust    📅 2025-07-06    👤 surdeus    👁️ 18      

surdeus

Warning

This post was published 122 days ago. The information described in this article may have changed.

In my debug builds panic terminates the process right away, it takes no time.

In release builds panic takes a second or two before the process termintes.

Normally who cares, but I have a weird test setup where I run my executable on about a hundred files. Most of them panic today.

As I fix the tests there will be no panics, but today running this test suite spends maybe half a minute on these post-panic delays.

I investigated this issue a little bit and it turns out it's this line in my Cargo.toml that causes the issue:

[profile.release]
panic = "abort"

With the default panic setting (unwind?) the processes terminate fast.

Is this expected? How can aborting the process take longer than aborting right away on panic?

5 posts - 3 participants

Read full topic

🏷️ rust_feed