risingwave_common::util

Module panic

source
Expand description

RisingWave aborts the execution in the panic hook by default to avoid unpredictability and interference in concurrent programming as much as possible. Since the hook is called no matter where the panic occurs, std::panic::catch_unwind will be a no-op.

To workaround this under some circumstances, we provide a task-local flag in practice to indicate whether we’re under the context of catching unwind. This is used in the panic hook to decide whether to abort the execution (see the usage of is_catching_unwind).

This module provides several utilities functions wrapping std::panic::catch_unwind and other related functions to set the flag properly. Calling functions under these contexts will disable the aborting behavior in the panic hook temporarily.

Statics§

  • A task-local flag indicating whether we’re under the context of catching unwind.

Traits§

Functions§

  • Returns whether the current scope is under the context of catching unwind (by calling rw_catch_unwind).
  • Invokes a closure, capturing the cause of an unwinding panic if one occurs.