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/surface/lame_client.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/core/surface/lame_client.c') diff --git a/src/core/surface/lame_client.c b/src/core/surface/lame_client.c index 705996cad3..537069e984 100644 --- a/src/core/surface/lame_client.c +++ b/src/core/surface/lame_client.c @@ -78,8 +78,7 @@ static void lame_start_transport_stream_op(grpc_exec_ctx *exec_ctx, } else if (op->recv_trailing_metadata != NULL) { fill_metadata(elem, op->recv_trailing_metadata); } - grpc_exec_ctx_enqueue(exec_ctx, op->on_complete, false, NULL); - grpc_exec_ctx_enqueue(exec_ctx, op->recv_message_ready, false, NULL); + grpc_transport_stream_op_finish_with_failure(exec_ctx, op); } static char *lame_get_peer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) { -- cgit v1.2.3