BitFun icon indicating copy to clipboard operation
BitFun copied to clipboard

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

Open 1688mengdie opened this issue 4 months ago • 1 comments

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.rs — process_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

  • PR: https://github.com/GCWing/BitFun/pull/1674
  • File: src/crates/taiji/taiji-engine/src/pipeline/mod.rs

1688mengdie avatar Jul 22 '26 07:07 1688mengdie

已迁移至太极独立仓库。本 Issue 为太极项目专属 BUG,不属于 BitFun 通用范畴,故关闭。修复代码保留在 PR #1674 中供参考。

1688mengdie avatar Jul 22 '26 20:07 1688mengdie