Merge pull request #17803 from AspirinSJL/fix_hcc_segv

Attempt to fix internal segv
reviewable/pr17653/r6^2
Juanli Shen 6 years ago committed by GitHub
commit f233119d17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/core/ext/filters/client_channel/subchannel.cc

@ -236,6 +236,7 @@ class ConnectedSubchannelStateWatcher
GRPC_SUBCHANNEL_WEAK_UNREF(subchannel_, "state_watcher"); GRPC_SUBCHANNEL_WEAK_UNREF(subchannel_, "state_watcher");
} }
// Must be called while holding subchannel_->mu.
void Orphan() override { health_check_client_.reset(); } void Orphan() override { health_check_client_.reset(); }
private: private:
@ -302,12 +303,12 @@ class ConnectedSubchannelStateWatcher
static void OnHealthChanged(void* arg, grpc_error* error) { static void OnHealthChanged(void* arg, grpc_error* error) {
auto* self = static_cast<ConnectedSubchannelStateWatcher*>(arg); auto* self = static_cast<ConnectedSubchannelStateWatcher*>(arg);
grpc_subchannel* c = self->subchannel_;
MutexLock lock(&c->mu);
if (self->health_state_ == GRPC_CHANNEL_SHUTDOWN) { if (self->health_state_ == GRPC_CHANNEL_SHUTDOWN) {
self->Unref(); self->Unref();
return; return;
} }
grpc_subchannel* c = self->subchannel_;
MutexLock lock(&c->mu);
if (self->last_connectivity_state_ == GRPC_CHANNEL_READY) { if (self->last_connectivity_state_ == GRPC_CHANNEL_READY) {
grpc_connectivity_state_set(&c->state_and_health_tracker, grpc_connectivity_state_set(&c->state_and_health_tracker,
self->health_state_, GRPC_ERROR_REF(error), self->health_state_, GRPC_ERROR_REF(error),

Loading…
Cancel
Save