[chaotic-good] Don't add new streams after transport closed (#37887)

Prior to this change events could conspire such that newly read streams got added after the AbortWithError() code ran, and so those calls would be orphaned in the transport forever - continuing to hold a ref.

Closes #37887

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37887 from ctiller:flake-fightas-20 2648d7f37f
PiperOrigin-RevId: 684609806
pull/37813/head
Craig Tiller 2 months ago committed by Copybara-Service
parent b2a05bebe0
commit 44bd0528c7
  1. 4
      src/core/ext/transport/chaotic_good/server_transport.cc
  2. 1
      src/core/ext/transport/chaotic_good/server_transport.h

@ -397,6 +397,7 @@ void ChaoticGoodServerTransport::AbortWithError() {
// Close all the available pipes.
outgoing_frames_.MarkClosed();
ReleasableMutexLock lock(&mu_);
aborted_with_error_ = true;
StreamMap stream_map = std::move(stream_map_);
stream_map_.clear();
state_tracker_.SetState(GRPC_CHANNEL_SHUTDOWN,
@ -439,6 +440,9 @@ absl::Status ChaoticGoodServerTransport::NewStream(
GRPC_TRACE_LOG(chaotic_good, INFO)
<< "CHAOTIC_GOOD " << this << " NewStream " << stream_id;
MutexLock lock(&mu_);
if (aborted_with_error_) {
return absl::UnavailableError("Transport closed");
}
auto it = stream_map_.find(stream_id);
if (it != stream_map_.end()) {
return absl::InternalError("Stream already exists");

@ -143,6 +143,7 @@ class ChaoticGoodServerTransport final : public ServerTransport {
Mutex mu_;
// Map of stream incoming server frames, key is stream_id.
StreamMap stream_map_ ABSL_GUARDED_BY(mu_);
bool aborted_with_error_ ABSL_GUARDED_BY(mu_) = false;
uint32_t last_seen_new_stream_id_ = 0;
RefCountedPtr<Party> party_;
ConnectivityStateTracker state_tracker_ ABSL_GUARDED_BY(mu_){

Loading…
Cancel
Save