diff options
Diffstat (limited to 'src')
85 files changed, 705 insertions, 354 deletions
diff --git a/src/compiler/csharp_generator.cc b/src/compiler/csharp_generator.cc index ab4a8a6aa3..bc3b0f24cd 100644 --- a/src/compiler/csharp_generator.cc +++ b/src/compiler/csharp_generator.cc @@ -670,6 +670,7 @@ grpc::string GetServices(const FileDescriptor *file, bool generate_client, out.Print(leading_comments.c_str()); } + out.Print("#pragma warning disable 1591\n"); out.Print("#region Designer generated code\n"); out.Print("\n"); out.Print("using System;\n"); diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 2024e5a1a2..831301ddef 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -304,10 +304,10 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, keepalive_watchdog_fired_locked, t, grpc_combiner_scheduler(t->combiner)); - grpc_bdp_estimator_init(&t->bdp_estimator, t->peer_string); - t->last_pid_update = gpr_now(GPR_CLOCK_MONOTONIC); + grpc_bdp_estimator_init(&t->flow_control.bdp_estimator, t->peer_string); + t->flow_control.last_pid_update = gpr_now(GPR_CLOCK_MONOTONIC); grpc_pid_controller_init( - &t->pid_controller, + &t->flow_control.pid_controller, (grpc_pid_controller_args){.gain_p = 4, .gain_i = 8, .gain_d = 0, @@ -340,7 +340,7 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, t->force_send_settings = 1 << GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE; t->sent_local_settings = 0; t->write_buffer_size = DEFAULT_WINDOW; - t->enable_bdp_probe = true; + t->flow_control.enable_bdp_probe = true; if (is_client) { grpc_slice_buffer_add(&t->outbuf, grpc_slice_from_copied_string( @@ -457,7 +457,7 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, (grpc_integer_options){0, 0, MAX_WRITE_BUFFER_SIZE}); } else if (0 == strcmp(channel_args->args[i].key, GRPC_ARG_HTTP2_BDP_PROBE)) { - t->enable_bdp_probe = grpc_channel_arg_get_integer( + t->flow_control.enable_bdp_probe = grpc_channel_arg_get_integer( &channel_args->args[i], (grpc_integer_options){1, 0, 1}); } else if (0 == strcmp(channel_args->args[i].key, GRPC_ARG_KEEPALIVE_TIME_MS)) { @@ -2262,46 +2262,27 @@ void grpc_chttp2_act_on_flowctl_action(grpc_exec_ctx *exec_ctx, case GRPC_CHTTP2_FLOWCTL_QUEUE_UPDATE: break; } -} - -static void update_bdp(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, - double bdp_dbl) { - // initial window size bounded [1,2^31-1], but we set the min to 128. - int32_t bdp = GPR_CLAMP((int32_t)bdp_dbl, 128, INT32_MAX); - int64_t delta = - (int64_t)bdp - - (int64_t)t->settings[GRPC_LOCAL_SETTINGS] - [GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE]; - if (delta == 0 || (delta > -bdp / 10 && delta < bdp / 10)) { - return; - } - if (GRPC_TRACER_ON(grpc_bdp_estimator_trace) || - GRPC_TRACER_ON(grpc_flowctl_trace)) { - gpr_log(GPR_DEBUG, "%s | %p[%s] | update initial window size to %d", - t->peer_string, t, t->is_client ? "cli" : "svr", (int)bdp); - } - queue_setting_update(exec_ctx, t, GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, - (uint32_t)bdp); -} - -static void update_frame(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, - double bw_dbl, double bdp_dbl) { - int32_t bdp = (int32_t)GPR_CLAMP(bdp_dbl, 128.0, INT32_MAX); - int32_t target = (int32_t)GPR_MAX(bw_dbl / 1000, bdp); - // frame size is bounded [2^14,2^24-1] - int32_t frame_size = GPR_CLAMP(target, 16384, 16777215); - int64_t delta = (int64_t)frame_size - - (int64_t)t->settings[GRPC_LOCAL_SETTINGS] - [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE]; - if (delta == 0 || (delta > -frame_size / 10 && delta < frame_size / 10)) { - return; + if (action.send_setting_update != GRPC_CHTTP2_FLOWCTL_NO_ACTION_NEEDED) { + if (action.initial_window_size > 0) { + queue_setting_update(exec_ctx, t, + GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, + (uint32_t)action.initial_window_size); + } + if (action.max_frame_size > 0) { + queue_setting_update(exec_ctx, t, GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE, + (uint32_t)action.max_frame_size); + } + if (action.send_setting_update == GRPC_CHTTP2_FLOWCTL_UPDATE_IMMEDIATELY) { + grpc_chttp2_initiate_write(exec_ctx, t, "immediate setting update"); + } } - if (GRPC_TRACER_ON(grpc_bdp_estimator_trace)) { - gpr_log(GPR_DEBUG, "%s: update max_frame size to %d", t->peer_string, - (int)frame_size); + if (action.need_ping) { + GRPC_CHTTP2_REF_TRANSPORT(t, "bdp_ping"); + grpc_bdp_estimator_schedule_ping(&t->flow_control.bdp_estimator); + send_ping_locked(exec_ctx, t, + GRPC_CHTTP2_PING_BEFORE_TRANSPORT_WINDOW_UPDATE, + &t->start_bdp_ping_locked, &t->finish_bdp_ping_locked); } - queue_setting_update(exec_ctx, t, GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE, - (uint32_t)frame_size); } static grpc_error *try_http_parsing(grpc_exec_ctx *exec_ctx, @@ -2339,7 +2320,6 @@ static void read_action_locked(grpc_exec_ctx *exec_ctx, void *tp, GPR_TIMER_BEGIN("reading_action_locked", 0); grpc_chttp2_transport *t = tp; - bool need_bdp_ping = false; GRPC_ERROR_REF(error); @@ -2358,11 +2338,9 @@ static void read_action_locked(grpc_exec_ctx *exec_ctx, void *tp, grpc_error *errors[3] = {GRPC_ERROR_REF(error), GRPC_ERROR_NONE, GRPC_ERROR_NONE}; for (; i < t->read_buffer.count && errors[1] == GRPC_ERROR_NONE; i++) { - if (grpc_bdp_estimator_add_incoming_bytes( - &t->bdp_estimator, - (int64_t)GRPC_SLICE_LENGTH(t->read_buffer.slices[i]))) { - need_bdp_ping = true; - } + grpc_bdp_estimator_add_incoming_bytes( + &t->flow_control.bdp_estimator, + (int64_t)GRPC_SLICE_LENGTH(t->read_buffer.slices[i])); errors[1] = grpc_chttp2_perform_read(exec_ctx, t, t->read_buffer.slices[i]); } @@ -2409,45 +2387,9 @@ static void read_action_locked(grpc_exec_ctx *exec_ctx, void *tp, if (keep_reading) { grpc_endpoint_read(exec_ctx, t->ep, &t->read_buffer, &t->read_action_locked); - - if (t->enable_bdp_probe) { - if (need_bdp_ping) { - GRPC_CHTTP2_REF_TRANSPORT(t, "bdp_ping"); - grpc_bdp_estimator_schedule_ping(&t->bdp_estimator); - send_ping_locked(exec_ctx, t, - GRPC_CHTTP2_PING_BEFORE_TRANSPORT_WINDOW_UPDATE, - &t->start_bdp_ping_locked, &t->finish_bdp_ping_locked); - } - - int64_t estimate = -1; - double bdp_guess = -1; - if (grpc_bdp_estimator_get_estimate(&t->bdp_estimator, &estimate)) { - double target = 1 + log2((double)estimate); - double memory_pressure = grpc_resource_quota_get_memory_pressure( - grpc_resource_user_quota(grpc_endpoint_get_resource_user(t->ep))); - if (memory_pressure > 0.8) { - target *= 1 - GPR_MIN(1, (memory_pressure - 0.8) / 0.1); - } - double bdp_error = - target - grpc_pid_controller_last(&t->pid_controller); - gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC); - gpr_timespec dt_timespec = gpr_time_sub(now, t->last_pid_update); - double dt = (double)dt_timespec.tv_sec + dt_timespec.tv_nsec * 1e-9; - if (dt > 0.1) { - dt = 0.1; - } - double log2_bdp_guess = - grpc_pid_controller_update(&t->pid_controller, bdp_error, dt); - bdp_guess = pow(2, log2_bdp_guess); - update_bdp(exec_ctx, t, bdp_guess); - t->last_pid_update = now; - } - - double bw = -1; - if (grpc_bdp_estimator_get_bw(&t->bdp_estimator, &bw)) { - update_frame(exec_ctx, t, bw, bdp_guess); - } - } + grpc_chttp2_act_on_flowctl_action( + exec_ctx, grpc_chttp2_flowctl_get_bdp_action(&t->flow_control), t, + NULL); GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "keep_reading"); } else { GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "reading_action"); @@ -2470,7 +2412,7 @@ static void start_bdp_ping_locked(grpc_exec_ctx *exec_ctx, void *tp, if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING) { grpc_timer_cancel(exec_ctx, &t->keepalive_ping_timer); } - grpc_bdp_estimator_start_ping(&t->bdp_estimator); + grpc_bdp_estimator_start_ping(&t->flow_control.bdp_estimator); } static void finish_bdp_ping_locked(grpc_exec_ctx *exec_ctx, void *tp, @@ -2479,7 +2421,7 @@ static void finish_bdp_ping_locked(grpc_exec_ctx *exec_ctx, void *tp, if (GRPC_TRACER_ON(grpc_http_trace)) { gpr_log(GPR_DEBUG, "%s: Complete BDP ping", t->peer_string); } - grpc_bdp_estimator_complete_ping(&t->bdp_estimator); + grpc_bdp_estimator_complete_ping(&t->flow_control.bdp_estimator); GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "bdp_ping"); } diff --git a/src/core/ext/transport/chttp2/transport/flow_control.c b/src/core/ext/transport/chttp2/transport/flow_control.c index c9f7eabd43..8dbdd1290a 100644 --- a/src/core/ext/transport/chttp2/transport/flow_control.c +++ b/src/core/ext/transport/chttp2/transport/flow_control.c @@ -18,6 +18,7 @@ #include "src/core/ext/transport/chttp2/transport/internal.h" +#include <math.h> #include <string.h> #include <grpc/support/alloc.h> @@ -39,6 +40,8 @@ typedef struct { int64_t remote_window_delta; int64_t local_window_delta; int64_t announced_window_delta; + uint32_t local_init_window; + uint32_t local_max_frame; } shadow_flow_control; static void pretrace(shadow_flow_control* shadow_fc, @@ -54,14 +57,28 @@ static void pretrace(shadow_flow_control* shadow_fc, } } -static char* fmt_str(int64_t old, int64_t new) { +#define TRACE_PADDING 30 + +static char* fmt_int64_diff_str(int64_t old, int64_t new) { char* str; if (old != new) { gpr_asprintf(&str, "%" PRId64 " -> %" PRId64 "", old, new); } else { gpr_asprintf(&str, "%" PRId64 "", old); } - char* str_lp = gpr_leftpad(str, ' ', 30); + char* str_lp = gpr_leftpad(str, ' ', TRACE_PADDING); + gpr_free(str); + return str_lp; +} + +static char* fmt_uint32_diff_str(uint32_t old, uint32_t new) { + char* str; + if (new > 0 && old != new) { + gpr_asprintf(&str, "%" PRIu32 " -> %" PRIu32 "", old, new); + } else { + gpr_asprintf(&str, "%" PRIu32 "", old); + } + char* str_lp = gpr_leftpad(str, ' ', TRACE_PADDING); gpr_free(str); return str_lp; } @@ -75,24 +92,28 @@ static void posttrace(shadow_flow_control* shadow_fc, uint32_t remote_window = tfc->t->settings[GRPC_PEER_SETTINGS] [GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE]; - char* trw_str = fmt_str(shadow_fc->remote_window, tfc->remote_window); - char* tlw_str = fmt_str(shadow_fc->target_window, - grpc_chttp2_target_announced_window(tfc)); - char* taw_str = fmt_str(shadow_fc->announced_window, tfc->announced_window); + char* trw_str = + fmt_int64_diff_str(shadow_fc->remote_window, tfc->remote_window); + char* tlw_str = fmt_int64_diff_str(shadow_fc->target_window, + grpc_chttp2_target_announced_window(tfc)); + char* taw_str = + fmt_int64_diff_str(shadow_fc->announced_window, tfc->announced_window); char* srw_str; char* slw_str; char* saw_str; if (sfc != NULL) { - srw_str = fmt_str(shadow_fc->remote_window_delta + remote_window, - sfc->remote_window_delta + remote_window); - slw_str = fmt_str(shadow_fc->local_window_delta + acked_local_window, - sfc->local_window_delta + acked_local_window); - saw_str = fmt_str(shadow_fc->announced_window_delta + acked_local_window, - sfc->announced_window_delta + acked_local_window); + srw_str = fmt_int64_diff_str(shadow_fc->remote_window_delta + remote_window, + sfc->remote_window_delta + remote_window); + slw_str = + fmt_int64_diff_str(shadow_fc->local_window_delta + acked_local_window, + sfc->local_window_delta + acked_local_window); + saw_str = fmt_int64_diff_str( + shadow_fc->announced_window_delta + acked_local_window, + sfc->announced_window_delta + acked_local_window); } else { - srw_str = gpr_leftpad("", ' ', 30); - slw_str = gpr_leftpad("", ' ', 30); - saw_str = gpr_leftpad("", ' ', 30); + srw_str = gpr_leftpad("", ' ', TRACE_PADDING); + slw_str = gpr_leftpad("", ' ', TRACE_PADDING); + saw_str = gpr_leftpad("", ' ', TRACE_PADDING); } gpr_log(GPR_DEBUG, "%p[%u][%s] | %s | trw:%s, ttw:%s, taw:%s, srw:%s, slw:%s, saw:%s", @@ -120,10 +141,21 @@ static char* urgency_to_string(grpc_chttp2_flowctl_urgency urgency) { GPR_UNREACHABLE_CODE(return "unknown"); } -static void trace_action(grpc_chttp2_flowctl_action action) { - gpr_log(GPR_DEBUG, "transport: %s, stream: %s", +static void trace_action(grpc_chttp2_transport_flowctl* tfc, + grpc_chttp2_flowctl_action action) { + char* iw_str = fmt_uint32_diff_str( + tfc->t->settings[GRPC_SENT_SETTINGS] + [GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE], + action.initial_window_size); + char* mf_str = fmt_uint32_diff_str( + tfc->t->settings[GRPC_SENT_SETTINGS][GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], + action.max_frame_size); + gpr_log(GPR_DEBUG, "t[%s], s[%s], settings[%s] iw:%s mf:%s", urgency_to_string(action.send_transport_update), - urgency_to_string(action.send_stream_update)); + urgency_to_string(action.send_stream_update), + urgency_to_string(action.send_setting_update), iw_str, mf_str); + gpr_free(iw_str); + gpr_free(mf_str); } #define PRETRACE(tfc, sfc) \ @@ -131,11 +163,12 @@ static void trace_action(grpc_chttp2_flowctl_action action) { GRPC_FLOW_CONTROL_IF_TRACING(pretrace(&shadow_fc, tfc, sfc)) #define POSTTRACE(tfc, sfc, reason) \ GRPC_FLOW_CONTROL_IF_TRACING(posttrace(&shadow_fc, tfc, sfc, reason)) -#define TRACEACTION(action) GRPC_FLOW_CONTROL_IF_TRACING(trace_action(action)) +#define TRACEACTION(tfc, action) \ + GRPC_FLOW_CONTROL_IF_TRACING(trace_action(tfc, action)) #else #define PRETRACE(tfc, sfc) #define POSTTRACE(tfc, sfc, reason) -#define TRACEACTION(action) +#define TRACEACTION(tfc, action) #endif /* How many bytes of incoming flow control would we like to advertise */ @@ -342,15 +375,58 @@ void grpc_chttp2_flowctl_destroy_stream(grpc_chttp2_transport_flowctl* tfc, announced_window_delta_preupdate(tfc, sfc); } +// Returns an urgency with which to make an update +static grpc_chttp2_flowctl_urgency delta_is_significant( + const grpc_chttp2_transport_flowctl* tfc, int32_t value, + grpc_chttp2_setting_id setting_id) { + int64_t delta = (int64_t)value - + (int64_t)tfc->t->settings[GRPC_LOCAL_SETTINGS][setting_id]; + // TODO(ncteisen): tune this + if (delta != 0 && (delta <= -value / 5 || delta >= value / 5)) { + return GRPC_CHTTP2_FLOWCTL_QUEUE_UPDATE; + } else { + return GRPC_CHTTP2_FLOWCTL_NO_ACTION_NEEDED; + } +} + +// Takes in a target and uses the pid controller to return a stabilized +// guess at the new bdp. +static double get_pid_controller_guess(grpc_chttp2_transport_flowctl* tfc, + double target) { + double bdp_error = target - grpc_pid_controller_last(&tfc->pid_controller); + gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC); + gpr_timespec dt_timespec = gpr_time_sub(now, tfc->last_pid_update); + double dt = (double)dt_timespec.tv_sec + dt_timespec.tv_nsec * 1e-9; + if (dt > 0.1) { + dt = 0.1; + } + double log2_bdp_guess = + grpc_pid_controller_update(&tfc->pid_controller, bdp_error, dt); + tfc->last_pid_update = now; + return pow(2, log2_bdp_guess); +} + +// Take in a target and modifies it based on the memory pressure of the system +static double get_target_under_memory_pressure( + grpc_chttp2_transport_flowctl* tfc, double target) { + // do not increase window under heavy memory pressure. + double memory_pressure = grpc_resource_quota_get_memory_pressure( + grpc_resource_user_quota(grpc_endpoint_get_resource_user(tfc->t->ep))); + if (memory_pressure > 0.8) { + target *= 1 - GPR_MIN(1, (memory_pressure - 0.8) / 0.1); + } + return target; +} + grpc_chttp2_flowctl_action grpc_chttp2_flowctl_get_action( - const grpc_chttp2_transport_flowctl* tfc, - const grpc_chttp2_stream_flowctl* sfc) { + grpc_chttp2_transport_flowctl* tfc, grpc_chttp2_stream_flowctl* sfc) { grpc_chttp2_flowctl_action action; memset(&action, 0, sizeof(action)); uint32_t target_announced_window = grpc_chttp2_target_announced_window(tfc); if (tfc->announced_window < target_announced_window / 2) { action.send_transport_update = GRPC_CHTTP2_FLOWCTL_UPDATE_IMMEDIATELY; } + // TODO(ncteisen): tune this if (sfc != NULL && !sfc->s->read_closed) { uint32_t sent_init_window = tfc->t->settings[GRPC_SENT_SETTINGS] @@ -364,6 +440,61 @@ grpc_chttp2_flowctl_action grpc_chttp2_flowctl_get_action( action.send_stream_update = GRPC_CHTTP2_FLOWCTL_QUEUE_UPDATE; } } - TRACEACTION(action); + TRACEACTION(tfc, action); + return action; +} + +grpc_chttp2_flowctl_action grpc_chttp2_flowctl_get_bdp_action( + grpc_chttp2_transport_flowctl* tfc) { + grpc_chttp2_flowctl_action action; + memset(&action, 0, sizeof(action)); + if (tfc->enable_bdp_probe) { + action.need_ping = grpc_bdp_estimator_need_ping(&tfc->bdp_estimator); + + // get bdp estimate and update initial_window accordingly. + int64_t estimate = -1; + int32_t bdp = -1; + if (grpc_bdp_estimator_get_estimate(&tfc->bdp_estimator, &estimate)) { + double target = 1 + log2((double)estimate); + + // target might change based on how much memory pressure we are under + // TODO(ncteisen): experiment with setting target to be huge under low + // memory pressure. + target = get_target_under_memory_pressure(tfc, target); + + // run our target through the pid controller to stabilize change. + // TODO(ncteisen): experiment with other controllers here. + double bdp_guess = get_pid_controller_guess(tfc, target); + + // Though initial window 'could' drop to 0, we keep the floor at 128 + bdp = GPR_MAX((int32_t)bdp_guess, 128); + + grpc_chttp2_flowctl_urgency init_window_update_urgency = + delta_is_significant(tfc, bdp, + GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE); + if (init_window_update_urgency != GRPC_CHTTP2_FLOWCTL_NO_ACTION_NEEDED) { + action.send_setting_update = init_window_update_urgency; + action.initial_window_size = (uint32_t)bdp; + } + } + + // get bandwidth estimate and update max_frame accordingly. + double bw_dbl = -1; + if (grpc_bdp_estimator_get_bw(&tfc->bdp_estimator, &bw_dbl)) { + // we target the max of BDP or bandwidth in microseconds. + int32_t frame_size = + GPR_CLAMP(GPR_MAX((int32_t)bw_dbl / 1000, bdp), 16384, 16777215); + grpc_chttp2_flowctl_urgency frame_size_urgency = delta_is_significant( + tfc, frame_size, GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE); + if (frame_size_urgency != GRPC_CHTTP2_FLOWCTL_NO_ACTION_NEEDED) { + if (frame_size_urgency > action.send_setting_update) { + action.send_setting_update = frame_size_urgency; + } + action.max_frame_size = (uint32_t)frame_size; + } + } + } + + TRACEACTION(tfc, action); return action; } diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index f26f14dbec..3c41a8958f 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -238,7 +238,17 @@ typedef struct { * to send WINDOW_UPDATE frames. */ int64_t announced_window; - // read only pointer back to transport for certain data + /** should we probe bdp? */ + bool enable_bdp_probe; + + /* bdp estimation */ + grpc_bdp_estimator bdp_estimator; + + /* pid controller */ + grpc_pid_controller pid_controller; + gpr_timespec last_pid_update; + + // pointer back to transport for tracing const grpc_chttp2_transport *t; } grpc_chttp2_transport_flowctl; @@ -261,9 +271,6 @@ struct grpc_chttp2_transport { /** is there a read request to the endpoint outstanding? */ uint8_t endpoint_reading; - /** should we probe bdp? */ - bool enable_bdp_probe; - grpc_chttp2_optimization_target opt_target; /** various lists of streams */ @@ -358,13 +365,6 @@ struct grpc_chttp2_transport { grpc_chttp2_transport_flowctl flow_control; - /* bdp estimation */ - grpc_bdp_estimator bdp_estimator; - - /* pid controller */ - grpc_pid_controller pid_controller; - gpr_timespec last_pid_update; - /* deframing */ grpc_chttp2_deframe_transport_state deframe_state; uint8_t incoming_frame_type; @@ -704,13 +704,19 @@ typedef enum { typedef struct { grpc_chttp2_flowctl_urgency send_stream_update; grpc_chttp2_flowctl_urgency send_transport_update; + grpc_chttp2_flowctl_urgency send_setting_update; + uint32_t initial_window_size; + uint32_t max_frame_size; + bool need_ping; } grpc_chttp2_flowctl_action; // Reads the flow control data and returns and actionable struct that will tell // chttp2 exactly what it needs to do grpc_chttp2_flowctl_action grpc_chttp2_flowctl_get_action( - const grpc_chttp2_transport_flowctl *tfc, - const grpc_chttp2_stream_flowctl *sfc); + grpc_chttp2_transport_flowctl *tfc, grpc_chttp2_stream_flowctl *sfc); + +grpc_chttp2_flowctl_action grpc_chttp2_flowctl_get_bdp_action( + grpc_chttp2_transport_flowctl *tfc); // Takes in a flow control action and performs all the needed operations. void grpc_chttp2_act_on_flowctl_action(grpc_exec_ctx *exec_ctx, diff --git a/src/core/lib/iomgr/ev_epoll1_linux.c b/src/core/lib/iomgr/ev_epoll1_linux.c index 90e0ce36cd..6b034ca960 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.c +++ b/src/core/lib/iomgr/ev_epoll1_linux.c @@ -406,7 +406,14 @@ static void pollset_init(grpc_pollset *pollset, gpr_mu **mu) { gpr_mu_init(&pollset->mu); *mu = &pollset->mu; pollset->neighbourhood = &g_neighbourhoods[choose_neighbourhood()]; + pollset->reassigning_neighbourhood = false; + pollset->root_worker = NULL; + pollset->kicked_without_poller = false; pollset->seen_inactive = true; + pollset->shutting_down = false; + pollset->shutdown_closure = NULL; + pollset->begin_refs = 0; + pollset->next = pollset->prev = NULL; } static void pollset_destroy(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset) { @@ -1043,8 +1050,6 @@ static const grpc_event_engine_vtable vtable = { /* It is possible that GLIBC has epoll but the underlying kernel doesn't. * Create a dummy epoll_fd to make sure epoll support is available */ const grpc_event_engine_vtable *grpc_init_epoll1_linux(bool explicit_request) { - /* TODO(sreek): Temporarily disable this poller unless explicitly requested - * via GRPC_POLL_STRATEGY */ if (!explicit_request) { return NULL; } diff --git a/src/core/lib/security/credentials/jwt/jwt_verifier.c b/src/core/lib/security/credentials/jwt/jwt_verifier.c index 6cd558d123..a27284bc50 100644 --- a/src/core/lib/security/credentials/jwt/jwt_verifier.c +++ b/src/core/lib/security/credentials/jwt/jwt_verifier.c @@ -442,7 +442,7 @@ static EVP_PKEY *extract_pkey_from_x509(const char *x509_str) { end: BIO_free(bio); - if (x509 != NULL) X509_free(x509); + X509_free(x509); return result; } @@ -496,6 +496,8 @@ static EVP_PKEY *pkey_from_jwk(grpc_exec_ctx *exec_ctx, const grpc_json *json, const grpc_json *key_prop; RSA *rsa = NULL; EVP_PKEY *result = NULL; + BIGNUM *tmp_n = NULL; + BIGNUM *tmp_e = NULL; GPR_ASSERT(kty != NULL && json != NULL); if (strcmp(kty, "RSA") != 0) { @@ -507,8 +509,6 @@ static EVP_PKEY *pkey_from_jwk(grpc_exec_ctx *exec_ctx, const grpc_json *json, gpr_log(GPR_ERROR, "Could not create rsa key."); goto end; } - BIGNUM *tmp_n = NULL; - BIGNUM *tmp_e = NULL; for (key_prop = json->child; key_prop != NULL; key_prop = key_prop->next) { if (strcmp(key_prop->key, "n") == 0) { tmp_n = @@ -528,11 +528,16 @@ static EVP_PKEY *pkey_from_jwk(grpc_exec_ctx *exec_ctx, const grpc_json *json, gpr_log(GPR_ERROR, "Cannot set RSA key from inputs."); goto end; } + /* RSA_set0_key takes ownership on success. */ + tmp_n = NULL; + tmp_e = NULL; result = EVP_PKEY_new(); EVP_PKEY_set1_RSA(result, rsa); /* uprefs rsa. */ end: - if (rsa != NULL) RSA_free(rsa); + RSA_free(rsa); + BN_free(tmp_n); + BN_free(tmp_e); return result; } @@ -618,7 +623,7 @@ static int verify_jwt_signature(EVP_PKEY *key, const char *alg, result = 1; end: - if (md_ctx != NULL) EVP_MD_CTX_destroy(md_ctx); + EVP_MD_CTX_destroy(md_ctx); return result; } @@ -658,7 +663,7 @@ static void on_keys_retrieved(grpc_exec_ctx *exec_ctx, void *user_data, end: if (json != NULL) grpc_json_destroy(json); - if (verification_key != NULL) EVP_PKEY_free(verification_key); + EVP_PKEY_free(verification_key); ctx->user_cb(exec_ctx, ctx->user_data, status, claims); verifier_cb_ctx_destroy(exec_ctx, ctx); } diff --git a/src/core/lib/security/credentials/oauth2/oauth2_credentials.c b/src/core/lib/security/credentials/oauth2/oauth2_credentials.c index c59e55136c..10b270c49c 100644 --- a/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +++ b/src/core/lib/security/credentials/oauth2/oauth2_credentials.c @@ -296,10 +296,10 @@ static bool oauth2_token_fetcher_get_request_metadata( gpr_mu_unlock(&c->mu); if (start_fetch) { grpc_call_credentials_ref(creds); - c->fetch_func(exec_ctx, grpc_credentials_metadata_request_create(creds), - &c->httpcli_context, &c->pollent, - on_oauth2_token_fetcher_http_response, - gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), refresh_threshold)); + c->fetch_func( + exec_ctx, grpc_credentials_metadata_request_create(creds), + &c->httpcli_context, &c->pollent, on_oauth2_token_fetcher_http_response, + gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), refresh_threshold)); } return false; } diff --git a/src/core/lib/surface/version.c b/src/core/lib/surface/version.c index 8cef15da80..96c16105e7 100644 --- a/src/core/lib/surface/version.c +++ b/src/core/lib/surface/version.c @@ -23,4 +23,4 @@ const char *grpc_version_string(void) { return "4.0.0-dev"; } -const char *grpc_g_stands_for(void) { return "gregarious"; } +const char *grpc_g_stands_for(void) { return "gambit"; } diff --git a/src/core/lib/transport/bdp_estimator.c b/src/core/lib/transport/bdp_estimator.c index 311ae6390d..8b57693413 100644 --- a/src/core/lib/transport/bdp_estimator.c +++ b/src/core/lib/transport/bdp_estimator.c @@ -33,20 +33,24 @@ void grpc_bdp_estimator_init(grpc_bdp_estimator *estimator, const char *name) { estimator->bw_est = 0; } -bool grpc_bdp_estimator_get_estimate(grpc_bdp_estimator *estimator, +bool grpc_bdp_estimator_get_estimate(const grpc_bdp_estimator *estimator, int64_t *estimate) { *estimate = estimator->estimate; return true; } -bool grpc_bdp_estimator_get_bw(grpc_bdp_estimator *estimator, double *bw) { +bool grpc_bdp_estimator_get_bw(const grpc_bdp_estimator *estimator, + double *bw) { *bw = estimator->bw_est; return true; } -bool grpc_bdp_estimator_add_incoming_bytes(grpc_bdp_estimator *estimator, +void grpc_bdp_estimator_add_incoming_bytes(grpc_bdp_estimator *estimator, int64_t num_bytes) { estimator->accumulator += num_bytes; +} + +bool grpc_bdp_estimator_need_ping(const grpc_bdp_estimator *estimator) { switch (estimator->ping_state) { case GRPC_BDP_PING_UNSCHEDULED: return true; diff --git a/src/core/lib/transport/bdp_estimator.h b/src/core/lib/transport/bdp_estimator.h index a232d1f87f..1ef0dc99dd 100644 --- a/src/core/lib/transport/bdp_estimator.h +++ b/src/core/lib/transport/bdp_estimator.h @@ -47,13 +47,15 @@ typedef struct grpc_bdp_estimator { void grpc_bdp_estimator_init(grpc_bdp_estimator *estimator, const char *name); // Returns true if a reasonable estimate could be obtained -bool grpc_bdp_estimator_get_estimate(grpc_bdp_estimator *estimator, +bool grpc_bdp_estimator_get_estimate(const grpc_bdp_estimator *estimator, int64_t *estimate); -// Returns true if a reasonable estimate could be obtained -bool grpc_bdp_estimator_get_bw(grpc_bdp_estimator *estimator, double *bw); +// Tracks new bytes read. +bool grpc_bdp_estimator_get_bw(const grpc_bdp_estimator *estimator, double *bw); // Returns true if the user should schedule a ping -bool grpc_bdp_estimator_add_incoming_bytes(grpc_bdp_estimator *estimator, +void grpc_bdp_estimator_add_incoming_bytes(grpc_bdp_estimator *estimator, int64_t num_bytes); +// Returns true if the user should schedule a ping +bool grpc_bdp_estimator_need_ping(const grpc_bdp_estimator *estimator); // Schedule a ping: call in response to receiving a true from // grpc_bdp_estimator_add_incoming_bytes once a ping has been scheduled by a // transport (but not necessarily started) diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index 34558ea216..2e9a51316d 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -22,5 +22,5 @@ #include <grpc++/grpc++.h> namespace grpc { -grpc::string Version() { return "1.5.0-dev"; } +grpc::string Version() { return "1.7.0-dev"; } } diff --git a/src/csharp/Grpc.Auth/Grpc.Auth.csproj b/src/csharp/Grpc.Auth/Grpc.Auth.csproj index 6030c70783..abf326459c 100755 --- a/src/csharp/Grpc.Auth/Grpc.Auth.csproj +++ b/src/csharp/Grpc.Auth/Grpc.Auth.csproj @@ -19,6 +19,7 @@ <IncludeSymbols>true</IncludeSymbols> <IncludeSource>true</IncludeSource> <GenerateDocumentationFile>true</GenerateDocumentationFile> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> </PropertyGroup> <ItemGroup> diff --git a/src/csharp/Grpc.Core.Testing/Grpc.Core.Testing.csproj b/src/csharp/Grpc.Core.Testing/Grpc.Core.Testing.csproj index 4e186d14dc..9ad6fd0c61 100755 --- a/src/csharp/Grpc.Core.Testing/Grpc.Core.Testing.csproj +++ b/src/csharp/Grpc.Core.Testing/Grpc.Core.Testing.csproj @@ -19,6 +19,7 @@ <IncludeSymbols>true</IncludeSymbols> <IncludeSource>true</IncludeSource> <GenerateDocumentationFile>true</GenerateDocumentationFile> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> </PropertyGroup> <ItemGroup> diff --git a/src/csharp/Grpc.Core.Tests/ClientServerTest.cs b/src/csharp/Grpc.Core.Tests/ClientServerTest.cs index 0cb9288131..72d9035a6f 100644 --- a/src/csharp/Grpc.Core.Tests/ClientServerTest.cs +++ b/src/csharp/Grpc.Core.Tests/ClientServerTest.cs @@ -57,9 +57,9 @@ namespace Grpc.Core.Tests [Test] public async Task UnaryCall() { - helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) => + helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) => { - return request; + return Task.FromResult(request); }); Assert.AreEqual("ABC", Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "ABC")); @@ -124,10 +124,10 @@ namespace Grpc.Core.Tests [Test] public void UnaryCall_ServerHandlerSetsStatus() { - helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) => + helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) => { context.Status = new Status(StatusCode.Unauthenticated, ""); - return ""; + return Task.FromResult(""); }); var ex = Assert.Throws<RpcException>(() => Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "abc")); @@ -142,11 +142,11 @@ namespace Grpc.Core.Tests [Test] public void UnaryCall_ServerHandlerSetsStatusAndTrailers() { - helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) => + helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) => { context.Status = new Status(StatusCode.Unauthenticated, ""); context.ResponseTrailers.Add("xyz", "xyz-value"); - return ""; + return Task.FromResult(""); }); var ex = Assert.Throws<RpcException>(() => Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "abc")); @@ -168,9 +168,10 @@ namespace Grpc.Core.Tests helper.ClientStreamingHandler = new ClientStreamingServerMethod<string, string>(async (requestStream, context) => { string result = ""; - await requestStream.ForEachAsync(async (request) => + await requestStream.ForEachAsync((request) => { result += request; + return TaskUtils.CompletedTask; }); await Task.Delay(100); return result; @@ -203,9 +204,7 @@ namespace Grpc.Core.Tests [Test] public async Task ServerStreamingCall_EndOfStreamIsIdempotent() { - helper.ServerStreamingHandler = new ServerStreamingServerMethod<string, string>(async (request, responseStream, context) => - { - }); + helper.ServerStreamingHandler = new ServerStreamingServerMethod<string, string>((request, responseStream, context) => TaskUtils.CompletedTask); var call = Calls.AsyncServerStreamingCall(helper.CreateServerStreamingCall(), ""); @@ -214,11 +213,12 @@ namespace Grpc.Core.Tests } [Test] - public async Task ServerStreamingCall_ErrorCanBeAwaitedTwice() + public void ServerStreamingCall_ErrorCanBeAwaitedTwice() { - helper.ServerStreamingHandler = new ServerStreamingServerMethod<string, string>(async (request, responseStream, context) => + helper.ServerStreamingHandler = new ServerStreamingServerMethod<string, string>((request, responseStream, context) => { context.Status = new Status(StatusCode.InvalidArgument, ""); + return TaskUtils.CompletedTask; }); var call = Calls.AsyncServerStreamingCall(helper.CreateServerStreamingCall(), ""); @@ -232,9 +232,9 @@ namespace Grpc.Core.Tests } [Test] - public async Task ServerStreamingCall_TrailersFromMultipleSourcesGetConcatenated() + public void ServerStreamingCall_TrailersFromMultipleSourcesGetConcatenated() { - helper.ServerStreamingHandler = new ServerStreamingServerMethod<string, string>(async (request, responseStream, context) => + helper.ServerStreamingHandler = new ServerStreamingServerMethod<string, string>((request, responseStream, context) => { context.ResponseTrailers.Add("xyz", "xyz-value"); throw new RpcException(new Status(StatusCode.InvalidArgument, ""), new Metadata { {"abc", "abc-value"} }); @@ -343,7 +343,7 @@ namespace Grpc.Core.Tests [Test] public async Task AsyncUnaryCall_EchoMetadata() { - helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) => + helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) => { foreach (Metadata.Entry metadataEntry in context.RequestHeaders) { @@ -352,7 +352,7 @@ namespace Grpc.Core.Tests context.ResponseTrailers.Add(metadataEntry); } } - return ""; + return Task.FromResult(""); }); var headers = new Metadata @@ -395,10 +395,10 @@ namespace Grpc.Core.Tests { // some japanese and chinese characters var nonAsciiString = "\u30a1\u30a2\u30a3 \u62b5\u6297\u662f\u5f92\u52b3\u7684"; - helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) => + helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) => { context.Status = new Status(StatusCode.Unknown, nonAsciiString); - return ""; + return Task.FromResult(""); }); var ex = Assert.Throws<RpcException>(() => Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "abc")); @@ -409,9 +409,9 @@ namespace Grpc.Core.Tests [Test] public void ServerCallContext_PeerInfoPresent() { - helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) => + helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) => { - return context.Peer; + return Task.FromResult(context.Peer); }); string peer = Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "abc"); @@ -421,11 +421,11 @@ namespace Grpc.Core.Tests [Test] public void ServerCallContext_HostAndMethodPresent() { - helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) => + helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) => { Assert.IsTrue(context.Host.Contains(Host)); Assert.AreEqual("/tests.Test/Unary", context.Method); - return "PASS"; + return Task.FromResult("PASS"); }); Assert.AreEqual("PASS", Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "abc")); } @@ -433,11 +433,11 @@ namespace Grpc.Core.Tests [Test] public void ServerCallContext_AuthContextNotPopulated() { - helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) => + helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) => { Assert.IsFalse(context.AuthContext.IsPeerAuthenticated); Assert.AreEqual(0, context.AuthContext.Properties.Count()); - return "PASS"; + return Task.FromResult("PASS"); }); Assert.AreEqual("PASS", Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "abc")); } @@ -445,9 +445,9 @@ namespace Grpc.Core.Tests [Test] public async Task Channel_WaitForStateChangedAsync() { - helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) => + helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) => { - return request; + return Task.FromResult(request); }); Assert.ThrowsAsync(typeof(TaskCanceledException), diff --git a/src/csharp/Grpc.Core.Tests/CompressionTest.cs b/src/csharp/Grpc.Core.Tests/CompressionTest.cs index 0b28433b98..9254cb998d 100644 --- a/src/csharp/Grpc.Core.Tests/CompressionTest.cs +++ b/src/csharp/Grpc.Core.Tests/CompressionTest.cs @@ -55,10 +55,10 @@ namespace Grpc.Core.Tests [Test] public void WriteOptions_Unary() { - helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) => + helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) => { context.WriteOptions = new WriteOptions(WriteFlags.NoCompress); - return request; + return Task.FromResult(request); }); var callOptions = new CallOptions(writeOptions: new WriteOptions(WriteFlags.NoCompress)); diff --git a/src/csharp/Grpc.Core.Tests/ContextPropagationTest.cs b/src/csharp/Grpc.Core.Tests/ContextPropagationTest.cs index 5a55ad1bbb..c8bc372202 100644 --- a/src/csharp/Grpc.Core.Tests/ContextPropagationTest.cs +++ b/src/csharp/Grpc.Core.Tests/ContextPropagationTest.cs @@ -106,11 +106,11 @@ namespace Grpc.Core.Tests public async Task PropagateDeadline() { var deadline = DateTime.UtcNow.AddDays(7); - helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) => + helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) => { Assert.IsTrue(context.Deadline < deadline.AddMinutes(1)); Assert.IsTrue(context.Deadline > deadline.AddMinutes(-1)); - return "PASS"; + return Task.FromResult("PASS"); }); helper.ClientStreamingHandler = new ClientStreamingServerMethod<string, string>(async (requestStream, context) => @@ -135,10 +135,10 @@ namespace Grpc.Core.Tests [Test] public async Task SuppressDeadlinePropagation() { - helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) => + helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) => { Assert.AreEqual(DateTime.MaxValue, context.Deadline); - return "PASS"; + return Task.FromResult("PASS"); }); helper.ClientStreamingHandler = new ClientStreamingServerMethod<string, string>(async (requestStream, context) => diff --git a/src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.csproj b/src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.csproj index 9be77c8875..6df68fda58 100755 --- a/src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.csproj +++ b/src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.csproj @@ -10,6 +10,7 @@ <PackageId>Grpc.Core.Tests</PackageId> <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45</PackageTargetFallback> <RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> </PropertyGroup> <ItemGroup> diff --git a/src/csharp/Grpc.Core.Tests/HalfcloseTest.cs b/src/csharp/Grpc.Core.Tests/HalfcloseTest.cs index 02554dcea5..5fc8fb694a 100644 --- a/src/csharp/Grpc.Core.Tests/HalfcloseTest.cs +++ b/src/csharp/Grpc.Core.Tests/HalfcloseTest.cs @@ -62,9 +62,9 @@ namespace Grpc.Core.Tests [Test] public async Task HalfcloseAfterFullclose_ClientStreamingCall() { - helper.ClientStreamingHandler = new ClientStreamingServerMethod<string, string>(async (requestStream, context) => + helper.ClientStreamingHandler = new ClientStreamingServerMethod<string, string>((requestStream, context) => { - return "PASS"; + return Task.FromResult("PASS"); }); var call = Calls.AsyncClientStreamingCall(helper.CreateClientStreamingCall()); diff --git a/src/csharp/Grpc.Core.Tests/Internal/CompletionQueueEventTest.cs b/src/csharp/Grpc.Core.Tests/Internal/CompletionQueueEventTest.cs index 6dac2de071..259520846f 100644 --- a/src/csharp/Grpc.Core.Tests/Internal/CompletionQueueEventTest.cs +++ b/src/csharp/Grpc.Core.Tests/Internal/CompletionQueueEventTest.cs @@ -29,9 +29,12 @@ namespace Grpc.Core.Internal.Tests public class CompletionQueueEventTest { [Test] - public void CreateAndDestroy() + public void CompletionQueueEventSizeIsNativeSize() { + #pragma warning disable 0618 + // We need to use the obsolete non-generic version of Marshal.SizeOf because the generic version is not available in net45 Assert.AreEqual(CompletionQueueEvent.NativeSize, Marshal.SizeOf(typeof(CompletionQueueEvent))); + #pragma warning restore 0618 } } } diff --git a/src/csharp/Grpc.Core.Tests/Internal/TimespecTest.cs b/src/csharp/Grpc.Core.Tests/Internal/TimespecTest.cs index d368c795d9..be35f31c36 100644 --- a/src/csharp/Grpc.Core.Tests/Internal/TimespecTest.cs +++ b/src/csharp/Grpc.Core.Tests/Internal/TimespecTest.cs @@ -60,7 +60,10 @@ namespace Grpc.Core.Internal.Tests [Test] public void TimespecSizeIsNativeSize() { + #pragma warning disable 0618 + // We need to use the obsolete non-generic version of Marshal.SizeOf because the generic version is not available in net45 Assert.AreEqual(Timespec.NativeSize, Marshal.SizeOf(typeof(Timespec))); + #pragma warning restore 0618 } [Test] diff --git a/src/csharp/Grpc.Core.Tests/MockServiceHelper.cs b/src/csharp/Grpc.Core.Tests/MockServiceHelper.cs index 925fb20833..7f4677d57f 100644 --- a/src/csharp/Grpc.Core.Tests/MockServiceHelper.cs +++ b/src/csharp/Grpc.Core.Tests/MockServiceHelper.cs @@ -96,26 +96,28 @@ namespace Grpc.Core.Tests var defaultStatus = new Status(StatusCode.Unknown, "Default mock implementation. Please provide your own."); - unaryHandler = new UnaryServerMethod<string, string>(async (request, context) => + unaryHandler = new UnaryServerMethod<string, string>((request, context) => { context.Status = defaultStatus; - return ""; + return Task.FromResult(""); }); - clientStreamingHandler = new ClientStreamingServerMethod<string, string>(async (requestStream, context) => + clientStreamingHandler = new ClientStreamingServerMethod<string, string>((requestStream, context) => { context.Status = defaultStatus; - return ""; + return Task.FromResult(""); }); - serverStreamingHandler = new ServerStreamingServerMethod<string, string>(async (request, responseStream, context) => + serverStreamingHandler = new ServerStreamingServerMethod<string, string>((request, responseStream, context) => { context.Status = defaultStatus; + return TaskUtils.CompletedTask; }); - duplexStreamingHandler = new DuplexStreamingServerMethod<string, string>(async (requestStream, responseStream, context) => + duplexStreamingHandler = new DuplexStreamingServerMethod<string, string>((requestStream, responseStream, context) => { context.Status = defaultStatus; + return TaskUtils.CompletedTask; }); } diff --git a/src/csharp/Grpc.Core.Tests/PerformanceTest.cs b/src/csharp/Grpc.Core.Tests/PerformanceTest.cs index 2420b47a87..4b1d745284 100644 --- a/src/csharp/Grpc.Core.Tests/PerformanceTest.cs +++ b/src/csharp/Grpc.Core.Tests/PerformanceTest.cs @@ -61,9 +61,9 @@ namespace Grpc.Core.Tests var profiler = new BasicProfiler(); Profilers.SetForCurrentThread(profiler); - helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) => + helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) => { - return request; + return Task.FromResult(request); }); var callDetails = helper.CreateUnaryCall(); diff --git a/src/csharp/Grpc.Core.Tests/ResponseHeadersTest.cs b/src/csharp/Grpc.Core.Tests/ResponseHeadersTest.cs index 67dbcf8f09..e318ee44f4 100644 --- a/src/csharp/Grpc.Core.Tests/ResponseHeadersTest.cs +++ b/src/csharp/Grpc.Core.Tests/ResponseHeadersTest.cs @@ -138,10 +138,10 @@ namespace Grpc.Core.Tests [Test] public void WriteResponseHeaders_NullNotAllowed() { - helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) => + helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) => { Assert.ThrowsAsync(typeof(ArgumentNullException), async () => await context.WriteResponseHeadersAsync(null)); - return "PASS"; + return Task.FromResult("PASS"); }); Assert.AreEqual("PASS", Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "")); @@ -158,7 +158,7 @@ namespace Grpc.Core.Tests await context.WriteResponseHeadersAsync(headers); Assert.Fail(); } - catch (InvalidOperationException expected) + catch (InvalidOperationException) { } return "PASS"; @@ -178,7 +178,7 @@ namespace Grpc.Core.Tests await context.WriteResponseHeadersAsync(headers); Assert.Fail(); } - catch (InvalidOperationException expected) + catch (InvalidOperationException) { } await responseStream.WriteAsync("B"); diff --git a/src/csharp/Grpc.Core.Tests/ThreadingModelTest.cs b/src/csharp/Grpc.Core.Tests/ThreadingModelTest.cs index fb18198945..9a828f307e 100644 --- a/src/csharp/Grpc.Core.Tests/ThreadingModelTest.cs +++ b/src/csharp/Grpc.Core.Tests/ThreadingModelTest.cs @@ -50,13 +50,14 @@ namespace Grpc.Core.Tests [Test] public void BlockingCallInServerHandlerDoesNotDeadlock() { - helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) => + helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) => { int recursionDepth = int.Parse(request); if (recursionDepth <= 0) { - return "SUCCESS"; + return Task.FromResult("SUCCESS"); } - return Calls.BlockingUnaryCall(helper.CreateUnaryCall(), (recursionDepth - 1).ToString()); + var response = Calls.BlockingUnaryCall(helper.CreateUnaryCall(), (recursionDepth - 1).ToString()); + return Task.FromResult(response); }); int maxRecursionDepth = Environment.ProcessorCount * 2; // make sure we have more pending blocking calls than threads in GrpcThreadPool @@ -66,12 +67,12 @@ namespace Grpc.Core.Tests [Test] public void HandlerDoesNotRunOnGrpcThread() { - helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) => + helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) => { if (IsRunningOnGrpcThreadPool()) { - return "Server handler should not run on gRPC threadpool thread."; + return Task.FromResult("Server handler should not run on gRPC threadpool thread."); } - return request; + return Task.FromResult(request); }); Assert.AreEqual("ABC", Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "ABC")); @@ -80,9 +81,9 @@ namespace Grpc.Core.Tests [Test] public async Task ContinuationDoesNotRunOnGrpcThread() { - helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) => + helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) => { - return request; + return Task.FromResult(request); }); await Calls.AsyncUnaryCall(helper.CreateUnaryCall(), "ABC"); diff --git a/src/csharp/Grpc.Core.Tests/TimeoutsTest.cs b/src/csharp/Grpc.Core.Tests/TimeoutsTest.cs index 8f0d6b866d..b89c1afcc3 100644 --- a/src/csharp/Grpc.Core.Tests/TimeoutsTest.cs +++ b/src/csharp/Grpc.Core.Tests/TimeoutsTest.cs @@ -57,10 +57,10 @@ namespace Grpc.Core.Tests [Test] public void InfiniteDeadline() { - helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) => + helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) => { Assert.AreEqual(DateTime.MaxValue, context.Deadline); - return "PASS"; + return Task.FromResult("PASS"); }); // no deadline specified, check server sees infinite deadline @@ -75,13 +75,13 @@ namespace Grpc.Core.Tests { var clientDeadline = DateTime.UtcNow + TimeSpan.FromDays(7); - helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) => + helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) => { // A fairly relaxed check that the deadline set by client and deadline seen by server // are in agreement. C core takes care of the work with transferring deadline over the wire, // so we don't need an exact check here. Assert.IsTrue(Math.Abs((clientDeadline - context.Deadline).TotalMilliseconds) < 5000); - return "PASS"; + return Task.FromResult("PASS"); }); Calls.BlockingUnaryCall(helper.CreateUnaryCall(new CallOptions(deadline: clientDeadline)), "abc"); } diff --git a/src/csharp/Grpc.Core/Grpc.Core.csproj b/src/csharp/Grpc.Core/Grpc.Core.csproj index e32711c520..dde800aadd 100755 --- a/src/csharp/Grpc.Core/Grpc.Core.csproj +++ b/src/csharp/Grpc.Core/Grpc.Core.csproj @@ -18,6 +18,7 @@ <IncludeSymbols>true</IncludeSymbols> <IncludeSource>true</IncludeSource> <GenerateDocumentationFile>true</GenerateDocumentationFile> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> </PropertyGroup> <ItemGroup> diff --git a/src/csharp/Grpc.Core/Internal/AtomicCounter.cs b/src/csharp/Grpc.Core/Internal/AtomicCounter.cs index 64e16e4c54..20e25f9d88 100644 --- a/src/csharp/Grpc.Core/Internal/AtomicCounter.cs +++ b/src/csharp/Grpc.Core/Internal/AtomicCounter.cs @@ -64,7 +64,7 @@ namespace Grpc.Core.Internal { get { - return counter; + return Interlocked.Read(ref counter); } } } diff --git a/src/csharp/Grpc.Core/Internal/AuthContextSafeHandle.cs b/src/csharp/Grpc.Core/Internal/AuthContextSafeHandle.cs index 6c22bd59ba..e8e61ebf3c 100644 --- a/src/csharp/Grpc.Core/Internal/AuthContextSafeHandle.cs +++ b/src/csharp/Grpc.Core/Internal/AuthContextSafeHandle.cs @@ -74,7 +74,10 @@ namespace Grpc.Core.Internal private AuthProperty PtrToAuthProperty(IntPtr authPropertyPtr) { + #pragma warning disable 0618 + // We need to use the obsolete non-generic version of Marshal.PtrToStructure, because the generic version is not available in net45 var nativeAuthProperty = (NativeAuthProperty) Marshal.PtrToStructure(authPropertyPtr, typeof(NativeAuthProperty)); + #pragma warning restore 0618 var name = Marshal.PtrToStringAnsi(nativeAuthProperty.Name); var valueBytes = new byte[(int) nativeAuthProperty.ValueLength]; Marshal.Copy(nativeAuthProperty.Value, valueBytes, 0, (int)nativeAuthProperty.ValueLength); diff --git a/src/csharp/Grpc.Core/Internal/GrpcThreadPool.cs b/src/csharp/Grpc.Core/Internal/GrpcThreadPool.cs index 19b44c2618..3c94b602c0 100644 --- a/src/csharp/Grpc.Core/Internal/GrpcThreadPool.cs +++ b/src/csharp/Grpc.Core/Internal/GrpcThreadPool.cs @@ -33,8 +33,8 @@ namespace Grpc.Core.Internal internal class GrpcThreadPool { static readonly ILogger Logger = GrpcEnvironment.Logger.ForType<GrpcThreadPool>(); - static readonly WaitCallback RunCompletionQueueEventCallbackSuccess = new WaitCallback((callback) => RunCompletionQueueEventCallback((OpCompletionDelegate) callback, true)); - static readonly WaitCallback RunCompletionQueueEventCallbackFailure = new WaitCallback((callback) => RunCompletionQueueEventCallback((OpCompletionDelegate) callback, false)); + const int FinishContinuationsSleepMillis = 10; + const int MaxFinishContinuationsSleepTotalMillis = 10000; readonly GrpcEnvironment environment; readonly object myLock = new object(); @@ -42,6 +42,9 @@ namespace Grpc.Core.Internal readonly int poolSize; readonly int completionQueueCount; readonly bool inlineHandlers; + readonly WaitCallback runCompletionQueueEventCallbackSuccess; + readonly WaitCallback runCompletionQueueEventCallbackFailure; + readonly AtomicCounter queuedContinuationCounter = new AtomicCounter(); readonly List<BasicProfiler> threadProfilers = new List<BasicProfiler>(); // profilers assigned to threadpool threads @@ -64,6 +67,9 @@ namespace Grpc.Core.Internal this.inlineHandlers = inlineHandlers; GrpcPreconditions.CheckArgument(poolSize >= completionQueueCount, "Thread pool size cannot be smaller than the number of completion queues used."); + + this.runCompletionQueueEventCallbackSuccess = new WaitCallback((callback) => RunCompletionQueueEventCallback((OpCompletionDelegate) callback, true)); + this.runCompletionQueueEventCallbackFailure = new WaitCallback((callback) => RunCompletionQueueEventCallback((OpCompletionDelegate) callback, false)); } public void Start() @@ -173,7 +179,8 @@ namespace Grpc.Core.Internal // Use cached delegates to avoid unnecessary allocations if (!inlineHandlers) { - ThreadPool.QueueUserWorkItem(success ? RunCompletionQueueEventCallbackSuccess : RunCompletionQueueEventCallbackFailure, callback); + queuedContinuationCounter.Increment(); + ThreadPool.QueueUserWorkItem(success ? runCompletionQueueEventCallbackSuccess : runCompletionQueueEventCallbackFailure, callback); } else { @@ -187,6 +194,24 @@ namespace Grpc.Core.Internal } } while (ev.type != CompletionQueueEvent.CompletionType.Shutdown); + + // Continuations are running on default threadpool that consists of background threads. + // GrpcThreadPool thread (a foreground thread) will not exit unless all queued work had + // been finished to prevent terminating the continuations queued prematurely. + int sleepIterations = 0; + while (queuedContinuationCounter.Count != 0) + { + // Only happens on shutdown and having pending continuations shouldn't very common, + // so sleeping here for a little bit is fine. + if (sleepIterations >= MaxFinishContinuationsSleepTotalMillis / FinishContinuationsSleepMillis) + { + Logger.Warning("Shutting down gRPC thread [{0}] with unfinished callbacks (Timed out waiting for callbacks to finish).", + Thread.CurrentThread.Name); + break; + } + Thread.Sleep(FinishContinuationsSleepMillis); + sleepIterations ++; + } } private static IReadOnlyCollection<CompletionQueueSafeHandle> CreateCompletionQueueList(GrpcEnvironment environment, int completionQueueCount) @@ -200,7 +225,7 @@ namespace Grpc.Core.Internal return list.AsReadOnly(); } - private static void RunCompletionQueueEventCallback(OpCompletionDelegate callback, bool success) + private void RunCompletionQueueEventCallback(OpCompletionDelegate callback, bool success) { try { @@ -210,6 +235,10 @@ namespace Grpc.Core.Internal { Logger.Error(e, "Exception occured while invoking completion delegate"); } + finally + { + queuedContinuationCounter.Decrement(); + } } } } diff --git a/src/csharp/Grpc.Core/Version.csproj.include b/src/csharp/Grpc.Core/Version.csproj.include index 81156452f3..124ecab14c 100755 --- a/src/csharp/Grpc.Core/Version.csproj.include +++ b/src/csharp/Grpc.Core/Version.csproj.include @@ -1,7 +1,7 @@ <!-- This file is generated --> <Project> <PropertyGroup> - <GrpcCsharpVersion>1.5.0-dev</GrpcCsharpVersion> + <GrpcCsharpVersion>1.7.0-dev</GrpcCsharpVersion> <GoogleProtobufVersion>3.3.0</GoogleProtobufVersion> </PropertyGroup> </Project> diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs index 92aa0e5aed..588cc84516 100644 --- a/src/csharp/Grpc.Core/VersionInfo.cs +++ b/src/csharp/Grpc.Core/VersionInfo.cs @@ -33,11 +33,11 @@ namespace Grpc.Core /// <summary> /// Current <c>AssemblyFileVersion</c> of gRPC C# assemblies /// </summary> - public const string CurrentAssemblyFileVersion = "1.5.0.0"; + public const string CurrentAssemblyFileVersion = "1.7.0.0"; /// <summary> /// Current version of gRPC C# /// </summary> - public const string CurrentVersion = "1.5.0-dev"; + public const string CurrentVersion = "1.7.0-dev"; } } diff --git a/src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.csproj b/src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.csproj index 08df026a53..74deed6584 100755 --- a/src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.csproj +++ b/src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.csproj @@ -9,6 +9,7 @@ <OutputType>Exe</OutputType> <PackageId>Grpc.Examples.MathClient</PackageId> <RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> </PropertyGroup> <ItemGroup> diff --git a/src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.csproj b/src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.csproj index a02937474a..1abf261498 100755 --- a/src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.csproj +++ b/src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.csproj @@ -9,6 +9,7 @@ <OutputType>Exe</OutputType> <PackageId>Grpc.Examples.MathServer</PackageId> <RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> </PropertyGroup> <ItemGroup> diff --git a/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.csproj b/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.csproj index 9a8e62cc8b..d2a13ed6e1 100755 --- a/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.csproj +++ b/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.csproj @@ -10,6 +10,7 @@ <PackageId>Grpc.Examples.Tests</PackageId> <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45</PackageTargetFallback> <RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> </PropertyGroup> <ItemGroup> diff --git a/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs b/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs index 8e6d685e0f..ded80ffba5 100644 --- a/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs +++ b/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs @@ -37,7 +37,7 @@ namespace Math.Tests Channel channel; Math.MathClient client; - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { // Disable SO_REUSEPORT to prevent https://github.com/grpc/grpc/issues/10755 @@ -51,7 +51,7 @@ namespace Math.Tests client = new Math.MathClient(channel); } - [TestFixtureTearDown] + [OneTimeTearDown] public void Cleanup() { channel.ShutdownAsync().Wait(); @@ -130,7 +130,7 @@ namespace Math.Tests } [Test] - public async Task FibWithDeadline() + public void FibWithDeadline() { using (var call = client.Fib(new FibArgs { Limit = 0 }, deadline: DateTime.UtcNow.AddMilliseconds(500))) diff --git a/src/csharp/Grpc.Examples/Grpc.Examples.csproj b/src/csharp/Grpc.Examples/Grpc.Examples.csproj index 625c1723bc..491d313f17 100755 --- a/src/csharp/Grpc.Examples/Grpc.Examples.csproj +++ b/src/csharp/Grpc.Examples/Grpc.Examples.csproj @@ -8,6 +8,7 @@ <AssemblyName>Grpc.Examples</AssemblyName> <PackageId>Grpc.Examples</PackageId> <RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> </PropertyGroup> <ItemGroup> diff --git a/src/csharp/Grpc.Examples/MathGrpc.cs b/src/csharp/Grpc.Examples/MathGrpc.cs index 317eeb52ef..4ed414400d 100644 --- a/src/csharp/Grpc.Examples/MathGrpc.cs +++ b/src/csharp/Grpc.Examples/MathGrpc.cs @@ -15,6 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // +#pragma warning disable 1591 #region Designer generated code using System; diff --git a/src/csharp/Grpc.Examples/MathServiceImpl.cs b/src/csharp/Grpc.Examples/MathServiceImpl.cs index 85b5e2dd96..0cc1b79137 100644 --- a/src/csharp/Grpc.Examples/MathServiceImpl.cs +++ b/src/csharp/Grpc.Examples/MathServiceImpl.cs @@ -52,9 +52,10 @@ namespace Math public override async Task<Num> Sum(IAsyncStreamReader<Num> requestStream, ServerCallContext context) { long sum = 0; - await requestStream.ForEachAsync(async num => + await requestStream.ForEachAsync(num => { sum += num.Num_; + return TaskUtils.CompletedTask; }); return new Num { Num_ = sum }; } diff --git a/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj b/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj index b0e2716e7e..2ccf46b9b9 100755 --- a/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj +++ b/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj @@ -10,6 +10,7 @@ <PackageId>Grpc.HealthCheck.Tests</PackageId> <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45</PackageTargetFallback> <RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> </PropertyGroup> <ItemGroup> diff --git a/src/csharp/Grpc.HealthCheck.Tests/HealthClientServerTest.cs b/src/csharp/Grpc.HealthCheck.Tests/HealthClientServerTest.cs index 7dadba75ff..45e8ad9062 100644 --- a/src/csharp/Grpc.HealthCheck.Tests/HealthClientServerTest.cs +++ b/src/csharp/Grpc.HealthCheck.Tests/HealthClientServerTest.cs @@ -37,7 +37,7 @@ namespace Grpc.HealthCheck.Tests Grpc.Health.V1.Health.HealthClient client; Grpc.HealthCheck.HealthServiceImpl serviceImpl; - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { serviceImpl = new HealthServiceImpl(); @@ -54,7 +54,7 @@ namespace Grpc.HealthCheck.Tests client = new Grpc.Health.V1.Health.HealthClient(channel); } - [TestFixtureTearDown] + [OneTimeTearDown] public void Cleanup() { channel.ShutdownAsync().Wait(); diff --git a/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj b/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj index b54311bbd5..3eb90434f3 100755 --- a/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj +++ b/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj @@ -18,6 +18,7 @@ <IncludeSymbols>true</IncludeSymbols> <IncludeSource>true</IncludeSource> <GenerateDocumentationFile>true</GenerateDocumentationFile> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> </PropertyGroup> <ItemGroup> diff --git a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs index 8c747aa306..3e8eb34689 100644 --- a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs +++ b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs @@ -15,6 +15,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // +#pragma warning disable 1591 #region Designer generated code using System; diff --git a/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.csproj b/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.csproj index dcb24c7216..c67beea7cd 100755 --- a/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.csproj +++ b/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.csproj @@ -10,6 +10,7 @@ <PackageId>Grpc.IntegrationTesting.Client</PackageId> <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45</PackageTargetFallback> <RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> </PropertyGroup> <ItemGroup> diff --git a/src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.csproj b/src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.csproj index 43772020d6..e452257b1b 100755 --- a/src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.csproj +++ b/src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.csproj @@ -11,6 +11,7 @@ <ServerGarbageCollection>true</ServerGarbageCollection> <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45</PackageTargetFallback> <RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> </PropertyGroup> <ItemGroup> diff --git a/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.csproj b/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.csproj index db736baed0..a1fb316fdb 100755 --- a/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.csproj +++ b/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.csproj @@ -10,6 +10,7 @@ <PackageId>Grpc.IntegrationTesting.Server</PackageId> <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45</PackageTargetFallback> <RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> </PropertyGroup> <ItemGroup> diff --git a/src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.csproj b/src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.csproj index fe4e0da417..f64bea3d2b 100755 --- a/src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.csproj +++ b/src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.csproj @@ -10,6 +10,7 @@ <PackageId>Grpc.IntegrationTesting.StressClient</PackageId> <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45</PackageTargetFallback> <RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> </PropertyGroup> <ItemGroup> diff --git a/src/csharp/Grpc.IntegrationTesting/Control.cs b/src/csharp/Grpc.IntegrationTesting/Control.cs index d62b5a1c5b..b15da8b8e5 100644 --- a/src/csharp/Grpc.IntegrationTesting/Control.cs +++ b/src/csharp/Grpc.IntegrationTesting/Control.cs @@ -28,86 +28,89 @@ namespace Grpc.Testing { "c29uUG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hIQCgxPVEhFUl9TRVJWRVIQAypyCgdScGNU", + "eXBlEgkKBVVOQVJZEAASDQoJU1RSRUFNSU5HEAESGQoVU1RSRUFNSU5HX0ZS", + "T01fQ0xJRU5UEAISGQoVU1RSRUFNSU5HX0ZST01fU0VSVkVSEAMSFwoTU1RS", + "RUFNSU5HX0JPVEhfV0FZUxAEYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Grpc.Testing.PayloadsReflection.Descriptor, global::Grpc.Testing.StatsReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Grpc.Testing.ClientType), typeof(global::Grpc.Testing.ServerType), typeof(global::Grpc.Testing.RpcType), }, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.PoissonParams), global::Grpc.Testing.PoissonParams.Parser, new[]{ "OfferedLoad" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClosedLoopParams), global::Grpc.Testing.ClosedLoopParams.Parser, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.LoadParams), global::Grpc.Testing.LoadParams.Parser, new[]{ "ClosedLoop", "Poisson" }, new[]{ "Load" }, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.SecurityParams), global::Grpc.Testing.SecurityParams.Parser, new[]{ "UseTestCa", "ServerHostOverride" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.SecurityParams), global::Grpc.Testing.SecurityParams.Parser, new[]{ "UseTestCa", "ServerHostOverride", "CredType" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ChannelArg), global::Grpc.Testing.ChannelArg.Parser, new[]{ "Name", "StrValue", "IntValue" }, new[]{ "Value" }, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientConfig), global::Grpc.Testing.ClientConfig.Parser, new[]{ "ServerTargets", "ClientType", "SecurityParams", "OutstandingRpcsPerChannel", "ClientChannels", "AsyncClientThreads", "RpcType", "LoadParams", "PayloadConfig", "HistogramParams", "CoreList", "CoreLimit", "OtherClientApi", "ChannelArgs", "ThreadsPerCq", "MessagesPerStream" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientStatus), global::Grpc.Testing.ClientStatus.Parser, new[]{ "Stats" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.Mark), global::Grpc.Testing.Mark.Parser, new[]{ "Reset" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientArgs), global::Grpc.Testing.ClientArgs.Parser, new[]{ "Setup", "Mark" }, new[]{ "Argtype" }, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ServerConfig), global::Grpc.Testing.ServerConfig.Parser, new[]{ "ServerType", "SecurityParams", "Port", "AsyncServerThreads", "CoreLimit", "PayloadConfig", "CoreList", "OtherServerApi", "ThreadsPerCq", "ResourceQuotaSize" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ServerConfig), global::Grpc.Testing.ServerConfig.Parser, new[]{ "ServerType", "SecurityParams", "Port", "AsyncServerThreads", "CoreLimit", "PayloadConfig", "CoreList", "OtherServerApi", "ThreadsPerCq", "ResourceQuotaSize", "ChannelArgs" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ServerArgs), global::Grpc.Testing.ServerArgs.Parser, new[]{ "Setup", "Mark" }, new[]{ "Argtype" }, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ServerStatus), global::Grpc.Testing.ServerStatus.Parser, new[]{ "Stats", "Port", "Cores" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.CoreRequest), global::Grpc.Testing.CoreRequest.Parser, null, null, null, null), @@ -115,7 +118,7 @@ namespace Grpc.Testing { new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.Void), global::Grpc.Testing.Void.Parser, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.Scenario), global::Grpc.Testing.Scenario.Parser, new[]{ "Name", "ClientConfig", "NumClients", "ServerConfig", "NumServers", "WarmupSeconds", "BenchmarkSeconds", "SpawnLocalWorkerCount" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.Scenarios), global::Grpc.Testing.Scenarios.Parser, new[]{ "Scenarios_" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ScenarioResultSummary), global::Grpc.Testing.ScenarioResultSummary.Parser, new[]{ "Qps", "QpsPerServerCore", "ServerSystemTime", "ServerUserTime", "ClientSystemTime", "ClientUserTime", "Latency50", "Latency90", "Latency95", "Latency99", "Latency999", "ServerCpuUsage", "SuccessfulRequestsPerSecond", "FailedRequestsPerSecond", "ClientPollsPerRequest", "ServerPollsPerRequest" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ScenarioResultSummary), global::Grpc.Testing.ScenarioResultSummary.Parser, new[]{ "Qps", "QpsPerServerCore", "ServerSystemTime", "ServerUserTime", "ClientSystemTime", "ClientUserTime", "Latency50", "Latency90", "Latency95", "Latency99", "Latency999", "ServerCpuUsage", "SuccessfulRequestsPerSecond", "FailedRequestsPerSecond", "ClientPollsPerRequest", "ServerPollsPerRequest", "ServerQueriesPerCpuSec", "ClientQueriesPerCpuSec" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ScenarioResult), global::Grpc.Testing.ScenarioResult.Parser, new[]{ "Scenario", "Latencies", "ClientStats", "ServerStats", "ServerCores", "Summary", "ClientSuccess", "ServerSuccess", "RequestResults" }, null, null, null) })); } @@ -589,6 +592,7 @@ namespace Grpc.Testing { public SecurityParams(SecurityParams other) : this() { useTestCa_ = other.useTestCa_; serverHostOverride_ = other.serverHostOverride_; + credType_ = other.credType_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -618,6 +622,17 @@ namespace Grpc.Testing { } } + /// <summary>Field number for the "cred_type" field.</summary> + public const int CredTypeFieldNumber = 3; + private string credType_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string CredType { + get { return credType_; } + set { + credType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as SecurityParams); @@ -633,6 +648,7 @@ namespace Grpc.Testing { } if (UseTestCa != other.UseTestCa) return false; if (ServerHostOverride != other.ServerHostOverride) return false; + if (CredType != other.CredType) return false; return true; } @@ -641,6 +657,7 @@ namespace Grpc.Testing { int hash = 1; if (UseTestCa != false) hash ^= UseTestCa.GetHashCode(); if (ServerHostOverride.Length != 0) hash ^= ServerHostOverride.GetHashCode(); + if (CredType.Length != 0) hash ^= CredType.GetHashCode(); return hash; } @@ -659,6 +676,10 @@ namespace Grpc.Testing { output.WriteRawTag(18); output.WriteString(ServerHostOverride); } + if (CredType.Length != 0) { + output.WriteRawTag(26); + output.WriteString(CredType); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -670,6 +691,9 @@ namespace Grpc.Testing { if (ServerHostOverride.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(ServerHostOverride); } + if (CredType.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(CredType); + } return size; } @@ -684,6 +708,9 @@ namespace Grpc.Testing { if (other.ServerHostOverride.Length != 0) { ServerHostOverride = other.ServerHostOverride; } + if (other.CredType.Length != 0) { + CredType = other.CredType; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -702,6 +729,10 @@ namespace Grpc.Testing { ServerHostOverride = input.ReadString(); break; } + case 26: { + CredType = input.ReadString(); + break; + } } } } @@ -1945,6 +1976,7 @@ namespace Grpc.Testing { otherServerApi_ = other.otherServerApi_; threadsPerCq_ = other.threadsPerCq_; resourceQuotaSize_ = other.resourceQuotaSize_; + channelArgs_ = other.channelArgs_.Clone(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2088,6 +2120,16 @@ namespace Grpc.Testing { } } + /// <summary>Field number for the "channel_args" field.</summary> + public const int ChannelArgsFieldNumber = 1002; + private static readonly pb::FieldCodec<global::Grpc.Testing.ChannelArg> _repeated_channelArgs_codec + = pb::FieldCodec.ForMessage(8018, global::Grpc.Testing.ChannelArg.Parser); + private readonly pbc::RepeatedField<global::Grpc.Testing.ChannelArg> channelArgs_ = new pbc::RepeatedField<global::Grpc.Testing.ChannelArg>(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField<global::Grpc.Testing.ChannelArg> ChannelArgs { + get { return channelArgs_; } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ServerConfig); @@ -2111,6 +2153,7 @@ namespace Grpc.Testing { if (OtherServerApi != other.OtherServerApi) return false; if (ThreadsPerCq != other.ThreadsPerCq) return false; if (ResourceQuotaSize != other.ResourceQuotaSize) return false; + if(!channelArgs_.Equals(other.channelArgs_)) return false; return true; } @@ -2127,6 +2170,7 @@ namespace Grpc.Testing { if (OtherServerApi.Length != 0) hash ^= OtherServerApi.GetHashCode(); if (ThreadsPerCq != 0) hash ^= ThreadsPerCq.GetHashCode(); if (ResourceQuotaSize != 0) hash ^= ResourceQuotaSize.GetHashCode(); + hash ^= channelArgs_.GetHashCode(); return hash; } @@ -2174,6 +2218,7 @@ namespace Grpc.Testing { output.WriteRawTag(200, 62); output.WriteInt32(ResourceQuotaSize); } + channelArgs_.WriteTo(output, _repeated_channelArgs_codec); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2207,6 +2252,7 @@ namespace Grpc.Testing { if (ResourceQuotaSize != 0) { size += 2 + pb::CodedOutputStream.ComputeInt32Size(ResourceQuotaSize); } + size += channelArgs_.CalculateSize(_repeated_channelArgs_codec); return size; } @@ -2249,6 +2295,7 @@ namespace Grpc.Testing { if (other.ResourceQuotaSize != 0) { ResourceQuotaSize = other.ResourceQuotaSize; } + channelArgs_.Add(other.channelArgs_); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2306,6 +2353,10 @@ namespace Grpc.Testing { ResourceQuotaSize = input.ReadInt32(); break; } + case 8018: { + channelArgs_.AddEntriesFrom(input, _repeated_channelArgs_codec); + break; + } } } } @@ -3489,6 +3540,8 @@ namespace Grpc.Testing { failedRequestsPerSecond_ = other.failedRequestsPerSecond_; clientPollsPerRequest_ = other.clientPollsPerRequest_; serverPollsPerRequest_ = other.serverPollsPerRequest_; + serverQueriesPerCpuSec_ = other.serverQueriesPerCpuSec_; + clientQueriesPerCpuSec_ = other.clientQueriesPerCpuSec_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3702,6 +3755,31 @@ namespace Grpc.Testing { } } + /// <summary>Field number for the "server_queries_per_cpu_sec" field.</summary> + public const int ServerQueriesPerCpuSecFieldNumber = 17; + private double serverQueriesPerCpuSec_; + /// <summary> + /// Queries per CPU-sec over all servers or clients + /// </summary> + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double ServerQueriesPerCpuSec { + get { return serverQueriesPerCpuSec_; } + set { + serverQueriesPerCpuSec_ = value; + } + } + + /// <summary>Field number for the "client_queries_per_cpu_sec" field.</summary> + public const int ClientQueriesPerCpuSecFieldNumber = 18; + private double clientQueriesPerCpuSec_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public double ClientQueriesPerCpuSec { + get { return clientQueriesPerCpuSec_; } + set { + clientQueriesPerCpuSec_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ScenarioResultSummary); @@ -3731,6 +3809,8 @@ namespace Grpc.Testing { if (FailedRequestsPerSecond != other.FailedRequestsPerSecond) return false; if (ClientPollsPerRequest != other.ClientPollsPerRequest) return false; if (ServerPollsPerRequest != other.ServerPollsPerRequest) return false; + if (ServerQueriesPerCpuSec != other.ServerQueriesPerCpuSec) return false; + if (ClientQueriesPerCpuSec != other.ClientQueriesPerCpuSec) return false; return true; } @@ -3753,6 +3833,8 @@ namespace Grpc.Testing { if (FailedRequestsPerSecond != 0D) hash ^= FailedRequestsPerSecond.GetHashCode(); if (ClientPollsPerRequest != 0D) hash ^= ClientPollsPerRequest.GetHashCode(); if (ServerPollsPerRequest != 0D) hash ^= ServerPollsPerRequest.GetHashCode(); + if (ServerQueriesPerCpuSec != 0D) hash ^= ServerQueriesPerCpuSec.GetHashCode(); + if (ClientQueriesPerCpuSec != 0D) hash ^= ClientQueriesPerCpuSec.GetHashCode(); return hash; } @@ -3827,6 +3909,14 @@ namespace Grpc.Testing { output.WriteRawTag(129, 1); output.WriteDouble(ServerPollsPerRequest); } + if (ServerQueriesPerCpuSec != 0D) { + output.WriteRawTag(137, 1); + output.WriteDouble(ServerQueriesPerCpuSec); + } + if (ClientQueriesPerCpuSec != 0D) { + output.WriteRawTag(145, 1); + output.WriteDouble(ClientQueriesPerCpuSec); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3880,6 +3970,12 @@ namespace Grpc.Testing { if (ServerPollsPerRequest != 0D) { size += 2 + 8; } + if (ServerQueriesPerCpuSec != 0D) { + size += 2 + 8; + } + if (ClientQueriesPerCpuSec != 0D) { + size += 2 + 8; + } return size; } @@ -3936,6 +4032,12 @@ namespace Grpc.Testing { if (other.ServerPollsPerRequest != 0D) { ServerPollsPerRequest = other.ServerPollsPerRequest; } + if (other.ServerQueriesPerCpuSec != 0D) { + ServerQueriesPerCpuSec = other.ServerQueriesPerCpuSec; + } + if (other.ClientQueriesPerCpuSec != 0D) { + ClientQueriesPerCpuSec = other.ClientQueriesPerCpuSec; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4010,6 +4112,14 @@ namespace Grpc.Testing { ServerPollsPerRequest = input.ReadDouble(); break; } + case 137: { + ServerQueriesPerCpuSec = input.ReadDouble(); + break; + } + case 145: { + ClientQueriesPerCpuSec = input.ReadDouble(); + break; + } } } } diff --git a/src/csharp/Grpc.IntegrationTesting/CustomErrorDetailsTest.cs b/src/csharp/Grpc.IntegrationTesting/CustomErrorDetailsTest.cs index 374c6fc23f..5d22d77ada 100644 --- a/src/csharp/Grpc.IntegrationTesting/CustomErrorDetailsTest.cs +++ b/src/csharp/Grpc.IntegrationTesting/CustomErrorDetailsTest.cs @@ -42,7 +42,7 @@ namespace Grpc.IntegrationTesting Channel channel; TestService.TestServiceClient client; - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { // Disable SO_REUSEPORT to prevent https://github.com/grpc/grpc/issues/10755 @@ -57,7 +57,7 @@ namespace Grpc.IntegrationTesting client = new TestService.TestServiceClient(channel); } - [TestFixtureTearDown] + [OneTimeTearDown] public void Cleanup() { channel.ShutdownAsync().Wait(); @@ -108,7 +108,7 @@ namespace Grpc.IntegrationTesting private class CustomErrorDetailsTestServiceImpl : TestService.TestServiceBase { - public override async Task<SimpleResponse> UnaryCall(SimpleRequest request, ServerCallContext context) + public override Task<SimpleResponse> UnaryCall(SimpleRequest request, ServerCallContext context) { try { diff --git a/src/csharp/Grpc.IntegrationTesting/GeneratedServiceBaseTest.cs b/src/csharp/Grpc.IntegrationTesting/GeneratedServiceBaseTest.cs index a97818a164..adeec05699 100644 --- a/src/csharp/Grpc.IntegrationTesting/GeneratedServiceBaseTest.cs +++ b/src/csharp/Grpc.IntegrationTesting/GeneratedServiceBaseTest.cs @@ -65,7 +65,7 @@ namespace Grpc.IntegrationTesting } [Test] - public async Task UnimplementedByDefault_ClientStreaming() + public void UnimplementedByDefault_ClientStreaming() { var call = client.StreamingInputCall(); @@ -74,7 +74,7 @@ namespace Grpc.IntegrationTesting } [Test] - public async Task UnimplementedByDefault_ServerStreamingCall() + public void UnimplementedByDefault_ServerStreamingCall() { var call = client.StreamingOutputCall(new StreamingOutputCallRequest()); @@ -83,7 +83,7 @@ namespace Grpc.IntegrationTesting } [Test] - public async Task UnimplementedByDefault_DuplexStreamingCall() + public void UnimplementedByDefault_DuplexStreamingCall() { var call = client.FullDuplexCall(); diff --git a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj index 6f2f06a652..f5077fe0f7 100755 --- a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj +++ b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj @@ -10,6 +10,7 @@ <PackageId>Grpc.IntegrationTesting</PackageId> <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45</PackageTargetFallback> <RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> </PropertyGroup> <ItemGroup> diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs index 4a28f24124..e0fc259f08 100644 --- a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs +++ b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs @@ -38,7 +38,7 @@ namespace Grpc.IntegrationTesting Channel channel; TestService.TestServiceClient client; - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { // Disable SO_REUSEPORT to prevent https://github.com/grpc/grpc/issues/10755 @@ -58,7 +58,7 @@ namespace Grpc.IntegrationTesting client = new TestService.TestServiceClient(channel); } - [TestFixtureTearDown] + [OneTimeTearDown] public void Cleanup() { channel.ShutdownAsync().Wait(); diff --git a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs index bc32c56927..9a664f3539 100644 --- a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs @@ -21,6 +21,7 @@ // Currently, 'Gauge' (i.e a metric that represents the measured value of // something at an instant of time) is the only metric type supported by the // service. +#pragma warning disable 1591 #region Designer generated code using System; diff --git a/src/csharp/Grpc.IntegrationTesting/RunnerClientServerTest.cs b/src/csharp/Grpc.IntegrationTesting/RunnerClientServerTest.cs index a766a5bba8..c5c92aa94a 100644 --- a/src/csharp/Grpc.IntegrationTesting/RunnerClientServerTest.cs +++ b/src/csharp/Grpc.IntegrationTesting/RunnerClientServerTest.cs @@ -35,7 +35,7 @@ namespace Grpc.IntegrationTesting { IServerRunner serverRunner; - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { var serverConfig = new ServerConfig @@ -45,7 +45,7 @@ namespace Grpc.IntegrationTesting serverRunner = ServerRunners.CreateStarted(serverConfig); } - [TestFixtureTearDown] + [OneTimeTearDown] public void Cleanup() { serverRunner.StopAsync().Wait(); diff --git a/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs b/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs index bd5971e296..bfae4ee6ac 100644 --- a/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs @@ -17,6 +17,7 @@ // // An integration test service that covers all the method signature permutations // of unary/streaming requests/responses. +#pragma warning disable 1591 #region Designer generated code using System; diff --git a/src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs b/src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs index 974ed966e4..152d8feab9 100644 --- a/src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs +++ b/src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs @@ -41,7 +41,7 @@ namespace Grpc.IntegrationTesting Channel channel; TestService.TestServiceClient client; - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { var rootCert = File.ReadAllText(TestCredentials.ClientCertAuthorityPath); @@ -69,7 +69,7 @@ namespace Grpc.IntegrationTesting client = new TestService.TestServiceClient(channel); } - [TestFixtureTearDown] + [OneTimeTearDown] public void Cleanup() { channel.ShutdownAsync().Wait(); @@ -94,15 +94,15 @@ namespace Grpc.IntegrationTesting private class SslCredentialsTestServiceImpl : TestService.TestServiceBase { - public override async Task<SimpleResponse> UnaryCall(SimpleRequest request, ServerCallContext context) + public override Task<SimpleResponse> UnaryCall(SimpleRequest request, ServerCallContext context) { - return new SimpleResponse { Payload = CreateZerosPayload(request.ResponseSize) }; + return Task.FromResult(new SimpleResponse { Payload = CreateZerosPayload(request.ResponseSize) }); } public override async Task<StreamingInputCallResponse> StreamingInputCall(IAsyncStreamReader<StreamingInputCallRequest> requestStream, ServerCallContext context) { var authContext = context.AuthContext; - await requestStream.ForEachAsync(async request => {}); + await requestStream.ForEachAsync(request => TaskUtils.CompletedTask); Assert.IsTrue(authContext.IsPeerAuthenticated); Assert.AreEqual("x509_subject_alternative_name", authContext.PeerIdentityPropertyName); diff --git a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs index b180d097bd..b419dd1702 100644 --- a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs @@ -18,6 +18,7 @@ // An integration test service that covers all the method signature permutations // of unary/streaming requests/responses. // +#pragma warning disable 1591 #region Designer generated code using System; diff --git a/src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs b/src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs index ad03351572..09725123d9 100644 --- a/src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs +++ b/src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs @@ -63,9 +63,10 @@ namespace Grpc.Testing await EnsureEchoMetadataAsync(context); int sum = 0; - await requestStream.ForEachAsync(async request => + await requestStream.ForEachAsync(request => { sum += request.Payload.Body.Length; + return TaskUtils.CompletedTask; }); return new StreamingInputCallResponse { AggregatedPayloadSize = sum }; } @@ -85,7 +86,7 @@ namespace Grpc.Testing }); } - public override async Task HalfDuplexCall(IAsyncStreamReader<StreamingOutputCallRequest> requestStream, IServerStreamWriter<StreamingOutputCallResponse> responseStream, ServerCallContext context) + public override Task HalfDuplexCall(IAsyncStreamReader<StreamingOutputCallRequest> requestStream, IServerStreamWriter<StreamingOutputCallResponse> responseStream, ServerCallContext context) { throw new NotImplementedException(); } diff --git a/src/csharp/Grpc.Microbenchmarks/Grpc.Microbenchmarks.csproj b/src/csharp/Grpc.Microbenchmarks/Grpc.Microbenchmarks.csproj index 26a940e488..17797e1e1e 100644 --- a/src/csharp/Grpc.Microbenchmarks/Grpc.Microbenchmarks.csproj +++ b/src/csharp/Grpc.Microbenchmarks/Grpc.Microbenchmarks.csproj @@ -10,6 +10,7 @@ <PackageId>Grpc.Microbenchmarks</PackageId> <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45</PackageTargetFallback> <RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> </PropertyGroup> <ItemGroup> diff --git a/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.csproj b/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.csproj index af6ade852b..cf756c68ad 100755 --- a/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.csproj +++ b/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.csproj @@ -10,6 +10,7 @@ <PackageId>Grpc.Reflection.Tests</PackageId> <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45</PackageTargetFallback> <RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> </PropertyGroup> <ItemGroup> diff --git a/src/csharp/Grpc.Reflection.Tests/ReflectionClientServerTest.cs b/src/csharp/Grpc.Reflection.Tests/ReflectionClientServerTest.cs index 7e894edd31..76f8cfadcf 100644 --- a/src/csharp/Grpc.Reflection.Tests/ReflectionClientServerTest.cs +++ b/src/csharp/Grpc.Reflection.Tests/ReflectionClientServerTest.cs @@ -38,7 +38,7 @@ namespace Grpc.Reflection.Tests ServerReflection.ServerReflectionClient client; ReflectionServiceImpl serviceImpl; - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { serviceImpl = new ReflectionServiceImpl(ServerReflection.Descriptor); @@ -55,7 +55,7 @@ namespace Grpc.Reflection.Tests client = new ServerReflection.ServerReflectionClient(channel); } - [TestFixtureTearDown] + [OneTimeTearDown] public void Cleanup() { channel.ShutdownAsync().Wait(); diff --git a/src/csharp/Grpc.Reflection/Grpc.Reflection.csproj b/src/csharp/Grpc.Reflection/Grpc.Reflection.csproj index 929a78edcb..b77fd69aee 100755 --- a/src/csharp/Grpc.Reflection/Grpc.Reflection.csproj +++ b/src/csharp/Grpc.Reflection/Grpc.Reflection.csproj @@ -18,6 +18,7 @@ <IncludeSymbols>true</IncludeSymbols> <IncludeSource>true</IncludeSource> <GenerateDocumentationFile>true</GenerateDocumentationFile> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> </PropertyGroup> <ItemGroup> diff --git a/src/csharp/Grpc.Reflection/ReflectionGrpc.cs b/src/csharp/Grpc.Reflection/ReflectionGrpc.cs index 0af76eefed..58439577e3 100644 --- a/src/csharp/Grpc.Reflection/ReflectionGrpc.cs +++ b/src/csharp/Grpc.Reflection/ReflectionGrpc.cs @@ -17,6 +17,7 @@ // // Service exported by server reflection // +#pragma warning disable 1591 #region Designer generated code using System; diff --git a/src/csharp/Grpc.Reflection/ReflectionServiceImpl.cs b/src/csharp/Grpc.Reflection/ReflectionServiceImpl.cs index 9f27a9491d..1eaf10bfb8 100644 --- a/src/csharp/Grpc.Reflection/ReflectionServiceImpl.cs +++ b/src/csharp/Grpc.Reflection/ReflectionServiceImpl.cs @@ -60,6 +60,9 @@ namespace Grpc.Reflection { } + /// <summary> + /// Processes a stream of server reflection requests. + /// </summary> public override async Task ServerReflectionInfo(IAsyncStreamReader<ServerReflectionRequest> requestStream, IServerStreamWriter<ServerReflectionResponse> responseStream, ServerCallContext context) { while (await requestStream.MoveNext()) diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat index 4e3870d71d..c419d87049 100755 --- a/src/csharp/build_packages_dotnetcli.bat +++ b/src/csharp/build_packages_dotnetcli.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=1.5.0-dev +set VERSION=1.7.0-dev @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe diff --git a/src/csharp/build_packages_dotnetcli.sh b/src/csharp/build_packages_dotnetcli.sh index f259cdb1d5..124dfbb257 100755 --- a/src/csharp/build_packages_dotnetcli.sh +++ b/src/csharp/build_packages_dotnetcli.sh @@ -39,7 +39,7 @@ dotnet pack --configuration Release Grpc.Auth --output ../../../artifacts dotnet pack --configuration Release Grpc.HealthCheck --output ../../../artifacts dotnet pack --configuration Release Grpc.Reflection --output ../../../artifacts -nuget pack Grpc.nuspec -Version "1.5.0-dev" -OutputDirectory ../../artifacts -nuget pack Grpc.Tools.nuspec -Version "1.5.0-dev" -OutputDirectory ../../artifacts +nuget pack Grpc.nuspec -Version "1.7.0-dev" -OutputDirectory ../../artifacts +nuget pack Grpc.Tools.nuspec -Version "1.7.0-dev" -OutputDirectory ../../artifacts (cd ../../artifacts && zip csharp_nugets_dotnetcli.zip *.nupkg) diff --git a/src/csharp/global.json b/src/csharp/global.json new file mode 100644 index 0000000000..e4b797ee8e --- /dev/null +++ b/src/csharp/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "1.0.0" + } +} diff --git a/src/node/health_check/package.json b/src/node/health_check/package.json index 6aa41522cd..3c7d3707ee 100644 --- a/src/node/health_check/package.json +++ b/src/node/health_check/package.json @@ -1,6 +1,6 @@ { "name": "grpc-health-check", - "version": "1.5.0-dev", + "version": "1.7.0-dev", "author": "Google Inc.", "description": "Health check service for use with gRPC", "repository": { @@ -15,7 +15,7 @@ } ], "dependencies": { - "grpc": "^1.5.0-dev", + "grpc": "^1.7.0-dev", "lodash": "^3.9.3", "google-protobuf": "^3.0.0" }, diff --git a/src/node/tools/package.json b/src/node/tools/package.json index 0a3c32734c..d9b1fb86c9 100644 --- a/src/node/tools/package.json +++ b/src/node/tools/package.json @@ -1,6 +1,6 @@ { "name": "grpc-tools", - "version": "1.5.0-dev", + "version": "1.7.0-dev", "author": "Google Inc.", "description": "Tools for developing with gRPC on Node.js", "homepage": "https://grpc.io/", diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index 345eecc279..3a282b0526 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCPlugin' - v = '1.5.0-dev' + v = '1.7.0-dev' s.version = v s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/GRPCClient/private/version.h b/src/objective-c/GRPCClient/private/version.h index d9cb3881e1..843954e84a 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -23,4 +23,4 @@ // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.5.0-dev" +#define GRPC_OBJC_VERSION_STRING @"1.7.0-dev" diff --git a/src/objective-c/tests/build_one_example.sh b/src/objective-c/tests/build_one_example.sh index 298d8e7043..985d55f3cc 100755 --- a/src/objective-c/tests/build_one_example.sh +++ b/src/objective-c/tests/build_one_example.sh @@ -37,11 +37,11 @@ rm -f Podfile.lock pod install set -o pipefail -XCODEBUILD_FILTER='(^===|^\*\*|\bfatal\b|\berror\b|\bwarning\b|\bfail|\bpassed\b)' +XCODEBUILD_FILTER='(^CompileC |^Ld |^.*clang |^ *cd |^ *export |^Libtool |^.*libtool |^CpHeader |^ *builtin-copy )' xcodebuild \ build \ -workspace *.xcworkspace \ -scheme $SCHEME \ -destination name="iPhone 6" \ - | egrep "$XCODEBUILD_FILTER" \ - | egrep -v "(GPBDictionary|GPBArray)" - + | egrep -v "$XCODEBUILD_FILTER" \ + | egrep -v "^$" - diff --git a/src/objective-c/tests/run_tests.sh b/src/objective-c/tests/run_tests.sh index 8843edaede..5b7a2d104a 100755 --- a/src/objective-c/tests/run_tests.sh +++ b/src/objective-c/tests/run_tests.sh @@ -38,7 +38,7 @@ trap 'kill -9 `jobs -p` ; echo "EXIT TIME: $(date)"' EXIT # element of the pipe fails. # TODO(jcanizales): Use xctool instead? Issue #2540. set -o pipefail -XCODEBUILD_FILTER='(^===|^\*\*|\bfatal\b|\berror\b|\bwarning\b|\bfail|\bpassed\b)' +XCODEBUILD_FILTER='(^CompileC |^Ld |^.*clang |^ *cd |^ *export |^Libtool |^.*libtool |^CpHeader |^ *builtin-copy )' echo "TIME: $(date)" xcodebuild \ -workspace Tests.xcworkspace \ @@ -48,8 +48,8 @@ xcodebuild \ HOST_PORT_LOCAL=localhost:5050 \ HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com \ test \ - | egrep "$XCODEBUILD_FILTER" \ - | egrep -v "(GPBDictionary|GPBArray)" - + | egrep -v "$XCODEBUILD_FILTER" \ + | egrep -v '^$' - echo "TIME: $(date)" xcodebuild \ @@ -60,16 +60,12 @@ xcodebuild \ | egrep "$XCODEBUILD_FILTER" \ | egrep -v "(GPBDictionary|GPBArray)" - -# Temporarily disabled for (possible) flakiness on Jenkins. -# Fix or reenable after confirmation/disconfirmation that it is the source of -# Jenkins problem. - -# echo "TIME: $(date)" -# xcodebuild \ -# -workspace Tests.xcworkspace \ -# -scheme CronetUnitTests \ -# -destination name="iPhone 6" \ -# test | xcpretty +echo "TIME: $(date)" +xcodebuild \ + -workspace Tests.xcworkspace \ + -scheme CronetUnitTests \ + -destination name="iPhone 6" \ + test | xcpretty echo "TIME: $(date)" xcodebuild \ diff --git a/src/php/composer.json b/src/php/composer.json index c6a74c5c84..3606a18f34 100644 --- a/src/php/composer.json +++ b/src/php/composer.json @@ -2,7 +2,7 @@ "name": "grpc/grpc-dev", "description": "gRPC library for PHP - for Developement use only", "license": "Apache-2.0", - "version": "1.5.0", + "version": "1.7.0", "require": { "php": ">=5.5.0", "google/protobuf": "^v3.3.0" diff --git a/src/php/ext/grpc/version.h b/src/php/ext/grpc/version.h index 744028b2ca..07d8eee7fe 100644 --- a/src/php/ext/grpc/version.h +++ b/src/php/ext/grpc/version.h @@ -20,6 +20,6 @@ #ifndef VERSION_H #define VERSION_H -#define PHP_GRPC_VERSION "1.5.0dev" +#define PHP_GRPC_VERSION "1.7.0dev" #endif /* VERSION_H */ diff --git a/src/php/lib/Grpc/ServerStreamingCall.php b/src/php/lib/Grpc/ServerStreamingCall.php index 269a99ab59..f8fddfea01 100644 --- a/src/php/lib/Grpc/ServerStreamingCall.php +++ b/src/php/lib/Grpc/ServerStreamingCall.php @@ -40,13 +40,11 @@ class ServerStreamingCall extends AbstractCall if (array_key_exists('flags', $options)) { $message_array['flags'] = $options['flags']; } - $event = $this->call->startBatch([ + $this->call->startBatch([ OP_SEND_INITIAL_METADATA => $metadata, - OP_RECV_INITIAL_METADATA => true, OP_SEND_MESSAGE => $message_array, OP_SEND_CLOSE_FROM_CLIENT => true, ]); - $this->metadata = $event->metadata; } /** @@ -54,9 +52,15 @@ class ServerStreamingCall extends AbstractCall */ public function responses() { - $response = $this->call->startBatch([ - OP_RECV_MESSAGE => true, - ])->message; + $batch = [OP_RECV_MESSAGE => true]; + if ($this->metadata === null) { + $batch[OP_RECV_INITIAL_METADATA] = true; + } + $read_event = $this->call->startBatch($batch); + if ($this->metadata === null) { + $this->metadata = $read_event->metadata; + } + $response = $read_event->message; while ($response !== null) { yield $this->_deserializeResponse($response); $response = $this->call->startBatch([ @@ -81,4 +85,16 @@ class ServerStreamingCall extends AbstractCall return $status_event->status; } + + /** + * @return mixed The metadata sent by the server + */ + public function getMetadata() + { + if ($this->metadata === null) { + $event = $this->call->startBatch([OP_RECV_INITIAL_METADATA => true]); + $this->metadata = $event->metadata; + } + return $this->metadata; + } } diff --git a/src/php/lib/Grpc/UnaryCall.php b/src/php/lib/Grpc/UnaryCall.php index dd55d02165..e8496492b8 100644 --- a/src/php/lib/Grpc/UnaryCall.php +++ b/src/php/lib/Grpc/UnaryCall.php @@ -40,13 +40,11 @@ class UnaryCall extends AbstractCall if (isset($options['flags'])) { $message_array['flags'] = $options['flags']; } - $event = $this->call->startBatch([ + $this->call->startBatch([ OP_SEND_INITIAL_METADATA => $metadata, - OP_RECV_INITIAL_METADATA => true, OP_SEND_MESSAGE => $message_array, OP_SEND_CLOSE_FROM_CLIENT => true, ]); - $this->metadata = $event->metadata; } /** @@ -56,14 +54,32 @@ class UnaryCall extends AbstractCall */ public function wait() { - $event = $this->call->startBatch([ + $batch = [ OP_RECV_MESSAGE => true, OP_RECV_STATUS_ON_CLIENT => true, - ]); - + ]; + if ($this->metadata === null) { + $batch[OP_RECV_INITIAL_METADATA] = true; + } + $event = $this->call->startBatch($batch); + if ($this->metadata === null) { + $this->metadata = $event->metadata; + } $status = $event->status; $this->trailing_metadata = $status->metadata; return [$this->_deserializeResponse($event->message), $status]; } + + /** + * @return mixed The metadata sent by the server + */ + public function getMetadata() + { + if ($this->metadata === null) { + $event = $this->call->startBatch([OP_RECV_INITIAL_METADATA => true]); + $this->metadata = $event->metadata; + } + return $this->metadata; + } } diff --git a/src/python/grpcio/grpc/_grpcio_metadata.py b/src/python/grpcio/grpc/_grpcio_metadata.py index dcb46459a2..a4eb358c4e 100644 --- a/src/python/grpcio/grpc/_grpcio_metadata.py +++ b/src/python/grpcio/grpc/_grpcio_metadata.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!! -__version__ = """1.5.0.dev0""" +__version__ = """1.7.0.dev0""" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index 1bbd1e149e..3194a893d7 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION='1.5.0.dev0' +VERSION='1.7.0.dev0' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index 8aa5118f39..ef68bad17a 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION='1.5.0.dev0' +VERSION='1.7.0.dev0' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index a23b9b5edb..55ab959cc5 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION='1.5.0.dev0' +VERSION='1.7.0.dev0' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index fd47b426ac..9e54dc9f75 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION='1.5.0.dev0' +VERSION='1.7.0.dev0' diff --git a/src/ruby/lib/grpc/generic/rpc_desc.rb b/src/ruby/lib/grpc/generic/rpc_desc.rb index 89cf8ff6a0..6fb6c412fb 100644 --- a/src/ruby/lib/grpc/generic/rpc_desc.rb +++ b/src/ruby/lib/grpc/generic/rpc_desc.rb @@ -99,9 +99,13 @@ module GRPC # event. Send a status of deadline exceeded GRPC.logger.warn("late call: #{active_call}") send_status(active_call, DEADLINE_EXCEEDED, 'late') - rescue StandardError => e + rescue StandardError, NotImplementedError => e # This will usuaally be an unhandled error in the handling code. # Send back a UNKNOWN status to the client + # + # Note: this intentionally does not map NotImplementedError to + # UNIMPLEMENTED because NotImplementedError is intended for low-level + # OS interaction (e.g. syscalls) not supported by the current OS. GRPC.logger.warn("failed handler: #{active_call}; sending status:UNKNOWN") GRPC.logger.warn(e) send_status(active_call, UNKNOWN, "#{e.class}: #{e.message}") diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index 0aaf44947a..228c01a92c 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -14,5 +14,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.5.0.dev' + VERSION = '1.7.0.dev' end diff --git a/src/ruby/spec/generic/rpc_desc_spec.rb b/src/ruby/spec/generic/rpc_desc_spec.rb index be578c40d3..6852b9804f 100644 --- a/src/ruby/spec/generic/rpc_desc_spec.rb +++ b/src/ruby/spec/generic/rpc_desc_spec.rb @@ -52,6 +52,13 @@ describe GRPC::RpcDesc do this_desc.run_server_method(@call, method(:other_error)) end + it 'sends status UNKNOWN if NotImplementedErrors are raised' do + expect(@call).to receive(:read_unary_request).once.and_return(Object.new) + expect(@call).to receive(:send_status).once.with( + UNKNOWN, not_implemented_error_msg, false, metadata: {}) + this_desc.run_server_method(@call, method(:not_implemented)) + end + it 'absorbs CallError with no further action' do expect(@call).to receive(:read_unary_request).once.and_raise(CallError) blk = proc do @@ -102,6 +109,12 @@ describe GRPC::RpcDesc do @client_streamer.run_server_method(@call, method(:other_error_alt)) end + it 'sends status UNKNOWN if NotImplementedErrors are raised' do + expect(@call).to receive(:send_status).once.with( + UNKNOWN, not_implemented_error_msg, false, metadata: {}) + @client_streamer.run_server_method(@call, method(:not_implemented_alt)) + end + it 'absorbs CallError with no further action' do expect(@call).to receive(:server_unary_response).once.and_raise( CallError) @@ -166,6 +179,14 @@ describe GRPC::RpcDesc do @bidi_streamer.run_server_method(@call, method(:other_error_alt)) end + it 'sends status UNKNOWN if NotImplementedErrors are raised' do + expect(@call).to receive(:run_server_bidi).and_raise( + not_implemented_error) + expect(@call).to receive(:send_status).once.with( + UNKNOWN, not_implemented_error_msg, false, metadata: {}) + @bidi_streamer.run_server_method(@call, method(:not_implemented_alt)) + end + it 'closes the stream if there no errors' do expect(@call).to receive(:run_server_bidi) expect(@call).to receive(:output_metadata).and_return(fake_md) @@ -329,8 +350,25 @@ describe GRPC::RpcDesc do fail(ArgumentError, 'other error') end + def not_implemented(_req, _call) + fail not_implemented_error + end + + def not_implemented_alt(_call) + fail not_implemented_error + end + def arg_error_msg(error = nil) error ||= ArgumentError.new('other error') "#{error.class}: #{error.message}" end + + def not_implemented_error + NotImplementedError.new('some OS feature not implemented') + end + + def not_implemented_error_msg(error = nil) + error ||= not_implemented_error + "#{error.class}: #{error.message}" + end end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index 4c5293241d..ea0c4ae56c 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -14,6 +14,6 @@ module GRPC module Tools - VERSION = '1.5.0.dev' + VERSION = '1.7.0.dev' end end |