-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't panic on unknown token_id in gRPC callbacks. #210
Don't panic on unknown token_id in gRPC callbacks. #210
Conversation
Just tested this, no more crash after scaling a remote service to 0 |
fc6da7c
to
81585d2
Compare
Signed-off-by: erikness-doordash <[email protected]>
Signed-off-by: erikness-doordash <[email protected]>
Signed-off-by: erikness-doordash <[email protected]>
81585d2
to
2e6867b
Compare
Signed-off-by: erikness-doordash <[email protected]>
src/dispatcher.rs
Outdated
.expect("invalid token_id"); | ||
let grpc_streams_ref = self.grpc_streams.borrow_mut(); | ||
let context_id_hash_slot = grpc_streams_ref.get(&token_id); | ||
let context_id = match context_id_hash_slot { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be written as:
let context_id = match self.grpc_streams.borrow_mut().get(&token_id) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason I thought the rust compiler would stop me. Checked again though, it works fine, thanks for the tip
Could you fix DCO? |
Code search to support patching
|
Signed-off-by: erikness-doordash <[email protected]>
Signed-off-by: erikness-doordash <[email protected]>
66aa985
to
56e15b4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, sans the nit.
Signed-off-by: erikness-doordash <[email protected]>
@PiotrSikora can you merge it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Sometimes
Dispatcher.on_grpc_receive_initial_metadata()
will get an invalid stream ID, and then panic.Dispatcher.on_grpc_receive_trailing_metadata()
as well.This is a quick fix that will turn a
panic!()
call into atrace!()
call. The broader issue/bug is out of scope here, though as far as I know it's benign other than this panic.NOTE: there may be a more concise way to write this Rust code.(thanks Piotr)NOTE: adding this change to
on_grpc_receive()
as well, just to be safe, even though I haven't seen this panic get triggered myself.See: