fix(eventhubs): box the receive timeout cause once - #5103
Draft
Johnathan W (j7nw4r) wants to merge 2 commits into
Draft
fix(eventhubs): box the receive timeout cause once#5103Johnathan W (j7nw4r) wants to merge 2 commits into
Johnathan W (j7nw4r) wants to merge 2 commits into
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 3 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
The receive timeout error is built inside an async select! arm that needs a live connection, so no offline test can reach it. Move the construction into a small associated function, and assert that the cause downcasts to std::io::Error with ErrorKind::TimedOut. The builder keeps the double box, so the new test fails until the fix lands. Refs #5098
azure_core::Error::new takes E: Into<Box<dyn Error + Send + Sync>> and boxes its argument. The receive timeout passed an already boxed std::io::Error, so the stored cause was a Box<std::io::Error> and downcast_ref::<std::io::Error>() returned None. The Debug output still printed Kind(TimedOut), so the cause looked present while every downcast failed. Pass the std::io::Error unboxed. A scan of the crate found no other Error::new or Error::with_error call site with a pre-boxed cause. Closes #5098
Johnathan W (j7nw4r)
force-pushed
the
j7nw4r/fix-eventhubs-timeout-double-box
branch
from
August 25, 2026 18:13
ea46892 to
6d349b6
Compare
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.
Summary
The error that an Event Hubs receive timeout produces now carries its cause unboxed, so
downcast_ref::<std::io::Error>()returns thestd::io::ErrorwithErrorKind::TimedOut.Motivation
azure_core::Error::newacceptsE: Into<Box<dyn Error + Send + Sync>>and boxes its argument. The receive timeout incommon/recoverable/receiver.rspassed an already boxedstd::io::Error, so the stored cause was aBox<std::io::Error>and every downcast tostd::io::ErrorreturnedNone. TheDebugoutput still printedKind(TimedOut), so the cause looked present while the downcast failed, and a caller could not tell a receive timeout from any other I/O error.Changes
Box::newaround thestd::io::Errorcause, soError::newboxes it once.RecoverableReceiver::receive_timeout_error, which gives an offline test a seam to an error that otherwise needs a live connection.Ioand the cause downcasts tostd::io::ErrorwithErrorKind::TimedOut.Test plan
Error::newandError::with_errorcall site insdk/eventhubsandsdk/core/azure_core_amqpfound this one pre-boxed cause and no other.downcast_ref::<std::io::Error>()returnedNone.cargo test --package azure_messaging_eventhubs --lib -- --test-threads=1: 145 passed, 0 failed, 14 live tests ignored.RUSTFLAGS=-Dwarnings cargo test --no-run --package azure_messaging_eventhubs: exit 0.cargo clippy --all-features --all-targets --package azure_messaging_eventhubs -- -Dwarnings,cargo fmt --all -- --check,RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps, and cspell on the changed files: all exit 0.Closes #5098