proxy-wasm-rust-sdk icon indicating copy to clipboard operation
proxy-wasm-rust-sdk copied to clipboard

Fix BorrowMutError panic when invoking dispatch_grpc_call() from on_grpc_call_response()

Open andytesti opened this issue 1 year ago • 0 comments

Panic with message "proxy-wasm-rust-sdk/src/dispatcher.rs:121:14:\nalready borrowed: BorrowMutError" is triggered when dispatch_grpc_call() is invoked from on_grpc_call_response(). The problem is originated by a self.grpc_callouts.borrow_mut() being invoked inside an if condition, that keeps the RefMut alive until the true branch ends. This PR adopts the same approach than on_http_call_response(), by invoking the RefCell::borrow_mut() outside the if condition.

andytesti avatar Jul 01 '24 22:07 andytesti