Summary
Nine FFI entry points in the Rust wrapper call runtime().block_on(...) directly, so each one ignores the per-call bound that RustCallContext carries. Any of them can hold the calling thread forever when the operation never completes.
Motivation
PR #7346 added the block_on_with_timeout helper and the call_context_set_timeout_ms FFI setter, then routed the two connection close entry points through the helper. The other entry points still block with no bound. A connection that the service dropped makes each of them wait forever, which is the same defect that #7346 fixed for the close path. A caller that sets a deadline gets no benefit today, because the Rust side never reads the bound on these paths.
Proposal
Route each call site through call_context.block_on_with_timeout(...), and match Ok(Ok(_)), Ok(Err(err)), and Err(elapsed) the same way amqpconnection_close does.
amqpconnection_open, src/amqp/connection.rs:103
amqpsession_begin, src/amqp/session.rs:65
amqpsession_begin_with_options, src/amqp/session.rs:79
amqpmanagement_attach, src/amqp/management.rs:112
amqpmanagement_detach, src/amqp/management.rs:140
amqpmanagement_call, src/amqp/management.rs:179
amqpclaimsbasedsecurity_attach, src/amqp/cbs.rs:77
amqpclaimsbasedsecurity_detach, src/amqp/cbs.rs:107
amqpclaimsbasedsecurity_authorize_path, src/amqp/cbs.rs:179
Make each matching C++ caller set the bound with CallContext::SetTimeoutMilliseconds where it does not already.
The paths are relative to sdk/core/azure-core-amqp/src/impl/rust_amqp/rust_amqp/rust_wrapper. The block_on call at src/amqp/message_receiver.rs:148 needs no bound, because it waits only for a task spawn and returns at once. Three further call sites sit inside mod tests.
Found while reviewing #7346.
Summary
Nine FFI entry points in the Rust wrapper call
runtime().block_on(...)directly, so each one ignores the per-call bound thatRustCallContextcarries. Any of them can hold the calling thread forever when the operation never completes.Motivation
PR #7346 added the
block_on_with_timeouthelper and thecall_context_set_timeout_msFFI setter, then routed the two connection close entry points through the helper. The other entry points still block with no bound. A connection that the service dropped makes each of them wait forever, which is the same defect that #7346 fixed for the close path. A caller that sets a deadline gets no benefit today, because the Rust side never reads the bound on these paths.Proposal
Route each call site through
call_context.block_on_with_timeout(...), and matchOk(Ok(_)),Ok(Err(err)), andErr(elapsed)the same wayamqpconnection_closedoes.amqpconnection_open,src/amqp/connection.rs:103amqpsession_begin,src/amqp/session.rs:65amqpsession_begin_with_options,src/amqp/session.rs:79amqpmanagement_attach,src/amqp/management.rs:112amqpmanagement_detach,src/amqp/management.rs:140amqpmanagement_call,src/amqp/management.rs:179amqpclaimsbasedsecurity_attach,src/amqp/cbs.rs:77amqpclaimsbasedsecurity_detach,src/amqp/cbs.rs:107amqpclaimsbasedsecurity_authorize_path,src/amqp/cbs.rs:179Make each matching C++ caller set the bound with
CallContext::SetTimeoutMillisecondswhere it does not already.The paths are relative to
sdk/core/azure-core-amqp/src/impl/rust_amqp/rust_amqp/rust_wrapper. The block_on call atsrc/amqp/message_receiver.rs:148needs no bound, because it waits only for a task spawn and returns at once. Three further call sites sit insidemod tests.Found while reviewing #7346.