[tsan] Race fix in chaotic good client transport (#37658)

Closes #37658

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37658 from ctiller:flake-fightas-2 01e0fc70f8
PiperOrigin-RevId: 672785236
pull/37663/head
Craig Tiller 3 months ago committed by Copybara-Service
parent c7ba45d4ab
commit 1769b20533
  1. 9
      src/core/ext/transport/chaotic_good/client_transport.cc

@ -254,13 +254,14 @@ uint32_t ChaoticGoodClientTransport::MakeStream(CallHandler call_handler) {
const uint32_t stream_id = next_stream_id_++;
stream_map_.emplace(stream_id, call_handler);
lock.Release();
call_handler.OnDone([this, stream_id](bool cancelled) {
call_handler.OnDone([self = RefAsSubclass<ChaoticGoodClientTransport>(),
stream_id](bool cancelled) {
if (cancelled) {
outgoing_frames_.MakeSender().UnbufferedImmediateSend(
self->outgoing_frames_.MakeSender().UnbufferedImmediateSend(
CancelFrame{stream_id});
}
MutexLock lock(&mu_);
stream_map_.erase(stream_id);
MutexLock lock(&self->mu_);
self->stream_map_.erase(stream_id);
});
return stream_id;
}

Loading…
Cancel
Save