Merge pull request #17959 from yashykt/errortracing

Add error logging around GOAWAYs and chttp2 logging around keepalives
pull/17974/head
Yash Tibrewal 6 years ago committed by GitHub
commit c79a632c6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc

@ -1119,9 +1119,6 @@ static void queue_setting_update(grpc_chttp2_transport* t,
void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t, void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
uint32_t goaway_error, uint32_t goaway_error,
grpc_slice goaway_text) { grpc_slice goaway_text) {
// GRPC_CHTTP2_IF_TRACING(
// gpr_log(GPR_INFO, "got goaway [%d]: %s", goaway_error, msg));
// Discard the error from a previous goaway frame (if any) // Discard the error from a previous goaway frame (if any)
if (t->goaway_error != GRPC_ERROR_NONE) { if (t->goaway_error != GRPC_ERROR_NONE) {
GRPC_ERROR_UNREF(t->goaway_error); GRPC_ERROR_UNREF(t->goaway_error);
@ -1132,6 +1129,10 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
GRPC_ERROR_INT_HTTP2_ERROR, static_cast<intptr_t>(goaway_error)), GRPC_ERROR_INT_HTTP2_ERROR, static_cast<intptr_t>(goaway_error)),
GRPC_ERROR_STR_RAW_BYTES, goaway_text); GRPC_ERROR_STR_RAW_BYTES, goaway_text);
/* We want to log this irrespective of whether http tracing is enabled */
gpr_log(GPR_INFO, "%s: Got goaway [%d] err=%s", t->peer_string, goaway_error,
grpc_error_string(t->goaway_error));
/* When a client receives a GOAWAY with error code ENHANCE_YOUR_CALM and debug /* When a client receives a GOAWAY with error code ENHANCE_YOUR_CALM and debug
* data equal to "too_many_pings", it should log the occurrence at a log level * data equal to "too_many_pings", it should log the occurrence at a log level
* that is enabled by default and double the configured KEEPALIVE_TIME used * that is enabled by default and double the configured KEEPALIVE_TIME used
@ -1774,6 +1775,9 @@ void grpc_chttp2_ack_ping(grpc_chttp2_transport* t, uint64_t id) {
} }
static void send_goaway(grpc_chttp2_transport* t, grpc_error* error) { static void send_goaway(grpc_chttp2_transport* t, grpc_error* error) {
/* We want to log this irrespective of whether http tracing is enabled */
gpr_log(GPR_INFO, "%s: Sending goaway err=%s", t->peer_string,
grpc_error_string(error));
t->sent_goaway_state = GRPC_CHTTP2_GOAWAY_SEND_SCHEDULED; t->sent_goaway_state = GRPC_CHTTP2_GOAWAY_SEND_SCHEDULED;
grpc_http2_error_code http_error; grpc_http2_error_code http_error;
grpc_slice slice; grpc_slice slice;
@ -2723,6 +2727,9 @@ static void start_keepalive_ping_locked(void* arg, grpc_error* error) {
if (t->channelz_socket != nullptr) { if (t->channelz_socket != nullptr) {
t->channelz_socket->RecordKeepaliveSent(); t->channelz_socket->RecordKeepaliveSent();
} }
if (grpc_http_trace.enabled()) {
gpr_log(GPR_INFO, "%s: Start keepalive ping", t->peer_string);
}
GRPC_CHTTP2_REF_TRANSPORT(t, "keepalive watchdog"); GRPC_CHTTP2_REF_TRANSPORT(t, "keepalive watchdog");
grpc_timer_init(&t->keepalive_watchdog_timer, grpc_timer_init(&t->keepalive_watchdog_timer,
grpc_core::ExecCtx::Get()->Now() + t->keepalive_timeout, grpc_core::ExecCtx::Get()->Now() + t->keepalive_timeout,
@ -2733,6 +2740,9 @@ static void finish_keepalive_ping_locked(void* arg, grpc_error* error) {
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg); grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) { if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) {
if (error == GRPC_ERROR_NONE) { if (error == GRPC_ERROR_NONE) {
if (grpc_http_trace.enabled()) {
gpr_log(GPR_INFO, "%s: Finish keepalive ping", t->peer_string);
}
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_WAITING; t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_WAITING;
grpc_timer_cancel(&t->keepalive_watchdog_timer); grpc_timer_cancel(&t->keepalive_watchdog_timer);
GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping"); GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
@ -2748,6 +2758,8 @@ static void keepalive_watchdog_fired_locked(void* arg, grpc_error* error) {
grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg); grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(arg);
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) { if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) {
if (error == GRPC_ERROR_NONE) { if (error == GRPC_ERROR_NONE) {
gpr_log(GPR_ERROR, "%s: Keepalive watchdog fired. Closing transport.",
t->peer_string);
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DYING; t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DYING;
close_transport_locked( close_transport_locked(
t, grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING( t, grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(

Loading…
Cancel
Save