ArroyoSystems / arroyo

Distributed stream processing engine in Rust
https://arroyo.dev
Apache License 2.0
3.81k stars 220 forks source link

fix: fix recursion limit reached decode error #716

Closed zhuliquan closed 3 months ago

zhuliquan commented 3 months ago

I meeting a decode error (in arroyo-worker), when I input sql with very long predicate expr in When clause. (in our case, we have converted filter node to another extension node).

2024-08-09T10:46:29.901975Z ERROR arroyo_server_common: crates/arroyo-server-common/src/lib.rs:133: panicked at crates/arroyo-worker/src/arrow/express
ion_match.rs:105:88:
called `Result::unwrap()` on an `Err` value: DecodeError { description: "recursion limit reached", stack: [("PhysicalExprNode", "expr_type"), ("Physic
alBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNo
de", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("P
hysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNod
e", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type
"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("Physical
BinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode
", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("Phy
sicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode"
, "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type")
, ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBi
naryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode",
"l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("Physi
calExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode",
"expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"),
("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBina
ryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "
l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("Physica
lExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "e
xpr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("
PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinary
ExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"
), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type"), ("PhysicalBinaryExprNode", "r"), ("PhysicalE
xprNode", "expr_type"), ("PhysicalBinaryExprNode", "l"), ("PhysicalExprNode", "expr_type")] } panic.file="crates/arroyo-worker/src/arrow/expression_ma
tch.rs" panic.line=105 panic.column=88

I dig out that the error is throwed from prost crate (see below code). and this limit is only available when missing no-recursion-limit feature in Cargo.toml.

https://github.com/tokio-rs/prost/blob/d38072f5962e29b0cb1ebef6038510c54fa13ca7/prost/src/encoding.rs#L82-L90

Whether add no-recursion-limit feature to handle this case?