Skip to main content

Module release_profile

Module release_profile 

Source
Expand description

Release profile validation for DuckDB loadable extensions.

DuckDB loadable extensions are shared libraries (.so/.dylib/.dll) whose Cargo release profile decides whether a panic in your code becomes a DuckDB error or kills the DuckDB process.

§Required settings

[profile.release]
panic = "unwind"    # Required: quack-rs catches panics, and catching needs unwinding
lto = true          # Recommended: reduces binary size
opt-level = 3       # Recommended: maximum optimization
codegen-units = 1   # Recommended: better optimization

§Why unwind, not abort

quack-rs wraps every extern "C" entry point — the extension entry point, every scalar/table/aggregate/cast/copy callback macro — in std::panic::catch_unwind, turning a panic into a DuckDB error message instead of a crash. catch_unwind cannot catch anything under panic = "abort": the runtime aborts before unwinding starts, so the process dies with SIGABRT and takes the user’s DuckDB session with it.

Demonstrated directly:

$ rustc -O panic_probe.rs && ./panic_probe
catch_unwind returned: true
process survived the panic          exit=0

$ rustc -O -C panic=abort panic_probe.rs && ./panic_probe
Aborted                             exit=134

The older advice to set panic = "abort" came from panics escaping an extern "C" boundary once being undefined behaviour. They no longer are — Rust defines that as an abort — and quack-rs catches them before the boundary anyway, which is the whole point.

Structs§

ReleaseProfileCheck
Results of checking a release profile configuration.

Functions§

validate_release_profile
Validates release profile settings from string key-value pairs.