From a44cbfc11c7d018785ef5699b900453090df07e3 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 3 Feb 2016 16:02:49 -0800 Subject: Fix race condition in transport API Specifically: Receiving trailing and initial metadata had to be published in lock-step. => If we wanted trailing metadata, we might not get initial metadata processed until messages arrived. => Compression code had no idea what codec to use. To fix it, publish initial metadata as soon as it's ready (this is a transport API change). Requires changes to grpc_call to ensure ordering in processing initial metadata and messages (one may be delayed). Exposed at least some bugs in C++ where we never read initial metadata. I expect at least one more similar bug. --- src/core/census/grpc_filter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/census') diff --git a/src/core/census/grpc_filter.c b/src/core/census/grpc_filter.c index a8db32b9d5..c8aaf31e2d 100644 --- a/src/core/census/grpc_filter.c +++ b/src/core/census/grpc_filter.c @@ -107,8 +107,8 @@ static void server_mutate_op(grpc_call_element *elem, if (op->recv_initial_metadata) { /* substitute our callback for the op callback */ calld->recv_initial_metadata = op->recv_initial_metadata; - calld->on_done_recv = op->on_complete; - op->on_complete = &calld->finish_recv; + calld->on_done_recv = op->recv_initial_metadata_ready; + op->recv_initial_metadata_ready = &calld->finish_recv; } } -- cgit v1.2.3