fix(consumer): Don't Crash Rust Consumer on Transport Error#535
Merged
george-sentry merged 2 commits intomainfrom Apr 23, 2026
Merged
fix(consumer): Don't Crash Rust Consumer on Transport Error#535george-sentry merged 2 commits intomainfrom
george-sentry merged 2 commits intomainfrom
Conversation
Member
Author
|
My solution is kind of ad hoc, and doesn't really reflect the Python logic. I could do that by extending the Rust |
untitaker
approved these changes
Apr 21, 2026
| } | ||
|
|
||
| /// Treat `RD_KAFKA_RESP_ERR__TRANSPORT` errors from `librdkafka` like an empty poll the same way Python treats `KafkaError._TRANSPORT`. | ||
| fn kafka_poll_error_is_recoverable_transport(err: &KafkaError) -> bool { |
Member
There was a problem hiding this comment.
maybe a bad idea, but you can make this a macro like such:
macro_rules recoverable_error_pattern {
() => ((KafkaError::MessageConsumption(RDKafkaErrorCode::BrokerTransportFailure)
| KafkaError::Global(RDKafkaErrorCode::BrokerTransportFailure));
}
...
match res {
Some(Err(recoverable_error_pattern!())) => ...,
Some(Err(err)) => ...
}
then the exhaustiveness and dead code checks of the compiler will continue to be effective because you avoided one if matches!()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linear
Completes STREAM-856
Description
Python and Rust Arroyo consumers handle errors differently during poll.
In Python, consumers raise TransportError if they hit
KafkaError._TRANSPORTduring poll.arroyo/arroyo/backends/kafka/consumer.py
Lines 501 to 502 in e33f4d6
TransportError is a RecoverableError, so StreamProcessor just swallows the error and goes to the next loop.
arroyo/arroyo/processing/processor.py
Lines 458 to 459 in e33f4d6
Rust doesn't seem to have a concept of recoverable errors, so it just crashes when we hit any error during poll.
arroyo/rust-arroyo/src/processing/mod.rs
Line 442 in e33f4d6
We need to update Rust Arroyo to retry / ignore
KafkaError._TRANSPORT. This PR accomplishes that by checking whether the error is one we consider to be "recoverable", and if it is, we returnOk(None). If it isn't one we consider "recoverable," we return an error as before.