From e43d05e32ae281aac598b049c68a11bd4bcaf33f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 4 Aug 2016 13:07:24 -0700 Subject: [PATCH] Fix tsan bug --- src/core/ext/transport/chttp2/transport/chttp2_transport.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index fc71d2804a4..c5e8f2f6d11 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -2143,9 +2143,12 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx *exec_ctx, grpc_chttp2_stream_global *stream_global = &bs->stream->global; if (bs->is_tail) { + gpr_mu_lock(&bs->slice_mu); + size_t cur_length = bs->slices.length; + gpr_mu_unlock(&bs->slice_mu); incoming_byte_stream_update_flow_control( exec_ctx, transport_global, stream_global, - bs->next_action.max_size_hint, bs->slices.length); + bs->next_action.max_size_hint, cur_length); } gpr_mu_lock(&bs->slice_mu); if (bs->slices.count > 0) {