@@ -40,11 +40,11 @@ void ConnPoolImplBase::assertCapacityCountsAreCorrect() {
4040 SLOW_ASSERT (currentUnusedCapacity (busy_clients_) <= 0 , dumpState ());
4141
4242 if (ready_clients_.empty ()) {
43- ASSERT ((connecting_and_connected_stream_capacity_ - connecting_stream_capacity_) <= 0 ,
44- dumpState ());
43+ ENVOY_BUG ((connecting_and_connected_stream_capacity_ - connecting_stream_capacity_) <= 0 ,
44+ dumpState ());
4545 } else {
46- ASSERT ((connecting_and_connected_stream_capacity_ - connecting_stream_capacity_) > 0 ,
47- dumpState ());
46+ ENVOY_BUG ((connecting_and_connected_stream_capacity_ - connecting_stream_capacity_) > 0 ,
47+ dumpState ());
4848 }
4949}
5050
@@ -53,21 +53,21 @@ ConnPoolImplBase::ConnPoolImplBase(
5353 Event::Dispatcher& dispatcher, const Network::ConnectionSocket::OptionsSharedPtr& options,
5454 const Network::TransportSocketOptionsConstSharedPtr& transport_socket_options,
5555 Upstream::ClusterConnectivityState& state)
56- : state_(state), host_(host), priority_(priority), dispatcher_(dispatcher),
57- socket_options_ (options ), transport_socket_options_(transport_socket_options ),
56+ : host_(host), priority_(priority), dispatcher_(dispatcher), socket_options_(options ),
57+ transport_socket_options_ (transport_socket_options ), cluster_connectivity_state_(state ),
5858 upstream_ready_cb_(dispatcher_.createSchedulableCallback([this ]() { onUpstreamReady (); })) {}
5959
6060ConnPoolImplBase::~ConnPoolImplBase () {
61- ASSERT (isIdleImpl (), dumpState ());
62- ASSERT (connecting_stream_capacity_ == 0 , dumpState ());
63- ASSERT (connecting_and_connected_stream_capacity_ == 0 , dumpState ());
61+ ENVOY_BUG (isIdleImpl (), dumpState ());
62+ ENVOY_BUG (connecting_stream_capacity_ == 0 , dumpState ());
63+ ENVOY_BUG (connecting_and_connected_stream_capacity_ == 0 , dumpState ());
6464}
6565
6666void ConnPoolImplBase::deleteIsPendingImpl () {
6767 deferred_deleting_ = true ;
68- ASSERT (isIdleImpl (), dumpState ());
69- ASSERT (connecting_stream_capacity_ == 0 , dumpState ());
70- ASSERT (connecting_and_connected_stream_capacity_ == 0 , dumpState ());
68+ ENVOY_BUG (isIdleImpl (), dumpState ());
69+ ENVOY_BUG (connecting_stream_capacity_ == 0 , dumpState ());
70+ ENVOY_BUG (connecting_and_connected_stream_capacity_ == 0 , dumpState ());
7171}
7272
7373void ConnPoolImplBase::destructAllConnections () {
@@ -197,9 +197,9 @@ ConnPoolImplBase::tryCreateNewConnection(float global_preconnect_ratio) {
197197 return ConnectionResult::FailedToCreateConnection;
198198 }
199199 ASSERT (client->state () == ActiveClient::State::Connecting, dumpState ());
200- ASSERT (std::numeric_limits<uint64_t >::max () - connecting_stream_capacity_ >=
201- static_cast <uint64_t >(client->currentUnusedCapacity ()),
202- dumpState ());
200+ ENVOY_BUG (std::numeric_limits<uint64_t >::max () - connecting_stream_capacity_ >=
201+ static_cast <uint64_t >(client->currentUnusedCapacity ()),
202+ dumpState ());
203203 ASSERT (client->real_host_description_ );
204204 // Increase the connecting capacity to reflect the streams this connection can serve.
205205 incrConnectingAndConnectedStreamCapacity (client->currentUnusedCapacity (), *client);
@@ -249,7 +249,7 @@ void ConnPoolImplBase::attachStreamToClient(Envoy::ConnectionPool::ActiveClient&
249249 decrConnectingAndConnectedStreamCapacity (1 , client);
250250 }
251251 // Track the new active stream.
252- state_ .incrActiveStreams (1 );
252+ cluster_connectivity_state_ .incrActiveStreams (1 );
253253 num_active_streams_++;
254254 host_->stats ().rq_total_ .inc ();
255255 host_->stats ().rq_active_ .inc ();
@@ -266,7 +266,7 @@ void ConnPoolImplBase::onStreamClosed(Envoy::ConnectionPool::ActiveClient& clien
266266 debug, " destroying stream: {} active remaining, readyForStream {}, currentUnusedCapacity {}" ,
267267 client, client.numActiveStreams (), client.readyForStream (), client.currentUnusedCapacity ());
268268 ASSERT (num_active_streams_ > 0 , dumpState ());
269- state_ .decrActiveStreams (1 );
269+ cluster_connectivity_state_ .decrActiveStreams (1 );
270270 num_active_streams_--;
271271 host_->stats ().rq_active_ .dec ();
272272 host_->cluster ().trafficStats ()->upstream_rq_active_ .dec ();
@@ -378,7 +378,7 @@ void ConnPoolImplBase::onUpstreamReady() {
378378 ENVOY_CONN_LOG (debug, " attaching to next stream" , *client);
379379 // Pending streams are pushed onto the front, so pull from the back.
380380 attachStreamToClient (*client, pending_streams_.back ()->context ());
381- state_ .decrPendingStreams (1 );
381+ cluster_connectivity_state_ .decrPendingStreams (1 );
382382 pending_streams_.pop_back ();
383383 }
384384 if (!pending_streams_.empty ()) {
@@ -622,7 +622,7 @@ void ConnPoolImplBase::onConnectionEvent(ActiveClient& client, absl::string_view
622622 client.connect_timer_ ->disableTimer ();
623623 client.connect_timer_ .reset ();
624624
625- ASSERT (connecting_stream_capacity_ >= client.currentUnusedCapacity (), dumpState ());
625+ ENVOY_BUG (connecting_stream_capacity_ >= client.currentUnusedCapacity (), dumpState ());
626626 connecting_stream_capacity_ -= client.currentUnusedCapacity ();
627627 client.has_handshake_completed_ = true ;
628628 client.conn_connect_ms_ ->complete ();
@@ -691,7 +691,7 @@ void ConnPoolImplBase::purgePendingStreams(
691691 absl::string_view failure_reason, ConnectionPool::PoolFailureReason reason) {
692692 // NOTE: We move the existing pending streams to a temporary list. This is done so that
693693 // if retry logic submits a new stream to the pool, we don't fail it inline.
694- state_ .decrPendingStreams (pending_streams_.size ());
694+ cluster_connectivity_state_ .decrPendingStreams (pending_streams_.size ());
695695 pending_streams_to_purge_ = std::move (pending_streams_);
696696 while (!pending_streams_to_purge_.empty ()) {
697697 PendingStreamPtr stream =
@@ -703,7 +703,7 @@ void ConnPoolImplBase::purgePendingStreams(
703703
704704bool ConnPoolImplBase::connectingConnectionIsExcess (const ActiveClient& client) const {
705705 ASSERT (!client.hasHandshakeCompleted ());
706- ASSERT (connecting_stream_capacity_ >= client.currentUnusedCapacity (), dumpState ());
706+ ENVOY_BUG (connecting_stream_capacity_ >= client.currentUnusedCapacity (), dumpState ());
707707 // If perUpstreamPreconnectRatio is one, this simplifies to checking if there would still be
708708 // sufficient connecting stream capacity to serve all pending streams if the most recent client
709709 // were removed from the picture.
@@ -725,7 +725,7 @@ void ConnPoolImplBase::onPendingStreamCancel(PendingStream& stream,
725725 // and there is no need to call its onPoolFailure callback.
726726 stream.removeFromList (pending_streams_to_purge_);
727727 } else {
728- state_ .decrPendingStreams (1 );
728+ cluster_connectivity_state_ .decrPendingStreams (1 );
729729 stream.removeFromList (pending_streams_);
730730 }
731731 if (policy == Envoy::ConnectionPool::CancelPolicy::CloseExcess) {
@@ -760,7 +760,7 @@ void ConnPoolImplBase::decrConnectingAndConnectedStreamCapacity(uint32_t delta,
760760 if (!client.hasHandshakeCompleted ()) {
761761 // If still doing handshake, it is contributing to the local connecting stream capacity. Update
762762 // the capacity as well.
763- ASSERT (connecting_stream_capacity_ >= delta, dumpState ());
763+ ENVOY_BUG (connecting_stream_capacity_ >= delta, dumpState ());
764764 connecting_stream_capacity_ -= delta;
765765 }
766766}
@@ -796,7 +796,7 @@ void ConnPoolImplBase::onUpstreamReadyForEarlyData(ActiveClient& client) {
796796 if (stream.can_send_early_data_ ) {
797797 ENVOY_CONN_LOG (debug, " creating stream for early data." , client);
798798 attachStreamToClient (client, stream.context ());
799- state_ .decrPendingStreams (1 );
799+ cluster_connectivity_state_ .decrPendingStreams (1 );
800800 stream.removeFromList (pending_streams_);
801801 }
802802 if (stop_iteration) {
0 commit comments