diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index 73235756dfb6af213104efc46ee74d8acc9e77a9..5f5c480f9dc31662988ab38a69db4aeca8a35e53 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -2465,6 +2465,13 @@ static void cancel_stream_cb(void* user_data, uint32_t key, void* stream) { } static void end_all_the_calls(grpc_chttp2_transport* t, grpc_error* error) { + intptr_t http2_error; + // If there is no explicit grpc or HTTP/2 error, set to UNAVAILABLE on server. + if (!t->is_client && !grpc_error_has_clear_grpc_status(error) && + !grpc_error_get_int(error, GRPC_ERROR_INT_HTTP2_ERROR, &http2_error)) { + error = grpc_error_set_int(error, GRPC_ERROR_INT_GRPC_STATUS, + GRPC_STATUS_UNAVAILABLE); + } cancel_stream_cb_args args = {error, t}; grpc_chttp2_stream_map_for_each(&t->stream_map, cancel_stream_cb, &args); GRPC_ERROR_UNREF(error); diff --git a/test/core/end2end/tests/max_connection_age.cc b/test/core/end2end/tests/max_connection_age.cc index fcb0aaffc4abad842ae2f97da4b5e25c876ef923..50c790d8521d2d4592a41ccec22ae2933e4f9ca1 100644 --- a/test/core/end2end/tests/max_connection_age.cc +++ b/test/core/end2end/tests/max_connection_age.cc @@ -204,7 +204,7 @@ static void test_max_age_forcibly_close(grpc_end2end_test_config config) { /* The connection should be closed immediately after the max age grace period, the in-progress RPC should fail. */ - GPR_ASSERT(status == GRPC_STATUS_INTERNAL); + GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); GPR_ASSERT(was_cancelled == 1); diff --git a/test/core/end2end/tests/shutdown_finishes_calls.cc b/test/core/end2end/tests/shutdown_finishes_calls.cc index 5dd5bb2ad6c29386bf48eb164da11cedf31ae283..60b738ef9ef1bb5a62518cde01845cb32e25ab7a 100644 --- a/test/core/end2end/tests/shutdown_finishes_calls.cc +++ b/test/core/end2end/tests/shutdown_finishes_calls.cc @@ -166,9 +166,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( grpc_server_destroy(f.server); - // new code should give INTERNAL, some older code will give UNAVAILABLE - GPR_ASSERT(status == GRPC_STATUS_INTERNAL || - status == GRPC_STATUS_UNAVAILABLE); + GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); GPR_ASSERT(was_cancelled == 1);