Skip to content

[BUG] taiji-engine: Pipeline panic propagation — node panic crashes entire pipeline #1676

Description

@1688mengdie

Summary

When any ComputeNode panics inside on_bar() or on_calculate(), the panic propagates through Pipeline::process_node() and crashes the entire pipeline. A single misbehaving strategy node should not bring down the whole system.

Root Cause

src/crates/taiji/taiji-engine/src/pipeline/mod.rsprocess_node() calls node.on_bar() and node.on_calculate() directly without panic isolation:

// Before fix:
node.on_bar(&bar, &mut store)?;
node.on_calculate(&mut store)?;

Any panic in these trait methods unwinds through the pipeline, killing all other nodes.

Evidence

  • Reproducible: inject a NaN into indicator calculation → entire pipeline terminates
  • Production risk: one bad strategy node kills live trading
  • No catch_unwind or equivalent guard existed

Fix

Wrapped on_bar() and on_calculate() in std::panic::catch_unwind(AssertUnwindSafe(|| { ... })). Panics are logged via tracing::error and the pipeline continues processing remaining nodes. Added use std::panic::{self, AssertUnwindSafe}.

Fixed in

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions