From ebe8eb2db9a1620496353f8ffb91e04488226790 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 10 Feb 2017 11:04:23 -0800 Subject: [PATCH 001/461] Deframe lazily --- .../chttp2/transport/chttp2_transport.c | 224 +++++++++++++++--- .../transport/chttp2/transport/frame_data.c | 44 ++-- .../ext/transport/chttp2/transport/internal.h | 5 +- .../ext/transport/chttp2/transport/parsing.c | 1 + 4 files changed, 225 insertions(+), 49 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index da4c7dc7b23..5c5c29389f4 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -156,6 +156,10 @@ static void finish_keepalive_ping_locked(grpc_exec_ctx *exec_ctx, void *arg, static void keepalive_watchdog_fired_locked(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error); +static grpc_error *deframe_unprocessed_incoming_frames( + grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *p, + grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_slice_buffer *slices); + /******************************************************************************* * CONSTRUCTION/DESTRUCTION/REFCOUNTING */ @@ -595,6 +599,8 @@ static int init_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, s->deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); grpc_closure_init(&s->complete_fetch_locked, complete_fetch_locked, s, grpc_schedule_on_exec_ctx); + s->incoming_frames = NULL; + grpc_slice_buffer_init(&s->unprocessed_incoming_frames_buffer); GRPC_CHTTP2_REF_TRANSPORT(t, "stream"); @@ -612,7 +618,6 @@ static int init_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, static void destroy_stream_locked(grpc_exec_ctx *exec_ctx, void *sp, grpc_error *error) { - grpc_byte_stream *bs; grpc_chttp2_stream *s = sp; grpc_chttp2_transport *t = s->t; @@ -623,8 +628,12 @@ static void destroy_stream_locked(grpc_exec_ctx *exec_ctx, void *sp, GPR_ASSERT(grpc_chttp2_stream_map_find(&t->stream_map, s->id) == NULL); } - while ((bs = grpc_chttp2_incoming_frame_queue_pop(&s->incoming_frames))) { - incoming_byte_stream_destroy_locked(exec_ctx, bs, GRPC_ERROR_NONE); + if (s->incoming_frames != NULL) { + grpc_chttp2_incoming_byte_stream *ibs = s->incoming_frames; + s->incoming_frames = NULL; + incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, GRPC_ERROR_NONE); + grpc_slice_buffer_destroy_internal(exec_ctx, + &s->unprocessed_incoming_frames_buffer); } grpc_chttp2_list_remove_stalled_by_transport(t, s); @@ -1316,8 +1325,8 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op, GPR_ASSERT(s->recv_message_ready == NULL); s->recv_message_ready = op->recv_message_ready; s->recv_message = op->recv_message; - if (s->id != 0 && - (s->incoming_frames.head == NULL || s->incoming_frames.head->is_tail)) { + if (s->id != 0 && (s->incoming_frames == NULL || + s->unprocessed_incoming_frames_buffer.count == 0)) { incoming_byte_stream_update_flow_control(exec_ctx, t, s, 5, 0); } grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); @@ -1483,13 +1492,16 @@ static void perform_transport_op(grpc_exec_ctx *exec_ctx, grpc_transport *gt, void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s) { - grpc_byte_stream *bs; if (s->recv_initial_metadata_ready != NULL && s->published_metadata[0] != GRPC_METADATA_NOT_PUBLISHED) { if (s->seen_error) { - while ((bs = grpc_chttp2_incoming_frame_queue_pop(&s->incoming_frames)) != - NULL) { - incoming_byte_stream_destroy_locked(exec_ctx, bs, GRPC_ERROR_NONE); + if (s->incoming_frames != NULL) { + grpc_chttp2_incoming_byte_stream *ibs = s->incoming_frames; + s->incoming_frames = NULL; + incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, + GRPC_ERROR_NONE); + grpc_slice_buffer_destroy_internal( + exec_ctx, &s->unprocessed_incoming_frames_buffer); } } grpc_chttp2_incoming_metadata_buffer_publish( @@ -1502,18 +1514,29 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_exec_ctx *exec_ctx, void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s) { - grpc_byte_stream *bs; + grpc_error *error = GRPC_ERROR_NONE; if (s->recv_message_ready != NULL) { - while (s->final_metadata_requested && s->seen_error && - (bs = grpc_chttp2_incoming_frame_queue_pop(&s->incoming_frames)) != - NULL) { - incoming_byte_stream_destroy_locked(exec_ctx, bs, GRPC_ERROR_NONE); + if (s->final_metadata_requested && s->seen_error && + s->incoming_frames != NULL) { + grpc_chttp2_incoming_byte_stream *ibs = s->incoming_frames; + s->incoming_frames = NULL; + incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, + GRPC_ERROR_NONE); + grpc_slice_buffer_destroy_internal( + exec_ctx, &s->unprocessed_incoming_frames_buffer); } - if (s->incoming_frames.head != NULL) { - *s->recv_message = - grpc_chttp2_incoming_frame_queue_pop(&s->incoming_frames); + if (s->incoming_frames != NULL || + (GRPC_ERROR_NONE == (error = deframe_unprocessed_incoming_frames( + exec_ctx, &s->data_parser, t, s, + &s->unprocessed_incoming_frames_buffer)) && + s->incoming_frames != NULL)) { + *s->recv_message = &s->incoming_frames->base; + s->incoming_frames = NULL; GPR_ASSERT(*s->recv_message != NULL); null_then_run_closure(exec_ctx, &s->recv_message_ready, GRPC_ERROR_NONE); + } else if (error != GRPC_ERROR_NONE) { + GPR_ASSERT(s->incoming_frames == NULL); + null_then_run_closure(exec_ctx, &s->recv_message_ready, error); } else if (s->published_metadata[1] != GRPC_METADATA_NOT_PUBLISHED) { *s->recv_message = NULL; null_then_run_closure(exec_ctx, &s->recv_message_ready, GRPC_ERROR_NONE); @@ -1524,14 +1547,17 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s) { - grpc_byte_stream *bs; grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); if (s->recv_trailing_metadata_finished != NULL && s->read_closed && s->write_closed) { if (s->seen_error) { - while ((bs = grpc_chttp2_incoming_frame_queue_pop(&s->incoming_frames)) != - NULL) { - incoming_byte_stream_destroy_locked(exec_ctx, bs, GRPC_ERROR_NONE); + if (s->incoming_frames != NULL) { + grpc_chttp2_incoming_byte_stream *ibs = s->incoming_frames; + s->incoming_frames = NULL; + incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, + GRPC_ERROR_NONE); + grpc_slice_buffer_destroy_internal( + exec_ctx, &s->unprocessed_incoming_frames_buffer); } } if (s->all_incoming_byte_streams_finished && @@ -2176,6 +2202,148 @@ static void set_pollset_set(grpc_exec_ctx *exec_ctx, grpc_transport *gt, * BYTE STREAM */ +static grpc_error *deframe_unprocessed_incoming_frames( + grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *p, + grpc_chttp2_transport *t, grpc_chttp2_stream *s, + grpc_slice_buffer *slices) { + while (slices->count > 0) { + uint8_t *beg = NULL; + uint8_t *end = NULL; + uint8_t *cur = NULL; + + grpc_slice slice = grpc_slice_buffer_take_first(slices); + + beg = GRPC_SLICE_START_PTR(slice); + end = GRPC_SLICE_END_PTR(slice); + cur = beg; + uint32_t message_flags; + char *msg; + + if (cur == end) { + grpc_slice_unref_internal(exec_ctx, slice); + continue; + } + + switch (p->state) { + case GRPC_CHTTP2_DATA_ERROR: + p->state = GRPC_CHTTP2_DATA_ERROR; + grpc_slice_unref_internal(exec_ctx, slice); + return GRPC_ERROR_REF(p->error); + case GRPC_CHTTP2_DATA_FH_0: + p->frame_type = *cur; + switch (p->frame_type) { + case 0: + p->is_frame_compressed = 0; /* GPR_FALSE */ + break; + case 1: + p->is_frame_compressed = 1; /* GPR_TRUE */ + break; + default: + gpr_asprintf(&msg, "Bad GRPC frame type 0x%02x", p->frame_type); + p->error = GRPC_ERROR_CREATE(msg); + p->error = grpc_error_set_int(p->error, GRPC_ERROR_INT_STREAM_ID, + (intptr_t)s->id); + gpr_free(msg); + msg = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); + p->error = + grpc_error_set_str(p->error, GRPC_ERROR_STR_RAW_BYTES, msg); + gpr_free(msg); + p->error = + grpc_error_set_int(p->error, GRPC_ERROR_INT_OFFSET, cur - beg); + p->state = GRPC_CHTTP2_DATA_ERROR; + grpc_slice_unref_internal(exec_ctx, slice); + return GRPC_ERROR_REF(p->error); + } + if (++cur == end) { + p->state = GRPC_CHTTP2_DATA_FH_1; + grpc_slice_unref_internal(exec_ctx, slice); + continue; + } + /* fallthrough */ + case GRPC_CHTTP2_DATA_FH_1: + p->frame_size = ((uint32_t)*cur) << 24; + if (++cur == end) { + p->state = GRPC_CHTTP2_DATA_FH_2; + grpc_slice_unref_internal(exec_ctx, slice); + continue; + } + /* fallthrough */ + case GRPC_CHTTP2_DATA_FH_2: + p->frame_size |= ((uint32_t)*cur) << 16; + if (++cur == end) { + p->state = GRPC_CHTTP2_DATA_FH_3; + grpc_slice_unref_internal(exec_ctx, slice); + continue; + } + /* fallthrough */ + case GRPC_CHTTP2_DATA_FH_3: + p->frame_size |= ((uint32_t)*cur) << 8; + if (++cur == end) { + p->state = GRPC_CHTTP2_DATA_FH_4; + grpc_slice_unref_internal(exec_ctx, slice); + continue; + } + /* fallthrough */ + case GRPC_CHTTP2_DATA_FH_4: + p->frame_size |= ((uint32_t)*cur); + p->state = GRPC_CHTTP2_DATA_FRAME; + ++cur; + message_flags = 0; + if (p->is_frame_compressed) { + message_flags |= GRPC_WRITE_INTERNAL_COMPRESS; + } + GPR_ASSERT(s->incoming_frames == NULL); + p->parsing_frame = s->incoming_frames = + grpc_chttp2_incoming_byte_stream_create( + exec_ctx, t, s, p->frame_size, message_flags, false); + /* fallthrough */ + case GRPC_CHTTP2_DATA_FRAME: + if (cur == end) { + grpc_slice_unref_internal(exec_ctx, slice); + continue; + } + uint32_t remaining = (uint32_t)(end - cur); + if (remaining == p->frame_size) { + grpc_chttp2_incoming_byte_stream_push( + exec_ctx, p->parsing_frame, + grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, + GRPC_ERROR_NONE); + p->parsing_frame = NULL; + p->state = GRPC_CHTTP2_DATA_FH_0; + grpc_slice_unref_internal(exec_ctx, slice); + break; + } else if (remaining < p->frame_size) { + grpc_chttp2_incoming_byte_stream_push( + exec_ctx, p->parsing_frame, + grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + p->frame_size -= remaining; + grpc_slice_unref_internal(exec_ctx, slice); + continue; + } else { + GPR_ASSERT(remaining > p->frame_size); + grpc_chttp2_incoming_byte_stream_push( + exec_ctx, p->parsing_frame, + grpc_slice_sub(slice, (size_t)(cur - beg), + (size_t)(cur + p->frame_size - beg))); + grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, + GRPC_ERROR_NONE); + p->parsing_frame = NULL; + p->state = GRPC_CHTTP2_DATA_FH_0; + cur += p->frame_size; + /* slice is not used up; push back to the head of buffer */ + grpc_slice_buffer_undo_take_first( + &s->unprocessed_incoming_frames_buffer, + grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + grpc_slice_unref_internal(exec_ctx, slice); + break; + } + } + } + + return GRPC_ERROR_NONE; +} + static void incoming_byte_stream_unref(grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs) { if (gpr_unref(&bs->refs)) { @@ -2249,6 +2417,7 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx *exec_ctx, exec_ctx, t, s, bs->next_action.max_size_hint, cur_length); } gpr_mu_lock(&bs->slice_mu); + if (bs->slices.count > 0) { *bs->next_action.slice = grpc_slice_buffer_take_first(&bs->slices); grpc_closure_run(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_NONE); @@ -2360,7 +2529,7 @@ void grpc_chttp2_incoming_byte_stream_finished( grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s, - uint32_t frame_size, uint32_t flags) { + uint32_t frame_size, uint32_t flags, bool trigger_recv) { grpc_chttp2_incoming_byte_stream *incoming_byte_stream = gpr_malloc(sizeof(*incoming_byte_stream)); incoming_byte_stream->base.length = frame_size; @@ -2378,15 +2547,10 @@ grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( incoming_byte_stream->on_next = NULL; incoming_byte_stream->is_tail = 1; incoming_byte_stream->error = GRPC_ERROR_NONE; - grpc_chttp2_incoming_frame_queue *q = &s->incoming_frames; - if (q->head == NULL) { - q->head = incoming_byte_stream; - } else { - q->tail->is_tail = 0; - q->tail->next_message = incoming_byte_stream; + s->incoming_frames = incoming_byte_stream; + if (trigger_recv) { + grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); } - q->tail = incoming_byte_stream; - grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); return incoming_byte_stream; } diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c index f9b9e1b3092..75657e4c70b 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -141,7 +141,7 @@ void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer *inbuf, stats->data_bytes += write_bytes; } -static grpc_error *parse_inner(grpc_exec_ctx *exec_ctx, +grpc_error *parse_inner_buffer(grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *p, grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_slice slice) { @@ -149,18 +149,26 @@ static grpc_error *parse_inner(grpc_exec_ctx *exec_ctx, uint8_t *const end = GRPC_SLICE_END_PTR(slice); uint8_t *cur = beg; uint32_t message_flags; - grpc_chttp2_incoming_byte_stream *incoming_byte_stream; char *msg; if (cur == end) { return GRPC_ERROR_NONE; } + /* If there is already pending data, or if there is a pending + * incoming_byte_stream that is finished, append the data to unprcessed frame + * buffer. */ + if (s->unprocessed_incoming_frames_buffer.count > 0 || + (s->incoming_frames != NULL && p->parsing_frame == NULL)) { + grpc_slice_ref(slice); + grpc_slice_buffer_add(&s->unprocessed_incoming_frames_buffer, slice); + return GRPC_ERROR_NONE; + } + switch (p->state) { case GRPC_CHTTP2_DATA_ERROR: p->state = GRPC_CHTTP2_DATA_ERROR; return GRPC_ERROR_REF(p->error); - fh_0: case GRPC_CHTTP2_DATA_FH_0: s->stats.incoming.framing_bytes++; p->frame_type = *cur; @@ -224,17 +232,17 @@ static grpc_error *parse_inner(grpc_exec_ctx *exec_ctx, if (p->is_frame_compressed) { message_flags |= GRPC_WRITE_INTERNAL_COMPRESS; } - p->parsing_frame = incoming_byte_stream = - grpc_chttp2_incoming_byte_stream_create(exec_ctx, t, s, p->frame_size, - message_flags); + GPR_ASSERT(s->incoming_frames == NULL); + p->parsing_frame = grpc_chttp2_incoming_byte_stream_create( + exec_ctx, t, s, p->frame_size, message_flags, true); /* fallthrough */ case GRPC_CHTTP2_DATA_FRAME: if (cur == end) { return GRPC_ERROR_NONE; } uint32_t remaining = (uint32_t)(end - cur); + s->stats.incoming.data_bytes += remaining; if (remaining == p->frame_size) { - s->stats.incoming.data_bytes += p->frame_size; grpc_chttp2_incoming_byte_stream_push( exec_ctx, p->parsing_frame, grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); @@ -243,8 +251,14 @@ static grpc_error *parse_inner(grpc_exec_ctx *exec_ctx, p->parsing_frame = NULL; p->state = GRPC_CHTTP2_DATA_FH_0; return GRPC_ERROR_NONE; - } else if (remaining > p->frame_size) { - s->stats.incoming.data_bytes += p->frame_size; + } else if (remaining < p->frame_size) { + grpc_chttp2_incoming_byte_stream_push( + exec_ctx, p->parsing_frame, + grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + p->frame_size -= remaining; + return GRPC_ERROR_NONE; + } else { + GPR_ASSERT(remaining > p->frame_size); grpc_chttp2_incoming_byte_stream_push( exec_ctx, p->parsing_frame, grpc_slice_sub(slice, (size_t)(cur - beg), @@ -252,15 +266,11 @@ static grpc_error *parse_inner(grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, GRPC_ERROR_NONE); p->parsing_frame = NULL; + p->state = GRPC_CHTTP2_DATA_FH_0; cur += p->frame_size; - goto fh_0; /* loop */ - } else { - GPR_ASSERT(remaining <= p->frame_size); - grpc_chttp2_incoming_byte_stream_push( - exec_ctx, p->parsing_frame, + grpc_slice_buffer_add( + &s->unprocessed_incoming_frames_buffer, grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); - p->frame_size -= remaining; - s->stats.incoming.data_bytes += remaining; return GRPC_ERROR_NONE; } } @@ -273,7 +283,7 @@ grpc_error *grpc_chttp2_data_parser_parse(grpc_exec_ctx *exec_ctx, void *parser, grpc_chttp2_stream *s, grpc_slice slice, int is_last) { grpc_chttp2_data_parser *p = parser; - grpc_error *error = parse_inner(exec_ctx, p, t, s, slice); + grpc_error *error = parse_inner_buffer(exec_ctx, p, t, s, slice); if (is_last && p->is_last_frame) { grpc_chttp2_mark_stream_closed(exec_ctx, t, s, true, false, diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index d26812ad6be..2e71c846646 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -489,7 +489,8 @@ struct grpc_chttp2_stream { grpc_chttp2_incoming_metadata_buffer metadata_buffer[2]; - grpc_chttp2_incoming_frame_queue incoming_frames; + grpc_chttp2_incoming_byte_stream *incoming_frames; + grpc_slice_buffer unprocessed_incoming_frames_buffer; gpr_timespec deadline; @@ -779,7 +780,7 @@ void grpc_chttp2_ref_transport(grpc_chttp2_transport *t); grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s, - uint32_t frame_size, uint32_t flags); + uint32_t frame_size, uint32_t flags, bool trigger_recv); void grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, grpc_slice slice); diff --git a/src/core/ext/transport/chttp2/transport/parsing.c b/src/core/ext/transport/chttp2/transport/parsing.c index 7ed00522c3e..f48de8ea25b 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.c +++ b/src/core/ext/transport/chttp2/transport/parsing.c @@ -441,6 +441,7 @@ static grpc_error *init_data_frame_parser(grpc_exec_ctx *exec_ctx, error_handler: if (err == GRPC_ERROR_NONE) { t->incoming_stream = s; + /* t->parser = grpc_chttp2_data_parser_parse;*/ t->parser = grpc_chttp2_data_parser_parse; t->parser_data = &s->data_parser; return GRPC_ERROR_NONE; From bdd92b56c4dea3c64474542efe3722315042693a Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 13 Feb 2017 11:36:51 -0800 Subject: [PATCH 002/461] intermediate changes --- .../chttp2/transport/chttp2_transport.c | 22 +++++++++++++++---- .../transport/chttp2/transport/frame_data.c | 2 +- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 5c5c29389f4..df54d188006 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -2205,7 +2205,7 @@ static void set_pollset_set(grpc_exec_ctx *exec_ctx, grpc_transport *gt, static grpc_error *deframe_unprocessed_incoming_frames( grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *p, grpc_chttp2_transport *t, grpc_chttp2_stream *s, - grpc_slice_buffer *slices) { + grpc_slice_buffer *slices, bool partial_deframe) { while (slices->count > 0) { uint8_t *beg = NULL; uint8_t *end = NULL; @@ -2298,6 +2298,20 @@ static grpc_error *deframe_unprocessed_incoming_frames( exec_ctx, t, s, p->frame_size, message_flags, false); /* fallthrough */ case GRPC_CHTTP2_DATA_FRAME: + if (partial_deframe) { + uint32_t remaining = (uint32_t)(end - cur); + if (remaining > 0) { + if (cur == beg) { + grpc_slice_buffer_undo_take_first(&s->unprocessed_incoming_frames_buffer, slice); + } else { + grpc_slice_buffer_undo_take_first( + &s->unprocessed_incoming_frames_buffer, + grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + grpc_slice_unref_internal(exec_ctx, slice); + } + return GRPC_ERROR_NONE; + } + } if (cur == end) { grpc_slice_unref_internal(exec_ctx, slice); continue; @@ -2312,7 +2326,7 @@ static grpc_error *deframe_unprocessed_incoming_frames( p->parsing_frame = NULL; p->state = GRPC_CHTTP2_DATA_FH_0; grpc_slice_unref_internal(exec_ctx, slice); - break; + return GRPC_ERROR_NONE; } else if (remaining < p->frame_size) { grpc_chttp2_incoming_byte_stream_push( exec_ctx, p->parsing_frame, @@ -2336,12 +2350,12 @@ static grpc_error *deframe_unprocessed_incoming_frames( &s->unprocessed_incoming_frames_buffer, grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); grpc_slice_unref_internal(exec_ctx, slice); - break; + return GRPC_ERROR_NONE; } } } - return GRPC_ERROR_NONE; + GPR_UNREACHABLE_CODE(return GRPC_ERROR_CREATE("Should never reach here")); } static void incoming_byte_stream_unref(grpc_exec_ctx *exec_ctx, diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c index 75657e4c70b..501565f8a14 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -156,7 +156,7 @@ grpc_error *parse_inner_buffer(grpc_exec_ctx *exec_ctx, } /* If there is already pending data, or if there is a pending - * incoming_byte_stream that is finished, append the data to unprcessed frame + * incoming_byte_stream that is finished, append the data to unprocessed frame * buffer. */ if (s->unprocessed_incoming_frames_buffer.count > 0 || (s->incoming_frames != NULL && p->parsing_frame == NULL)) { From 380a8f6de54c2843c74f5a756b4c91b85cbf3809 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 15 Feb 2017 15:19:46 -0800 Subject: [PATCH 003/461] intermediate --- .../chttp2/transport/chttp2_transport.c | 50 +++++++++++-------- .../transport/chttp2/transport/frame_data.c | 48 ++++++------------ .../ext/transport/chttp2/transport/internal.h | 2 +- 3 files changed, 44 insertions(+), 56 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index df54d188006..c0f43b7ffb5 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1525,11 +1525,7 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, grpc_slice_buffer_destroy_internal( exec_ctx, &s->unprocessed_incoming_frames_buffer); } - if (s->incoming_frames != NULL || - (GRPC_ERROR_NONE == (error = deframe_unprocessed_incoming_frames( - exec_ctx, &s->data_parser, t, s, - &s->unprocessed_incoming_frames_buffer)) && - s->incoming_frames != NULL)) { + if (s->incoming_frames != NULL) { *s->recv_message = &s->incoming_frames->base; s->incoming_frames = NULL; GPR_ASSERT(*s->recv_message != NULL); @@ -2206,6 +2202,11 @@ static grpc_error *deframe_unprocessed_incoming_frames( grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *p, grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_slice_buffer *slices, bool partial_deframe) { + + if (p->parsing_frame == NULL && s->incoming_frames != NULL) { + return GRPC_ERROR_NONE; + } + while (slices->count > 0) { uint8_t *beg = NULL; uint8_t *end = NULL; @@ -2230,6 +2231,12 @@ static grpc_error *deframe_unprocessed_incoming_frames( grpc_slice_unref_internal(exec_ctx, slice); return GRPC_ERROR_REF(p->error); case GRPC_CHTTP2_DATA_FH_0: + if (s->incoming_frames != NULL) { + s->stats.incoming.framing_bytes += (size_t)(end - cur); + grpc_slice_buffer_add(&s->unprocessed_incoming_frames_buffer, + grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + return GRPC_ERROR_NONE; + } p->frame_type = *cur; switch (p->frame_type) { case 0: @@ -2293,30 +2300,33 @@ static grpc_error *deframe_unprocessed_incoming_frames( message_flags |= GRPC_WRITE_INTERNAL_COMPRESS; } GPR_ASSERT(s->incoming_frames == NULL); - p->parsing_frame = s->incoming_frames = + p->parsing_frame = grpc_chttp2_incoming_byte_stream_create( - exec_ctx, t, s, p->frame_size, message_flags, false); + exec_ctx, t, s, p->frame_size, message_flags); + + undo_take_first? + + /* fallthrough */ case GRPC_CHTTP2_DATA_FRAME: + uint32_t remaining = (uint32_t)(end - cur); if (partial_deframe) { - uint32_t remaining = (uint32_t)(end - cur); - if (remaining > 0) { - if (cur == beg) { - grpc_slice_buffer_undo_take_first(&s->unprocessed_incoming_frames_buffer, slice); - } else { - grpc_slice_buffer_undo_take_first( + if (remaining > 0 && cur == beg) { + grpc_slice_buffer_undo_take_first(&s->unprocessed_incoming_frames_buffer, slice); + } else if (remaining > 0 && cur > beg) { + grpc_slice_buffer_undo_take_first( &s->unprocessed_incoming_frames_buffer, grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); - grpc_slice_unref_internal(exec_ctx, slice); - } - return GRPC_ERROR_NONE; + grpc_slice_unref_internal(exec_ctx, slice); + } else { /* remaining == 0 */ + grpc_slice_unref_internal(exec_ctx, slice); } + return GRPC_ERROR_NONE; } if (cur == end) { grpc_slice_unref_internal(exec_ctx, slice); continue; } - uint32_t remaining = (uint32_t)(end - cur); if (remaining == p->frame_size) { grpc_chttp2_incoming_byte_stream_push( exec_ctx, p->parsing_frame, @@ -2543,7 +2553,7 @@ void grpc_chttp2_incoming_byte_stream_finished( grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s, - uint32_t frame_size, uint32_t flags, bool trigger_recv) { + uint32_t frame_size, uint32_t flags) { grpc_chttp2_incoming_byte_stream *incoming_byte_stream = gpr_malloc(sizeof(*incoming_byte_stream)); incoming_byte_stream->base.length = frame_size; @@ -2562,9 +2572,7 @@ grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( incoming_byte_stream->is_tail = 1; incoming_byte_stream->error = GRPC_ERROR_NONE; s->incoming_frames = incoming_byte_stream; - if (trigger_recv) { - grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); - } + grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); return incoming_byte_stream; } diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c index 501565f8a14..71adf80c890 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -158,8 +158,8 @@ grpc_error *parse_inner_buffer(grpc_exec_ctx *exec_ctx, /* If there is already pending data, or if there is a pending * incoming_byte_stream that is finished, append the data to unprocessed frame * buffer. */ - if (s->unprocessed_incoming_frames_buffer.count > 0 || - (s->incoming_frames != NULL && p->parsing_frame == NULL)) { + if (s->unprocessed_incoming_frames_buffer.count > 0) { + s->stats.incoming.framing_bytes += GRPC_SLICE_LENGTH(slice); grpc_slice_ref(slice); grpc_slice_buffer_add(&s->unprocessed_incoming_frames_buffer, slice); return GRPC_ERROR_NONE; @@ -170,6 +170,12 @@ grpc_error *parse_inner_buffer(grpc_exec_ctx *exec_ctx, p->state = GRPC_CHTTP2_DATA_ERROR; return GRPC_ERROR_REF(p->error); case GRPC_CHTTP2_DATA_FH_0: + if (s->incoming_frames != NULL) { + s->stats.incoming.framing_bytes += (size_t)(end - cur); + grpc_slice_buffer_add(&s->unprocessed_incoming_frames_buffer, + grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + return GRPC_ERROR_NONE; + } s->stats.incoming.framing_bytes++; p->frame_type = *cur; switch (p->frame_type) { @@ -234,7 +240,7 @@ grpc_error *parse_inner_buffer(grpc_exec_ctx *exec_ctx, } GPR_ASSERT(s->incoming_frames == NULL); p->parsing_frame = grpc_chttp2_incoming_byte_stream_create( - exec_ctx, t, s, p->frame_size, message_flags, true); + exec_ctx, t, s, p->frame_size, message_flags); /* fallthrough */ case GRPC_CHTTP2_DATA_FRAME: if (cur == end) { @@ -242,37 +248,11 @@ grpc_error *parse_inner_buffer(grpc_exec_ctx *exec_ctx, } uint32_t remaining = (uint32_t)(end - cur); s->stats.incoming.data_bytes += remaining; - if (remaining == p->frame_size) { - grpc_chttp2_incoming_byte_stream_push( - exec_ctx, p->parsing_frame, - grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); - grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, - GRPC_ERROR_NONE); - p->parsing_frame = NULL; - p->state = GRPC_CHTTP2_DATA_FH_0; - return GRPC_ERROR_NONE; - } else if (remaining < p->frame_size) { - grpc_chttp2_incoming_byte_stream_push( - exec_ctx, p->parsing_frame, - grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); - p->frame_size -= remaining; - return GRPC_ERROR_NONE; - } else { - GPR_ASSERT(remaining > p->frame_size); - grpc_chttp2_incoming_byte_stream_push( - exec_ctx, p->parsing_frame, - grpc_slice_sub(slice, (size_t)(cur - beg), - (size_t)(cur + p->frame_size - beg))); - grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, - GRPC_ERROR_NONE); - p->parsing_frame = NULL; - p->state = GRPC_CHTTP2_DATA_FH_0; - cur += p->frame_size; - grpc_slice_buffer_add( - &s->unprocessed_incoming_frames_buffer, - grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); - return GRPC_ERROR_NONE; - } + grpc_slice_buffer_add( + &s->unprocessed_incoming_frames_buffer, + grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + grpc_chttp2_incoming_byte_stream_notify(exec_ctx, p->parsing_frame); + return GRPC_ERROR_NONE; } GPR_UNREACHABLE_CODE(return GRPC_ERROR_CREATE("Should never reach here")); diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 2e71c846646..0ce67ce450a 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -780,7 +780,7 @@ void grpc_chttp2_ref_transport(grpc_chttp2_transport *t); grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s, - uint32_t frame_size, uint32_t flags, bool trigger_recv); + uint32_t frame_size, uint32_t flags); void grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, grpc_slice slice); From 3d97670b801965ad479fc49c534be61faf8507f9 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 17 Feb 2017 13:53:10 -0800 Subject: [PATCH 004/461] Intermediate --- .../ext/transport/chttp2/transport/chttp2_transport.c | 10 ++++------ src/core/ext/transport/chttp2/transport/frame_data.c | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index c0f43b7ffb5..18ee1a70876 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -158,7 +158,8 @@ static void keepalive_watchdog_fired_locked(grpc_exec_ctx *exec_ctx, void *arg, static grpc_error *deframe_unprocessed_incoming_frames( grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *p, - grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_slice_buffer *slices); + grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_slice_buffer *slices, + bool partial_deframe); /******************************************************************************* * CONSTRUCTION/DESTRUCTION/REFCOUNTING @@ -2303,12 +2304,8 @@ static grpc_error *deframe_unprocessed_incoming_frames( p->parsing_frame = grpc_chttp2_incoming_byte_stream_create( exec_ctx, t, s, p->frame_size, message_flags); - - undo_take_first? - - /* fallthrough */ - case GRPC_CHTTP2_DATA_FRAME: + case GRPC_CHTTP2_DATA_FRAME: { uint32_t remaining = (uint32_t)(end - cur); if (partial_deframe) { if (remaining > 0 && cur == beg) { @@ -2362,6 +2359,7 @@ static grpc_error *deframe_unprocessed_incoming_frames( grpc_slice_unref_internal(exec_ctx, slice); return GRPC_ERROR_NONE; } + } } } diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c index 71adf80c890..cde9cd9c99c 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -251,7 +251,6 @@ grpc_error *parse_inner_buffer(grpc_exec_ctx *exec_ctx, grpc_slice_buffer_add( &s->unprocessed_incoming_frames_buffer, grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); - grpc_chttp2_incoming_byte_stream_notify(exec_ctx, p->parsing_frame); return GRPC_ERROR_NONE; } From 456f48ad9851b88a94b806dd451eb85056801c26 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 21 Feb 2017 11:12:49 -0800 Subject: [PATCH 005/461] Change stream interface for method --- .../chttp2/transport/chttp2_transport.c | 25 +++++++++++++++---- src/core/lib/surface/call.c | 5 +++- src/core/lib/transport/byte_stream.h | 2 ++ 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 18ee1a70876..da5cdaea8b4 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -2441,8 +2441,12 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx *exec_ctx, gpr_mu_lock(&bs->slice_mu); if (bs->slices.count > 0) { - *bs->next_action.slice = grpc_slice_buffer_take_first(&bs->slices); - grpc_closure_run(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_NONE); + grpc_closure_sched(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_NONE); + } else if (GRPC_ERROR_NONE == deframe_unprocessed_incoming_frames( + exec_ctx, &s->data_parser, t, s, &s->unprocessed_incoming_frames_buffer, + false) && + bs->slices.count > 0) { + grpc_closure_sched(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_NONE); } else if (bs->error != GRPC_ERROR_NONE) { grpc_closure_run(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_REF(bs->error)); @@ -2454,6 +2458,18 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx *exec_ctx, incoming_byte_stream_unref(exec_ctx, bs); } +static void incoming_byte_stream_pull(grpc_exec_ctx *exec_ctx, + grpc_byte_stream *byte_stream, + grpc_slice *slice) { + GPR_TIMER_BEGIN("incoming_byte_stream_pull", 0); + grpc_chttp2_incoming_byte_stream *bs = + (grpc_chttp2_incoming_byte_stream *)byte_stream; + if (bs->slices.count > 0) { + *slice = grpc_slice_buffer_take_first(&bs->slices); + } + GPR_TIMER_END("incoming_byte_stream_pull", 0); +} + static int incoming_byte_stream_next(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, grpc_slice *slice, size_t max_size_hint, @@ -2522,12 +2538,10 @@ void grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, exec_ctx, bs, GRPC_ERROR_CREATE("Too many bytes in stream")); } else { bs->remaining_bytes -= (uint32_t)GRPC_SLICE_LENGTH(slice); + grpc_slice_buffer_add(&bs->slices, slice); if (bs->on_next != NULL) { - *bs->next = slice; grpc_closure_sched(exec_ctx, bs->on_next, GRPC_ERROR_NONE); bs->on_next = NULL; - } else { - grpc_slice_buffer_add(&bs->slices, slice); } } gpr_mu_unlock(&bs->slice_mu); @@ -2558,6 +2572,7 @@ grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( incoming_byte_stream->remaining_bytes = frame_size; incoming_byte_stream->base.flags = flags; incoming_byte_stream->base.next = incoming_byte_stream_next; + incoming_byte_stream->base.pull = incoming_byte_stream_pull; incoming_byte_stream->base.destroy = incoming_byte_stream_destroy; gpr_mu_init(&incoming_byte_stream->slice_mu); gpr_ref_init(&incoming_byte_stream->refs, 2); diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index cc57654ea41..ec1eb0a5f9f 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -1177,10 +1177,13 @@ static void receiving_slice_ready(grpc_exec_ctx *exec_ctx, void *bctlp, grpc_error *error) { batch_control *bctl = bctlp; grpc_call *call = bctl->call; + grpc_byte_stream *bs = call->receiving_stream; if (error == GRPC_ERROR_NONE) { + grpc_slice slice; + bs->pull(exec_ctx, bs, &slice); grpc_slice_buffer_add(&(*call->receiving_buffer)->data.raw.slice_buffer, - call->receiving_slice); + slice); continue_receiving_slices(exec_ctx, bctl); } else { if (grpc_trace_operation_failures) { diff --git a/src/core/lib/transport/byte_stream.h b/src/core/lib/transport/byte_stream.h index 1fdd5b4d775..646ffcd660b 100644 --- a/src/core/lib/transport/byte_stream.h +++ b/src/core/lib/transport/byte_stream.h @@ -52,6 +52,8 @@ struct grpc_byte_stream { int (*next)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, grpc_slice *slice, size_t max_size_hint, grpc_closure *on_complete); + void (*pull)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, + grpc_slice *slice); void (*destroy)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream); }; From 5a6e2416ed4938afd26ed756af6ea57c2288b8ed Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 24 Feb 2017 14:52:28 -0800 Subject: [PATCH 006/461] Lazy deframe pass cronet end2end tests --- .../chttp2/transport/chttp2_transport.c | 116 ++++++++++-------- .../transport/chttp2/transport/frame_data.c | 42 ++++++- .../ext/transport/chttp2/transport/internal.h | 3 +- src/core/lib/surface/call.c | 14 ++- src/core/lib/transport/byte_stream.c | 5 + src/core/lib/transport/byte_stream.h | 5 +- 6 files changed, 121 insertions(+), 64 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index da5cdaea8b4..b03c79315bb 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -159,7 +159,7 @@ static void keepalive_watchdog_fired_locked(grpc_exec_ctx *exec_ctx, void *arg, static grpc_error *deframe_unprocessed_incoming_frames( grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *p, grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_slice_buffer *slices, - bool partial_deframe); + grpc_slice *slice_out, bool partial_deframe); /******************************************************************************* * CONSTRUCTION/DESTRUCTION/REFCOUNTING @@ -602,6 +602,7 @@ static int init_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, grpc_schedule_on_exec_ctx); s->incoming_frames = NULL; grpc_slice_buffer_init(&s->unprocessed_incoming_frames_buffer); + gpr_mu_init(&s->buffer_mu); GRPC_CHTTP2_REF_TRANSPORT(t, "stream"); @@ -633,8 +634,10 @@ static void destroy_stream_locked(grpc_exec_ctx *exec_ctx, void *sp, grpc_chttp2_incoming_byte_stream *ibs = s->incoming_frames; s->incoming_frames = NULL; incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, GRPC_ERROR_NONE); + gpr_mu_lock(&s->buffer_mu); grpc_slice_buffer_destroy_internal(exec_ctx, &s->unprocessed_incoming_frames_buffer); + gpr_mu_unlock(&s->buffer_mu); } grpc_chttp2_list_remove_stalled_by_transport(t, s); @@ -1096,7 +1099,7 @@ static void continue_fetching_send_locked(grpc_exec_ctx *exec_ctx, return; /* early out */ } else if (grpc_byte_stream_next(exec_ctx, s->fetching_send_message, &s->fetching_slice, UINT32_MAX, - &s->complete_fetch)) { + &s->complete_fetch_locked)) { add_fetched_slice_locked(exec_ctx, t, s); } } @@ -1326,9 +1329,13 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op, GPR_ASSERT(s->recv_message_ready == NULL); s->recv_message_ready = op->recv_message_ready; s->recv_message = op->recv_message; + gpr_mu_lock(&s->buffer_mu); if (s->id != 0 && (s->incoming_frames == NULL || s->unprocessed_incoming_frames_buffer.count == 0)) { + gpr_mu_unlock(&s->buffer_mu); incoming_byte_stream_update_flow_control(exec_ctx, t, s, 5, 0); + } else { + gpr_mu_unlock(&s->buffer_mu); } grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); } @@ -1501,8 +1508,10 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_exec_ctx *exec_ctx, s->incoming_frames = NULL; incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, GRPC_ERROR_NONE); + gpr_mu_lock(&s->buffer_mu); grpc_slice_buffer_destroy_internal( exec_ctx, &s->unprocessed_incoming_frames_buffer); + gpr_mu_unlock(&s->buffer_mu); } } grpc_chttp2_incoming_metadata_buffer_publish( @@ -1523,8 +1532,10 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, s->incoming_frames = NULL; incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, GRPC_ERROR_NONE); + gpr_mu_lock(&s->buffer_mu); grpc_slice_buffer_destroy_internal( exec_ctx, &s->unprocessed_incoming_frames_buffer); + gpr_mu_unlock(&s->buffer_mu); } if (s->incoming_frames != NULL) { *s->recv_message = &s->incoming_frames->base; @@ -1553,8 +1564,10 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx *exec_ctx, s->incoming_frames = NULL; incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, GRPC_ERROR_NONE); + gpr_mu_lock(&s->buffer_mu); grpc_slice_buffer_destroy_internal( exec_ctx, &s->unprocessed_incoming_frames_buffer); + gpr_mu_unlock(&s->buffer_mu); } } if (s->all_incoming_byte_streams_finished && @@ -2202,12 +2215,10 @@ static void set_pollset_set(grpc_exec_ctx *exec_ctx, grpc_transport *gt, static grpc_error *deframe_unprocessed_incoming_frames( grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *p, grpc_chttp2_transport *t, grpc_chttp2_stream *s, - grpc_slice_buffer *slices, bool partial_deframe) { - - if (p->parsing_frame == NULL && s->incoming_frames != NULL) { - return GRPC_ERROR_NONE; - } + grpc_slice_buffer *slices, grpc_slice *slice_out, + bool partial_deframe) { + bool slice_set = false; while (slices->count > 0) { uint8_t *beg = NULL; uint8_t *end = NULL; @@ -2231,10 +2242,12 @@ static grpc_error *deframe_unprocessed_incoming_frames( p->state = GRPC_CHTTP2_DATA_ERROR; grpc_slice_unref_internal(exec_ctx, slice); return GRPC_ERROR_REF(p->error); + fh_0: case GRPC_CHTTP2_DATA_FH_0: + GPR_ASSERT(s->incoming_frames == NULL); if (s->incoming_frames != NULL) { s->stats.incoming.framing_bytes += (size_t)(end - cur); - grpc_slice_buffer_add(&s->unprocessed_incoming_frames_buffer, + grpc_slice_buffer_undo_take_first(&s->unprocessed_incoming_frames_buffer, grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); return GRPC_ERROR_NONE; } @@ -2306,20 +2319,14 @@ static grpc_error *deframe_unprocessed_incoming_frames( exec_ctx, t, s, p->frame_size, message_flags); /* fallthrough */ case GRPC_CHTTP2_DATA_FRAME: { - uint32_t remaining = (uint32_t)(end - cur); - if (partial_deframe) { - if (remaining > 0 && cur == beg) { - grpc_slice_buffer_undo_take_first(&s->unprocessed_incoming_frames_buffer, slice); - } else if (remaining > 0 && cur > beg) { - grpc_slice_buffer_undo_take_first( - &s->unprocessed_incoming_frames_buffer, - grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); - grpc_slice_unref_internal(exec_ctx, slice); - } else { /* remaining == 0 */ - grpc_slice_unref_internal(exec_ctx, slice); - } + if (slice_set) { + grpc_slice_buffer_undo_take_first( + &s->unprocessed_incoming_frames_buffer, + grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + grpc_slice_unref_internal(exec_ctx, slice); return GRPC_ERROR_NONE; } + uint32_t remaining = (uint32_t)(end - cur); if (cur == end) { grpc_slice_unref_internal(exec_ctx, slice); continue; @@ -2327,17 +2334,21 @@ static grpc_error *deframe_unprocessed_incoming_frames( if (remaining == p->frame_size) { grpc_chttp2_incoming_byte_stream_push( exec_ctx, p->parsing_frame, - grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg)), + slice_out); + slice_set = true; grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, GRPC_ERROR_NONE); p->parsing_frame = NULL; p->state = GRPC_CHTTP2_DATA_FH_0; grpc_slice_unref_internal(exec_ctx, slice); - return GRPC_ERROR_NONE; + continue; } else if (remaining < p->frame_size) { grpc_chttp2_incoming_byte_stream_push( exec_ctx, p->parsing_frame, - grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg)), + slice_out); + slice_set = true; p->frame_size -= remaining; grpc_slice_unref_internal(exec_ctx, slice); continue; @@ -2346,24 +2357,22 @@ static grpc_error *deframe_unprocessed_incoming_frames( grpc_chttp2_incoming_byte_stream_push( exec_ctx, p->parsing_frame, grpc_slice_sub(slice, (size_t)(cur - beg), - (size_t)(cur + p->frame_size - beg))); + (size_t)(cur + p->frame_size - beg)), + slice_out); + slice_set = true; grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, GRPC_ERROR_NONE); p->parsing_frame = NULL; p->state = GRPC_CHTTP2_DATA_FH_0; cur += p->frame_size; - /* slice is not used up; push back to the head of buffer */ - grpc_slice_buffer_undo_take_first( - &s->unprocessed_incoming_frames_buffer, - grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); - grpc_slice_unref_internal(exec_ctx, slice); + goto fh_0; return GRPC_ERROR_NONE; } } } } - GPR_UNREACHABLE_CODE(return GRPC_ERROR_CREATE("Should never reach here")); + return GRPC_ERROR_NONE; } static void incoming_byte_stream_unref(grpc_exec_ctx *exec_ctx, @@ -2438,36 +2447,45 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx *exec_ctx, incoming_byte_stream_update_flow_control( exec_ctx, t, s, bs->next_action.max_size_hint, cur_length); } + gpr_mu_lock(&s->buffer_mu); gpr_mu_lock(&bs->slice_mu); - - if (bs->slices.count > 0) { - grpc_closure_sched(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_NONE); - } else if (GRPC_ERROR_NONE == deframe_unprocessed_incoming_frames( - exec_ctx, &s->data_parser, t, s, &s->unprocessed_incoming_frames_buffer, - false) && - bs->slices.count > 0) { + if (s->unprocessed_incoming_frames_buffer.length > 0) { grpc_closure_sched(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_NONE); } else if (bs->error != GRPC_ERROR_NONE) { - grpc_closure_run(exec_ctx, bs->next_action.on_complete, - GRPC_ERROR_REF(bs->error)); + grpc_closure_sched(exec_ctx, bs->next_action.on_complete, + GRPC_ERROR_REF(bs->error)); } else { bs->on_next = bs->next_action.on_complete; bs->next = bs->next_action.slice; } gpr_mu_unlock(&bs->slice_mu); + gpr_mu_unlock(&s->buffer_mu); incoming_byte_stream_unref(exec_ctx, bs); } -static void incoming_byte_stream_pull(grpc_exec_ctx *exec_ctx, - grpc_byte_stream *byte_stream, - grpc_slice *slice) { +static grpc_error *incoming_byte_stream_pull(grpc_exec_ctx *exec_ctx, + grpc_byte_stream *byte_stream, + grpc_slice *slice) { GPR_TIMER_BEGIN("incoming_byte_stream_pull", 0); grpc_chttp2_incoming_byte_stream *bs = (grpc_chttp2_incoming_byte_stream *)byte_stream; - if (bs->slices.count > 0) { - *slice = grpc_slice_buffer_take_first(&bs->slices); + grpc_chttp2_stream *s = bs->stream; + grpc_chttp2_transport *t = bs->transport; + + gpr_mu_lock(&s->buffer_mu); + if (s->unprocessed_incoming_frames_buffer.length > 0) { + grpc_error *error = deframe_unprocessed_incoming_frames( + exec_ctx, &s->data_parser, t, s, + &s->unprocessed_incoming_frames_buffer, + slice, false); + if (error != GRPC_ERROR_NONE) { + gpr_mu_unlock(&s->buffer_mu); + return error; + } } + gpr_mu_unlock(&s->buffer_mu); GPR_TIMER_END("incoming_byte_stream_pull", 0); + return GRPC_ERROR_NONE; } static int incoming_byte_stream_next(grpc_exec_ctx *exec_ctx, @@ -2531,20 +2549,14 @@ static void incoming_byte_stream_publish_error( void grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, - grpc_slice slice) { - gpr_mu_lock(&bs->slice_mu); + grpc_slice slice, grpc_slice *slice_out) { if (bs->remaining_bytes < GRPC_SLICE_LENGTH(slice)) { incoming_byte_stream_publish_error( exec_ctx, bs, GRPC_ERROR_CREATE("Too many bytes in stream")); } else { bs->remaining_bytes -= (uint32_t)GRPC_SLICE_LENGTH(slice); - grpc_slice_buffer_add(&bs->slices, slice); - if (bs->on_next != NULL) { - grpc_closure_sched(exec_ctx, bs->on_next, GRPC_ERROR_NONE); - bs->on_next = NULL; - } + *slice_out = slice; } - gpr_mu_unlock(&bs->slice_mu); } void grpc_chttp2_incoming_byte_stream_finished( diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c index cde9cd9c99c..e889e3527bd 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -141,6 +141,23 @@ void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer *inbuf, stats->data_bytes += write_bytes; } +static void grpc_chttp2_unprocessed_frames_buffer_push(grpc_exec_ctx *exec_ctx, + grpc_chttp2_data_parser *p, + grpc_chttp2_stream *s, + grpc_slice slice) { + grpc_slice_buffer_add(&s->unprocessed_incoming_frames_buffer, slice); + if (p->parsing_frame) { + grpc_chttp2_incoming_byte_stream *bs = p->parsing_frame; + // Necessary? + gpr_mu_lock(&bs->slice_mu); + if (bs->on_next != NULL) { + grpc_closure_sched(exec_ctx, bs->on_next, GRPC_ERROR_NONE); + bs->on_next = NULL; + } + gpr_mu_unlock(&bs->slice_mu); + } +} + grpc_error *parse_inner_buffer(grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *p, grpc_chttp2_transport *t, grpc_chttp2_stream *s, @@ -158,22 +175,30 @@ grpc_error *parse_inner_buffer(grpc_exec_ctx *exec_ctx, /* If there is already pending data, or if there is a pending * incoming_byte_stream that is finished, append the data to unprocessed frame * buffer. */ + gpr_mu_lock(&s->buffer_mu); if (s->unprocessed_incoming_frames_buffer.count > 0) { s->stats.incoming.framing_bytes += GRPC_SLICE_LENGTH(slice); grpc_slice_ref(slice); - grpc_slice_buffer_add(&s->unprocessed_incoming_frames_buffer, slice); + grpc_chttp2_unprocessed_frames_buffer_push(exec_ctx, + p, + s, + slice); + gpr_mu_unlock(&s->buffer_mu); return GRPC_ERROR_NONE; } switch (p->state) { case GRPC_CHTTP2_DATA_ERROR: p->state = GRPC_CHTTP2_DATA_ERROR; + gpr_mu_unlock(&s->buffer_mu); return GRPC_ERROR_REF(p->error); case GRPC_CHTTP2_DATA_FH_0: if (s->incoming_frames != NULL) { s->stats.incoming.framing_bytes += (size_t)(end - cur); - grpc_slice_buffer_add(&s->unprocessed_incoming_frames_buffer, - grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + grpc_chttp2_unprocessed_frames_buffer_push( + exec_ctx, p, s, + grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + gpr_mu_unlock(&s->buffer_mu); return GRPC_ERROR_NONE; } s->stats.incoming.framing_bytes++; @@ -198,10 +223,12 @@ grpc_error *parse_inner_buffer(grpc_exec_ctx *exec_ctx, p->error = grpc_error_set_int(p->error, GRPC_ERROR_INT_OFFSET, cur - beg); p->state = GRPC_CHTTP2_DATA_ERROR; + gpr_mu_unlock(&s->buffer_mu); return GRPC_ERROR_REF(p->error); } if (++cur == end) { p->state = GRPC_CHTTP2_DATA_FH_1; + gpr_mu_unlock(&s->buffer_mu); return GRPC_ERROR_NONE; } /* fallthrough */ @@ -210,6 +237,7 @@ grpc_error *parse_inner_buffer(grpc_exec_ctx *exec_ctx, p->frame_size = ((uint32_t)*cur) << 24; if (++cur == end) { p->state = GRPC_CHTTP2_DATA_FH_2; + gpr_mu_unlock(&s->buffer_mu); return GRPC_ERROR_NONE; } /* fallthrough */ @@ -218,6 +246,7 @@ grpc_error *parse_inner_buffer(grpc_exec_ctx *exec_ctx, p->frame_size |= ((uint32_t)*cur) << 16; if (++cur == end) { p->state = GRPC_CHTTP2_DATA_FH_3; + gpr_mu_unlock(&s->buffer_mu); return GRPC_ERROR_NONE; } /* fallthrough */ @@ -226,6 +255,7 @@ grpc_error *parse_inner_buffer(grpc_exec_ctx *exec_ctx, p->frame_size |= ((uint32_t)*cur) << 8; if (++cur == end) { p->state = GRPC_CHTTP2_DATA_FH_4; + gpr_mu_unlock(&s->buffer_mu); return GRPC_ERROR_NONE; } /* fallthrough */ @@ -244,13 +274,15 @@ grpc_error *parse_inner_buffer(grpc_exec_ctx *exec_ctx, /* fallthrough */ case GRPC_CHTTP2_DATA_FRAME: if (cur == end) { + gpr_mu_unlock(&s->buffer_mu); return GRPC_ERROR_NONE; } uint32_t remaining = (uint32_t)(end - cur); s->stats.incoming.data_bytes += remaining; - grpc_slice_buffer_add( - &s->unprocessed_incoming_frames_buffer, + grpc_chttp2_unprocessed_frames_buffer_push( + exec_ctx, p, s, grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + gpr_mu_unlock(&s->buffer_mu); return GRPC_ERROR_NONE; } diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 0ce67ce450a..8d0f96efc6b 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -490,6 +490,7 @@ struct grpc_chttp2_stream { grpc_chttp2_incoming_metadata_buffer metadata_buffer[2]; grpc_chttp2_incoming_byte_stream *incoming_frames; + gpr_mu buffer_mu; /* protects unprocessed_incoming_frames_buffer and parse_data */ grpc_slice_buffer unprocessed_incoming_frames_buffer; gpr_timespec deadline; @@ -783,7 +784,7 @@ grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( uint32_t frame_size, uint32_t flags); void grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, - grpc_slice slice); + grpc_slice slice, grpc_slice *slice_out); void grpc_chttp2_incoming_byte_stream_finished( grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, grpc_error *error); diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index ec1eb0a5f9f..7baa8e10a59 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -1181,11 +1181,15 @@ static void receiving_slice_ready(grpc_exec_ctx *exec_ctx, void *bctlp, if (error == GRPC_ERROR_NONE) { grpc_slice slice; - bs->pull(exec_ctx, bs, &slice); - grpc_slice_buffer_add(&(*call->receiving_buffer)->data.raw.slice_buffer, - slice); - continue_receiving_slices(exec_ctx, bctl); - } else { + error = grpc_byte_stream_pull(exec_ctx, bs, &slice); + if (error == GRPC_ERROR_NONE) { + grpc_slice_buffer_add(&(*call->receiving_buffer)->data.raw.slice_buffer, + slice); + continue_receiving_slices(exec_ctx, bctl); + } + } + + if (error != GRPC_ERROR_NONE) { if (grpc_trace_operation_failures) { GRPC_LOG_IF_ERROR("receiving_slice_ready", GRPC_ERROR_REF(error)); } diff --git a/src/core/lib/transport/byte_stream.c b/src/core/lib/transport/byte_stream.c index 4d4206189e7..afebf52cd58 100644 --- a/src/core/lib/transport/byte_stream.c +++ b/src/core/lib/transport/byte_stream.c @@ -46,6 +46,11 @@ int grpc_byte_stream_next(grpc_exec_ctx *exec_ctx, on_complete); } +grpc_error *grpc_byte_stream_pull(grpc_exec_ctx *exec_ctx, + grpc_byte_stream *byte_stream, grpc_slice *slice) { + return byte_stream->pull(exec_ctx, byte_stream, slice); +} + void grpc_byte_stream_destroy(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream) { byte_stream->destroy(exec_ctx, byte_stream); diff --git a/src/core/lib/transport/byte_stream.h b/src/core/lib/transport/byte_stream.h index 646ffcd660b..582480bb88f 100644 --- a/src/core/lib/transport/byte_stream.h +++ b/src/core/lib/transport/byte_stream.h @@ -52,7 +52,7 @@ struct grpc_byte_stream { int (*next)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, grpc_slice *slice, size_t max_size_hint, grpc_closure *on_complete); - void (*pull)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, + grpc_error* (*pull)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, grpc_slice *slice); void (*destroy)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream); }; @@ -70,6 +70,9 @@ int grpc_byte_stream_next(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, grpc_slice *slice, size_t max_size_hint, grpc_closure *on_complete); +grpc_error *grpc_byte_stream_pull(grpc_exec_ctx *exec_ctx, + grpc_byte_stream *byte_stream, grpc_slice *slice); + void grpc_byte_stream_destroy(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream); From 31ed2d9effd77029b879a139f4dd9e8ab166a1f5 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sun, 26 Feb 2017 22:10:07 -0800 Subject: [PATCH 007/461] clang-format --- .../chttp2/transport/chttp2_transport.c | 24 +++++++++---------- .../transport/chttp2/transport/frame_data.c | 12 ++++------ .../ext/transport/chttp2/transport/internal.h | 6 +++-- src/core/lib/transport/byte_stream.c | 3 ++- src/core/lib/transport/byte_stream.h | 7 +++--- 5 files changed, 25 insertions(+), 27 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index b03c79315bb..b5e087d8f72 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -2214,10 +2214,8 @@ static void set_pollset_set(grpc_exec_ctx *exec_ctx, grpc_transport *gt, static grpc_error *deframe_unprocessed_incoming_frames( grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *p, - grpc_chttp2_transport *t, grpc_chttp2_stream *s, - grpc_slice_buffer *slices, grpc_slice *slice_out, - bool partial_deframe) { - + grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_slice_buffer *slices, + grpc_slice *slice_out, bool partial_deframe) { bool slice_set = false; while (slices->count > 0) { uint8_t *beg = NULL; @@ -2247,8 +2245,9 @@ static grpc_error *deframe_unprocessed_incoming_frames( GPR_ASSERT(s->incoming_frames == NULL); if (s->incoming_frames != NULL) { s->stats.incoming.framing_bytes += (size_t)(end - cur); - grpc_slice_buffer_undo_take_first(&s->unprocessed_incoming_frames_buffer, - grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + grpc_slice_buffer_undo_take_first( + &s->unprocessed_incoming_frames_buffer, + grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); return GRPC_ERROR_NONE; } p->frame_type = *cur; @@ -2314,9 +2313,8 @@ static grpc_error *deframe_unprocessed_incoming_frames( message_flags |= GRPC_WRITE_INTERNAL_COMPRESS; } GPR_ASSERT(s->incoming_frames == NULL); - p->parsing_frame = - grpc_chttp2_incoming_byte_stream_create( - exec_ctx, t, s, p->frame_size, message_flags); + p->parsing_frame = grpc_chttp2_incoming_byte_stream_create( + exec_ctx, t, s, p->frame_size, message_flags); /* fallthrough */ case GRPC_CHTTP2_DATA_FRAME: { if (slice_set) { @@ -2475,9 +2473,8 @@ static grpc_error *incoming_byte_stream_pull(grpc_exec_ctx *exec_ctx, gpr_mu_lock(&s->buffer_mu); if (s->unprocessed_incoming_frames_buffer.length > 0) { grpc_error *error = deframe_unprocessed_incoming_frames( - exec_ctx, &s->data_parser, t, s, - &s->unprocessed_incoming_frames_buffer, - slice, false); + exec_ctx, &s->data_parser, t, s, &s->unprocessed_incoming_frames_buffer, + slice, false); if (error != GRPC_ERROR_NONE) { gpr_mu_unlock(&s->buffer_mu); return error; @@ -2549,7 +2546,8 @@ static void incoming_byte_stream_publish_error( void grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, - grpc_slice slice, grpc_slice *slice_out) { + grpc_slice slice, + grpc_slice *slice_out) { if (bs->remaining_bytes < GRPC_SLICE_LENGTH(slice)) { incoming_byte_stream_publish_error( exec_ctx, bs, GRPC_ERROR_CREATE("Too many bytes in stream")); diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c index e889e3527bd..2c12b871418 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -141,10 +141,9 @@ void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer *inbuf, stats->data_bytes += write_bytes; } -static void grpc_chttp2_unprocessed_frames_buffer_push(grpc_exec_ctx *exec_ctx, - grpc_chttp2_data_parser *p, - grpc_chttp2_stream *s, - grpc_slice slice) { +static void grpc_chttp2_unprocessed_frames_buffer_push( + grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *p, grpc_chttp2_stream *s, + grpc_slice slice) { grpc_slice_buffer_add(&s->unprocessed_incoming_frames_buffer, slice); if (p->parsing_frame) { grpc_chttp2_incoming_byte_stream *bs = p->parsing_frame; @@ -179,10 +178,7 @@ grpc_error *parse_inner_buffer(grpc_exec_ctx *exec_ctx, if (s->unprocessed_incoming_frames_buffer.count > 0) { s->stats.incoming.framing_bytes += GRPC_SLICE_LENGTH(slice); grpc_slice_ref(slice); - grpc_chttp2_unprocessed_frames_buffer_push(exec_ctx, - p, - s, - slice); + grpc_chttp2_unprocessed_frames_buffer_push(exec_ctx, p, s, slice); gpr_mu_unlock(&s->buffer_mu); return GRPC_ERROR_NONE; } diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 8d0f96efc6b..3d6253cd6fa 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -490,7 +490,8 @@ struct grpc_chttp2_stream { grpc_chttp2_incoming_metadata_buffer metadata_buffer[2]; grpc_chttp2_incoming_byte_stream *incoming_frames; - gpr_mu buffer_mu; /* protects unprocessed_incoming_frames_buffer and parse_data */ + gpr_mu buffer_mu; /* protects unprocessed_incoming_frames_buffer and + parse_data */ grpc_slice_buffer unprocessed_incoming_frames_buffer; gpr_timespec deadline; @@ -784,7 +785,8 @@ grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( uint32_t frame_size, uint32_t flags); void grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, - grpc_slice slice, grpc_slice *slice_out); + grpc_slice slice, + grpc_slice *slice_out); void grpc_chttp2_incoming_byte_stream_finished( grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, grpc_error *error); diff --git a/src/core/lib/transport/byte_stream.c b/src/core/lib/transport/byte_stream.c index afebf52cd58..3a50694670f 100644 --- a/src/core/lib/transport/byte_stream.c +++ b/src/core/lib/transport/byte_stream.c @@ -47,7 +47,8 @@ int grpc_byte_stream_next(grpc_exec_ctx *exec_ctx, } grpc_error *grpc_byte_stream_pull(grpc_exec_ctx *exec_ctx, - grpc_byte_stream *byte_stream, grpc_slice *slice) { + grpc_byte_stream *byte_stream, + grpc_slice *slice) { return byte_stream->pull(exec_ctx, byte_stream, slice); } diff --git a/src/core/lib/transport/byte_stream.h b/src/core/lib/transport/byte_stream.h index 582480bb88f..6afba92c523 100644 --- a/src/core/lib/transport/byte_stream.h +++ b/src/core/lib/transport/byte_stream.h @@ -52,8 +52,8 @@ struct grpc_byte_stream { int (*next)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, grpc_slice *slice, size_t max_size_hint, grpc_closure *on_complete); - grpc_error* (*pull)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, - grpc_slice *slice); + grpc_error *(*pull)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, + grpc_slice *slice); void (*destroy)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream); }; @@ -71,7 +71,8 @@ int grpc_byte_stream_next(grpc_exec_ctx *exec_ctx, size_t max_size_hint, grpc_closure *on_complete); grpc_error *grpc_byte_stream_pull(grpc_exec_ctx *exec_ctx, - grpc_byte_stream *byte_stream, grpc_slice *slice); + grpc_byte_stream *byte_stream, + grpc_slice *slice); void grpc_byte_stream_destroy(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream); From 9767a94a6a94ac8e1bb575f8cae44e52000ba0fc Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sun, 26 Feb 2017 23:15:51 -0800 Subject: [PATCH 008/461] Stop nulling the parse_frame when stream is closed --- src/core/ext/transport/chttp2/transport/chttp2_transport.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index b5e087d8f72..9cb66d77727 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1597,11 +1597,6 @@ static void remove_stream(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, t->incoming_stream = NULL; grpc_chttp2_parsing_become_skip_parser(exec_ctx, t); } - if (s->data_parser.parsing_frame != NULL) { - grpc_chttp2_incoming_byte_stream_finished( - exec_ctx, s->data_parser.parsing_frame, GRPC_ERROR_REF(error)); - s->data_parser.parsing_frame = NULL; - } if (grpc_chttp2_stream_map_size(&t->stream_map) == 0) { post_benign_reclaimer(exec_ctx, t); From 3989b88ffafd738d15ae1dbeee9107af95930d90 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 27 Feb 2017 08:26:49 -0800 Subject: [PATCH 009/461] sanity fix --- src/core/ext/transport/chttp2/transport/frame_data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c index 2c12b871418..e1341228026 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -177,7 +177,7 @@ grpc_error *parse_inner_buffer(grpc_exec_ctx *exec_ctx, gpr_mu_lock(&s->buffer_mu); if (s->unprocessed_incoming_frames_buffer.count > 0) { s->stats.incoming.framing_bytes += GRPC_SLICE_LENGTH(slice); - grpc_slice_ref(slice); + grpc_slice_ref_internal(exec_ctx, slice); grpc_chttp2_unprocessed_frames_buffer_push(exec_ctx, p, s, slice); gpr_mu_unlock(&s->buffer_mu); return GRPC_ERROR_NONE; From 146cf4b57f6266b834e8d0427a6b1177dfd6bc9b Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 27 Feb 2017 08:31:52 -0800 Subject: [PATCH 010/461] nit fix --- src/core/ext/transport/chttp2/transport/frame_data.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c index e1341228026..aa2ccfdcec3 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -43,6 +43,7 @@ #include "src/core/lib/slice/slice_string_helpers.h" #include "src/core/lib/support/string.h" #include "src/core/lib/transport/transport.h" +#include "src/core/lib/slice/slice_internal.h" grpc_error *grpc_chttp2_data_parser_init(grpc_chttp2_data_parser *parser) { parser->state = GRPC_CHTTP2_DATA_FH_0; @@ -177,7 +178,7 @@ grpc_error *parse_inner_buffer(grpc_exec_ctx *exec_ctx, gpr_mu_lock(&s->buffer_mu); if (s->unprocessed_incoming_frames_buffer.count > 0) { s->stats.incoming.framing_bytes += GRPC_SLICE_LENGTH(slice); - grpc_slice_ref_internal(exec_ctx, slice); + grpc_slice_ref_internal(slice); grpc_chttp2_unprocessed_frames_buffer_push(exec_ctx, p, s, slice); gpr_mu_unlock(&s->buffer_mu); return GRPC_ERROR_NONE; From cad4c809a3b5167ac0b6a944e68adcb0d0b513d6 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 27 Feb 2017 08:47:14 -0800 Subject: [PATCH 011/461] clang-format --- src/core/ext/transport/chttp2/transport/frame_data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c index aa2ccfdcec3..08b4b81bf8d 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -40,10 +40,10 @@ #include #include #include "src/core/ext/transport/chttp2/transport/internal.h" +#include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/slice/slice_string_helpers.h" #include "src/core/lib/support/string.h" #include "src/core/lib/transport/transport.h" -#include "src/core/lib/slice/slice_internal.h" grpc_error *grpc_chttp2_data_parser_init(grpc_chttp2_data_parser *parser) { parser->state = GRPC_CHTTP2_DATA_FH_0; From c9b538a43886c1f2bc3ff7f7943c49686ad06472 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 27 Feb 2017 12:26:33 -0800 Subject: [PATCH 012/461] Revert "Stop nulling the parse_frame when stream is closed" This reverts commit d3294286b3b90e1a01772d19bc476f579066d218. --- src/core/ext/transport/chttp2/transport/chttp2_transport.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 9cb66d77727..b5e087d8f72 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1597,6 +1597,11 @@ static void remove_stream(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, t->incoming_stream = NULL; grpc_chttp2_parsing_become_skip_parser(exec_ctx, t); } + if (s->data_parser.parsing_frame != NULL) { + grpc_chttp2_incoming_byte_stream_finished( + exec_ctx, s->data_parser.parsing_frame, GRPC_ERROR_REF(error)); + s->data_parser.parsing_frame = NULL; + } if (grpc_chttp2_stream_map_size(&t->stream_map) == 0) { post_benign_reclaimer(exec_ctx, t); From 6deb74968aba72e4a008bb4f717cc8fdf64039f4 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 27 Feb 2017 12:29:04 -0800 Subject: [PATCH 013/461] Stop nulling the parse_frame when stream is closed and there is no error --- src/core/ext/transport/chttp2/transport/chttp2_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index b5e087d8f72..6155335f814 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1597,7 +1597,7 @@ static void remove_stream(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, t->incoming_stream = NULL; grpc_chttp2_parsing_become_skip_parser(exec_ctx, t); } - if (s->data_parser.parsing_frame != NULL) { + if (error != GRPC_ERROR_NONE && s->data_parser.parsing_frame != NULL) { grpc_chttp2_incoming_byte_stream_finished( exec_ctx, s->data_parser.parsing_frame, GRPC_ERROR_REF(error)); s->data_parser.parsing_frame = NULL; From 532f2dd53e624bbc81f521f765df32e044ca1d78 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 27 Feb 2017 15:29:06 -0800 Subject: [PATCH 014/461] Protect with mutex and check for bs->error at incoming_stream_pull --- .../transport/chttp2/transport/chttp2_transport.c | 14 ++++++++++++++ src/core/ext/transport/chttp2/transport/parsing.c | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 6155335f814..d99c0dc50c2 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -595,7 +595,9 @@ static int init_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, grpc_chttp2_incoming_metadata_buffer_init(&s->metadata_buffer[0]); grpc_chttp2_incoming_metadata_buffer_init(&s->metadata_buffer[1]); + gpr_mu_lock(&s->buffer_mu); grpc_chttp2_data_parser_init(&s->data_parser); + gpr_mu_unlock(&s->buffer_mu); grpc_slice_buffer_init(&s->flow_controlled_buffer); s->deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); grpc_closure_init(&s->complete_fetch_locked, complete_fetch_locked, s, @@ -657,7 +659,9 @@ static void destroy_stream_locked(grpc_exec_ctx *exec_ctx, void *sp, GPR_ASSERT(s->recv_initial_metadata_ready == NULL); GPR_ASSERT(s->recv_message_ready == NULL); GPR_ASSERT(s->recv_trailing_metadata_finished == NULL); + gpr_mu_lock(&s->buffer_mu); grpc_chttp2_data_parser_destroy(exec_ctx, &s->data_parser); + gpr_mu_unlock(&s->buffer_mu); grpc_chttp2_incoming_metadata_buffer_destroy(exec_ctx, &s->metadata_buffer[0]); grpc_chttp2_incoming_metadata_buffer_destroy(exec_ctx, @@ -1597,11 +1601,14 @@ static void remove_stream(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, t->incoming_stream = NULL; grpc_chttp2_parsing_become_skip_parser(exec_ctx, t); } + gpr_mu_lock(&s->buffer_mu); if (error != GRPC_ERROR_NONE && s->data_parser.parsing_frame != NULL) { grpc_chttp2_incoming_byte_stream_finished( exec_ctx, s->data_parser.parsing_frame, GRPC_ERROR_REF(error)); + s->data_parser.parsing_frame = NULL; } + gpr_mu_unlock(&s->buffer_mu); if (grpc_chttp2_stream_map_size(&t->stream_map) == 0) { post_benign_reclaimer(exec_ctx, t); @@ -2324,6 +2331,10 @@ static grpc_error *deframe_unprocessed_incoming_frames( grpc_slice_unref_internal(exec_ctx, slice); return GRPC_ERROR_NONE; } + if (p->parsing_frame == NULL) { + + return GRPC_ERROR_NONE; + } uint32_t remaining = (uint32_t)(end - cur); if (cur == end) { grpc_slice_unref_internal(exec_ctx, slice); @@ -2470,6 +2481,9 @@ static grpc_error *incoming_byte_stream_pull(grpc_exec_ctx *exec_ctx, grpc_chttp2_stream *s = bs->stream; grpc_chttp2_transport *t = bs->transport; + if (bs->error) { + return bs->error; + } gpr_mu_lock(&s->buffer_mu); if (s->unprocessed_incoming_frames_buffer.length > 0) { grpc_error *error = deframe_unprocessed_incoming_frames( diff --git a/src/core/ext/transport/chttp2/transport/parsing.c b/src/core/ext/transport/chttp2/transport/parsing.c index f48de8ea25b..29405994f02 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.c +++ b/src/core/ext/transport/chttp2/transport/parsing.c @@ -435,8 +435,10 @@ static grpc_error *init_data_frame_parser(grpc_exec_ctx *exec_ctx, return init_skip_frame_parser(exec_ctx, t, 0); } if (err == GRPC_ERROR_NONE) { + gpr_mu_lock(&s->buffer_mu); err = grpc_chttp2_data_parser_begin_frame(&s->data_parser, t->incoming_frame_flags, s->id); + gpr_mu_unlock(&s->buffer_mu); } error_handler: if (err == GRPC_ERROR_NONE) { From d9d3c902d7ffcb5d3bda87a46a015cd0ba0752ef Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 27 Feb 2017 20:40:41 -0800 Subject: [PATCH 015/461] Clean up stream when there's no unprocessed frames --- .../ext/transport/chttp2/transport/chttp2_transport.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index d99c0dc50c2..d1f0a483915 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1602,11 +1602,12 @@ static void remove_stream(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_parsing_become_skip_parser(exec_ctx, t); } gpr_mu_lock(&s->buffer_mu); - if (error != GRPC_ERROR_NONE && s->data_parser.parsing_frame != NULL) { - grpc_chttp2_incoming_byte_stream_finished( - exec_ctx, s->data_parser.parsing_frame, GRPC_ERROR_REF(error)); - - s->data_parser.parsing_frame = NULL; + if (s->data_parser.parsing_frame != NULL && + (error != GRPC_ERROR_NONE || + s->unprocessed_incoming_frames_buffer.length == 0)) { + grpc_chttp2_incoming_byte_stream_finished( + exec_ctx, s->data_parser.parsing_frame, GRPC_ERROR_REF(error)); + s->data_parser.parsing_frame = NULL; } gpr_mu_unlock(&s->buffer_mu); From 4ec9a1fadc0278aabbeaf18c2ea22aabbef00bcc Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 28 Feb 2017 14:35:46 -0800 Subject: [PATCH 016/461] Add grpc_chttp2_incoming_byte_stream_notify --- .../chttp2/transport/chttp2_transport.c | 23 +++++++++++++++---- .../transport/chttp2/transport/frame_data.c | 1 + .../ext/transport/chttp2/transport/internal.h | 3 +++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index d1f0a483915..6cfe4730756 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -595,9 +595,7 @@ static int init_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, grpc_chttp2_incoming_metadata_buffer_init(&s->metadata_buffer[0]); grpc_chttp2_incoming_metadata_buffer_init(&s->metadata_buffer[1]); - gpr_mu_lock(&s->buffer_mu); grpc_chttp2_data_parser_init(&s->data_parser); - gpr_mu_unlock(&s->buffer_mu); grpc_slice_buffer_init(&s->flow_controlled_buffer); s->deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); grpc_closure_init(&s->complete_fetch_locked, complete_fetch_locked, s, @@ -1602,12 +1600,16 @@ static void remove_stream(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_parsing_become_skip_parser(exec_ctx, t); } gpr_mu_lock(&s->buffer_mu); - if (s->data_parser.parsing_frame != NULL && - (error != GRPC_ERROR_NONE || - s->unprocessed_incoming_frames_buffer.length == 0)) { + if (s->data_parser.parsing_frame != NULL) { + gpr_mu_lock(&s->data_parser.parsing_frame->slice_mu); + if (error != GRPC_ERROR_NONE || + s->data_parser.parsing_frame->on_next) { + gpr_mu_unlock(&s->data_parser.parsing_frame->slice_mu); grpc_chttp2_incoming_byte_stream_finished( exec_ctx, s->data_parser.parsing_frame, GRPC_ERROR_REF(error)); + gpr_mu_unlock(&s->data_parser.parsing_frame->slice_mu); s->data_parser.parsing_frame = NULL; + } } gpr_mu_unlock(&s->buffer_mu); @@ -2572,6 +2574,17 @@ void grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, } } +void grpc_chttp2_incoming_byte_stream_notify(grpc_exec_ctx *exec_ctx, + grpc_chttp2_incoming_byte_stream *bs, + grpc_error *error) { + gpr_mu_lock(&bs->slice_mu); + if (bs->on_next) { + grpc_closure_sched(exec_ctx, bs->next_action.on_complete, error); + bs->on_next = NULL; + } + gpr_mu_unlock(&bs->slice_mu); +} + void grpc_chttp2_incoming_byte_stream_finished( grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, grpc_error *error) { diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c index 08b4b81bf8d..a53241ad30d 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -279,6 +279,7 @@ grpc_error *parse_inner_buffer(grpc_exec_ctx *exec_ctx, grpc_chttp2_unprocessed_frames_buffer_push( exec_ctx, p, s, grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + grpc_chttp2_incoming_byte_stream_notify(exec_ctx, p->parsing_frame, GRPC_ERROR_NONE); gpr_mu_unlock(&s->buffer_mu); return GRPC_ERROR_NONE; } diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 3d6253cd6fa..a7ff26a42a2 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -790,6 +790,9 @@ void grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, void grpc_chttp2_incoming_byte_stream_finished( grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, grpc_error *error); +void grpc_chttp2_incoming_byte_stream_notify(grpc_exec_ctx *exec_ctx, + grpc_chttp2_incoming_byte_stream *bs, + grpc_error *error); void grpc_chttp2_ack_ping(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, uint64_t id); From d106082c2f967386aa596e5f641b81bbc499eb51 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 28 Feb 2017 18:18:03 -0800 Subject: [PATCH 017/461] Nit --- src/core/ext/transport/chttp2/transport/chttp2_transport.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 6cfe4730756..b842a889bab 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1604,10 +1604,8 @@ static void remove_stream(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, gpr_mu_lock(&s->data_parser.parsing_frame->slice_mu); if (error != GRPC_ERROR_NONE || s->data_parser.parsing_frame->on_next) { - gpr_mu_unlock(&s->data_parser.parsing_frame->slice_mu); grpc_chttp2_incoming_byte_stream_finished( exec_ctx, s->data_parser.parsing_frame, GRPC_ERROR_REF(error)); - gpr_mu_unlock(&s->data_parser.parsing_frame->slice_mu); s->data_parser.parsing_frame = NULL; } } From 369d5cce0222b911d491135c7b2db6044654d829 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 28 Feb 2017 18:20:19 -0800 Subject: [PATCH 018/461] nit --- src/core/ext/transport/chttp2/transport/chttp2_transport.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index b842a889bab..56829900e11 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1604,6 +1604,7 @@ static void remove_stream(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, gpr_mu_lock(&s->data_parser.parsing_frame->slice_mu); if (error != GRPC_ERROR_NONE || s->data_parser.parsing_frame->on_next) { + gpr_mu_unlock(&s->data_parser.parsing_frame->slice_mu); grpc_chttp2_incoming_byte_stream_finished( exec_ctx, s->data_parser.parsing_frame, GRPC_ERROR_REF(error)); s->data_parser.parsing_frame = NULL; From 58500218452332a72ded0dee6273675e57839621 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 28 Feb 2017 19:08:00 -0800 Subject: [PATCH 019/461] nit --- src/core/ext/transport/chttp2/transport/chttp2_transport.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 56829900e11..436440d7b16 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1602,9 +1602,9 @@ static void remove_stream(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, gpr_mu_lock(&s->buffer_mu); if (s->data_parser.parsing_frame != NULL) { gpr_mu_lock(&s->data_parser.parsing_frame->slice_mu); - if (error != GRPC_ERROR_NONE || - s->data_parser.parsing_frame->on_next) { - gpr_mu_unlock(&s->data_parser.parsing_frame->slice_mu); + grpc_closure *next = s->data_parser.parsing_frame->on_next; + gpr_mu_unlock(&s->data_parser.parsing_frame->slice_mu); + if (error != GRPC_ERROR_NONE || next != NULL) { grpc_chttp2_incoming_byte_stream_finished( exec_ctx, s->data_parser.parsing_frame, GRPC_ERROR_REF(error)); s->data_parser.parsing_frame = NULL; From 9a0356b1e6d0f4fdd1e29a48596b91458b038f46 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 1 Mar 2017 18:48:43 -0800 Subject: [PATCH 020/461] Fix a bug in slice_buffer:maybe_embiggen --- src/core/lib/slice/slice_buffer.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/core/lib/slice/slice_buffer.c b/src/core/lib/slice/slice_buffer.c index 9176dc8a420..451319c50d6 100644 --- a/src/core/lib/slice/slice_buffer.c +++ b/src/core/lib/slice/slice_buffer.c @@ -46,11 +46,6 @@ #define GROW(x) (3 * (x) / 2) static void maybe_embiggen(grpc_slice_buffer *sb) { - if (sb->base_slices != sb->slices) { - memmove(sb->base_slices, sb->slices, sb->count * sizeof(grpc_slice)); - sb->slices = sb->base_slices; - } - /* How far away from sb->base_slices is sb->slices pointer */ size_t slice_offset = (size_t)(sb->slices - sb->base_slices); size_t slice_count = sb->count + slice_offset; @@ -61,12 +56,15 @@ static void maybe_embiggen(grpc_slice_buffer *sb) { if (sb->base_slices == sb->inlined) { sb->base_slices = gpr_malloc(sb->capacity * sizeof(grpc_slice)); memcpy(sb->base_slices, sb->inlined, slice_count * sizeof(grpc_slice)); + sb->slices = sb->base_slices + slice_offset; } else { + if (sb->base_slices != sb->slices) { + memmove(sb->base_slices, sb->slices, sb->count * sizeof(grpc_slice)); + } sb->base_slices = gpr_realloc(sb->base_slices, sb->capacity * sizeof(grpc_slice)); + sb->slices = sb->base_slices; } - - sb->slices = sb->base_slices + slice_offset; } } From 7a4e5b427ccfdef78a170c9e9ba7f04e1f59b0fe Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Fri, 17 Feb 2017 09:28:46 -0800 Subject: [PATCH 021/461] Completion queue creation API change (JUST API change. No functionality change) --- include/grpc/grpc.h | 44 ++++++++++++++++++++++++- src/core/lib/surface/completion_queue.c | 27 ++++++++++++--- 2 files changed, 65 insertions(+), 6 deletions(-) diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 1b33d48c023..5874710bd43 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -93,9 +93,51 @@ GRPCAPI const char *grpc_version_string(void); /** Return a string specifying what the 'g' in gRPC stands for */ GRPCAPI const char *grpc_g_stands_for(void); -/** Create a completion queue */ +/** Specifies the type of APIs to use to pop events from the completion queue */ +typedef enum { + /** Events are popped out by calling grpc_completion_queue_next() API ONLY */ + GRPC_CQ_NEXT = 1, + /** Events are popped out by calling grpc_completion_queue_pluck() API ONLY*/ + GRPC_CQ_PLUCK +} grpc_cq_completion_type; + +/** Completion queues internally MAY maintain a set of file descriptors in a + structure called 'pollset'. This enum specifies if a completion queue has an + associated pollset and any restrictions on the type of file descriptors that + can be present in the pollset. + + I/O progress can only be made when grpc_completion_queue_next() or + grpc_completion_queue_pluck() are called on the completion queue (unless the + grpc_cq_polling_type is NON_POLLING) and hence it is very important to + actively call these APIs */ +typedef enum { + /** The completion queue will have an associated pollset and there is no + restriction on the type of file descriptors the pollset may contain */ + DEFAULT_POLLING, + + /** Similar to DEFAULT_POLLING except that the completion queues will not + contain any 'listening file descriptors' (i.e file descriptors used to + listen to incoming channels */ + NON_LISTENING, + + /** The completion queue will not have an associated pollset. Note that + grpc_completion_queue_next() or grpc_completion_queue_pluck() MUST still + be called to pop events from the completion queue; it is not required to + call them actively to make I/O progress */ + NON_POLLING +} grpc_cq_polling_type; + +/** Create a completion queue. + + WARNING: This API is deprecated and will soon be deleted and replaced with + completion_queue_create_ex() */ GRPCAPI grpc_completion_queue *grpc_completion_queue_create(void *reserved); +/** Create a completion queue */ +GRPCAPI grpc_completion_queue *grpc_completion_queue_create_ex( + grpc_cq_completion_type completion_type, grpc_cq_polling_type polling_type, + void *reserved); + /** Blocks until an event is available, the completion queue is being shut down, or deadline is reached. diff --git a/src/core/lib/surface/completion_queue.c b/src/core/lib/surface/completion_queue.c index b4594817e45..59148fa6a50 100644 --- a/src/core/lib/surface/completion_queue.c +++ b/src/core/lib/surface/completion_queue.c @@ -64,6 +64,10 @@ typedef struct { struct grpc_completion_queue { /** owned by pollset */ gpr_mu *mu; + + grpc_cq_completion_type completion_type; + grpc_cq_polling_type polling_type; + /** completed events */ grpc_cq_completion completed_head; grpc_cq_completion *completed_tail; @@ -79,6 +83,7 @@ struct grpc_completion_queue { int shutdown_called; int is_server_cq; /** Can the server cq accept incoming channels */ + /* TODO: sreek - This will no longer be needed. Use polling_type set */ int is_non_listening_server_cq; int num_pluckers; plucker pluckers[GRPC_MAX_COMPLETION_QUEUE_PLUCKERS]; @@ -110,7 +115,9 @@ int grpc_cq_event_timeout_trace; static void on_pollset_shutdown_done(grpc_exec_ctx *exec_ctx, void *cc, grpc_error *error); -grpc_completion_queue *grpc_completion_queue_create(void *reserved) { +grpc_completion_queue *grpc_completion_queue_create_ex( + grpc_cq_completion_type completion_type, grpc_cq_polling_type polling_type, + void *reserved) { grpc_completion_queue *cc; GPR_ASSERT(!reserved); @@ -148,6 +155,10 @@ grpc_completion_queue *grpc_completion_queue_create(void *reserved) { return cc; } +grpc_completion_queue *grpc_completion_queue_create(void *reserved) { + return grpc_completion_queue_create_ex(0, DEFAULT_POLLING, reserved); +} + #ifdef GRPC_CQ_REF_COUNT_DEBUG void grpc_cq_internal_ref(grpc_completion_queue *cc, const char *reason, const char *file, int line) { @@ -356,8 +367,9 @@ grpc_event grpc_completion_queue_next(grpc_completion_queue *cc, "deadline=gpr_timespec { tv_sec: %" PRId64 ", tv_nsec: %d, clock_type: %d }, " "reserved=%p)", - 5, (cc, deadline.tv_sec, deadline.tv_nsec, (int)deadline.clock_type, - reserved)); + 5, + (cc, deadline.tv_sec, deadline.tv_nsec, (int)deadline.clock_type, + reserved)); GPR_ASSERT(!reserved); dump_pending_tags(cc); @@ -524,8 +536,9 @@ grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cc, void *tag, "deadline=gpr_timespec { tv_sec: %" PRId64 ", tv_nsec: %d, clock_type: %d }, " "reserved=%p)", - 6, (cc, tag, deadline.tv_sec, deadline.tv_nsec, - (int)deadline.clock_type, reserved)); + 6, + (cc, tag, deadline.tv_sec, deadline.tv_nsec, (int)deadline.clock_type, + reserved)); } GPR_ASSERT(!reserved); @@ -681,10 +694,14 @@ grpc_completion_queue *grpc_cq_from_pollset(grpc_pollset *ps) { } void grpc_cq_mark_non_listening_server_cq(grpc_completion_queue *cc) { + /* TODO: sreek - use cc->polling_type field here and add a validation check + (i.e grpc_cq_mark_non_listening_server_cq can only be called on a cc whose + polling_type is set to NON_LISTENING */ cc->is_non_listening_server_cq = 1; } bool grpc_cq_is_non_listening_server_cq(grpc_completion_queue *cc) { + /* TODO (sreek) - return (cc->polling_type == NON_LISTENING) */ return (cc->is_non_listening_server_cq == 1); } From 321881d07f7806601bbf6d7929f4e4e58bc1e913 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Mon, 27 Feb 2017 11:25:28 -0800 Subject: [PATCH 022/461] Change Core to use the new completion_queue_create API --- include/grpc/grpc.h | 8 +- src/core/lib/surface/completion_queue.c | 27 ++- src/core/lib/surface/completion_queue.h | 3 + src/core/lib/surface/server.c | 18 +- test/core/bad_client/bad_client.c | 10 +- test/core/bad_ssl/bad_ssl_test.c | 3 +- test/core/bad_ssl/server_common.c | 22 +- test/core/client_channel/lb_policies_test.c | 24 ++- .../set_initial_connect_string_test.c | 2 +- test/core/end2end/bad_server_response_test.c | 2 +- test/core/end2end/connection_refused_test.c | 2 +- test/core/end2end/dualstack_socket_test.c | 12 +- test/core/end2end/end2end_tests.h | 1 + test/core/end2end/fixtures/h2_census.c | 11 +- test/core/end2end/fixtures/h2_compress.c | 11 +- test/core/end2end/fixtures/h2_fakesec.c | 4 +- test/core/end2end/fixtures/h2_fd.c | 4 +- test/core/end2end/fixtures/h2_full+pipe.c | 11 +- test/core/end2end/fixtures/h2_full+trace.c | 11 +- test/core/end2end/fixtures/h2_full.c | 11 +- test/core/end2end/fixtures/h2_http_proxy.c | 11 +- .../core/end2end/fixtures/h2_load_reporting.c | 4 +- test/core/end2end/fixtures/h2_oauth2.c | 4 +- test/core/end2end/fixtures/h2_proxy.c | 13 +- .../core/end2end/fixtures/h2_sockpair+trace.c | 4 +- test/core/end2end/fixtures/h2_sockpair.c | 4 +- .../core/end2end/fixtures/h2_sockpair_1byte.c | 4 +- test/core/end2end/fixtures/h2_ssl.c | 4 +- test/core/end2end/fixtures/h2_ssl_cert.c | 32 +-- test/core/end2end/fixtures/h2_ssl_proxy.c | 4 +- test/core/end2end/fixtures/h2_uds.c | 11 +- test/core/end2end/fixtures/proxy.c | 2 +- test/core/end2end/fuzzers/api_fuzzer.c | 28 ++- test/core/end2end/fuzzers/client_fuzzer.c | 3 +- test/core/end2end/fuzzers/server_fuzzer.c | 3 +- test/core/end2end/goaway_server_test.c | 2 +- .../core/end2end/invalid_call_argument_test.c | 11 +- .../end2end/multiple_server_queues_test.c | 14 +- test/core/end2end/no_server_test.c | 2 +- .../end2end/tests/authority_not_supported.c | 8 +- test/core/end2end/tests/bad_hostname.c | 8 +- test/core/end2end/tests/binary_metadata.c | 8 +- test/core/end2end/tests/call_creds.c | 5 +- test/core/end2end/tests/cancel_after_accept.c | 8 +- .../end2end/tests/cancel_after_client_done.c | 8 +- test/core/end2end/tests/cancel_after_invoke.c | 8 +- .../core/end2end/tests/cancel_before_invoke.c | 8 +- test/core/end2end/tests/cancel_in_a_vacuum.c | 8 +- test/core/end2end/tests/cancel_with_status.c | 8 +- test/core/end2end/tests/compressed_payload.c | 8 +- test/core/end2end/tests/connectivity.c | 3 + test/core/end2end/tests/default_host.c | 8 +- test/core/end2end/tests/disappearing_server.c | 3 + test/core/end2end/tests/empty_batch.c | 8 +- .../end2end/tests/filter_call_init_fails.c | 8 +- test/core/end2end/tests/filter_causes_close.c | 8 +- test/core/end2end/tests/filter_latency.c | 8 +- .../end2end/tests/graceful_server_shutdown.c | 2 + test/core/end2end/tests/high_initial_seqno.c | 8 +- test/core/end2end/tests/hpack_size.c | 8 +- test/core/end2end/tests/idempotent_request.c | 8 +- .../core/end2end/tests/invoke_large_request.c | 8 +- test/core/end2end/tests/large_metadata.c | 8 +- test/core/end2end/tests/load_reporting_hook.c | 8 +- .../end2end/tests/max_concurrent_streams.c | 8 +- test/core/end2end/tests/max_message_length.c | 8 +- test/core/end2end/tests/negative_deadline.c | 8 +- .../end2end/tests/network_status_change.c | 8 +- test/core/end2end/tests/no_logging.c | 8 +- test/core/end2end/tests/no_op.c | 8 +- test/core/end2end/tests/payload.c | 8 +- test/core/end2end/tests/ping.c | 3 + test/core/end2end/tests/ping_pong_streaming.c | 8 +- test/core/end2end/tests/registered_call.c | 8 +- test/core/end2end/tests/request_with_flags.c | 8 +- .../core/end2end/tests/request_with_payload.c | 8 +- .../end2end/tests/resource_quota_server.c | 8 +- .../end2end/tests/server_finishes_request.c | 8 +- .../end2end/tests/shutdown_finishes_calls.c | 2 + .../end2end/tests/shutdown_finishes_tags.c | 2 + .../end2end/tests/simple_cacheable_request.c | 8 +- .../end2end/tests/simple_delayed_request.c | 8 +- test/core/end2end/tests/simple_metadata.c | 8 +- test/core/end2end/tests/simple_request.c | 8 +- .../end2end/tests/streaming_error_response.c | 8 +- test/core/end2end/tests/trailing_metadata.c | 8 +- test/core/end2end/tests/write_buffering.c | 8 +- .../end2end/tests/write_buffering_at_end.c | 8 +- test/core/fling/client.c | 2 +- test/core/fling/server.c | 23 ++- test/core/handshake/client_ssl.c | 4 +- test/core/handshake/server_ssl.c | 3 +- test/core/memory_usage/client.c | 7 +- test/core/memory_usage/server.c | 21 +- test/core/surface/alarm_test.c | 2 +- test/core/surface/completion_queue_test.c | 192 ++++++++++++------ .../surface/concurrent_connectivity_test.c | 5 +- test/core/surface/lame_client_test.c | 2 +- .../surface/sequential_connectivity_test.c | 6 +- test/core/surface/server_chttp2_test.c | 3 +- test/core/surface/server_test.c | 9 +- 101 files changed, 658 insertions(+), 334 deletions(-) diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 5874710bd43..0e4711fa1f3 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -127,14 +127,8 @@ typedef enum { NON_POLLING } grpc_cq_polling_type; -/** Create a completion queue. - - WARNING: This API is deprecated and will soon be deleted and replaced with - completion_queue_create_ex() */ -GRPCAPI grpc_completion_queue *grpc_completion_queue_create(void *reserved); - /** Create a completion queue */ -GRPCAPI grpc_completion_queue *grpc_completion_queue_create_ex( +GRPCAPI grpc_completion_queue *grpc_completion_queue_create( grpc_cq_completion_type completion_type, grpc_cq_polling_type polling_type, void *reserved); diff --git a/src/core/lib/surface/completion_queue.c b/src/core/lib/surface/completion_queue.c index 59148fa6a50..d45e265d5c8 100644 --- a/src/core/lib/surface/completion_queue.c +++ b/src/core/lib/surface/completion_queue.c @@ -115,7 +115,7 @@ int grpc_cq_event_timeout_trace; static void on_pollset_shutdown_done(grpc_exec_ctx *exec_ctx, void *cc, grpc_error *error); -grpc_completion_queue *grpc_completion_queue_create_ex( +grpc_completion_queue *grpc_completion_queue_create( grpc_cq_completion_type completion_type, grpc_cq_polling_type polling_type, void *reserved) { grpc_completion_queue *cc; @@ -132,6 +132,9 @@ grpc_completion_queue *grpc_completion_queue_create_ex( cc->outstanding_tag_capacity = 0; #endif + cc->completion_type = completion_type; + cc->polling_type = polling_type; + /* Initial ref is dropped by grpc_completion_queue_shutdown */ gpr_ref_init(&cc->pending_events, 1); /* One for destroy(), one for pollset_shutdown */ @@ -155,8 +158,12 @@ grpc_completion_queue *grpc_completion_queue_create_ex( return cc; } -grpc_completion_queue *grpc_completion_queue_create(void *reserved) { - return grpc_completion_queue_create_ex(0, DEFAULT_POLLING, reserved); +grpc_cq_completion_type grpc_get_cq_completion_type(grpc_completion_queue *cc) { + return cc->completion_type; +} + +grpc_cq_polling_type grpc_get_cq_polling_type(grpc_completion_queue *cc) { + return cc->polling_type; } #ifdef GRPC_CQ_REF_COUNT_DEBUG @@ -359,6 +366,13 @@ grpc_event grpc_completion_queue_next(grpc_completion_queue *cc, grpc_pollset_worker *worker = NULL; gpr_timespec now; + if (cc->completion_type != GRPC_CQ_NEXT) { + gpr_log(GPR_ERROR, + "grpc_completion_queue_next() cannot be called on this completion " + "queue since its completion type is not GRPC_CQ_NEXT"); + abort(); + } + GPR_TIMER_BEGIN("grpc_completion_queue_next", 0); GRPC_API_TRACE( @@ -529,6 +543,13 @@ grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cc, void *tag, GPR_TIMER_BEGIN("grpc_completion_queue_pluck", 0); + if (cc->completion_type != GRPC_CQ_PLUCK) { + gpr_log(GPR_ERROR, + "grpc_completion_queue_pluck() cannot be called on this completion " + "queue since its completion type is not GRPC_CQ_PLUCK"); + abort(); + } + if (grpc_cq_pluck_trace) { GRPC_API_TRACE( "grpc_completion_queue_pluck(" diff --git a/src/core/lib/surface/completion_queue.h b/src/core/lib/surface/completion_queue.h index 5d73dd7216e..21f28e94249 100644 --- a/src/core/lib/surface/completion_queue.h +++ b/src/core/lib/surface/completion_queue.h @@ -99,4 +99,7 @@ bool grpc_cq_is_non_listening_server_cq(grpc_completion_queue *cc); void grpc_cq_mark_server_cq(grpc_completion_queue *cc); int grpc_cq_is_server_cq(grpc_completion_queue *cc); +grpc_cq_completion_type grpc_get_cq_completion_type(grpc_completion_queue *cc); +grpc_cq_polling_type grpc_get_cq_polling_type(grpc_completion_queue *cc); + #endif /* GRPC_CORE_LIB_SURFACE_COMPLETION_QUEUE_H */ diff --git a/src/core/lib/surface/server.c b/src/core/lib/surface/server.c index b3605795536..13f7321facb 100644 --- a/src/core/lib/surface/server.c +++ b/src/core/lib/surface/server.c @@ -1001,6 +1001,14 @@ void grpc_server_register_completion_queue(grpc_server *server, GRPC_API_TRACE( "grpc_server_register_completion_queue(server=%p, cq=%p, reserved=%p)", 3, (server, cq, reserved)); + + if (grpc_get_cq_completion_type(cq) != GRPC_CQ_NEXT) { + gpr_log( + GPR_ERROR, + "Server completion queues must have a completion type of GRPC_CQ_NEXT"); + abort(); + } + register_completion_queue(server, cq, false, reserved); } @@ -1423,8 +1431,9 @@ grpc_call_error grpc_server_request_call( "grpc_server_request_call(" "server=%p, call=%p, details=%p, initial_metadata=%p, " "cq_bound_to_call=%p, cq_for_notification=%p, tag=%p)", - 7, (server, call, details, initial_metadata, cq_bound_to_call, - cq_for_notification, tag)); + 7, + (server, call, details, initial_metadata, cq_bound_to_call, + cq_for_notification, tag)); size_t cq_idx; for (cq_idx = 0; cq_idx < server->cq_count; cq_idx++) { if (server->cqs[cq_idx] == cq_for_notification) { @@ -1466,8 +1475,9 @@ grpc_call_error grpc_server_request_registered_call( "server=%p, rmp=%p, call=%p, deadline=%p, initial_metadata=%p, " "optional_payload=%p, cq_bound_to_call=%p, cq_for_notification=%p, " "tag=%p)", - 9, (server, rmp, call, deadline, initial_metadata, optional_payload, - cq_bound_to_call, cq_for_notification, tag)); + 9, + (server, rmp, call, deadline, initial_metadata, optional_payload, + cq_bound_to_call, cq_for_notification, tag)); size_t cq_idx; for (cq_idx = 0; cq_idx < server->cq_count; cq_idx++) { diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.c index fdedfe284e2..a6e859d06e8 100644 --- a/test/core/bad_client/bad_client.c +++ b/test/core/bad_client/bad_client.c @@ -104,6 +104,7 @@ void grpc_run_bad_client_test( grpc_slice_buffer outgoing; grpc_closure done_write_closure; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_completion_queue *shutdown_cq; hex = gpr_dump(client_payload, client_payload_length, GPR_DUMP_HEX | GPR_DUMP_ASCII); @@ -124,7 +125,7 @@ void grpc_run_bad_client_test( /* Create server, completion events */ a.server = grpc_server_create(NULL, NULL); - a.cq = grpc_completion_queue_create(NULL); + a.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); gpr_event_init(&a.done_thd); gpr_event_init(&a.done_write); a.validator = server_validator; @@ -195,10 +196,13 @@ void grpc_run_bad_client_test( grpc_endpoint_destroy(&exec_ctx, sfd.client); grpc_exec_ctx_finish(&exec_ctx); } - grpc_server_shutdown_and_notify(a.server, a.cq, NULL); + + shutdown_cq = grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_server_shutdown_and_notify(a.server, shutdown_cq, NULL); GPR_ASSERT(grpc_completion_queue_pluck( - a.cq, NULL, grpc_timeout_seconds_to_deadline(1), NULL) + shutdown_cq, NULL, grpc_timeout_seconds_to_deadline(1), NULL) .type == GRPC_OP_COMPLETE); + grpc_completion_queue_destroy(shutdown_cq); grpc_server_destroy(a.server); grpc_completion_queue_destroy(a.cq); grpc_slice_buffer_destroy_internal(&exec_ctx, &outgoing); diff --git a/test/core/bad_ssl/bad_ssl_test.c b/test/core/bad_ssl/bad_ssl_test.c index bd855857066..4d34f8a9ea8 100644 --- a/test/core/bad_ssl/bad_ssl_test.c +++ b/test/core/bad_ssl/bad_ssl_test.c @@ -61,7 +61,8 @@ static void run_test(const char *target, size_t nops) { grpc_status_code status; grpc_call_error error; gpr_timespec deadline = grpc_timeout_seconds_to_deadline(5); - grpc_completion_queue *cq = grpc_completion_queue_create(NULL); + grpc_completion_queue *cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); cq_verifier *cqv = cq_verifier_create(cq); grpc_op ops[6]; diff --git a/test/core/bad_ssl/server_common.c b/test/core/bad_ssl/server_common.c index 6a4313eafd6..383899d94a8 100644 --- a/test/core/bad_ssl/server_common.c +++ b/test/core/bad_ssl/server_common.c @@ -66,7 +66,10 @@ void bad_ssl_run(grpc_server *server) { grpc_call *s = NULL; grpc_call_details call_details; grpc_metadata_array request_metadata_recv; - grpc_completion_queue *cq = grpc_completion_queue_create(NULL); + + grpc_completion_queue *cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + grpc_completion_queue *shutdown_cq; grpc_call_details_init(&call_details); grpc_metadata_array_init(&request_metadata_recv); @@ -82,16 +85,21 @@ void bad_ssl_run(grpc_server *server) { while (!shutdown_finished) { if (got_sigint && !shutdown_started) { gpr_log(GPR_INFO, "Shutting down due to SIGINT"); - grpc_server_shutdown_and_notify(server, cq, NULL); - GPR_ASSERT(grpc_completion_queue_pluck( - cq, NULL, grpc_timeout_seconds_to_deadline(5), NULL) - .type == GRPC_OP_COMPLETE); + shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_server_shutdown_and_notify(server, shutdown_cq, NULL); + GPR_ASSERT( + grpc_completion_queue_pluck(shutdown_cq, NULL, + grpc_timeout_seconds_to_deadline(5), NULL) + .type == GRPC_OP_COMPLETE); + grpc_completion_queue_destroy(shutdown_cq); grpc_completion_queue_shutdown(cq); shutdown_started = 1; } ev = grpc_completion_queue_next( - cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(1000000, GPR_TIMESPAN)), + cq, + gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(1000000, GPR_TIMESPAN)), NULL); switch (ev.type) { case GRPC_OP_COMPLETE: diff --git a/test/core/client_channel/lb_policies_test.c b/test/core/client_channel/lb_policies_test.c index 057b90ec84f..9dcbdb979da 100644 --- a/test/core/client_channel/lb_policies_test.c +++ b/test/core/client_channel/lb_policies_test.c @@ -59,14 +59,15 @@ typedef struct servers_fixture { grpc_server **servers; grpc_call **server_calls; grpc_completion_queue *cq; + grpc_completion_queue *shutdown_cq; char **servers_hostports; grpc_metadata_array *request_metadata_recv; } servers_fixture; typedef struct request_sequences { - size_t n; /* number of iterations */ - int *connections; /* indexed by the interation number, value is the index of - the server it connected to or -1 if none */ + size_t n; /* number of iterations */ + int *connections; /* indexed by the interation number, value is the index of + the server it connected to or -1 if none */ int *connectivity_states; /* indexed by the interation number, value is the client connectivity state */ } request_sequences; @@ -146,10 +147,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void kill_server(const servers_fixture *f, size_t i) { gpr_log(GPR_INFO, "KILLING SERVER %" PRIuPTR, i); GPR_ASSERT(f->servers[i] != NULL); - grpc_server_shutdown_and_notify(f->servers[i], f->cq, tag(10000)); - GPR_ASSERT( - grpc_completion_queue_pluck(f->cq, tag(10000), n_millis_time(5000), NULL) - .type == GRPC_OP_COMPLETE); + grpc_server_shutdown_and_notify(f->servers[i], f->shutdown_cq, tag(10000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(10000), + n_millis_time(5000), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->servers[i]); f->servers[i] = NULL; } @@ -196,7 +197,9 @@ static servers_fixture *setup_servers(const char *server_host, /* Create servers. */ f->servers = gpr_malloc(sizeof(grpc_server *) * num_servers); f->servers_hostports = gpr_malloc(sizeof(char *) * num_servers); - f->cq = grpc_completion_queue_create(NULL); + f->cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f->shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); for (i = 0; i < num_servers; i++) { grpc_metadata_array_init(&f->request_metadata_recv[i]); gpr_join_host_port(&f->servers_hostports[i], server_host, @@ -212,8 +215,8 @@ static void teardown_servers(servers_fixture *f) { /* Destroy server. */ for (i = 0; i < f->num_servers; i++) { if (f->servers[i] == NULL) continue; - grpc_server_shutdown_and_notify(f->servers[i], f->cq, tag(10000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(10000), + grpc_server_shutdown_and_notify(f->servers[i], f->shutdown_cq, tag(10000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(10000), n_millis_time(5000), NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->servers[i]); @@ -221,6 +224,7 @@ static void teardown_servers(servers_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); gpr_free(f->servers); diff --git a/test/core/client_channel/set_initial_connect_string_test.c b/test/core/client_channel/set_initial_connect_string_test.c index a0a33667cc8..38f2fbac623 100644 --- a/test/core/client_channel/set_initial_connect_string_test.c +++ b/test/core/client_channel/set_initial_connect_string_test.c @@ -130,7 +130,7 @@ static gpr_timespec n_sec_deadline(int seconds) { } static void start_rpc(int use_creds, int target_port) { - state.cq = grpc_completion_queue_create(NULL); + state.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); if (use_creds) { state.creds = grpc_fake_transport_security_credentials_create(); } else { diff --git a/test/core/end2end/bad_server_response_test.c b/test/core/end2end/bad_server_response_test.c index 39a98e84ca9..67f5bdbac80 100644 --- a/test/core/end2end/bad_server_response_test.c +++ b/test/core/end2end/bad_server_response_test.c @@ -178,7 +178,7 @@ static void start_rpc(int target_port, grpc_status_code expected_status, cq_verifier *cqv; grpc_slice details; - state.cq = grpc_completion_queue_create(NULL); + state.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); cqv = cq_verifier_create(state.cq); gpr_join_host_port(&state.target, "127.0.0.1", target_port); state.channel = grpc_insecure_channel_create(state.target, NULL, NULL); diff --git a/test/core/end2end/connection_refused_test.c b/test/core/end2end/connection_refused_test.c index 16a3005539b..617828f9546 100644 --- a/test/core/end2end/connection_refused_test.c +++ b/test/core/end2end/connection_refused_test.c @@ -69,7 +69,7 @@ static void run_test(bool wait_for_ready, bool use_service_config) { grpc_metadata_array_init(&trailing_metadata_recv); - cq = grpc_completion_queue_create(NULL); + cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); cqv = cq_verifier_create(cq); /* if using service config, create channel args */ diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.c index 3623bd7be8b..5125be9b942 100644 --- a/test/core/end2end/dualstack_socket_test.c +++ b/test/core/end2end/dualstack_socket_test.c @@ -76,6 +76,7 @@ void test_connect(const char *server_host, const char *client_host, int port, grpc_channel *client; grpc_server *server; grpc_completion_queue *cq; + grpc_completion_queue *shutdown_cq; grpc_call *c; grpc_call *s; cq_verifier *cqv; @@ -107,7 +108,7 @@ void test_connect(const char *server_host, const char *client_host, int port, grpc_call_details_init(&call_details); /* Create server. */ - cq = grpc_completion_queue_create(NULL); + cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); server = grpc_server_create(NULL, NULL); grpc_server_register_completion_queue(server, cq, NULL); GPR_ASSERT((got_port = grpc_server_add_insecure_http2_port( @@ -259,11 +260,14 @@ void test_connect(const char *server_host, const char *client_host, int port, grpc_channel_destroy(client); /* Destroy server. */ - grpc_server_shutdown_and_notify(server, cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + shutdown_cq = grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_server_shutdown_and_notify(server, shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(server); + grpc_completion_queue_destroy(shutdown_cq); grpc_completion_queue_shutdown(cq); drain_cq(cq); grpc_completion_queue_destroy(cq); diff --git a/test/core/end2end/end2end_tests.h b/test/core/end2end/end2end_tests.h index cb0afd9cd99..ac87c55dc49 100644 --- a/test/core/end2end/end2end_tests.h +++ b/test/core/end2end/end2end_tests.h @@ -50,6 +50,7 @@ typedef struct grpc_end2end_test_config grpc_end2end_test_config; struct grpc_end2end_test_fixture { grpc_completion_queue *cq; + grpc_completion_queue *shutdown_cq; grpc_server *server; grpc_channel *client; void *fixture_data; diff --git a/test/core/end2end/fixtures/h2_census.c b/test/core/end2end/fixtures/h2_census.c index 8e60123ed6e..a1fae013c29 100644 --- a/test/core/end2end/fixtures/h2_census.c +++ b/test/core/end2end/fixtures/h2_census.c @@ -65,7 +65,9 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(NULL); + f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); return f; } @@ -119,9 +121,10 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack+census", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack+census", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_compress.c b/test/core/end2end/fixtures/h2_compress.c index c01e45664bb..7a2aa7ff7fb 100644 --- a/test/core/end2end/fixtures/h2_compress.c +++ b/test/core/end2end/fixtures/h2_compress.c @@ -69,7 +69,9 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_compression( memset(&f, 0, sizeof(f)); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(NULL); + f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); return f; } @@ -119,9 +121,10 @@ void chttp2_tear_down_fullstack_compression(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack_compression", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack_compression", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack_compression, chttp2_init_client_fullstack_compression, chttp2_init_server_fullstack_compression, diff --git a/test/core/end2end/fixtures/h2_fakesec.c b/test/core/end2end/fixtures/h2_fakesec.c index c9747913c2f..0ccdef9767a 100644 --- a/test/core/end2end/fixtures/h2_fakesec.c +++ b/test/core/end2end/fixtures/h2_fakesec.c @@ -60,7 +60,9 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(NULL); + f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); return f; } diff --git a/test/core/end2end/fixtures/h2_fd.c b/test/core/end2end/fixtures/h2_fd.c index 223fadc386d..d97b693e331 100644 --- a/test/core/end2end/fixtures/h2_fd.c +++ b/test/core/end2end/fixtures/h2_fd.c @@ -70,7 +70,9 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); f.fixture_data = fixture_data; - f.cq = grpc_completion_queue_create(NULL); + f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); create_sockets(fixture_data->fd_pair); diff --git a/test/core/end2end/fixtures/h2_full+pipe.c b/test/core/end2end/fixtures/h2_full+pipe.c index c6013f30400..812922ff5bc 100644 --- a/test/core/end2end/fixtures/h2_full+pipe.c +++ b/test/core/end2end/fixtures/h2_full+pipe.c @@ -70,7 +70,9 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(NULL); + f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); return f; } @@ -102,9 +104,10 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_full+trace.c b/test/core/end2end/fixtures/h2_full+trace.c index 01316376e03..02d794d08d2 100644 --- a/test/core/end2end/fixtures/h2_full+trace.c +++ b/test/core/end2end/fixtures/h2_full+trace.c @@ -70,7 +70,9 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(NULL); + f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); return f; } @@ -102,9 +104,10 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_full.c b/test/core/end2end/fixtures/h2_full.c index 3399f1981e4..bfb300e42ff 100644 --- a/test/core/end2end/fixtures/h2_full.c +++ b/test/core/end2end/fixtures/h2_full.c @@ -64,7 +64,9 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(NULL); + f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); return f; } @@ -96,9 +98,10 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_http_proxy.c b/test/core/end2end/fixtures/h2_http_proxy.c index 44b223664ab..0f8e002e568 100644 --- a/test/core/end2end/fixtures/h2_http_proxy.c +++ b/test/core/end2end/fixtures/h2_http_proxy.c @@ -69,7 +69,9 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( ffd->proxy = grpc_end2end_http_proxy_create(); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(NULL); + f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); return f; } @@ -107,9 +109,10 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_load_reporting.c b/test/core/end2end/fixtures/h2_load_reporting.c index 38321f34db7..664c7ba9d4b 100644 --- a/test/core/end2end/fixtures/h2_load_reporting.c +++ b/test/core/end2end/fixtures/h2_load_reporting.c @@ -67,7 +67,9 @@ static grpc_end2end_test_fixture chttp2_create_fixture_load_reporting( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(NULL); + f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); return f; } diff --git a/test/core/end2end/fixtures/h2_oauth2.c b/test/core/end2end/fixtures/h2_oauth2.c index 33516528586..73928759fed 100644 --- a/test/core/end2end/fixtures/h2_oauth2.c +++ b/test/core/end2end/fixtures/h2_oauth2.c @@ -113,7 +113,9 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(NULL); + f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); return f; } diff --git a/test/core/end2end/fixtures/h2_proxy.c b/test/core/end2end/fixtures/h2_proxy.c index 9e37ed4db34..016ba41fbd7 100644 --- a/test/core/end2end/fixtures/h2_proxy.c +++ b/test/core/end2end/fixtures/h2_proxy.c @@ -79,7 +79,9 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( ffd->proxy = grpc_end2end_proxy_create(&proxy_def, client_args, server_args); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(NULL); + f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); return f; } @@ -113,10 +115,11 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack+proxy", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_REQUEST_PROXYING | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack+proxy", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_REQUEST_PROXYING | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.c b/test/core/end2end/fixtures/h2_sockpair+trace.c index edf42a40702..445f8a2dd1d 100644 --- a/test/core/end2end/fixtures/h2_sockpair+trace.c +++ b/test/core/end2end/fixtures/h2_sockpair+trace.c @@ -94,7 +94,9 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); f.fixture_data = sfd; - f.cq = grpc_completion_queue_create(NULL); + f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); grpc_resource_quota *resource_quota = grpc_resource_quota_create("fixture"); *sfd = grpc_iomgr_create_endpoint_pair("fixture", resource_quota, 65536); diff --git a/test/core/end2end/fixtures/h2_sockpair.c b/test/core/end2end/fixtures/h2_sockpair.c index 94b2623b3ea..66c05c55625 100644 --- a/test/core/end2end/fixtures/h2_sockpair.c +++ b/test/core/end2end/fixtures/h2_sockpair.c @@ -88,7 +88,9 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); f.fixture_data = sfd; - f.cq = grpc_completion_queue_create(NULL); + f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); grpc_resource_quota *resource_quota = grpc_resource_quota_create("fixture"); *sfd = grpc_iomgr_create_endpoint_pair("fixture", resource_quota, 65536); diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.c b/test/core/end2end/fixtures/h2_sockpair_1byte.c index 6f9cf8fe26a..2d845f369b8 100644 --- a/test/core/end2end/fixtures/h2_sockpair_1byte.c +++ b/test/core/end2end/fixtures/h2_sockpair_1byte.c @@ -88,7 +88,9 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); f.fixture_data = sfd; - f.cq = grpc_completion_queue_create(NULL); + f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); grpc_resource_quota *resource_quota = grpc_resource_quota_create("fixture"); *sfd = grpc_iomgr_create_endpoint_pair("fixture", resource_quota, 1); diff --git a/test/core/end2end/fixtures/h2_ssl.c b/test/core/end2end/fixtures/h2_ssl.c index cf44cd093c9..d73944fe6cc 100644 --- a/test/core/end2end/fixtures/h2_ssl.c +++ b/test/core/end2end/fixtures/h2_ssl.c @@ -64,7 +64,9 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(NULL); + f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); return f; } diff --git a/test/core/end2end/fixtures/h2_ssl_cert.c b/test/core/end2end/fixtures/h2_ssl_cert.c index f62331eea3d..c8bd7153c2c 100644 --- a/test/core/end2end/fixtures/h2_ssl_cert.c +++ b/test/core/end2end/fixtures/h2_ssl_cert.c @@ -67,7 +67,9 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(NULL); + f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); return f; } @@ -203,15 +205,17 @@ CLIENT_INIT(BAD_CERT_PAIR) typedef enum { SUCCESS, FAIL } test_result; -#define SSL_TEST(request_type, cert_type, result) \ - { \ - {TEST_NAME(request_type, cert_type, result), \ - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | \ - FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | \ - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL, \ - chttp2_create_fixture_secure_fullstack, CLIENT_INIT_NAME(cert_type), \ - SERVER_INIT_NAME(request_type), chttp2_tear_down_secure_fullstack}, \ - result \ +#define SSL_TEST(request_type, cert_type, result) \ + { \ + {TEST_NAME(request_type, cert_type, result), \ + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | \ + FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | \ + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL, \ + chttp2_create_fixture_secure_fullstack, \ + CLIENT_INIT_NAME(cert_type), \ + SERVER_INIT_NAME(request_type), \ + chttp2_tear_down_secure_fullstack}, \ + result \ } /* All test configurations */ @@ -289,9 +293,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -310,6 +315,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } static void simple_request_body(grpc_end2end_test_fixture f, diff --git a/test/core/end2end/fixtures/h2_ssl_proxy.c b/test/core/end2end/fixtures/h2_ssl_proxy.c index 740b075bf6d..22fbeb1a83f 100644 --- a/test/core/end2end/fixtures/h2_ssl_proxy.c +++ b/test/core/end2end/fixtures/h2_ssl_proxy.c @@ -100,7 +100,9 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( ffd->proxy = grpc_end2end_proxy_create(&proxy_def, client_args, server_args); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(NULL); + f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); return f; } diff --git a/test/core/end2end/fixtures/h2_uds.c b/test/core/end2end/fixtures/h2_uds.c index bc973ea8e3c..1c7799d5d96 100644 --- a/test/core/end2end/fixtures/h2_uds.c +++ b/test/core/end2end/fixtures/h2_uds.c @@ -70,7 +70,9 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( unique++); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(NULL); + f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); return f; } @@ -101,9 +103,10 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack_uds", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack_uds", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/proxy.c b/test/core/end2end/fixtures/proxy.c index cee053e8c56..7f23eef66a5 100644 --- a/test/core/end2end/fixtures/proxy.c +++ b/test/core/end2end/fixtures/proxy.c @@ -104,7 +104,7 @@ grpc_end2end_proxy *grpc_end2end_proxy_create(const grpc_end2end_proxy_def *def, gpr_log(GPR_DEBUG, "PROXY ADDR:%s BACKEND:%s", proxy->proxy_port, proxy->server_port); - proxy->cq = grpc_completion_queue_create(NULL); + proxy->cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); proxy->server = def->create_server(proxy->proxy_port, server_args); proxy->client = def->create_client(proxy->server_port, client_args); diff --git a/test/core/end2end/fuzzers/api_fuzzer.c b/test/core/end2end/fuzzers/api_fuzzer.c index 0de8b9459ab..61f972e65eb 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.c +++ b/test/core/end2end/fuzzers/api_fuzzer.c @@ -314,8 +314,9 @@ static grpc_call_credentials *read_call_creds(input_stream *inp) { cred_artifact_ctx ctx = CRED_ARTIFACT_CTX_INIT; const char *access_token = read_cred_artifact(&ctx, inp, NULL, 0); grpc_call_credentials *out = - access_token == NULL ? NULL : grpc_access_token_credentials_create( - access_token, NULL); + access_token == NULL + ? NULL + : grpc_access_token_credentials_create(access_token, NULL); cred_artifact_ctx_finish(&ctx); return out; } @@ -409,8 +410,9 @@ void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr, r->on_done = on_done; r->addrs = addresses; grpc_timer_init( - exec_ctx, &r->timer, gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), - gpr_time_from_seconds(1, GPR_TIMESPAN)), + exec_ctx, &r->timer, + gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), + gpr_time_from_seconds(1, GPR_TIMESPAN)), grpc_closure_create(finish_resolve, r, grpc_schedule_on_exec_ctx), gpr_now(GPR_CLOCK_MONOTONIC)); } @@ -471,8 +473,9 @@ static void sched_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure, fc->ep = ep; fc->deadline = deadline; grpc_timer_init( - exec_ctx, &fc->timer, gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), - gpr_time_from_millis(1, GPR_TIMESPAN)), + exec_ctx, &fc->timer, + gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), + gpr_time_from_millis(1, GPR_TIMESPAN)), grpc_closure_create(do_connect, fc, grpc_schedule_on_exec_ctx), gpr_now(GPR_CLOCK_MONOTONIC)); } @@ -735,7 +738,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { g_active_call = new_call(NULL, ROOT); g_resource_quota = grpc_resource_quota_create("api_fuzzer"); - grpc_completion_queue *cq = grpc_completion_queue_create(NULL); + grpc_completion_queue *cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); while (!is_eof(&inp) || g_channel != NULL || g_server != NULL || pending_channel_watches > 0 || pending_pings > 0 || @@ -748,8 +752,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { if (g_server != NULL) { if (!server_shutdown) { grpc_server_shutdown_and_notify( - g_server, cq, create_validator(assert_success_and_decrement, - &pending_server_shutdowns)); + g_server, cq, + create_validator(assert_success_and_decrement, + &pending_server_shutdowns)); server_shutdown = true; pending_server_shutdowns++; } else if (pending_server_shutdowns == 0) { @@ -854,8 +859,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { case 5: { if (g_server != NULL) { grpc_server_shutdown_and_notify( - g_server, cq, create_validator(assert_success_and_decrement, - &pending_server_shutdowns)); + g_server, cq, + create_validator(assert_success_and_decrement, + &pending_server_shutdowns)); pending_server_shutdowns++; server_shutdown = true; } else { diff --git a/test/core/end2end/fuzzers/client_fuzzer.c b/test/core/end2end/fuzzers/client_fuzzer.c index e7e7dbefd03..6b8c09cdf4b 100644 --- a/test/core/end2end/fuzzers/client_fuzzer.c +++ b/test/core/end2end/fuzzers/client_fuzzer.c @@ -65,7 +65,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { grpc_mock_endpoint_create(discard_write, resource_quota); grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); - grpc_completion_queue *cq = grpc_completion_queue_create(NULL); + grpc_completion_queue *cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); grpc_transport *transport = grpc_create_chttp2_transport(&exec_ctx, NULL, mock_endpoint, 1); grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL); diff --git a/test/core/end2end/fuzzers/server_fuzzer.c b/test/core/end2end/fuzzers/server_fuzzer.c index 186542d4b2d..76fe97ec0f1 100644 --- a/test/core/end2end/fuzzers/server_fuzzer.c +++ b/test/core/end2end/fuzzers/server_fuzzer.c @@ -67,7 +67,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { grpc_slice_from_copied_buffer((const char *)data, size)); grpc_server *server = grpc_server_create(NULL, NULL); - grpc_completion_queue *cq = grpc_completion_queue_create(NULL); + grpc_completion_queue *cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); grpc_server_register_completion_queue(server, cq, NULL); // TODO(ctiller): add registered methods (one for POST, one for PUT) // void *registered_method = diff --git a/test/core/end2end/goaway_server_test.c b/test/core/end2end/goaway_server_test.c index a9634bfbaec..85d54c16e56 100644 --- a/test/core/end2end/goaway_server_test.c +++ b/test/core/end2end/goaway_server_test.c @@ -121,7 +121,7 @@ int main(int argc, char **argv) { grpc_metadata_array_init(&request_metadata2); grpc_call_details_init(&request_details2); - cq = grpc_completion_queue_create(NULL); + cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); cqv = cq_verifier_create(cq); /* reserve two ports */ diff --git a/test/core/end2end/invalid_call_argument_test.c b/test/core/end2end/invalid_call_argument_test.c index 2a9072570d3..0563127af84 100644 --- a/test/core/end2end/invalid_call_argument_test.c +++ b/test/core/end2end/invalid_call_argument_test.c @@ -73,7 +73,8 @@ static void prepare_test(int is_client) { grpc_metadata_array_init(&g_state.initial_metadata_recv); grpc_metadata_array_init(&g_state.trailing_metadata_recv); g_state.deadline = grpc_timeout_seconds_to_deadline(2); - g_state.cq = grpc_completion_queue_create(NULL); + g_state.cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); g_state.cqv = cq_verifier_create(g_state.cq); g_state.details = grpc_empty_slice(); memset(g_state.ops, 0, sizeof(g_state.ops)); @@ -123,6 +124,7 @@ static void prepare_test(int is_client) { } static void cleanup_test() { + grpc_completion_queue *shutdown_cq; grpc_call_destroy(g_state.call); cq_verifier_destroy(g_state.cqv); grpc_channel_destroy(g_state.chan); @@ -131,12 +133,15 @@ static void cleanup_test() { grpc_metadata_array_destroy(&g_state.trailing_metadata_recv); if (!g_state.is_client) { + shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); grpc_call_destroy(g_state.server_call); - grpc_server_shutdown_and_notify(g_state.server, g_state.cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(g_state.cq, tag(1000), + grpc_server_shutdown_and_notify(g_state.server, shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) .type == GRPC_OP_COMPLETE); + grpc_completion_queue_destroy(shutdown_cq); grpc_server_destroy(g_state.server); grpc_call_details_destroy(&g_state.call_details); grpc_metadata_array_destroy(&g_state.server_initial_metadata_recv); diff --git a/test/core/end2end/multiple_server_queues_test.c b/test/core/end2end/multiple_server_queues_test.c index 5e2eaf4ae94..94e615f1aa7 100644 --- a/test/core/end2end/multiple_server_queues_test.c +++ b/test/core/end2end/multiple_server_queues_test.c @@ -37,27 +37,37 @@ int main(int argc, char **argv) { grpc_completion_queue *cq1; grpc_completion_queue *cq2; + grpc_completion_queue *cq3; grpc_server *server; grpc_test_init(argc, argv); grpc_init(); - cq1 = grpc_completion_queue_create(NULL); - cq2 = grpc_completion_queue_create(NULL); + cq1 = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + cq2 = grpc_completion_queue_create(GRPC_CQ_NEXT, NON_LISTENING, NULL); + cq3 = grpc_completion_queue_create(GRPC_CQ_NEXT, NON_POLLING, NULL); + server = grpc_server_create(NULL, NULL); grpc_server_register_completion_queue(server, cq1, NULL); grpc_server_add_insecure_http2_port(server, "[::]:0"); grpc_server_register_completion_queue(server, cq2, NULL); + grpc_server_register_completion_queue(server, cq3, NULL); + grpc_server_start(server); grpc_server_shutdown_and_notify(server, cq2, NULL); grpc_completion_queue_next(cq2, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); /* cue queue hang */ grpc_completion_queue_shutdown(cq1); grpc_completion_queue_shutdown(cq2); + grpc_completion_queue_shutdown(cq3); + grpc_completion_queue_next(cq1, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); grpc_completion_queue_next(cq2, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + grpc_completion_queue_next(cq3, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + grpc_server_destroy(server); grpc_completion_queue_destroy(cq1); grpc_completion_queue_destroy(cq2); + grpc_completion_queue_destroy(cq3); grpc_shutdown(); return 0; } diff --git a/test/core/end2end/no_server_test.c b/test/core/end2end/no_server_test.c index 26d26d8f7a7..e16c129d671 100644 --- a/test/core/end2end/no_server_test.c +++ b/test/core/end2end/no_server_test.c @@ -59,7 +59,7 @@ int main(int argc, char **argv) { grpc_metadata_array_init(&trailing_metadata_recv); - cq = grpc_completion_queue_create(NULL); + cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); cqv = cq_verifier_create(cq); /* create a call, channel to a non existant server */ diff --git a/test/core/end2end/tests/authority_not_supported.c b/test/core/end2end/tests/authority_not_supported.c index 7db2fd6b278..4b6878794d9 100644 --- a/test/core/end2end/tests/authority_not_supported.c +++ b/test/core/end2end/tests/authority_not_supported.c @@ -72,9 +72,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -93,6 +94,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } /* Request/response with metadata and payload.*/ diff --git a/test/core/end2end/tests/bad_hostname.c b/test/core/end2end/tests/bad_hostname.c index f50a5805a23..c7bdd34a0b6 100644 --- a/test/core/end2end/tests/bad_hostname.c +++ b/test/core/end2end/tests/bad_hostname.c @@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } static void simple_request_body(grpc_end2end_test_fixture f) { diff --git a/test/core/end2end/tests/binary_metadata.c b/test/core/end2end/tests/binary_metadata.c index 7fb60f4495b..90258185bac 100644 --- a/test/core/end2end/tests/binary_metadata.c +++ b/test/core/end2end/tests/binary_metadata.c @@ -72,9 +72,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -93,6 +94,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } /* Request/response with metadata and payload.*/ diff --git a/test/core/end2end/tests/call_creds.c b/test/core/end2end/tests/call_creds.c index 38cba50e129..2a9269345e5 100644 --- a/test/core/end2end/tests/call_creds.c +++ b/test/core/end2end/tests/call_creds.c @@ -90,9 +90,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -111,6 +111,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } static void print_auth_context(int is_client, const grpc_auth_context *ctx) { diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c index 1a92aa48378..3c59511ebe7 100644 --- a/test/core/end2end/tests/cancel_after_accept.c +++ b/test/core/end2end/tests/cancel_after_accept.c @@ -79,9 +79,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -100,6 +101,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } /* Cancel after accept, no payload */ diff --git a/test/core/end2end/tests/cancel_after_client_done.c b/test/core/end2end/tests/cancel_after_client_done.c index 0afeecb037b..2edadeff426 100644 --- a/test/core/end2end/tests/cancel_after_client_done.c +++ b/test/core/end2end/tests/cancel_after_client_done.c @@ -73,9 +73,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -94,6 +95,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } /* Cancel after accept with a writes closed, no payload */ diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c index 8a96ef2f894..6a7fae8614c 100644 --- a/test/core/end2end/tests/cancel_after_invoke.c +++ b/test/core/end2end/tests/cancel_after_invoke.c @@ -75,9 +75,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -96,6 +97,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } /* Cancel after invoke, no payload */ diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.c index 586aa7ead37..e96ee5a0e19 100644 --- a/test/core/end2end/tests/cancel_before_invoke.c +++ b/test/core/end2end/tests/cancel_before_invoke.c @@ -72,9 +72,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -93,6 +94,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } /* Cancel before invoke */ diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.c b/test/core/end2end/tests/cancel_in_a_vacuum.c index bc462ddcf56..630527a6583 100644 --- a/test/core/end2end/tests/cancel_in_a_vacuum.c +++ b/test/core/end2end/tests/cancel_in_a_vacuum.c @@ -73,9 +73,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -94,6 +95,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } /* Cancel and do nothing */ diff --git a/test/core/end2end/tests/cancel_with_status.c b/test/core/end2end/tests/cancel_with_status.c index 7d03fe5580f..2a81feaf0bd 100644 --- a/test/core/end2end/tests/cancel_with_status.c +++ b/test/core/end2end/tests/cancel_with_status.c @@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } static void simple_request_body(grpc_end2end_test_config config, diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c index 7dd8c112d11..1ad4d118e0b 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.c @@ -80,9 +80,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -101,6 +102,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } static void request_for_disabled_algorithm( diff --git a/test/core/end2end/tests/connectivity.c b/test/core/end2end/tests/connectivity.c index 979419a100a..eb84aaed16b 100644 --- a/test/core/end2end/tests/connectivity.c +++ b/test/core/end2end/tests/connectivity.c @@ -171,6 +171,9 @@ static void test_connectivity(grpc_end2end_test_config config) { grpc_channel_destroy(f.client); grpc_completion_queue_shutdown(f.cq); grpc_completion_queue_destroy(f.cq); + + /* shutdown_cq is not used in this test */ + grpc_completion_queue_destroy(f.shutdown_cq); config.tear_down_data(&f); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/default_host.c b/test/core/end2end/tests/default_host.c index bc1829b24b7..b765de3cea6 100644 --- a/test/core/end2end/tests/default_host.c +++ b/test/core/end2end/tests/default_host.c @@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } static void simple_request_body(grpc_end2end_test_fixture f) { diff --git a/test/core/end2end/tests/disappearing_server.c b/test/core/end2end/tests/disappearing_server.c index 05440a6f56c..d7265a7780f 100644 --- a/test/core/end2end/tests/disappearing_server.c +++ b/test/core/end2end/tests/disappearing_server.c @@ -77,6 +77,9 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + + /* Note: shutdown_cq was unused in this test */ + grpc_completion_queue_destroy(f->shutdown_cq); } static void do_request_and_shutdown_server(grpc_end2end_test_config config, diff --git a/test/core/end2end/tests/empty_batch.c b/test/core/end2end/tests/empty_batch.c index 50bb6b849e1..9aa92942587 100644 --- a/test/core/end2end/tests/empty_batch.c +++ b/test/core/end2end/tests/empty_batch.c @@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } static void empty_batch_body(grpc_end2end_test_config config, diff --git a/test/core/end2end/tests/filter_call_init_fails.c b/test/core/end2end/tests/filter_call_init_fails.c index d2d6e82d574..dee3531f807 100644 --- a/test/core/end2end/tests/filter_call_init_fails.c +++ b/test/core/end2end/tests/filter_call_init_fails.c @@ -80,9 +80,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -101,6 +102,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } // Simple request via a server filter that always fails to initialize diff --git a/test/core/end2end/tests/filter_causes_close.c b/test/core/end2end/tests/filter_causes_close.c index 25e606556da..d41eb48101d 100644 --- a/test/core/end2end/tests/filter_causes_close.c +++ b/test/core/end2end/tests/filter_causes_close.c @@ -77,9 +77,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -98,6 +99,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } /* Simple request via a server filter that always closes the stream.*/ diff --git a/test/core/end2end/tests/filter_latency.c b/test/core/end2end/tests/filter_latency.c index d05e9e79a11..ffe9880d81b 100644 --- a/test/core/end2end/tests/filter_latency.c +++ b/test/core/end2end/tests/filter_latency.c @@ -84,9 +84,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -105,6 +106,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } // Simple request via a server filter that saves the reported latency value. diff --git a/test/core/end2end/tests/graceful_server_shutdown.c b/test/core/end2end/tests/graceful_server_shutdown.c index a3ad260cc22..8e35d27af9b 100644 --- a/test/core/end2end/tests/graceful_server_shutdown.c +++ b/test/core/end2end/tests/graceful_server_shutdown.c @@ -89,6 +89,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + /* Note: shutdown_cq is not used in this test */ + grpc_completion_queue_destroy(f->shutdown_cq); } static void test_early_server_shutdown_finishes_inflight_calls( diff --git a/test/core/end2end/tests/high_initial_seqno.c b/test/core/end2end/tests/high_initial_seqno.c index cca8532b0e0..1707c8192c6 100644 --- a/test/core/end2end/tests/high_initial_seqno.c +++ b/test/core/end2end/tests/high_initial_seqno.c @@ -76,9 +76,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -97,6 +98,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } static void simple_request_body(grpc_end2end_test_config config, diff --git a/test/core/end2end/tests/hpack_size.c b/test/core/end2end/tests/hpack_size.c index 7601722deea..68a33f3008c 100644 --- a/test/core/end2end/tests/hpack_size.c +++ b/test/core/end2end/tests/hpack_size.c @@ -216,9 +216,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -237,6 +238,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } static void simple_request_body(grpc_end2end_test_config config, diff --git a/test/core/end2end/tests/idempotent_request.c b/test/core/end2end/tests/idempotent_request.c index cef2e100be9..3455c6eb413 100644 --- a/test/core/end2end/tests/idempotent_request.c +++ b/test/core/end2end/tests/idempotent_request.c @@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } static void simple_request_body(grpc_end2end_test_config config, diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.c index d799bd8ccf9..3bce8dffe48 100644 --- a/test/core/end2end/tests/invoke_large_request.c +++ b/test/core/end2end/tests/invoke_large_request.c @@ -71,9 +71,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -92,6 +93,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } static grpc_slice large_slice(void) { diff --git a/test/core/end2end/tests/large_metadata.c b/test/core/end2end/tests/large_metadata.c index ac4c0e7f3b4..227db3293f2 100644 --- a/test/core/end2end/tests/large_metadata.c +++ b/test/core/end2end/tests/large_metadata.c @@ -72,9 +72,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -93,6 +94,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } // Request with a large amount of metadata. diff --git a/test/core/end2end/tests/load_reporting_hook.c b/test/core/end2end/tests/load_reporting_hook.c index d1ee26fe502..d8e9eaafa91 100644 --- a/test/core/end2end/tests/load_reporting_hook.c +++ b/test/core/end2end/tests/load_reporting_hook.c @@ -99,9 +99,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -120,6 +121,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } static void request_response_with_payload( diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c index e81a6289443..ebc92c69651 100644 --- a/test/core/end2end/tests/max_concurrent_streams.c +++ b/test/core/end2end/tests/max_concurrent_streams.c @@ -72,9 +72,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -93,6 +94,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } static void simple_request_body(grpc_end2end_test_config config, diff --git a/test/core/end2end/tests/max_message_length.c b/test/core/end2end/tests/max_message_length.c index b15d30f58c4..c015b653b83 100644 --- a/test/core/end2end/tests/max_message_length.c +++ b/test/core/end2end/tests/max_message_length.c @@ -81,9 +81,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -102,6 +103,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } // Test with request larger than the limit. diff --git a/test/core/end2end/tests/negative_deadline.c b/test/core/end2end/tests/negative_deadline.c index 0b61efbac97..f0e81533c25 100644 --- a/test/core/end2end/tests/negative_deadline.c +++ b/test/core/end2end/tests/negative_deadline.c @@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } static void simple_request_body(grpc_end2end_test_config config, diff --git a/test/core/end2end/tests/network_status_change.c b/test/core/end2end/tests/network_status_change.c index 7540ce93a1b..3a420cce239 100644 --- a/test/core/end2end/tests/network_status_change.c +++ b/test/core/end2end/tests/network_status_change.c @@ -75,9 +75,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -96,6 +97,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } /* Client sends a request with payload, server reads then returns status. */ diff --git a/test/core/end2end/tests/no_logging.c b/test/core/end2end/tests/no_logging.c index 56e48a88a87..4233f9ab5b0 100644 --- a/test/core/end2end/tests/no_logging.c +++ b/test/core/end2end/tests/no_logging.c @@ -102,9 +102,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -123,6 +124,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } static void simple_request_body(grpc_end2end_test_config config, diff --git a/test/core/end2end/tests/no_op.c b/test/core/end2end/tests/no_op.c index 62fc728c3eb..d5712cb1cca 100644 --- a/test/core/end2end/tests/no_op.c +++ b/test/core/end2end/tests/no_op.c @@ -72,9 +72,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -93,6 +94,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } static void test_no_op(grpc_end2end_test_config config) { diff --git a/test/core/end2end/tests/payload.c b/test/core/end2end/tests/payload.c index b04ee5705c6..b0b639681f6 100644 --- a/test/core/end2end/tests/payload.c +++ b/test/core/end2end/tests/payload.c @@ -72,9 +72,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -93,6 +94,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } /* Creates and returns a grpc_slice containing random alphanumeric characters. diff --git a/test/core/end2end/tests/ping.c b/test/core/end2end/tests/ping.c index f5bfac2255c..966288239c1 100644 --- a/test/core/end2end/tests/ping.c +++ b/test/core/end2end/tests/ping.c @@ -95,6 +95,9 @@ static void test_ping(grpc_end2end_test_config config) { grpc_channel_destroy(f.client); grpc_completion_queue_shutdown(f.cq); grpc_completion_queue_destroy(f.cq); + + /* f.shutdown_cq is not used in this test */ + grpc_completion_queue_destroy(f.shutdown_cq); config.tear_down_data(&f); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.c index 848f76018d1..a4b48ea5c38 100644 --- a/test/core/end2end/tests/ping_pong_streaming.c +++ b/test/core/end2end/tests/ping_pong_streaming.c @@ -72,9 +72,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -93,6 +94,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } /* Client pings and server pongs. Repeat messages rounds before finishing. */ diff --git a/test/core/end2end/tests/registered_call.c b/test/core/end2end/tests/registered_call.c index 9c8ce89c838..4846cfe99e1 100644 --- a/test/core/end2end/tests/registered_call.c +++ b/test/core/end2end/tests/registered_call.c @@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } static void simple_request_body(grpc_end2end_test_config config, diff --git a/test/core/end2end/tests/request_with_flags.c b/test/core/end2end/tests/request_with_flags.c index 329359e08b8..fa943cf57d3 100644 --- a/test/core/end2end/tests/request_with_flags.c +++ b/test/core/end2end/tests/request_with_flags.c @@ -73,9 +73,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -94,6 +95,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } static void test_invoke_request_with_flags( diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c index f71f92bbb84..3cf6d828b50 100644 --- a/test/core/end2end/tests/request_with_payload.c +++ b/test/core/end2end/tests/request_with_payload.c @@ -72,9 +72,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -93,6 +94,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } /* Client sends a request with payload, server reads then returns status. */ diff --git a/test/core/end2end/tests/resource_quota_server.c b/test/core/end2end/tests/resource_quota_server.c index 4f9ed7a3a17..115fddc1673 100644 --- a/test/core/end2end/tests/resource_quota_server.c +++ b/test/core/end2end/tests/resource_quota_server.c @@ -72,9 +72,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -93,6 +94,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } /* Creates and returns a grpc_slice containing random alphanumeric characters. diff --git a/test/core/end2end/tests/server_finishes_request.c b/test/core/end2end/tests/server_finishes_request.c index b42d17002e8..b545f14454d 100644 --- a/test/core/end2end/tests/server_finishes_request.c +++ b/test/core/end2end/tests/server_finishes_request.c @@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } static void simple_request_body(grpc_end2end_test_config config, diff --git a/test/core/end2end/tests/shutdown_finishes_calls.c b/test/core/end2end/tests/shutdown_finishes_calls.c index c019682ea66..d74b740a6c5 100644 --- a/test/core/end2end/tests/shutdown_finishes_calls.c +++ b/test/core/end2end/tests/shutdown_finishes_calls.c @@ -82,6 +82,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + /* f->shutdown_cq is not used in this test */ + grpc_completion_queue_destroy(f->shutdown_cq); } static void test_early_server_shutdown_finishes_inflight_calls( diff --git a/test/core/end2end/tests/shutdown_finishes_tags.c b/test/core/end2end/tests/shutdown_finishes_tags.c index 5540d2aab9c..e5d3c43e69c 100644 --- a/test/core/end2end/tests/shutdown_finishes_tags.c +++ b/test/core/end2end/tests/shutdown_finishes_tags.c @@ -82,6 +82,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + /* f->shutdown_cq is not used in this test */ + grpc_completion_queue_destroy(f->shutdown_cq); } static void test_early_server_shutdown_finishes_tags( diff --git a/test/core/end2end/tests/simple_cacheable_request.c b/test/core/end2end/tests/simple_cacheable_request.c index 4eef02e9eed..bb594a9fbd5 100644 --- a/test/core/end2end/tests/simple_cacheable_request.c +++ b/test/core/end2end/tests/simple_cacheable_request.c @@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } /* Request/response with metadata and payload.*/ diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c index e3b6aee783e..489ed5c0732 100644 --- a/test/core/end2end/tests/simple_delayed_request.c +++ b/test/core/end2end/tests/simple_delayed_request.c @@ -60,9 +60,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -81,6 +82,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } static void simple_delayed_request_body(grpc_end2end_test_config config, diff --git a/test/core/end2end/tests/simple_metadata.c b/test/core/end2end/tests/simple_metadata.c index 7ab5563cfa9..f8a5254fe8d 100644 --- a/test/core/end2end/tests/simple_metadata.c +++ b/test/core/end2end/tests/simple_metadata.c @@ -72,9 +72,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -93,6 +94,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } /* Request/response with metadata and payload.*/ diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index af5d74959e3..47fbff3375d 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } static void simple_request_body(grpc_end2end_test_config config, diff --git a/test/core/end2end/tests/streaming_error_response.c b/test/core/end2end/tests/streaming_error_response.c index 42055907c85..354c5091fdf 100644 --- a/test/core/end2end/tests/streaming_error_response.c +++ b/test/core/end2end/tests/streaming_error_response.c @@ -74,9 +74,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -95,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } /* Client sends a request with payload, server reads then returns status. */ diff --git a/test/core/end2end/tests/trailing_metadata.c b/test/core/end2end/tests/trailing_metadata.c index dbbda505bc4..0cb111976a4 100644 --- a/test/core/end2end/tests/trailing_metadata.c +++ b/test/core/end2end/tests/trailing_metadata.c @@ -72,9 +72,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -93,6 +94,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } /* Request/response with metadata and payload.*/ diff --git a/test/core/end2end/tests/write_buffering.c b/test/core/end2end/tests/write_buffering.c index abf90ca6e06..7bb44f5c6f1 100644 --- a/test/core/end2end/tests/write_buffering.c +++ b/test/core/end2end/tests/write_buffering.c @@ -72,9 +72,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -93,6 +94,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } /* Client sends a request with payload, server reads then returns status. */ diff --git a/test/core/end2end/tests/write_buffering_at_end.c b/test/core/end2end/tests/write_buffering_at_end.c index 8c02b425bae..2ff506a744e 100644 --- a/test/core/end2end/tests/write_buffering_at_end.c +++ b/test/core/end2end/tests/write_buffering_at_end.c @@ -72,9 +72,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; @@ -93,6 +94,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } /* Client sends a request with payload, server reads then returns status. */ diff --git a/test/core/fling/client.c b/test/core/fling/client.c index 85bab6d431b..188696c189c 100644 --- a/test/core/fling/client.c +++ b/test/core/fling/client.c @@ -208,7 +208,7 @@ int main(int argc, char **argv) { } channel = grpc_insecure_channel_create(target, NULL, NULL); - cq = grpc_completion_queue_create(NULL); + cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); the_buffer = grpc_raw_byte_buffer_create(&slice, (size_t)payload_size); histogram = gpr_histogram_create(0.01, 60e9); diff --git a/test/core/fling/server.c b/test/core/fling/server.c index 7ea54b1167e..f1b5f39a607 100644 --- a/test/core/fling/server.c +++ b/test/core/fling/server.c @@ -185,6 +185,7 @@ int main(int argc, char **argv) { call_state *s; char *addr_buf = NULL; gpr_cmdline *cl; + grpc_completion_queue *shutdown_cq; int shutdown_started = 0; int shutdown_finished = 0; @@ -214,7 +215,7 @@ int main(int argc, char **argv) { } gpr_log(GPR_INFO, "creating server on: %s", addr); - cq = grpc_completion_queue_create(NULL); + cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); if (secure) { grpc_ssl_pem_key_cert_pair pem_key_cert_pair = {test_server1_key, test_server1_cert}; @@ -242,16 +243,24 @@ int main(int argc, char **argv) { while (!shutdown_finished) { if (got_sigint && !shutdown_started) { gpr_log(GPR_INFO, "Shutting down due to SIGINT"); - grpc_server_shutdown_and_notify(server, cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) - .type == GRPC_OP_COMPLETE); + + shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_server_shutdown_and_notify(server, shutdown_cq, tag(1000)); + + GPR_ASSERT( + grpc_completion_queue_pluck(shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), NULL) + .type == GRPC_OP_COMPLETE); + grpc_completion_queue_destroy(shutdown_cq); + grpc_completion_queue_shutdown(cq); shutdown_started = 1; } ev = grpc_completion_queue_next( - cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(1000000, GPR_TIMESPAN)), + cq, + gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(1000000, GPR_TIMESPAN)), NULL); s = ev.tag; switch (ev.type) { diff --git a/test/core/handshake/client_ssl.c b/test/core/handshake/client_ssl.c index 5cfe60de4be..72e8ffe02ae 100644 --- a/test/core/handshake/client_ssl.c +++ b/test/core/handshake/client_ssl.c @@ -289,7 +289,9 @@ static bool client_ssl_test(char *server_alpn_preferred) { // completed and we know that the client's ALPN list satisfied the server. int retries = 10; grpc_connectivity_state state = GRPC_CHANNEL_IDLE; - grpc_completion_queue *cq = grpc_completion_queue_create(NULL); + grpc_completion_queue *cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + while (state != GRPC_CHANNEL_READY && retries-- > 0) { grpc_channel_watch_connectivity_state( channel, state, grpc_timeout_seconds_to_deadline(3), cq, NULL); diff --git a/test/core/handshake/server_ssl.c b/test/core/handshake/server_ssl.c index 0bd5a03cffe..f61ad786bc6 100644 --- a/test/core/handshake/server_ssl.c +++ b/test/core/handshake/server_ssl.c @@ -104,7 +104,8 @@ static void server_thread(void *arg) { GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, ssl_creds)); free(addr); - grpc_completion_queue *cq = grpc_completion_queue_create(NULL); + grpc_completion_queue *cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); grpc_server_register_completion_queue(server, cq, NULL); grpc_server_start(server); diff --git a/test/core/memory_usage/client.c b/test/core/memory_usage/client.c index 09f0e2d8670..588f559d4c4 100644 --- a/test/core/memory_usage/client.c +++ b/test/core/memory_usage/client.c @@ -222,7 +222,7 @@ int main(int argc, char **argv) { calls[k].details = grpc_empty_slice(); } - cq = grpc_completion_queue_create(NULL); + cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); struct grpc_memory_counters client_channel_start = grpc_memory_counters_snapshot(); @@ -260,8 +260,9 @@ int main(int argc, char **argv) { do { event = grpc_completion_queue_next( - cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(10000, GPR_TIMESPAN)), + cq, + gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(10000, GPR_TIMESPAN)), NULL); } while (event.type != GRPC_QUEUE_TIMEOUT); diff --git a/test/core/memory_usage/server.c b/test/core/memory_usage/server.c index ab059c25b8b..eb9794b5580 100644 --- a/test/core/memory_usage/server.c +++ b/test/core/memory_usage/server.c @@ -161,6 +161,7 @@ int main(int argc, char **argv) { grpc_event ev; char *addr_buf = NULL; gpr_cmdline *cl; + grpc_completion_queue *shutdown_cq; int shutdown_started = 0; int shutdown_finished = 0; @@ -188,7 +189,7 @@ int main(int argc, char **argv) { } gpr_log(GPR_INFO, "creating server on: %s", addr); - cq = grpc_completion_queue_create(NULL); + cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); struct grpc_memory_counters before_server_create = grpc_memory_counters_snapshot(); @@ -230,16 +231,22 @@ int main(int argc, char **argv) { while (!shutdown_finished) { if (got_sigint && !shutdown_started) { gpr_log(GPR_INFO, "Shutting down due to SIGINT"); - grpc_server_shutdown_and_notify(server, cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) - .type == GRPC_OP_COMPLETE); + + shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_server_shutdown_and_notify(server, shutdown_cq, tag(1000)); + GPR_ASSERT( + grpc_completion_queue_pluck(shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), NULL) + .type == GRPC_OP_COMPLETE); + grpc_completion_queue_destroy(shutdown_cq); grpc_completion_queue_shutdown(cq); shutdown_started = 1; } ev = grpc_completion_queue_next( - cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(1000000, GPR_TIMESPAN)), + cq, + gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(1000000, GPR_TIMESPAN)), NULL); fling_call *s = ev.tag; switch (ev.type) { diff --git a/test/core/surface/alarm_test.c b/test/core/surface/alarm_test.c index 4afe357c277..7419d388a37 100644 --- a/test/core/surface/alarm_test.c +++ b/test/core/surface/alarm_test.c @@ -58,7 +58,7 @@ static void test_alarm(void) { grpc_completion_queue *cc; LOG_TEST("test_alarm"); - cc = grpc_completion_queue_create(NULL); + cc = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); { /* regular expiry */ grpc_event ev; diff --git a/test/core/surface/completion_queue_test.c b/test/core/surface/completion_queue_test.c index 07f6a9869b7..6d913cc9321 100644 --- a/test/core/surface/completion_queue_test.c +++ b/test/core/surface/completion_queue_test.c @@ -51,24 +51,62 @@ static void *create_test_tag(void) { static void shutdown_and_destroy(grpc_completion_queue *cc) { grpc_event ev; grpc_completion_queue_shutdown(cc); - ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), NULL); + + switch (grpc_get_cq_completion_type(cc)) { + case GRPC_CQ_NEXT: { + ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), + NULL); + break; + } + case GRPC_CQ_PLUCK: { + ev = grpc_completion_queue_pluck(cc, create_test_tag(), + gpr_inf_past(GPR_CLOCK_REALTIME), NULL); + break; + } + default: { + gpr_log(GPR_ERROR, "Unknown completion type"); + break; + } + } + GPR_ASSERT(ev.type == GRPC_QUEUE_SHUTDOWN); grpc_completion_queue_destroy(cc); } /* ensure we can create and destroy a completion channel */ static void test_no_op(void) { + grpc_cq_completion_type completion_types[] = {GRPC_CQ_NEXT, GRPC_CQ_PLUCK}; + grpc_cq_polling_type polling_types[] = {DEFAULT_POLLING, NON_LISTENING, + NON_POLLING}; LOG_TEST("test_no_op"); - shutdown_and_destroy(grpc_completion_queue_create(NULL)); + + for (size_t i = 0; i < GPR_ARRAY_SIZE(completion_types); i++) { + for (size_t j = 0; j < GPR_ARRAY_SIZE(polling_types); j++) { + shutdown_and_destroy(grpc_completion_queue_create( + completion_types[i], polling_types[j], NULL)); + } + } } static void test_pollset_conversion(void) { - grpc_completion_queue *cq = grpc_completion_queue_create(NULL); - GPR_ASSERT(grpc_cq_from_pollset(grpc_cq_pollset(cq)) == cq); - shutdown_and_destroy(cq); + grpc_cq_completion_type completion_types[] = {GRPC_CQ_NEXT, GRPC_CQ_PLUCK}; + grpc_cq_polling_type polling_types[] = {DEFAULT_POLLING, NON_LISTENING}; + grpc_completion_queue *cq; + + LOG_TEST("test_pollset_conversion"); + + for (size_t i = 0; i < GPR_ARRAY_SIZE(completion_types); i++) { + for (size_t j = 0; j < GPR_ARRAY_SIZE(polling_types); j++) { + cq = grpc_completion_queue_create(completion_types[i], polling_types[j], + NULL); + GPR_ASSERT(grpc_cq_from_pollset(grpc_cq_pollset(cq)) == cq); + shutdown_and_destroy(cq); + } + } } static void test_wait_empty(void) { + grpc_cq_polling_type polling_types[] = {DEFAULT_POLLING, NON_LISTENING}; grpc_completion_queue *cc; grpc_event event; @@ -87,50 +125,66 @@ static void test_cq_end_op(void) { grpc_event ev; grpc_completion_queue *cc; grpc_cq_completion completion; - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_cq_polling_type polling_types[] = {DEFAULT_POLLING, NON_LISTENING, + NON_POLLING}; + + grpc_exec_ctx init_exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_exec_ctx exec_ctx; void *tag = create_test_tag(); LOG_TEST("test_cq_end_op"); - cc = grpc_completion_queue_create(NULL); + for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) { + exec_ctx = init_exec_ctx; // Reset exec_ctx + cc = grpc_completion_queue_create(GRPC_CQ_NEXT, polling_types[i], NULL); - grpc_cq_begin_op(cc, tag); - grpc_cq_end_op(&exec_ctx, cc, tag, GRPC_ERROR_NONE, do_nothing_end_completion, - NULL, &completion); + grpc_cq_begin_op(cc, tag); + grpc_cq_end_op(&exec_ctx, cc, tag, GRPC_ERROR_NONE, + do_nothing_end_completion, NULL, &completion); - ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), NULL); - GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); - GPR_ASSERT(ev.tag == tag); - GPR_ASSERT(ev.success); + ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), NULL); + GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); + GPR_ASSERT(ev.tag == tag); + GPR_ASSERT(ev.success); - shutdown_and_destroy(cc); - grpc_exec_ctx_finish(&exec_ctx); + shutdown_and_destroy(cc); + grpc_exec_ctx_finish(&exec_ctx); + } } static void test_shutdown_then_next_polling(void) { + grpc_cq_polling_type polling_types[] = {DEFAULT_POLLING, NON_LISTENING, + NON_POLLING}; grpc_completion_queue *cc; grpc_event event; LOG_TEST("test_shutdown_then_next_polling"); - cc = grpc_completion_queue_create(NULL); - grpc_completion_queue_shutdown(cc); - event = - grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), NULL); - GPR_ASSERT(event.type == GRPC_QUEUE_SHUTDOWN); - grpc_completion_queue_destroy(cc); + for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) { + cc = grpc_completion_queue_create(GRPC_CQ_NEXT, polling_types[i], NULL); + grpc_completion_queue_shutdown(cc); + event = + grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), NULL); + GPR_ASSERT(event.type == GRPC_QUEUE_SHUTDOWN); + grpc_completion_queue_destroy(cc); + } } static void test_shutdown_then_next_with_timeout(void) { + grpc_cq_polling_type polling_types[] = {DEFAULT_POLLING, NON_LISTENING, + NON_POLLING}; grpc_completion_queue *cc; grpc_event event; LOG_TEST("test_shutdown_then_next_with_timeout"); - cc = grpc_completion_queue_create(NULL); - grpc_completion_queue_shutdown(cc); - event = - grpc_completion_queue_next(cc, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); - GPR_ASSERT(event.type == GRPC_QUEUE_SHUTDOWN); - grpc_completion_queue_destroy(cc); + for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) { + cc = grpc_completion_queue_create(GRPC_CQ_NEXT, polling_types[i], NULL); + + grpc_completion_queue_shutdown(cc); + event = grpc_completion_queue_next(cc, gpr_inf_future(GPR_CLOCK_REALTIME), + NULL); + GPR_ASSERT(event.type == GRPC_QUEUE_SHUTDOWN); + grpc_completion_queue_destroy(cc); + } } static void test_pluck(void) { @@ -138,7 +192,10 @@ static void test_pluck(void) { grpc_completion_queue *cc; void *tags[128]; grpc_cq_completion completions[GPR_ARRAY_SIZE(tags)]; - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_cq_polling_type polling_types[] = {DEFAULT_POLLING, NON_LISTENING, + NON_POLLING}; + grpc_exec_ctx init_exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_exec_ctx exec_ctx; unsigned i, j; LOG_TEST("test_pluck"); @@ -150,47 +207,66 @@ static void test_pluck(void) { } } - cc = grpc_completion_queue_create(NULL); + for (size_t pidx = 0; pidx < GPR_ARRAY_SIZE(polling_types); pidx++) { + exec_ctx = init_exec_ctx; // reset exec_ctx + cc = grpc_completion_queue_create(GRPC_CQ_PLUCK, polling_types[pidx], NULL); - for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { - grpc_cq_begin_op(cc, tags[i]); - grpc_cq_end_op(&exec_ctx, cc, tags[i], GRPC_ERROR_NONE, - do_nothing_end_completion, NULL, &completions[i]); - } + for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { + grpc_cq_begin_op(cc, tags[i]); + grpc_cq_end_op(&exec_ctx, cc, tags[i], GRPC_ERROR_NONE, + do_nothing_end_completion, NULL, &completions[i]); + } - for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { - ev = grpc_completion_queue_pluck(cc, tags[i], - gpr_inf_past(GPR_CLOCK_REALTIME), NULL); - GPR_ASSERT(ev.tag == tags[i]); - } + for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { + ev = grpc_completion_queue_pluck(cc, tags[i], + gpr_inf_past(GPR_CLOCK_REALTIME), NULL); + GPR_ASSERT(ev.tag == tags[i]); + } - for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { - grpc_cq_begin_op(cc, tags[i]); - grpc_cq_end_op(&exec_ctx, cc, tags[i], GRPC_ERROR_NONE, - do_nothing_end_completion, NULL, &completions[i]); - } + for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { + grpc_cq_begin_op(cc, tags[i]); + grpc_cq_end_op(&exec_ctx, cc, tags[i], GRPC_ERROR_NONE, + do_nothing_end_completion, NULL, &completions[i]); + } - for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { - ev = grpc_completion_queue_pluck(cc, tags[GPR_ARRAY_SIZE(tags) - i - 1], - gpr_inf_past(GPR_CLOCK_REALTIME), NULL); - GPR_ASSERT(ev.tag == tags[GPR_ARRAY_SIZE(tags) - i - 1]); - } + for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { + ev = grpc_completion_queue_pluck(cc, tags[GPR_ARRAY_SIZE(tags) - i - 1], + gpr_inf_past(GPR_CLOCK_REALTIME), NULL); + GPR_ASSERT(ev.tag == tags[GPR_ARRAY_SIZE(tags) - i - 1]); + } - shutdown_and_destroy(cc); - grpc_exec_ctx_finish(&exec_ctx); + shutdown_and_destroy(cc); + grpc_exec_ctx_finish(&exec_ctx); + } } static void test_pluck_after_shutdown(void) { + grpc_cq_polling_type polling_types[] = {DEFAULT_POLLING, NON_LISTENING, + NON_POLLING}; grpc_event ev; grpc_completion_queue *cc; LOG_TEST("test_pluck_after_shutdown"); - cc = grpc_completion_queue_create(NULL); - grpc_completion_queue_shutdown(cc); - ev = grpc_completion_queue_pluck(cc, NULL, gpr_inf_future(GPR_CLOCK_REALTIME), - NULL); - GPR_ASSERT(ev.type == GRPC_QUEUE_SHUTDOWN); - grpc_completion_queue_destroy(cc); + + for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) { + cc = grpc_completion_queue_create(GRPC_CQ_PLUCK, polling_types[i], NULL); + grpc_completion_queue_shutdown(cc); + ev = grpc_completion_queue_pluck(cc, NULL, + gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + GPR_ASSERT(ev.type == GRPC_QUEUE_SHUTDOWN); + grpc_completion_queue_destroy(cc); + } +} + +struct thread_state { + grpc_completion_queue *cc; + void *tag; +}; + +static void pluck_one(void *arg) { + struct thread_state *state = arg; + grpc_completion_queue_pluck(state->cc, state->tag, + gpr_inf_future(GPR_CLOCK_REALTIME), NULL); } int main(int argc, char **argv) { diff --git a/test/core/surface/concurrent_connectivity_test.c b/test/core/surface/concurrent_connectivity_test.c index ff927385d47..3758b86fab9 100644 --- a/test/core/surface/concurrent_connectivity_test.c +++ b/test/core/surface/concurrent_connectivity_test.c @@ -66,7 +66,8 @@ static int detag(void *p) { return (int)(uintptr_t)p; } void create_loop_destroy(void *addr) { for (int i = 0; i < NUM_OUTER_LOOPS; ++i) { - grpc_completion_queue *cq = grpc_completion_queue_create(NULL); + grpc_completion_queue *cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); grpc_channel *chan = grpc_insecure_channel_create((char *)addr, NULL, NULL); for (int j = 0; j < NUM_INNER_LOOPS; ++j) { @@ -195,7 +196,7 @@ int main(int argc, char **argv) { gpr_asprintf(&args.addr, "localhost:%d", port); args.server = grpc_server_create(NULL, NULL); grpc_server_add_insecure_http2_port(args.server, args.addr); - args.cq = grpc_completion_queue_create(NULL); + args.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); grpc_server_register_completion_queue(args.server, args.cq, NULL); grpc_server_start(args.server); gpr_thd_new(&server, server_thread, &args, &options); diff --git a/test/core/surface/lame_client_test.c b/test/core/surface/lame_client_test.c index 9deb50bb044..0cb183a4f00 100644 --- a/test/core/surface/lame_client_test.c +++ b/test/core/surface/lame_client_test.c @@ -108,7 +108,7 @@ int main(int argc, char **argv) { GPR_ASSERT(GRPC_CHANNEL_SHUTDOWN == grpc_channel_check_connectivity_state(chan, 0)); - cq = grpc_completion_queue_create(NULL); + cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); grpc_slice host = grpc_slice_from_static_string("anywhere"); call = grpc_channel_create_call(chan, NULL, GRPC_PROPAGATE_DEFAULTS, cq, diff --git a/test/core/surface/sequential_connectivity_test.c b/test/core/surface/sequential_connectivity_test.c index 5f66f900372..37678a40d94 100644 --- a/test/core/surface/sequential_connectivity_test.c +++ b/test/core/surface/sequential_connectivity_test.c @@ -76,7 +76,8 @@ static void run_test(const test_fixture *fixture) { grpc_server *server = grpc_server_create(NULL, NULL); fixture->add_server_port(server, addr); - grpc_completion_queue *server_cq = grpc_completion_queue_create(NULL); + grpc_completion_queue *server_cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); grpc_server_register_completion_queue(server, server_cq, NULL); grpc_server_start(server); @@ -86,7 +87,8 @@ static void run_test(const test_fixture *fixture) { gpr_thd_options_set_joinable(&thdopt); gpr_thd_new(&server_thread, server_thread_func, &sta, &thdopt); - grpc_completion_queue *cq = grpc_completion_queue_create(NULL); + grpc_completion_queue *cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); grpc_channel *channels[NUM_CONNECTIONS]; for (size_t i = 0; i < NUM_CONNECTIONS; i++) { channels[i] = fixture->create_channel(addr); diff --git a/test/core/surface/server_chttp2_test.c b/test/core/surface/server_chttp2_test.c index 6c178abdad1..9fac63418f9 100644 --- a/test/core/surface/server_chttp2_test.c +++ b/test/core/surface/server_chttp2_test.c @@ -60,7 +60,8 @@ void test_add_same_port_twice() { int port = grpc_pick_unused_port_or_die(); char *addr = NULL; - grpc_completion_queue *cq = grpc_completion_queue_create(NULL); + grpc_completion_queue *cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); grpc_server *server = grpc_server_create(&args, NULL); grpc_server_credentials *fake_creds = grpc_fake_transport_security_server_credentials_create(); diff --git a/test/core/surface/server_test.c b/test/core/surface/server_test.c index 3fd1c2c2663..aa54794d14a 100644 --- a/test/core/surface/server_test.c +++ b/test/core/surface/server_test.c @@ -70,7 +70,8 @@ void test_register_method_fail(void) { } void test_request_call_on_no_server_cq(void) { - grpc_completion_queue *cc = grpc_completion_queue_create(NULL); + grpc_completion_queue *cc = + grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); grpc_server *server = grpc_server_create(NULL, NULL); GPR_ASSERT(GRPC_CALL_ERROR_NOT_SERVER_COMPLETION_QUEUE == grpc_server_request_call(server, NULL, NULL, NULL, cc, cc, NULL)); @@ -91,7 +92,8 @@ void test_bind_server_twice(void) { char *addr; grpc_server *server1 = grpc_server_create(&args, NULL); grpc_server *server2 = grpc_server_create(&args, NULL); - grpc_completion_queue *cq = grpc_completion_queue_create(NULL); + grpc_completion_queue *cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); int port = grpc_pick_unused_port_or_die(); gpr_asprintf(&addr, "[::]:%d", port); grpc_server_register_completion_queue(server1, cq, NULL); @@ -128,7 +130,8 @@ void test_bind_server_to_addr(const char *host, bool secure) { } else { GPR_ASSERT(grpc_server_add_insecure_http2_port(server, addr)); } - grpc_completion_queue *cq = grpc_completion_queue_create(NULL); + grpc_completion_queue *cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); grpc_server_register_completion_queue(server, cq, NULL); grpc_server_start(server); grpc_server_shutdown_and_notify(server, cq, NULL); From 0393d5d0a6f3567fd9f38580ae2651ceade7dfcc Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Thu, 2 Mar 2017 10:44:46 -0800 Subject: [PATCH 023/461] generate_projects.sh --- src/ruby/ext/grpc/rb_grpc_imports.generated.h | 2 +- tools/run_tests/generated/tests.json | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h index b16e6738781..8ec7f6fd95d 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h @@ -224,7 +224,7 @@ extern grpc_version_string_type grpc_version_string_import; typedef const char *(*grpc_g_stands_for_type)(void); extern grpc_g_stands_for_type grpc_g_stands_for_import; #define grpc_g_stands_for grpc_g_stands_for_import -typedef grpc_completion_queue *(*grpc_completion_queue_create_type)(void *reserved); +typedef grpc_completion_queue *(*grpc_completion_queue_create_type)(grpc_cq_completion_type completion_type, grpc_cq_polling_type polling_type, void *reserved); extern grpc_completion_queue_create_type grpc_completion_queue_create_import; #define grpc_completion_queue_create grpc_completion_queue_create_import typedef grpc_event(*grpc_completion_queue_next_type)(grpc_completion_queue *cq, gpr_timespec deadline, void *reserved); diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index ab7938d0ca1..7ac14ab2c92 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -2551,6 +2551,10 @@ "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], + "excluded_poll_engines": [ + "poll", + "poll-cv" + ], "flaky": false, "gtest": false, "language": "c++", @@ -2661,10 +2665,6 @@ "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], - "excluded_poll_engines": [ - "poll", - "poll-cv" - ], "flaky": false, "gtest": false, "language": "c++", From 4f31f44f344bdb1da1429db830989a3aced27b8a Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Thu, 2 Mar 2017 13:15:39 -0800 Subject: [PATCH 024/461] rebase with latest master --- test/core/surface/completion_queue_test.c | 19 ++++++++----------- .../surface/completion_queue_threading_test.c | 5 +++-- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/test/core/surface/completion_queue_test.c b/test/core/surface/completion_queue_test.c index 6d913cc9321..f76074f2073 100644 --- a/test/core/surface/completion_queue_test.c +++ b/test/core/surface/completion_queue_test.c @@ -106,16 +106,19 @@ static void test_pollset_conversion(void) { } static void test_wait_empty(void) { - grpc_cq_polling_type polling_types[] = {DEFAULT_POLLING, NON_LISTENING}; + grpc_cq_polling_type polling_types[] = {DEFAULT_POLLING, NON_LISTENING, + NON_POLLING}; grpc_completion_queue *cc; grpc_event event; LOG_TEST("test_wait_empty"); - cc = grpc_completion_queue_create(NULL); - event = grpc_completion_queue_next(cc, gpr_now(GPR_CLOCK_REALTIME), NULL); - GPR_ASSERT(event.type == GRPC_QUEUE_TIMEOUT); - shutdown_and_destroy(cc); + for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) { + cc = grpc_completion_queue_create(GRPC_CQ_NEXT, polling_types[i], NULL); + event = grpc_completion_queue_next(cc, gpr_now(GPR_CLOCK_REALTIME), NULL); + GPR_ASSERT(event.type == GRPC_QUEUE_TIMEOUT); + shutdown_and_destroy(cc); + } } static void do_nothing_end_completion(grpc_exec_ctx *exec_ctx, void *arg, @@ -263,12 +266,6 @@ struct thread_state { void *tag; }; -static void pluck_one(void *arg) { - struct thread_state *state = arg; - grpc_completion_queue_pluck(state->cc, state->tag, - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); -} - int main(int argc, char **argv) { grpc_test_init(argc, argv); grpc_init(); diff --git a/test/core/surface/completion_queue_threading_test.c b/test/core/surface/completion_queue_threading_test.c index 2d55ead843e..0945597284c 100644 --- a/test/core/surface/completion_queue_threading_test.c +++ b/test/core/surface/completion_queue_threading_test.c @@ -84,7 +84,7 @@ static void test_too_many_plucks(void) { LOG_TEST("test_too_many_plucks"); - cc = grpc_completion_queue_create(NULL); + cc = grpc_completion_queue_create(GRPC_CQ_PLUCK, DEFAULT_POLLING, NULL); gpr_thd_options_set_joinable(&thread_options); for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { @@ -210,7 +210,8 @@ static void test_threading(size_t producers, size_t consumers) { gpr_malloc((producers + consumers) * sizeof(test_thread_options)); gpr_event phase1 = GPR_EVENT_INIT; gpr_event phase2 = GPR_EVENT_INIT; - grpc_completion_queue *cc = grpc_completion_queue_create(NULL); + grpc_completion_queue *cc = + grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); size_t i; size_t total_consumed = 0; static int optid = 101; From 6b45d012466025c227eead4cf2c9f5abe28ea0dc Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Thu, 2 Mar 2017 16:37:59 -0800 Subject: [PATCH 025/461] fix tests after rebase --- test/core/end2end/tests/keepalive_timeout.c | 9 +++++---- .../surface/completion_queue_threading_test.c | 19 ++++++++++++++++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/test/core/end2end/tests/keepalive_timeout.c b/test/core/end2end/tests/keepalive_timeout.c index 4296be36190..66dcc1cd102 100644 --- a/test/core/end2end/tests/keepalive_timeout.c +++ b/test/core/end2end/tests/keepalive_timeout.c @@ -75,10 +75,10 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT( - grpc_completion_queue_pluck(f->cq, tag(1000), five_seconds_time(), NULL) - .type == GRPC_OP_COMPLETE); + grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + five_seconds_time(), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } @@ -96,6 +96,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } /* Client sends a request, server replies with a payload, then waits for the diff --git a/test/core/surface/completion_queue_threading_test.c b/test/core/surface/completion_queue_threading_test.c index 0945597284c..b101cd13f72 100644 --- a/test/core/surface/completion_queue_threading_test.c +++ b/test/core/surface/completion_queue_threading_test.c @@ -52,7 +52,24 @@ static void *create_test_tag(void) { static void shutdown_and_destroy(grpc_completion_queue *cc) { grpc_event ev; grpc_completion_queue_shutdown(cc); - ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), NULL); + + switch (grpc_get_cq_completion_type(cc)) { + case GRPC_CQ_NEXT: { + ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), + NULL); + break; + } + case GRPC_CQ_PLUCK: { + ev = grpc_completion_queue_pluck(cc, create_test_tag(), + gpr_inf_past(GPR_CLOCK_REALTIME), NULL); + break; + } + default: { + gpr_log(GPR_ERROR, "Unknown completion type"); + break; + } + } + GPR_ASSERT(ev.type == GRPC_QUEUE_SHUTDOWN); grpc_completion_queue_destroy(cc); } From 59469c911d0434ae9355d78453869c351e98bfdc Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 2 Mar 2017 18:49:31 -0800 Subject: [PATCH 026/461] better handling of stream closure --- .../chttp2/transport/chttp2_transport.c | 24 +++++++++++++++---- .../ext/transport/chttp2/transport/internal.h | 1 + 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 436440d7b16..598dae40a05 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1601,13 +1601,17 @@ static void remove_stream(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, } gpr_mu_lock(&s->buffer_mu); if (s->data_parser.parsing_frame != NULL) { - gpr_mu_lock(&s->data_parser.parsing_frame->slice_mu); - grpc_closure *next = s->data_parser.parsing_frame->on_next; - gpr_mu_unlock(&s->data_parser.parsing_frame->slice_mu); - if (error != GRPC_ERROR_NONE || next != NULL) { + grpc_chttp2_incoming_byte_stream *bs = s->data_parser.parsing_frame; + gpr_mu_lock(&bs->slice_mu); + bs->push_closed = true; + if (bs->on_next != NULL) { + gpr_mu_unlock(&bs->slice_mu); grpc_chttp2_incoming_byte_stream_finished( - exec_ctx, s->data_parser.parsing_frame, GRPC_ERROR_REF(error)); + exec_ctx, s->data_parser.parsing_frame, GRPC_ERROR_REF(error)); s->data_parser.parsing_frame = NULL; + } else { + bs->error = GRPC_ERROR_REF(error); + gpr_mu_unlock(&bs->slice_mu); } } gpr_mu_unlock(&s->buffer_mu); @@ -2465,6 +2469,15 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx *exec_ctx, } else if (bs->error != GRPC_ERROR_NONE) { grpc_closure_sched(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_REF(bs->error)); + } else if (bs->push_closed) { + if (bs->remaining_bytes != 0) { + grpc_closure_sched(exec_ctx, bs->next_action.on_complete, + GRPC_ERROR_CREATE("Truncated message")); + } else { + /* Should never reach here. */ + GPR_ASSERT(false); + grpc_closure_sched(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_NONE); + } } else { bs->on_next = bs->next_action.on_complete; bs->next = bs->next_action.slice; @@ -2621,6 +2634,7 @@ grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( incoming_byte_stream->on_next = NULL; incoming_byte_stream->is_tail = 1; incoming_byte_stream->error = GRPC_ERROR_NONE; + incoming_byte_stream->push_closed = false; s->incoming_frames = incoming_byte_stream; grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); return incoming_byte_stream; diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index a7ff26a42a2..5ec107c3f32 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -188,6 +188,7 @@ struct grpc_chttp2_incoming_byte_stream { gpr_refcount refs; struct grpc_chttp2_incoming_byte_stream *next_message; grpc_error *error; + bool push_closed; grpc_chttp2_transport *transport; grpc_chttp2_stream *stream; From 982a6f2b1c8ca5ec6d361776fc76472ef6728253 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Fri, 3 Mar 2017 02:19:31 -0800 Subject: [PATCH 027/461] C++ code changes in response to grpc_completion_queue_create() API change --- .../grpc++/impl/codegen/client_unary_call.h | 2 +- .../grpc++/impl/codegen/completion_queue.h | 19 ++++++++++++------ include/grpc++/impl/codegen/core_codegen.h | 5 ++++- .../impl/codegen/core_codegen_interface.h | 4 +++- include/grpc++/impl/codegen/sync_stream.h | 12 ++++++++--- include/grpc/impl/codegen/grpc_types.h | 7 +++++-- src/cpp/common/core_codegen.cc | 4 +++- src/cpp/server/server_cc.cc | 19 ++++++++++++++---- test/cpp/grpclb/grpclb_test.cc | 20 ++++++++++++------- test/cpp/microbenchmarks/bm_call_create.cc | 3 ++- test/cpp/microbenchmarks/bm_cq.cc | 20 +++++++++++++++---- 11 files changed, 84 insertions(+), 31 deletions(-) diff --git a/include/grpc++/impl/codegen/client_unary_call.h b/include/grpc++/impl/codegen/client_unary_call.h index 201e52ae073..bf18a7d6449 100644 --- a/include/grpc++/impl/codegen/client_unary_call.h +++ b/include/grpc++/impl/codegen/client_unary_call.h @@ -52,7 +52,7 @@ template Status BlockingUnaryCall(ChannelInterface* channel, const RpcMethod& method, ClientContext* context, const InputMessage& request, OutputMessage* result) { - CompletionQueue cq; + CompletionQueue cq(GRPC_CQ_PLUCK, DEFAULT_POLLING); Call call(channel->CreateCall(method, context, &cq)); CallOpSet, diff --git a/include/grpc++/impl/codegen/completion_queue.h b/include/grpc++/impl/codegen/completion_queue.h index 03cecdc21c6..a123af2cf69 100644 --- a/include/grpc++/impl/codegen/completion_queue.h +++ b/include/grpc++/impl/codegen/completion_queue.h @@ -52,6 +52,7 @@ #include #include #include +#include #include struct grpc_completion_queue; @@ -102,10 +103,7 @@ class CompletionQueue : private GrpcLibraryCodegen { public: /// Default constructor. Implicitly creates a \a grpc_completion_queue /// instance. - CompletionQueue() { - cq_ = g_core_codegen_interface->grpc_completion_queue_create(nullptr); - InitialAvalanching(); // reserve this for the future shutdown - } + CompletionQueue() : CompletionQueue(GRPC_CQ_NEXT, DEFAULT_POLLING) {} /// Wrap \a take, taking ownership of the instance. /// @@ -149,8 +147,9 @@ class CompletionQueue : private GrpcLibraryCodegen { /// /// \return true if read a regular event, false if the queue is shutting down. bool Next(void** tag, bool* ok) { - return (AsyncNextInternal(tag, ok, g_core_codegen_interface->gpr_inf_future( - GPR_CLOCK_REALTIME)) != SHUTDOWN); + return (AsyncNextInternal(tag, ok, + g_core_codegen_interface->gpr_inf_future( + GPR_CLOCK_REALTIME)) != SHUTDOWN); } /// Request the shutdown of the queue. @@ -218,6 +217,14 @@ class CompletionQueue : private GrpcLibraryCodegen { const InputMessage& request, OutputMessage* result); + /// Private constructor of CompletionQueue only visible to friend classes + CompletionQueue(grpc_cq_completion_type completion_type, + grpc_cq_polling_type polling_type) { + cq_ = g_core_codegen_interface->grpc_completion_queue_create( + completion_type, polling_type, nullptr); + InitialAvalanching(); // reserve this for the future shutdown + } + NextStatus AsyncNextInternal(void** tag, bool* ok, gpr_timespec deadline); /// Wraps \a grpc_completion_queue_pluck. diff --git a/include/grpc++/impl/codegen/core_codegen.h b/include/grpc++/impl/codegen/core_codegen.h index 754bf14b259..4c8567f7702 100644 --- a/include/grpc++/impl/codegen/core_codegen.h +++ b/include/grpc++/impl/codegen/core_codegen.h @@ -38,6 +38,7 @@ #include #include +#include #include namespace grpc { @@ -45,7 +46,9 @@ namespace grpc { /// Implementation of the core codegen interface. class CoreCodegen : public CoreCodegenInterface { private: - grpc_completion_queue* grpc_completion_queue_create(void* reserved) override; + grpc_completion_queue* grpc_completion_queue_create( + grpc_cq_completion_type completion_type, + grpc_cq_polling_type polling_type, void* reserved) override; void grpc_completion_queue_destroy(grpc_completion_queue* cq) override; grpc_event grpc_completion_queue_pluck(grpc_completion_queue* cq, void* tag, gpr_timespec deadline, diff --git a/include/grpc++/impl/codegen/core_codegen_interface.h b/include/grpc++/impl/codegen/core_codegen_interface.h index 45ea0403031..8f2b4a3b76e 100644 --- a/include/grpc++/impl/codegen/core_codegen_interface.h +++ b/include/grpc++/impl/codegen/core_codegen_interface.h @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -60,7 +61,8 @@ class CoreCodegenInterface { int line) = 0; virtual grpc_completion_queue* grpc_completion_queue_create( - void* reserved) = 0; + grpc_cq_completion_type completion_type, + grpc_cq_polling_type polling_type, void* reserved) = 0; virtual void grpc_completion_queue_destroy(grpc_completion_queue* cq) = 0; virtual grpc_event grpc_completion_queue_pluck(grpc_completion_queue* cq, void* tag, diff --git a/include/grpc++/impl/codegen/sync_stream.h b/include/grpc++/impl/codegen/sync_stream.h index 4d9b074e95f..d3a6c7ff899 100644 --- a/include/grpc++/impl/codegen/sync_stream.h +++ b/include/grpc++/impl/codegen/sync_stream.h @@ -137,7 +137,9 @@ class ClientReader final : public ClientReaderInterface { template ClientReader(ChannelInterface* channel, const RpcMethod& method, ClientContext* context, const W& request) - : context_(context), call_(channel->CreateCall(method, context, &cq_)) { + : context_(context), + cq_(GRPC_CQ_PLUCK, DEFAULT_POLLING), + call_(channel->CreateCall(method, context, &cq_)) { CallOpSet ops; @@ -209,7 +211,9 @@ class ClientWriter : public ClientWriterInterface { template ClientWriter(ChannelInterface* channel, const RpcMethod& method, ClientContext* context, R* response) - : context_(context), call_(channel->CreateCall(method, context, &cq_)) { + : context_(context), + cq_(GRPC_CQ_PLUCK, DEFAULT_POLLING), + call_(channel->CreateCall(method, context, &cq_)) { finish_ops_.RecvMessage(response); finish_ops_.AllowNoMessage(); @@ -292,7 +296,9 @@ class ClientReaderWriter final : public ClientReaderWriterInterface { /// Blocking create a stream. ClientReaderWriter(ChannelInterface* channel, const RpcMethod& method, ClientContext* context) - : context_(context), call_(channel->CreateCall(method, context, &cq_)) { + : context_(context), + cq_(GRPC_CQ_PLUCK, DEFAULT_POLLING), + call_(channel->CreateCall(method, context, &cq_)) { CallOpSet ops; ops.SendInitialMetadata(context->send_initial_metadata_, context->initial_metadata_flags()); diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index e5c731304cd..061f59213ce 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -352,8 +352,11 @@ typedef enum grpc_completion_type { typedef struct grpc_event { /** The type of the completion. */ grpc_completion_type type; - /** non-zero if the operation was successful, 0 upon failure. - Only GRPC_OP_COMPLETE can succeed or fail. */ + /** If the grpc_completion_type is GRPC_OP_COMPLETE, this field indicates + whether the operation was successful or not; 0 in case of failure and + non-zero in case of success. + If grpc_completion_type is GRPC_QUEUE_SHUTDOWN or GRPC_QUEUE_TIMEOUT, this + field is guaranteed to be 0 */ int success; /** The tag passed to grpc_call_start_batch etc to start this operation. Only GRPC_OP_COMPLETE has a tag. */ diff --git a/src/cpp/common/core_codegen.cc b/src/cpp/common/core_codegen.cc index 36e4c893540..81b32938b85 100644 --- a/src/cpp/common/core_codegen.cc +++ b/src/cpp/common/core_codegen.cc @@ -55,8 +55,10 @@ struct grpc_byte_buffer; namespace grpc { grpc_completion_queue* CoreCodegen::grpc_completion_queue_create( + grpc_cq_completion_type completion_type, grpc_cq_polling_type polling_type, void* reserved) { - return ::grpc_completion_queue_create(reserved); + return ::grpc_completion_queue_create(completion_type, polling_type, + reserved); } void CoreCodegen::grpc_completion_queue_destroy(grpc_completion_queue* cq) { diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index 9e11a8a9e07..1b7ca82be08 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -124,6 +124,14 @@ class ShutdownTag : public CompletionQueueTag { bool FinalizeResult(void** tag, bool* status) { return false; } }; +class DummyTag : public CompletionQueueTag { + public: + bool FinalizeResult(void** tag, bool* status) { + *status = true; + return true; + } +}; + class Server::SyncRequest final : public CompletionQueueTag { public: SyncRequest(RpcServiceMethod* method, void* tag) @@ -145,7 +153,10 @@ class Server::SyncRequest final : public CompletionQueueTag { grpc_metadata_array_destroy(&request_metadata_); } - void SetupRequest() { cq_ = grpc_completion_queue_create(nullptr); } + void SetupRequest() { + // TODO: sreek - Double check if this should be GRPC_CQ_PLUCK + cq_ = grpc_completion_queue_create(GRPC_CQ_PLUCK, DEFAULT_POLLING, nullptr); + } void TeardownRequest() { grpc_completion_queue_destroy(cq_); @@ -213,10 +224,10 @@ class Server::SyncRequest final : public CompletionQueueTag { MethodHandler::HandlerParameter(&call_, &ctx_, request_payload_)); global_callbacks->PostSynchronousRequest(&ctx_); request_payload_ = nullptr; - void* ignored_tag; - bool ignored_ok; + DummyTag ignored_tag; cq_.Shutdown(); - GPR_ASSERT(cq_.Next(&ignored_tag, &ignored_ok) == false); + /* Ensure the cq_ is shutdown (else this will hang indefinitely) */ + GPR_ASSERT(cq_.Pluck(&ignored_tag) == false); } private: diff --git a/test/cpp/grpclb/grpclb_test.cc b/test/cpp/grpclb/grpclb_test.cc index 89ed9249adc..542f396d109 100644 --- a/test/cpp/grpclb/grpclb_test.cc +++ b/test/cpp/grpclb/grpclb_test.cc @@ -354,8 +354,9 @@ static void start_backend_server(server_fixture *sf) { } GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); const string expected_token = - strlen(sf->lb_token_prefix) == 0 ? "" : sf->lb_token_prefix + - std::to_string(sf->port); + strlen(sf->lb_token_prefix) == 0 + ? "" + : sf->lb_token_prefix + std::to_string(sf->port); GPR_ASSERT(contains_metadata(&request_metadata_recv, "lb-token", expected_token.c_str())); @@ -593,7 +594,7 @@ static void setup_client(const server_fixture *lb_server, grpc_channel_args_copy_and_add(NULL, &expected_target_arg, 1); gpr_free(expected_target_names); - cf->cq = grpc_completion_queue_create(NULL); + cf->cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); cf->server_uri = lb_uri; grpc_channel_credentials *fake_creds = grpc_fake_transport_security_credentials_create(); @@ -616,7 +617,7 @@ static void teardown_client(client_fixture *cf) { static void setup_server(const char *host, server_fixture *sf) { int assigned_port; - sf->cq = grpc_completion_queue_create(NULL); + sf->cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); const char *colon_idx = strchr(host, ':'); if (colon_idx) { const char *port_str = colon_idx + 1; @@ -643,10 +644,15 @@ static void teardown_server(server_fixture *sf) { if (!sf->server) return; gpr_log(GPR_INFO, "Server[%s] shutting down", sf->servers_hostport); - grpc_server_shutdown_and_notify(sf->server, sf->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - sf->cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + + grpc_completion_queue *shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_server_shutdown_and_notify(sf->server, shutdown_cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); + grpc_completion_queue_destroy(shutdown_cq); grpc_server_destroy(sf->server); gpr_thd_join(sf->tid); diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index 76d50302769..ecfa20aa905 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -65,7 +65,8 @@ static struct Init { static void BM_InsecureChannelWithDefaults(benchmark::State &state) { grpc_channel *channel = grpc_insecure_channel_create("localhost:12345", NULL, NULL); - grpc_completion_queue *cq = grpc_completion_queue_create(NULL); + grpc_completion_queue *cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, DEFAULT_POLLING, NULL); grpc_slice method = grpc_slice_from_static_string("/foo/bar"); gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); while (state.KeepRunning()) { diff --git a/test/cpp/microbenchmarks/bm_cq.cc b/test/cpp/microbenchmarks/bm_cq.cc index c017474bf4a..c7bd8743a57 100644 --- a/test/cpp/microbenchmarks/bm_cq.cc +++ b/test/cpp/microbenchmarks/bm_cq.cc @@ -66,7 +66,10 @@ BENCHMARK(BM_CreateDestroyCpp); static void BM_CreateDestroyCore(benchmark::State& state) { while (state.KeepRunning()) { - grpc_completion_queue_destroy(grpc_completion_queue_create(NULL)); + // TODO: sreek Make this a templatized benchmark and pass completion type + // and polling type as parameters + grpc_completion_queue_destroy( + grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL)); } } BENCHMARK(BM_CreateDestroyCore); @@ -98,7 +101,10 @@ static void BM_Pass1Cpp(benchmark::State& state) { BENCHMARK(BM_Pass1Cpp); static void BM_Pass1Core(benchmark::State& state) { - grpc_completion_queue* cq = grpc_completion_queue_create(NULL); + // TODO: sreek Make this templatized benchmark and pass polling_type as a + // param + grpc_completion_queue* cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); while (state.KeepRunning()) { grpc_cq_completion completion; @@ -114,7 +120,10 @@ static void BM_Pass1Core(benchmark::State& state) { BENCHMARK(BM_Pass1Core); static void BM_Pluck1Core(benchmark::State& state) { - grpc_completion_queue* cq = grpc_completion_queue_create(NULL); + // TODO: sreek Make this templatized benchmark and pass polling_type as a + // param + grpc_completion_queue* cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, DEFAULT_POLLING, NULL); gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); while (state.KeepRunning()) { grpc_cq_completion completion; @@ -130,7 +139,10 @@ static void BM_Pluck1Core(benchmark::State& state) { BENCHMARK(BM_Pluck1Core); static void BM_EmptyCore(benchmark::State& state) { - grpc_completion_queue* cq = grpc_completion_queue_create(NULL); + // TODO: sreek Make this a templatized benchmark and pass polling_type as a + // param + grpc_completion_queue* cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); gpr_timespec deadline = gpr_inf_past(GPR_CLOCK_MONOTONIC); while (state.KeepRunning()) { grpc_completion_queue_next(cq, deadline, NULL); From 39b6f27a3570d850076ae65fc4b1f32a621ce96c Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Fri, 3 Mar 2017 02:22:09 -0800 Subject: [PATCH 028/461] generate_projects.sh change --- tools/run_tests/generated/tests.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 7ac14ab2c92..ab7938d0ca1 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -2551,10 +2551,6 @@ "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], - "excluded_poll_engines": [ - "poll", - "poll-cv" - ], "flaky": false, "gtest": false, "language": "c++", @@ -2665,6 +2661,10 @@ "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], + "excluded_poll_engines": [ + "poll", + "poll-cv" + ], "flaky": false, "gtest": false, "language": "c++", From 9f71b177074ceb2607f331241dcceafa03431eaa Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Fri, 3 Mar 2017 12:54:58 -0800 Subject: [PATCH 029/461] Fix clang formatting issues --- include/grpc++/impl/codegen/completion_queue.h | 5 ++--- test/core/bad_ssl/server_common.c | 5 ++--- test/core/client_channel/lb_policies_test.c | 4 ++-- test/core/end2end/fixtures/h2_full+pipe.c | 7 +++---- test/core/end2end/fixtures/h2_full+trace.c | 7 +++---- test/core/end2end/fixtures/h2_http_proxy.c | 7 +++---- test/core/end2end/fixtures/h2_uds.c | 7 +++---- test/core/fling/server.c | 5 ++--- test/core/memory_usage/client.c | 5 ++--- test/core/memory_usage/server.c | 5 ++--- test/cpp/grpclb/grpclb_test.cc | 5 ++--- 11 files changed, 26 insertions(+), 36 deletions(-) diff --git a/include/grpc++/impl/codegen/completion_queue.h b/include/grpc++/impl/codegen/completion_queue.h index a123af2cf69..a7125e6af33 100644 --- a/include/grpc++/impl/codegen/completion_queue.h +++ b/include/grpc++/impl/codegen/completion_queue.h @@ -147,9 +147,8 @@ class CompletionQueue : private GrpcLibraryCodegen { /// /// \return true if read a regular event, false if the queue is shutting down. bool Next(void** tag, bool* ok) { - return (AsyncNextInternal(tag, ok, - g_core_codegen_interface->gpr_inf_future( - GPR_CLOCK_REALTIME)) != SHUTDOWN); + return (AsyncNextInternal(tag, ok, g_core_codegen_interface->gpr_inf_future( + GPR_CLOCK_REALTIME)) != SHUTDOWN); } /// Request the shutdown of the queue. diff --git a/test/core/bad_ssl/server_common.c b/test/core/bad_ssl/server_common.c index 383899d94a8..42a8d4ede88 100644 --- a/test/core/bad_ssl/server_common.c +++ b/test/core/bad_ssl/server_common.c @@ -97,9 +97,8 @@ void bad_ssl_run(grpc_server *server) { shutdown_started = 1; } ev = grpc_completion_queue_next( - cq, - gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(1000000, GPR_TIMESPAN)), + cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(1000000, GPR_TIMESPAN)), NULL); switch (ev.type) { case GRPC_OP_COMPLETE: diff --git a/test/core/client_channel/lb_policies_test.c b/test/core/client_channel/lb_policies_test.c index 9dcbdb979da..8bbcfe987e3 100644 --- a/test/core/client_channel/lb_policies_test.c +++ b/test/core/client_channel/lb_policies_test.c @@ -65,8 +65,8 @@ typedef struct servers_fixture { } servers_fixture; typedef struct request_sequences { - size_t n; /* number of iterations */ - int *connections; /* indexed by the interation number, value is the index of + size_t n; /* number of iterations */ + int *connections; /* indexed by the interation number, value is the index of the server it connected to or -1 if none */ int *connectivity_states; /* indexed by the interation number, value is the client connectivity state */ diff --git a/test/core/end2end/fixtures/h2_full+pipe.c b/test/core/end2end/fixtures/h2_full+pipe.c index 812922ff5bc..833b8278cc3 100644 --- a/test/core/end2end/fixtures/h2_full+pipe.c +++ b/test/core/end2end/fixtures/h2_full+pipe.c @@ -104,10 +104,9 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_full+trace.c b/test/core/end2end/fixtures/h2_full+trace.c index 02d794d08d2..a44587cd153 100644 --- a/test/core/end2end/fixtures/h2_full+trace.c +++ b/test/core/end2end/fixtures/h2_full+trace.c @@ -104,10 +104,9 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_http_proxy.c b/test/core/end2end/fixtures/h2_http_proxy.c index 0f8e002e568..2c0dc84d40f 100644 --- a/test/core/end2end/fixtures/h2_http_proxy.c +++ b/test/core/end2end/fixtures/h2_http_proxy.c @@ -109,10 +109,9 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_uds.c b/test/core/end2end/fixtures/h2_uds.c index 1c7799d5d96..4e2b5f0ba58 100644 --- a/test/core/end2end/fixtures/h2_uds.c +++ b/test/core/end2end/fixtures/h2_uds.c @@ -103,10 +103,9 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack_uds", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack_uds", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/fling/server.c b/test/core/fling/server.c index f1b5f39a607..3d20d22aaae 100644 --- a/test/core/fling/server.c +++ b/test/core/fling/server.c @@ -258,9 +258,8 @@ int main(int argc, char **argv) { shutdown_started = 1; } ev = grpc_completion_queue_next( - cq, - gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(1000000, GPR_TIMESPAN)), + cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(1000000, GPR_TIMESPAN)), NULL); s = ev.tag; switch (ev.type) { diff --git a/test/core/memory_usage/client.c b/test/core/memory_usage/client.c index 588f559d4c4..ef18ac03e8d 100644 --- a/test/core/memory_usage/client.c +++ b/test/core/memory_usage/client.c @@ -260,9 +260,8 @@ int main(int argc, char **argv) { do { event = grpc_completion_queue_next( - cq, - gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(10000, GPR_TIMESPAN)), + cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(10000, GPR_TIMESPAN)), NULL); } while (event.type != GRPC_QUEUE_TIMEOUT); diff --git a/test/core/memory_usage/server.c b/test/core/memory_usage/server.c index eb9794b5580..6b61ecabba1 100644 --- a/test/core/memory_usage/server.c +++ b/test/core/memory_usage/server.c @@ -244,9 +244,8 @@ int main(int argc, char **argv) { shutdown_started = 1; } ev = grpc_completion_queue_next( - cq, - gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(1000000, GPR_TIMESPAN)), + cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(1000000, GPR_TIMESPAN)), NULL); fling_call *s = ev.tag; switch (ev.type) { diff --git a/test/cpp/grpclb/grpclb_test.cc b/test/cpp/grpclb/grpclb_test.cc index 542f396d109..7fd31a2dbf7 100644 --- a/test/cpp/grpclb/grpclb_test.cc +++ b/test/cpp/grpclb/grpclb_test.cc @@ -354,9 +354,8 @@ static void start_backend_server(server_fixture *sf) { } GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); const string expected_token = - strlen(sf->lb_token_prefix) == 0 - ? "" - : sf->lb_token_prefix + std::to_string(sf->port); + strlen(sf->lb_token_prefix) == 0 ? "" : sf->lb_token_prefix + + std::to_string(sf->port); GPR_ASSERT(contains_metadata(&request_metadata_recv, "lb-token", expected_token.c_str())); From 1dbd981cf8be17db0268e96c2e2a0647b7d53385 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Fri, 3 Mar 2017 14:27:44 -0800 Subject: [PATCH 030/461] Prefix grpc_cq_polling_type enums with GRPC_CQ_ --- .../grpc++/impl/codegen/client_unary_call.h | 2 +- .../grpc++/impl/codegen/completion_queue.h | 2 +- include/grpc++/impl/codegen/sync_stream.h | 6 ++-- include/grpc/grpc.h | 14 ++++----- src/core/lib/surface/completion_queue.c | 4 +-- src/cpp/server/server_cc.cc | 4 +-- test/core/bad_client/bad_client.c | 6 ++-- test/core/bad_ssl/bad_ssl_test.c | 2 +- test/core/bad_ssl/server_common.c | 11 ++++--- test/core/client_channel/lb_policies_test.c | 7 +++-- .../set_initial_connect_string_test.c | 3 +- test/core/end2end/bad_server_response_test.c | 3 +- test/core/end2end/connection_refused_test.c | 3 +- test/core/end2end/dualstack_socket_test.c | 6 ++-- test/core/end2end/fixtures/h2_census.c | 5 +-- test/core/end2end/fixtures/h2_compress.c | 5 +-- test/core/end2end/fixtures/h2_fakesec.c | 5 +-- test/core/end2end/fixtures/h2_fd.c | 5 +-- test/core/end2end/fixtures/h2_full+pipe.c | 5 +-- test/core/end2end/fixtures/h2_full+trace.c | 12 ++++--- test/core/end2end/fixtures/h2_full.c | 5 +-- test/core/end2end/fixtures/h2_http_proxy.c | 5 +-- .../core/end2end/fixtures/h2_load_reporting.c | 5 +-- test/core/end2end/fixtures/h2_oauth2.c | 5 +-- test/core/end2end/fixtures/h2_proxy.c | 5 +-- .../core/end2end/fixtures/h2_sockpair+trace.c | 5 +-- test/core/end2end/fixtures/h2_sockpair.c | 5 +-- .../core/end2end/fixtures/h2_sockpair_1byte.c | 5 +-- test/core/end2end/fixtures/h2_ssl.c | 5 +-- test/core/end2end/fixtures/h2_ssl_cert.c | 5 +-- test/core/end2end/fixtures/h2_ssl_proxy.c | 5 +-- test/core/end2end/fixtures/h2_uds.c | 12 ++++--- test/core/end2end/fixtures/proxy.c | 3 +- test/core/end2end/fuzzers/api_fuzzer.c | 2 +- test/core/end2end/fuzzers/client_fuzzer.c | 2 +- test/core/end2end/fuzzers/server_fuzzer.c | 2 +- test/core/end2end/goaway_server_test.c | 3 +- .../core/end2end/invalid_call_argument_test.c | 4 +-- .../end2end/multiple_server_queues_test.c | 7 +++-- test/core/end2end/no_server_test.c | 3 +- test/core/fling/client.c | 3 +- test/core/fling/server.c | 12 ++++--- test/core/handshake/client_ssl.c | 2 +- test/core/handshake/server_ssl.c | 2 +- test/core/memory_usage/client.c | 8 +++-- test/core/memory_usage/server.c | 12 ++++--- test/core/surface/alarm_test.c | 3 +- test/core/surface/completion_queue_test.c | 31 ++++++++++--------- .../surface/completion_queue_threading_test.c | 5 +-- .../surface/concurrent_connectivity_test.c | 7 +++-- test/core/surface/lame_client_test.c | 3 +- .../surface/sequential_connectivity_test.c | 4 +-- test/core/surface/server_chttp2_test.c | 2 +- test/core/surface/server_test.c | 6 ++-- test/cpp/grpclb/grpclb_test.cc | 13 +++++--- test/cpp/microbenchmarks/bm_call_create.cc | 2 +- test/cpp/microbenchmarks/bm_cq.cc | 12 +++---- 57 files changed, 189 insertions(+), 141 deletions(-) diff --git a/include/grpc++/impl/codegen/client_unary_call.h b/include/grpc++/impl/codegen/client_unary_call.h index bf18a7d6449..d8085a0a7f8 100644 --- a/include/grpc++/impl/codegen/client_unary_call.h +++ b/include/grpc++/impl/codegen/client_unary_call.h @@ -52,7 +52,7 @@ template Status BlockingUnaryCall(ChannelInterface* channel, const RpcMethod& method, ClientContext* context, const InputMessage& request, OutputMessage* result) { - CompletionQueue cq(GRPC_CQ_PLUCK, DEFAULT_POLLING); + CompletionQueue cq(GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING); Call call(channel->CreateCall(method, context, &cq)); CallOpSet, diff --git a/include/grpc++/impl/codegen/completion_queue.h b/include/grpc++/impl/codegen/completion_queue.h index a7125e6af33..f34b82dad29 100644 --- a/include/grpc++/impl/codegen/completion_queue.h +++ b/include/grpc++/impl/codegen/completion_queue.h @@ -103,7 +103,7 @@ class CompletionQueue : private GrpcLibraryCodegen { public: /// Default constructor. Implicitly creates a \a grpc_completion_queue /// instance. - CompletionQueue() : CompletionQueue(GRPC_CQ_NEXT, DEFAULT_POLLING) {} + CompletionQueue() : CompletionQueue(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING) {} /// Wrap \a take, taking ownership of the instance. /// diff --git a/include/grpc++/impl/codegen/sync_stream.h b/include/grpc++/impl/codegen/sync_stream.h index d3a6c7ff899..c09ab5e647c 100644 --- a/include/grpc++/impl/codegen/sync_stream.h +++ b/include/grpc++/impl/codegen/sync_stream.h @@ -138,7 +138,7 @@ class ClientReader final : public ClientReaderInterface { ClientReader(ChannelInterface* channel, const RpcMethod& method, ClientContext* context, const W& request) : context_(context), - cq_(GRPC_CQ_PLUCK, DEFAULT_POLLING), + cq_(GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING), call_(channel->CreateCall(method, context, &cq_)) { CallOpSet @@ -212,7 +212,7 @@ class ClientWriter : public ClientWriterInterface { ClientWriter(ChannelInterface* channel, const RpcMethod& method, ClientContext* context, R* response) : context_(context), - cq_(GRPC_CQ_PLUCK, DEFAULT_POLLING), + cq_(GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING), call_(channel->CreateCall(method, context, &cq_)) { finish_ops_.RecvMessage(response); finish_ops_.AllowNoMessage(); @@ -297,7 +297,7 @@ class ClientReaderWriter final : public ClientReaderWriterInterface { ClientReaderWriter(ChannelInterface* channel, const RpcMethod& method, ClientContext* context) : context_(context), - cq_(GRPC_CQ_PLUCK, DEFAULT_POLLING), + cq_(GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING), call_(channel->CreateCall(method, context, &cq_)) { CallOpSet ops; ops.SendInitialMetadata(context->send_initial_metadata_, diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 0e4711fa1f3..29fd3048fcb 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -108,23 +108,23 @@ typedef enum { I/O progress can only be made when grpc_completion_queue_next() or grpc_completion_queue_pluck() are called on the completion queue (unless the - grpc_cq_polling_type is NON_POLLING) and hence it is very important to - actively call these APIs */ + grpc_cq_polling_type is GRPC_CQ_NON_POLLING) and hence it is very important + to actively call these APIs */ typedef enum { /** The completion queue will have an associated pollset and there is no restriction on the type of file descriptors the pollset may contain */ - DEFAULT_POLLING, + GRPC_CQ_DEFAULT_POLLING, - /** Similar to DEFAULT_POLLING except that the completion queues will not - contain any 'listening file descriptors' (i.e file descriptors used to + /** Similar to GRPC_CQ_DEFAULT_POLLING except that the completion queues will + not contain any 'listening file descriptors' (i.e file descriptors used to listen to incoming channels */ - NON_LISTENING, + GRPC_CQ_NON_LISTENING, /** The completion queue will not have an associated pollset. Note that grpc_completion_queue_next() or grpc_completion_queue_pluck() MUST still be called to pop events from the completion queue; it is not required to call them actively to make I/O progress */ - NON_POLLING + GRPC_CQ_NON_POLLING } grpc_cq_polling_type; /** Create a completion queue */ diff --git a/src/core/lib/surface/completion_queue.c b/src/core/lib/surface/completion_queue.c index d45e265d5c8..ad9d7b20b08 100644 --- a/src/core/lib/surface/completion_queue.c +++ b/src/core/lib/surface/completion_queue.c @@ -717,12 +717,12 @@ grpc_completion_queue *grpc_cq_from_pollset(grpc_pollset *ps) { void grpc_cq_mark_non_listening_server_cq(grpc_completion_queue *cc) { /* TODO: sreek - use cc->polling_type field here and add a validation check (i.e grpc_cq_mark_non_listening_server_cq can only be called on a cc whose - polling_type is set to NON_LISTENING */ + polling_type is set to GRPC_CQ_NON_LISTENING */ cc->is_non_listening_server_cq = 1; } bool grpc_cq_is_non_listening_server_cq(grpc_completion_queue *cc) { - /* TODO (sreek) - return (cc->polling_type == NON_LISTENING) */ + /* TODO (sreek) - return (cc->polling_type == GRPC_CQ_NON_LISTENING) */ return (cc->is_non_listening_server_cq == 1); } diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index 1b7ca82be08..50c4cafa7a5 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -154,8 +154,8 @@ class Server::SyncRequest final : public CompletionQueueTag { } void SetupRequest() { - // TODO: sreek - Double check if this should be GRPC_CQ_PLUCK - cq_ = grpc_completion_queue_create(GRPC_CQ_PLUCK, DEFAULT_POLLING, nullptr); + cq_ = grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING, + nullptr); } void TeardownRequest() { diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.c index a6e859d06e8..2ecb75883bd 100644 --- a/test/core/bad_client/bad_client.c +++ b/test/core/bad_client/bad_client.c @@ -125,7 +125,8 @@ void grpc_run_bad_client_test( /* Create server, completion events */ a.server = grpc_server_create(NULL, NULL); - a.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + a.cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); gpr_event_init(&a.done_thd); gpr_event_init(&a.done_write); a.validator = server_validator; @@ -197,7 +198,8 @@ void grpc_run_bad_client_test( grpc_exec_ctx_finish(&exec_ctx); } - shutdown_cq = grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); grpc_server_shutdown_and_notify(a.server, shutdown_cq, NULL); GPR_ASSERT(grpc_completion_queue_pluck( shutdown_cq, NULL, grpc_timeout_seconds_to_deadline(1), NULL) diff --git a/test/core/bad_ssl/bad_ssl_test.c b/test/core/bad_ssl/bad_ssl_test.c index 4d34f8a9ea8..e0f1d2789f8 100644 --- a/test/core/bad_ssl/bad_ssl_test.c +++ b/test/core/bad_ssl/bad_ssl_test.c @@ -62,7 +62,7 @@ static void run_test(const char *target, size_t nops) { grpc_call_error error; gpr_timespec deadline = grpc_timeout_seconds_to_deadline(5); grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); cq_verifier *cqv = cq_verifier_create(cq); grpc_op ops[6]; diff --git a/test/core/bad_ssl/server_common.c b/test/core/bad_ssl/server_common.c index 42a8d4ede88..b112ae4e780 100644 --- a/test/core/bad_ssl/server_common.c +++ b/test/core/bad_ssl/server_common.c @@ -68,7 +68,7 @@ void bad_ssl_run(grpc_server *server) { grpc_metadata_array request_metadata_recv; grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); grpc_completion_queue *shutdown_cq; grpc_call_details_init(&call_details); @@ -85,8 +85,8 @@ void bad_ssl_run(grpc_server *server) { while (!shutdown_finished) { if (got_sigint && !shutdown_started) { gpr_log(GPR_INFO, "Shutting down due to SIGINT"); - shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + shutdown_cq = grpc_completion_queue_create(GRPC_CQ_PLUCK, + GRPC_CQ_NON_POLLING, NULL); grpc_server_shutdown_and_notify(server, shutdown_cq, NULL); GPR_ASSERT( grpc_completion_queue_pluck(shutdown_cq, NULL, @@ -97,8 +97,9 @@ void bad_ssl_run(grpc_server *server) { shutdown_started = 1; } ev = grpc_completion_queue_next( - cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(1000000, GPR_TIMESPAN)), + cq, + gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(1000000, GPR_TIMESPAN)), NULL); switch (ev.type) { case GRPC_OP_COMPLETE: diff --git a/test/core/client_channel/lb_policies_test.c b/test/core/client_channel/lb_policies_test.c index 8bbcfe987e3..f440e3348ca 100644 --- a/test/core/client_channel/lb_policies_test.c +++ b/test/core/client_channel/lb_policies_test.c @@ -67,7 +67,7 @@ typedef struct servers_fixture { typedef struct request_sequences { size_t n; /* number of iterations */ int *connections; /* indexed by the interation number, value is the index of - the server it connected to or -1 if none */ + the server it connected to or -1 if none */ int *connectivity_states; /* indexed by the interation number, value is the client connectivity state */ } request_sequences; @@ -197,9 +197,10 @@ static servers_fixture *setup_servers(const char *server_host, /* Create servers. */ f->servers = gpr_malloc(sizeof(grpc_server *) * num_servers); f->servers_hostports = gpr_malloc(sizeof(char *) * num_servers); - f->cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f->cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); f->shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); for (i = 0; i < num_servers; i++) { grpc_metadata_array_init(&f->request_metadata_recv[i]); gpr_join_host_port(&f->servers_hostports[i], server_host, diff --git a/test/core/client_channel/set_initial_connect_string_test.c b/test/core/client_channel/set_initial_connect_string_test.c index 38f2fbac623..999c89bdbd6 100644 --- a/test/core/client_channel/set_initial_connect_string_test.c +++ b/test/core/client_channel/set_initial_connect_string_test.c @@ -130,7 +130,8 @@ static gpr_timespec n_sec_deadline(int seconds) { } static void start_rpc(int use_creds, int target_port) { - state.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + state.cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); if (use_creds) { state.creds = grpc_fake_transport_security_credentials_create(); } else { diff --git a/test/core/end2end/bad_server_response_test.c b/test/core/end2end/bad_server_response_test.c index 67f5bdbac80..e4dc3831dcd 100644 --- a/test/core/end2end/bad_server_response_test.c +++ b/test/core/end2end/bad_server_response_test.c @@ -178,7 +178,8 @@ static void start_rpc(int target_port, grpc_status_code expected_status, cq_verifier *cqv; grpc_slice details; - state.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + state.cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); cqv = cq_verifier_create(state.cq); gpr_join_host_port(&state.target, "127.0.0.1", target_port); state.channel = grpc_insecure_channel_create(state.target, NULL, NULL); diff --git a/test/core/end2end/connection_refused_test.c b/test/core/end2end/connection_refused_test.c index 617828f9546..fe203ddf4de 100644 --- a/test/core/end2end/connection_refused_test.c +++ b/test/core/end2end/connection_refused_test.c @@ -69,7 +69,8 @@ static void run_test(bool wait_for_ready, bool use_service_config) { grpc_metadata_array_init(&trailing_metadata_recv); - cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); cqv = cq_verifier_create(cq); /* if using service config, create channel args */ diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.c index 5125be9b942..19f947865a2 100644 --- a/test/core/end2end/dualstack_socket_test.c +++ b/test/core/end2end/dualstack_socket_test.c @@ -108,7 +108,8 @@ void test_connect(const char *server_host, const char *client_host, int port, grpc_call_details_init(&call_details); /* Create server. */ - cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); server = grpc_server_create(NULL, NULL); grpc_server_register_completion_queue(server, cq, NULL); GPR_ASSERT((got_port = grpc_server_add_insecure_http2_port( @@ -260,7 +261,8 @@ void test_connect(const char *server_host, const char *client_host, int port, grpc_channel_destroy(client); /* Destroy server. */ - shutdown_cq = grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + shutdown_cq = + grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); grpc_server_shutdown_and_notify(server, shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), diff --git a/test/core/end2end/fixtures/h2_census.c b/test/core/end2end/fixtures/h2_census.c index a1fae013c29..1077e063b8b 100644 --- a/test/core/end2end/fixtures/h2_census.c +++ b/test/core/end2end/fixtures/h2_census.c @@ -65,9 +65,10 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); return f; } diff --git a/test/core/end2end/fixtures/h2_compress.c b/test/core/end2end/fixtures/h2_compress.c index 7a2aa7ff7fb..a985faeb5a7 100644 --- a/test/core/end2end/fixtures/h2_compress.c +++ b/test/core/end2end/fixtures/h2_compress.c @@ -69,9 +69,10 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_compression( memset(&f, 0, sizeof(f)); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); return f; } diff --git a/test/core/end2end/fixtures/h2_fakesec.c b/test/core/end2end/fixtures/h2_fakesec.c index 0ccdef9767a..59ae3f0cb35 100644 --- a/test/core/end2end/fixtures/h2_fakesec.c +++ b/test/core/end2end/fixtures/h2_fakesec.c @@ -60,9 +60,10 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); return f; } diff --git a/test/core/end2end/fixtures/h2_fd.c b/test/core/end2end/fixtures/h2_fd.c index d97b693e331..b01b52c9960 100644 --- a/test/core/end2end/fixtures/h2_fd.c +++ b/test/core/end2end/fixtures/h2_fd.c @@ -70,9 +70,10 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); f.fixture_data = fixture_data; - f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); create_sockets(fixture_data->fd_pair); diff --git a/test/core/end2end/fixtures/h2_full+pipe.c b/test/core/end2end/fixtures/h2_full+pipe.c index 833b8278cc3..6add99707fa 100644 --- a/test/core/end2end/fixtures/h2_full+pipe.c +++ b/test/core/end2end/fixtures/h2_full+pipe.c @@ -70,9 +70,10 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); return f; } diff --git a/test/core/end2end/fixtures/h2_full+trace.c b/test/core/end2end/fixtures/h2_full+trace.c index a44587cd153..c24bacc42f4 100644 --- a/test/core/end2end/fixtures/h2_full+trace.c +++ b/test/core/end2end/fixtures/h2_full+trace.c @@ -70,9 +70,10 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); return f; } @@ -104,9 +105,10 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_full.c b/test/core/end2end/fixtures/h2_full.c index bfb300e42ff..901a419f253 100644 --- a/test/core/end2end/fixtures/h2_full.c +++ b/test/core/end2end/fixtures/h2_full.c @@ -64,9 +64,10 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); return f; } diff --git a/test/core/end2end/fixtures/h2_http_proxy.c b/test/core/end2end/fixtures/h2_http_proxy.c index 2c0dc84d40f..52850687976 100644 --- a/test/core/end2end/fixtures/h2_http_proxy.c +++ b/test/core/end2end/fixtures/h2_http_proxy.c @@ -69,9 +69,10 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( ffd->proxy = grpc_end2end_http_proxy_create(); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); return f; } diff --git a/test/core/end2end/fixtures/h2_load_reporting.c b/test/core/end2end/fixtures/h2_load_reporting.c index 664c7ba9d4b..5b8721adbd6 100644 --- a/test/core/end2end/fixtures/h2_load_reporting.c +++ b/test/core/end2end/fixtures/h2_load_reporting.c @@ -67,9 +67,10 @@ static grpc_end2end_test_fixture chttp2_create_fixture_load_reporting( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); return f; } diff --git a/test/core/end2end/fixtures/h2_oauth2.c b/test/core/end2end/fixtures/h2_oauth2.c index 73928759fed..19920473ffa 100644 --- a/test/core/end2end/fixtures/h2_oauth2.c +++ b/test/core/end2end/fixtures/h2_oauth2.c @@ -113,9 +113,10 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); return f; } diff --git a/test/core/end2end/fixtures/h2_proxy.c b/test/core/end2end/fixtures/h2_proxy.c index 016ba41fbd7..5a64a109181 100644 --- a/test/core/end2end/fixtures/h2_proxy.c +++ b/test/core/end2end/fixtures/h2_proxy.c @@ -79,9 +79,10 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( ffd->proxy = grpc_end2end_proxy_create(&proxy_def, client_args, server_args); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); return f; } diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.c b/test/core/end2end/fixtures/h2_sockpair+trace.c index 445f8a2dd1d..069b880238a 100644 --- a/test/core/end2end/fixtures/h2_sockpair+trace.c +++ b/test/core/end2end/fixtures/h2_sockpair+trace.c @@ -94,9 +94,10 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); f.fixture_data = sfd; - f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); grpc_resource_quota *resource_quota = grpc_resource_quota_create("fixture"); *sfd = grpc_iomgr_create_endpoint_pair("fixture", resource_quota, 65536); diff --git a/test/core/end2end/fixtures/h2_sockpair.c b/test/core/end2end/fixtures/h2_sockpair.c index 66c05c55625..c19d4854031 100644 --- a/test/core/end2end/fixtures/h2_sockpair.c +++ b/test/core/end2end/fixtures/h2_sockpair.c @@ -88,9 +88,10 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); f.fixture_data = sfd; - f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); grpc_resource_quota *resource_quota = grpc_resource_quota_create("fixture"); *sfd = grpc_iomgr_create_endpoint_pair("fixture", resource_quota, 65536); diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.c b/test/core/end2end/fixtures/h2_sockpair_1byte.c index 2d845f369b8..05883b5ef4c 100644 --- a/test/core/end2end/fixtures/h2_sockpair_1byte.c +++ b/test/core/end2end/fixtures/h2_sockpair_1byte.c @@ -88,9 +88,10 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); f.fixture_data = sfd; - f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); grpc_resource_quota *resource_quota = grpc_resource_quota_create("fixture"); *sfd = grpc_iomgr_create_endpoint_pair("fixture", resource_quota, 1); diff --git a/test/core/end2end/fixtures/h2_ssl.c b/test/core/end2end/fixtures/h2_ssl.c index d73944fe6cc..d704b97e1cf 100644 --- a/test/core/end2end/fixtures/h2_ssl.c +++ b/test/core/end2end/fixtures/h2_ssl.c @@ -64,9 +64,10 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); return f; } diff --git a/test/core/end2end/fixtures/h2_ssl_cert.c b/test/core/end2end/fixtures/h2_ssl_cert.c index c8bd7153c2c..c3d25ac836c 100644 --- a/test/core/end2end/fixtures/h2_ssl_cert.c +++ b/test/core/end2end/fixtures/h2_ssl_cert.c @@ -67,9 +67,10 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); return f; } diff --git a/test/core/end2end/fixtures/h2_ssl_proxy.c b/test/core/end2end/fixtures/h2_ssl_proxy.c index 22fbeb1a83f..61bcfebbbe9 100644 --- a/test/core/end2end/fixtures/h2_ssl_proxy.c +++ b/test/core/end2end/fixtures/h2_ssl_proxy.c @@ -100,9 +100,10 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( ffd->proxy = grpc_end2end_proxy_create(&proxy_def, client_args, server_args); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); return f; } diff --git a/test/core/end2end/fixtures/h2_uds.c b/test/core/end2end/fixtures/h2_uds.c index 4e2b5f0ba58..820c587bee5 100644 --- a/test/core/end2end/fixtures/h2_uds.c +++ b/test/core/end2end/fixtures/h2_uds.c @@ -70,9 +70,10 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( unique++); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + f.cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); return f; } @@ -103,9 +104,10 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack_uds", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack_uds", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/proxy.c b/test/core/end2end/fixtures/proxy.c index 7f23eef66a5..7d306c60326 100644 --- a/test/core/end2end/fixtures/proxy.c +++ b/test/core/end2end/fixtures/proxy.c @@ -104,7 +104,8 @@ grpc_end2end_proxy *grpc_end2end_proxy_create(const grpc_end2end_proxy_def *def, gpr_log(GPR_DEBUG, "PROXY ADDR:%s BACKEND:%s", proxy->proxy_port, proxy->server_port); - proxy->cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + proxy->cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); proxy->server = def->create_server(proxy->proxy_port, server_args); proxy->client = def->create_client(proxy->server_port, client_args); diff --git a/test/core/end2end/fuzzers/api_fuzzer.c b/test/core/end2end/fuzzers/api_fuzzer.c index 61f972e65eb..278b6dbae0a 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.c +++ b/test/core/end2end/fuzzers/api_fuzzer.c @@ -739,7 +739,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { g_resource_quota = grpc_resource_quota_create("api_fuzzer"); grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); while (!is_eof(&inp) || g_channel != NULL || g_server != NULL || pending_channel_watches > 0 || pending_pings > 0 || diff --git a/test/core/end2end/fuzzers/client_fuzzer.c b/test/core/end2end/fuzzers/client_fuzzer.c index 6b8c09cdf4b..46acf7d70a2 100644 --- a/test/core/end2end/fuzzers/client_fuzzer.c +++ b/test/core/end2end/fuzzers/client_fuzzer.c @@ -66,7 +66,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); grpc_transport *transport = grpc_create_chttp2_transport(&exec_ctx, NULL, mock_endpoint, 1); grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL); diff --git a/test/core/end2end/fuzzers/server_fuzzer.c b/test/core/end2end/fuzzers/server_fuzzer.c index 76fe97ec0f1..33c8ed4e727 100644 --- a/test/core/end2end/fuzzers/server_fuzzer.c +++ b/test/core/end2end/fuzzers/server_fuzzer.c @@ -68,7 +68,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { grpc_server *server = grpc_server_create(NULL, NULL); grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); grpc_server_register_completion_queue(server, cq, NULL); // TODO(ctiller): add registered methods (one for POST, one for PUT) // void *registered_method = diff --git a/test/core/end2end/goaway_server_test.c b/test/core/end2end/goaway_server_test.c index 85d54c16e56..92ea7a72ef5 100644 --- a/test/core/end2end/goaway_server_test.c +++ b/test/core/end2end/goaway_server_test.c @@ -121,7 +121,8 @@ int main(int argc, char **argv) { grpc_metadata_array_init(&request_metadata2); grpc_call_details_init(&request_details2); - cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); cqv = cq_verifier_create(cq); /* reserve two ports */ diff --git a/test/core/end2end/invalid_call_argument_test.c b/test/core/end2end/invalid_call_argument_test.c index 0563127af84..7aa8d98933c 100644 --- a/test/core/end2end/invalid_call_argument_test.c +++ b/test/core/end2end/invalid_call_argument_test.c @@ -74,7 +74,7 @@ static void prepare_test(int is_client) { grpc_metadata_array_init(&g_state.trailing_metadata_recv); g_state.deadline = grpc_timeout_seconds_to_deadline(2); g_state.cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); g_state.cqv = cq_verifier_create(g_state.cq); g_state.details = grpc_empty_slice(); memset(g_state.ops, 0, sizeof(g_state.ops)); @@ -134,7 +134,7 @@ static void cleanup_test() { if (!g_state.is_client) { shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); grpc_call_destroy(g_state.server_call); grpc_server_shutdown_and_notify(g_state.server, shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(shutdown_cq, tag(1000), diff --git a/test/core/end2end/multiple_server_queues_test.c b/test/core/end2end/multiple_server_queues_test.c index 94e615f1aa7..7da5ee55aef 100644 --- a/test/core/end2end/multiple_server_queues_test.c +++ b/test/core/end2end/multiple_server_queues_test.c @@ -42,9 +42,10 @@ int main(int argc, char **argv) { grpc_test_init(argc, argv); grpc_init(); - cq1 = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); - cq2 = grpc_completion_queue_create(GRPC_CQ_NEXT, NON_LISTENING, NULL); - cq3 = grpc_completion_queue_create(GRPC_CQ_NEXT, NON_POLLING, NULL); + cq1 = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + cq2 = grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_NON_LISTENING, NULL); + cq3 = grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_NON_POLLING, NULL); server = grpc_server_create(NULL, NULL); grpc_server_register_completion_queue(server, cq1, NULL); diff --git a/test/core/end2end/no_server_test.c b/test/core/end2end/no_server_test.c index e16c129d671..fd8a2f8a399 100644 --- a/test/core/end2end/no_server_test.c +++ b/test/core/end2end/no_server_test.c @@ -59,7 +59,8 @@ int main(int argc, char **argv) { grpc_metadata_array_init(&trailing_metadata_recv); - cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); cqv = cq_verifier_create(cq); /* create a call, channel to a non existant server */ diff --git a/test/core/fling/client.c b/test/core/fling/client.c index 188696c189c..a9f6a3d5161 100644 --- a/test/core/fling/client.c +++ b/test/core/fling/client.c @@ -208,7 +208,8 @@ int main(int argc, char **argv) { } channel = grpc_insecure_channel_create(target, NULL, NULL); - cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); the_buffer = grpc_raw_byte_buffer_create(&slice, (size_t)payload_size); histogram = gpr_histogram_create(0.01, 60e9); diff --git a/test/core/fling/server.c b/test/core/fling/server.c index 3d20d22aaae..02168c4ea90 100644 --- a/test/core/fling/server.c +++ b/test/core/fling/server.c @@ -215,7 +215,8 @@ int main(int argc, char **argv) { } gpr_log(GPR_INFO, "creating server on: %s", addr); - cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); if (secure) { grpc_ssl_pem_key_cert_pair pem_key_cert_pair = {test_server1_key, test_server1_cert}; @@ -244,8 +245,8 @@ int main(int argc, char **argv) { if (got_sigint && !shutdown_started) { gpr_log(GPR_INFO, "Shutting down due to SIGINT"); - shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + shutdown_cq = grpc_completion_queue_create(GRPC_CQ_PLUCK, + GRPC_CQ_NON_POLLING, NULL); grpc_server_shutdown_and_notify(server, shutdown_cq, tag(1000)); GPR_ASSERT( @@ -258,8 +259,9 @@ int main(int argc, char **argv) { shutdown_started = 1; } ev = grpc_completion_queue_next( - cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(1000000, GPR_TIMESPAN)), + cq, + gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(1000000, GPR_TIMESPAN)), NULL); s = ev.tag; switch (ev.type) { diff --git a/test/core/handshake/client_ssl.c b/test/core/handshake/client_ssl.c index 72e8ffe02ae..5ebbc426092 100644 --- a/test/core/handshake/client_ssl.c +++ b/test/core/handshake/client_ssl.c @@ -290,7 +290,7 @@ static bool client_ssl_test(char *server_alpn_preferred) { int retries = 10; grpc_connectivity_state state = GRPC_CHANNEL_IDLE; grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); while (state != GRPC_CHANNEL_READY && retries-- > 0) { grpc_channel_watch_connectivity_state( diff --git a/test/core/handshake/server_ssl.c b/test/core/handshake/server_ssl.c index f61ad786bc6..6ac22eaae5c 100644 --- a/test/core/handshake/server_ssl.c +++ b/test/core/handshake/server_ssl.c @@ -105,7 +105,7 @@ static void server_thread(void *arg) { free(addr); grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); grpc_server_register_completion_queue(server, cq, NULL); grpc_server_start(server); diff --git a/test/core/memory_usage/client.c b/test/core/memory_usage/client.c index ef18ac03e8d..b2bc2691369 100644 --- a/test/core/memory_usage/client.c +++ b/test/core/memory_usage/client.c @@ -222,7 +222,8 @@ int main(int argc, char **argv) { calls[k].details = grpc_empty_slice(); } - cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); struct grpc_memory_counters client_channel_start = grpc_memory_counters_snapshot(); @@ -260,8 +261,9 @@ int main(int argc, char **argv) { do { event = grpc_completion_queue_next( - cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(10000, GPR_TIMESPAN)), + cq, + gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(10000, GPR_TIMESPAN)), NULL); } while (event.type != GRPC_QUEUE_TIMEOUT); diff --git a/test/core/memory_usage/server.c b/test/core/memory_usage/server.c index 6b61ecabba1..9f4c7fd22ce 100644 --- a/test/core/memory_usage/server.c +++ b/test/core/memory_usage/server.c @@ -189,7 +189,8 @@ int main(int argc, char **argv) { } gpr_log(GPR_INFO, "creating server on: %s", addr); - cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); struct grpc_memory_counters before_server_create = grpc_memory_counters_snapshot(); @@ -232,8 +233,8 @@ int main(int argc, char **argv) { if (got_sigint && !shutdown_started) { gpr_log(GPR_INFO, "Shutting down due to SIGINT"); - shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + shutdown_cq = grpc_completion_queue_create(GRPC_CQ_PLUCK, + GRPC_CQ_NON_POLLING, NULL); grpc_server_shutdown_and_notify(server, shutdown_cq, tag(1000)); GPR_ASSERT( grpc_completion_queue_pluck(shutdown_cq, tag(1000), @@ -244,8 +245,9 @@ int main(int argc, char **argv) { shutdown_started = 1; } ev = grpc_completion_queue_next( - cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(1000000, GPR_TIMESPAN)), + cq, + gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(1000000, GPR_TIMESPAN)), NULL); fling_call *s = ev.tag; switch (ev.type) { diff --git a/test/core/surface/alarm_test.c b/test/core/surface/alarm_test.c index 7419d388a37..2c555db5ddf 100644 --- a/test/core/surface/alarm_test.c +++ b/test/core/surface/alarm_test.c @@ -58,7 +58,8 @@ static void test_alarm(void) { grpc_completion_queue *cc; LOG_TEST("test_alarm"); - cc = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + cc = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); { /* regular expiry */ grpc_event ev; diff --git a/test/core/surface/completion_queue_test.c b/test/core/surface/completion_queue_test.c index f76074f2073..c90e72cde68 100644 --- a/test/core/surface/completion_queue_test.c +++ b/test/core/surface/completion_queue_test.c @@ -76,8 +76,8 @@ static void shutdown_and_destroy(grpc_completion_queue *cc) { /* ensure we can create and destroy a completion channel */ static void test_no_op(void) { grpc_cq_completion_type completion_types[] = {GRPC_CQ_NEXT, GRPC_CQ_PLUCK}; - grpc_cq_polling_type polling_types[] = {DEFAULT_POLLING, NON_LISTENING, - NON_POLLING}; + grpc_cq_polling_type polling_types[] = { + GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING}; LOG_TEST("test_no_op"); for (size_t i = 0; i < GPR_ARRAY_SIZE(completion_types); i++) { @@ -90,7 +90,8 @@ static void test_no_op(void) { static void test_pollset_conversion(void) { grpc_cq_completion_type completion_types[] = {GRPC_CQ_NEXT, GRPC_CQ_PLUCK}; - grpc_cq_polling_type polling_types[] = {DEFAULT_POLLING, NON_LISTENING}; + grpc_cq_polling_type polling_types[] = {GRPC_CQ_DEFAULT_POLLING, + GRPC_CQ_NON_LISTENING}; grpc_completion_queue *cq; LOG_TEST("test_pollset_conversion"); @@ -106,8 +107,8 @@ static void test_pollset_conversion(void) { } static void test_wait_empty(void) { - grpc_cq_polling_type polling_types[] = {DEFAULT_POLLING, NON_LISTENING, - NON_POLLING}; + grpc_cq_polling_type polling_types[] = { + GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING}; grpc_completion_queue *cc; grpc_event event; @@ -128,8 +129,8 @@ static void test_cq_end_op(void) { grpc_event ev; grpc_completion_queue *cc; grpc_cq_completion completion; - grpc_cq_polling_type polling_types[] = {DEFAULT_POLLING, NON_LISTENING, - NON_POLLING}; + grpc_cq_polling_type polling_types[] = { + GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING}; grpc_exec_ctx init_exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx; @@ -156,8 +157,8 @@ static void test_cq_end_op(void) { } static void test_shutdown_then_next_polling(void) { - grpc_cq_polling_type polling_types[] = {DEFAULT_POLLING, NON_LISTENING, - NON_POLLING}; + grpc_cq_polling_type polling_types[] = { + GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING}; grpc_completion_queue *cc; grpc_event event; LOG_TEST("test_shutdown_then_next_polling"); @@ -173,8 +174,8 @@ static void test_shutdown_then_next_polling(void) { } static void test_shutdown_then_next_with_timeout(void) { - grpc_cq_polling_type polling_types[] = {DEFAULT_POLLING, NON_LISTENING, - NON_POLLING}; + grpc_cq_polling_type polling_types[] = { + GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING}; grpc_completion_queue *cc; grpc_event event; LOG_TEST("test_shutdown_then_next_with_timeout"); @@ -195,8 +196,8 @@ static void test_pluck(void) { grpc_completion_queue *cc; void *tags[128]; grpc_cq_completion completions[GPR_ARRAY_SIZE(tags)]; - grpc_cq_polling_type polling_types[] = {DEFAULT_POLLING, NON_LISTENING, - NON_POLLING}; + grpc_cq_polling_type polling_types[] = { + GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING}; grpc_exec_ctx init_exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx; unsigned i, j; @@ -244,8 +245,8 @@ static void test_pluck(void) { } static void test_pluck_after_shutdown(void) { - grpc_cq_polling_type polling_types[] = {DEFAULT_POLLING, NON_LISTENING, - NON_POLLING}; + grpc_cq_polling_type polling_types[] = { + GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING}; grpc_event ev; grpc_completion_queue *cc; diff --git a/test/core/surface/completion_queue_threading_test.c b/test/core/surface/completion_queue_threading_test.c index b101cd13f72..6a23aee5373 100644 --- a/test/core/surface/completion_queue_threading_test.c +++ b/test/core/surface/completion_queue_threading_test.c @@ -101,7 +101,8 @@ static void test_too_many_plucks(void) { LOG_TEST("test_too_many_plucks"); - cc = grpc_completion_queue_create(GRPC_CQ_PLUCK, DEFAULT_POLLING, NULL); + cc = grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING, + NULL); gpr_thd_options_set_joinable(&thread_options); for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { @@ -228,7 +229,7 @@ static void test_threading(size_t producers, size_t consumers) { gpr_event phase1 = GPR_EVENT_INIT; gpr_event phase2 = GPR_EVENT_INIT; grpc_completion_queue *cc = - grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); size_t i; size_t total_consumed = 0; static int optid = 101; diff --git a/test/core/surface/concurrent_connectivity_test.c b/test/core/surface/concurrent_connectivity_test.c index 3758b86fab9..69f00f4d48c 100644 --- a/test/core/surface/concurrent_connectivity_test.c +++ b/test/core/surface/concurrent_connectivity_test.c @@ -66,8 +66,8 @@ static int detag(void *p) { return (int)(uintptr_t)p; } void create_loop_destroy(void *addr) { for (int i = 0; i < NUM_OUTER_LOOPS; ++i) { - grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + grpc_completion_queue *cq = grpc_completion_queue_create( + GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); grpc_channel *chan = grpc_insecure_channel_create((char *)addr, NULL, NULL); for (int j = 0; j < NUM_INNER_LOOPS; ++j) { @@ -196,7 +196,8 @@ int main(int argc, char **argv) { gpr_asprintf(&args.addr, "localhost:%d", port); args.server = grpc_server_create(NULL, NULL); grpc_server_add_insecure_http2_port(args.server, args.addr); - args.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + args.cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); grpc_server_register_completion_queue(args.server, args.cq, NULL); grpc_server_start(args.server); gpr_thd_new(&server, server_thread, &args, &options); diff --git a/test/core/surface/lame_client_test.c b/test/core/surface/lame_client_test.c index 0cb183a4f00..6531e5eb182 100644 --- a/test/core/surface/lame_client_test.c +++ b/test/core/surface/lame_client_test.c @@ -108,7 +108,8 @@ int main(int argc, char **argv) { GPR_ASSERT(GRPC_CHANNEL_SHUTDOWN == grpc_channel_check_connectivity_state(chan, 0)); - cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); grpc_slice host = grpc_slice_from_static_string("anywhere"); call = grpc_channel_create_call(chan, NULL, GRPC_PROPAGATE_DEFAULTS, cq, diff --git a/test/core/surface/sequential_connectivity_test.c b/test/core/surface/sequential_connectivity_test.c index 37678a40d94..1880c0b8591 100644 --- a/test/core/surface/sequential_connectivity_test.c +++ b/test/core/surface/sequential_connectivity_test.c @@ -77,7 +77,7 @@ static void run_test(const test_fixture *fixture) { grpc_server *server = grpc_server_create(NULL, NULL); fixture->add_server_port(server, addr); grpc_completion_queue *server_cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); grpc_server_register_completion_queue(server, server_cq, NULL); grpc_server_start(server); @@ -88,7 +88,7 @@ static void run_test(const test_fixture *fixture) { gpr_thd_new(&server_thread, server_thread_func, &sta, &thdopt); grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); grpc_channel *channels[NUM_CONNECTIONS]; for (size_t i = 0; i < NUM_CONNECTIONS; i++) { channels[i] = fixture->create_channel(addr); diff --git a/test/core/surface/server_chttp2_test.c b/test/core/surface/server_chttp2_test.c index 9fac63418f9..47e8eeab1e3 100644 --- a/test/core/surface/server_chttp2_test.c +++ b/test/core/surface/server_chttp2_test.c @@ -61,7 +61,7 @@ void test_add_same_port_twice() { int port = grpc_pick_unused_port_or_die(); char *addr = NULL; grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); grpc_server *server = grpc_server_create(&args, NULL); grpc_server_credentials *fake_creds = grpc_fake_transport_security_server_credentials_create(); diff --git a/test/core/surface/server_test.c b/test/core/surface/server_test.c index aa54794d14a..e488966b931 100644 --- a/test/core/surface/server_test.c +++ b/test/core/surface/server_test.c @@ -71,7 +71,7 @@ void test_register_method_fail(void) { void test_request_call_on_no_server_cq(void) { grpc_completion_queue *cc = - grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); grpc_server *server = grpc_server_create(NULL, NULL); GPR_ASSERT(GRPC_CALL_ERROR_NOT_SERVER_COMPLETION_QUEUE == grpc_server_request_call(server, NULL, NULL, NULL, cc, cc, NULL)); @@ -93,7 +93,7 @@ void test_bind_server_twice(void) { grpc_server *server1 = grpc_server_create(&args, NULL); grpc_server *server2 = grpc_server_create(&args, NULL); grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); int port = grpc_pick_unused_port_or_die(); gpr_asprintf(&addr, "[::]:%d", port); grpc_server_register_completion_queue(server1, cq, NULL); @@ -131,7 +131,7 @@ void test_bind_server_to_addr(const char *host, bool secure) { GPR_ASSERT(grpc_server_add_insecure_http2_port(server, addr)); } grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); grpc_server_register_completion_queue(server, cq, NULL); grpc_server_start(server); grpc_server_shutdown_and_notify(server, cq, NULL); diff --git a/test/cpp/grpclb/grpclb_test.cc b/test/cpp/grpclb/grpclb_test.cc index 7fd31a2dbf7..71370ad3b49 100644 --- a/test/cpp/grpclb/grpclb_test.cc +++ b/test/cpp/grpclb/grpclb_test.cc @@ -354,8 +354,9 @@ static void start_backend_server(server_fixture *sf) { } GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); const string expected_token = - strlen(sf->lb_token_prefix) == 0 ? "" : sf->lb_token_prefix + - std::to_string(sf->port); + strlen(sf->lb_token_prefix) == 0 + ? "" + : sf->lb_token_prefix + std::to_string(sf->port); GPR_ASSERT(contains_metadata(&request_metadata_recv, "lb-token", expected_token.c_str())); @@ -593,7 +594,8 @@ static void setup_client(const server_fixture *lb_server, grpc_channel_args_copy_and_add(NULL, &expected_target_arg, 1); gpr_free(expected_target_names); - cf->cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + cf->cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); cf->server_uri = lb_uri; grpc_channel_credentials *fake_creds = grpc_fake_transport_security_credentials_create(); @@ -616,7 +618,8 @@ static void teardown_client(client_fixture *cf) { static void setup_server(const char *host, server_fixture *sf) { int assigned_port; - sf->cq = grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + sf->cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); const char *colon_idx = strchr(host, ':'); if (colon_idx) { const char *port_str = colon_idx + 1; @@ -645,7 +648,7 @@ static void teardown_server(server_fixture *sf) { gpr_log(GPR_INFO, "Server[%s] shutting down", sf->servers_hostport); grpc_completion_queue *shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, NON_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); grpc_server_shutdown_and_notify(sf->server, shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index 21e3374f911..b8aa87dfb34 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -91,7 +91,7 @@ template static void BM_CallCreateDestroy(benchmark::State &state) { Fixture fixture; grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); void *method_hdl = grpc_channel_register_call(fixture.channel(), "/foo/bar", NULL, NULL); diff --git a/test/cpp/microbenchmarks/bm_cq.cc b/test/cpp/microbenchmarks/bm_cq.cc index c7bd8743a57..6fda0081ae2 100644 --- a/test/cpp/microbenchmarks/bm_cq.cc +++ b/test/cpp/microbenchmarks/bm_cq.cc @@ -68,8 +68,8 @@ static void BM_CreateDestroyCore(benchmark::State& state) { while (state.KeepRunning()) { // TODO: sreek Make this a templatized benchmark and pass completion type // and polling type as parameters - grpc_completion_queue_destroy( - grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL)); + grpc_completion_queue_destroy(grpc_completion_queue_create( + GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL)); } } BENCHMARK(BM_CreateDestroyCore); @@ -104,7 +104,7 @@ static void BM_Pass1Core(benchmark::State& state) { // TODO: sreek Make this templatized benchmark and pass polling_type as a // param grpc_completion_queue* cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); while (state.KeepRunning()) { grpc_cq_completion completion; @@ -122,8 +122,8 @@ BENCHMARK(BM_Pass1Core); static void BM_Pluck1Core(benchmark::State& state) { // TODO: sreek Make this templatized benchmark and pass polling_type as a // param - grpc_completion_queue* cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, DEFAULT_POLLING, NULL); + grpc_completion_queue* cq = grpc_completion_queue_create( + GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING, NULL); gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); while (state.KeepRunning()) { grpc_cq_completion completion; @@ -142,7 +142,7 @@ static void BM_EmptyCore(benchmark::State& state) { // TODO: sreek Make this a templatized benchmark and pass polling_type as a // param grpc_completion_queue* cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, DEFAULT_POLLING, NULL); + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); gpr_timespec deadline = gpr_inf_past(GPR_CLOCK_MONOTONIC); while (state.KeepRunning()) { grpc_completion_queue_next(cq, deadline, NULL); From 752be9ceeba1e3958229b2ab0a9d59c072eebb7c Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Fri, 3 Mar 2017 14:36:02 -0800 Subject: [PATCH 031/461] clang format code --- src/core/lib/surface/completion_queue.c | 10 ++++----- src/core/lib/surface/server.c | 10 ++++----- test/core/bad_ssl/server_common.c | 5 ++--- test/core/end2end/fixtures/h2_census.c | 7 +++--- test/core/end2end/fixtures/h2_compress.c | 7 +++--- test/core/end2end/fixtures/h2_full+trace.c | 7 +++--- test/core/end2end/fixtures/h2_full.c | 7 +++--- test/core/end2end/fixtures/h2_proxy.c | 9 ++++---- test/core/end2end/fixtures/h2_ssl_cert.c | 20 ++++++++--------- test/core/end2end/fixtures/h2_uds.c | 7 +++--- test/core/end2end/fuzzers/api_fuzzer.c | 25 +++++++++------------- test/core/end2end/tests/call_creds.c | 5 +++-- test/core/fling/server.c | 5 ++--- test/core/memory_usage/client.c | 5 ++--- test/core/memory_usage/server.c | 5 ++--- test/cpp/grpclb/grpclb_test.cc | 5 ++--- 16 files changed, 59 insertions(+), 80 deletions(-) diff --git a/src/core/lib/surface/completion_queue.c b/src/core/lib/surface/completion_queue.c index ad9d7b20b08..e571733a20e 100644 --- a/src/core/lib/surface/completion_queue.c +++ b/src/core/lib/surface/completion_queue.c @@ -381,9 +381,8 @@ grpc_event grpc_completion_queue_next(grpc_completion_queue *cc, "deadline=gpr_timespec { tv_sec: %" PRId64 ", tv_nsec: %d, clock_type: %d }, " "reserved=%p)", - 5, - (cc, deadline.tv_sec, deadline.tv_nsec, (int)deadline.clock_type, - reserved)); + 5, (cc, deadline.tv_sec, deadline.tv_nsec, (int)deadline.clock_type, + reserved)); GPR_ASSERT(!reserved); dump_pending_tags(cc); @@ -557,9 +556,8 @@ grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cc, void *tag, "deadline=gpr_timespec { tv_sec: %" PRId64 ", tv_nsec: %d, clock_type: %d }, " "reserved=%p)", - 6, - (cc, tag, deadline.tv_sec, deadline.tv_nsec, (int)deadline.clock_type, - reserved)); + 6, (cc, tag, deadline.tv_sec, deadline.tv_nsec, + (int)deadline.clock_type, reserved)); } GPR_ASSERT(!reserved); diff --git a/src/core/lib/surface/server.c b/src/core/lib/surface/server.c index 13f7321facb..7dd320a75be 100644 --- a/src/core/lib/surface/server.c +++ b/src/core/lib/surface/server.c @@ -1431,9 +1431,8 @@ grpc_call_error grpc_server_request_call( "grpc_server_request_call(" "server=%p, call=%p, details=%p, initial_metadata=%p, " "cq_bound_to_call=%p, cq_for_notification=%p, tag=%p)", - 7, - (server, call, details, initial_metadata, cq_bound_to_call, - cq_for_notification, tag)); + 7, (server, call, details, initial_metadata, cq_bound_to_call, + cq_for_notification, tag)); size_t cq_idx; for (cq_idx = 0; cq_idx < server->cq_count; cq_idx++) { if (server->cqs[cq_idx] == cq_for_notification) { @@ -1475,9 +1474,8 @@ grpc_call_error grpc_server_request_registered_call( "server=%p, rmp=%p, call=%p, deadline=%p, initial_metadata=%p, " "optional_payload=%p, cq_bound_to_call=%p, cq_for_notification=%p, " "tag=%p)", - 9, - (server, rmp, call, deadline, initial_metadata, optional_payload, - cq_bound_to_call, cq_for_notification, tag)); + 9, (server, rmp, call, deadline, initial_metadata, optional_payload, + cq_bound_to_call, cq_for_notification, tag)); size_t cq_idx; for (cq_idx = 0; cq_idx < server->cq_count; cq_idx++) { diff --git a/test/core/bad_ssl/server_common.c b/test/core/bad_ssl/server_common.c index b112ae4e780..1176c079b23 100644 --- a/test/core/bad_ssl/server_common.c +++ b/test/core/bad_ssl/server_common.c @@ -97,9 +97,8 @@ void bad_ssl_run(grpc_server *server) { shutdown_started = 1; } ev = grpc_completion_queue_next( - cq, - gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(1000000, GPR_TIMESPAN)), + cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(1000000, GPR_TIMESPAN)), NULL); switch (ev.type) { case GRPC_OP_COMPLETE: diff --git a/test/core/end2end/fixtures/h2_census.c b/test/core/end2end/fixtures/h2_census.c index 1077e063b8b..35a52fa9a91 100644 --- a/test/core/end2end/fixtures/h2_census.c +++ b/test/core/end2end/fixtures/h2_census.c @@ -122,10 +122,9 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack+census", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack+census", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_compress.c b/test/core/end2end/fixtures/h2_compress.c index a985faeb5a7..e6270071519 100644 --- a/test/core/end2end/fixtures/h2_compress.c +++ b/test/core/end2end/fixtures/h2_compress.c @@ -122,10 +122,9 @@ void chttp2_tear_down_fullstack_compression(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack_compression", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack_compression", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack_compression, chttp2_init_client_fullstack_compression, chttp2_init_server_fullstack_compression, diff --git a/test/core/end2end/fixtures/h2_full+trace.c b/test/core/end2end/fixtures/h2_full+trace.c index c24bacc42f4..25a76ca266c 100644 --- a/test/core/end2end/fixtures/h2_full+trace.c +++ b/test/core/end2end/fixtures/h2_full+trace.c @@ -105,10 +105,9 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_full.c b/test/core/end2end/fixtures/h2_full.c index 901a419f253..435d9dfd45f 100644 --- a/test/core/end2end/fixtures/h2_full.c +++ b/test/core/end2end/fixtures/h2_full.c @@ -99,10 +99,9 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_proxy.c b/test/core/end2end/fixtures/h2_proxy.c index 5a64a109181..55eec11b81c 100644 --- a/test/core/end2end/fixtures/h2_proxy.c +++ b/test/core/end2end/fixtures/h2_proxy.c @@ -116,11 +116,10 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack+proxy", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_REQUEST_PROXYING | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack+proxy", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_REQUEST_PROXYING | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_ssl_cert.c b/test/core/end2end/fixtures/h2_ssl_cert.c index c3d25ac836c..cf3bc457418 100644 --- a/test/core/end2end/fixtures/h2_ssl_cert.c +++ b/test/core/end2end/fixtures/h2_ssl_cert.c @@ -206,17 +206,15 @@ CLIENT_INIT(BAD_CERT_PAIR) typedef enum { SUCCESS, FAIL } test_result; -#define SSL_TEST(request_type, cert_type, result) \ - { \ - {TEST_NAME(request_type, cert_type, result), \ - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | \ - FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | \ - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL, \ - chttp2_create_fixture_secure_fullstack, \ - CLIENT_INIT_NAME(cert_type), \ - SERVER_INIT_NAME(request_type), \ - chttp2_tear_down_secure_fullstack}, \ - result \ +#define SSL_TEST(request_type, cert_type, result) \ + { \ + {TEST_NAME(request_type, cert_type, result), \ + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | \ + FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | \ + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL, \ + chttp2_create_fixture_secure_fullstack, CLIENT_INIT_NAME(cert_type), \ + SERVER_INIT_NAME(request_type), chttp2_tear_down_secure_fullstack}, \ + result \ } /* All test configurations */ diff --git a/test/core/end2end/fixtures/h2_uds.c b/test/core/end2end/fixtures/h2_uds.c index 820c587bee5..8f043566b16 100644 --- a/test/core/end2end/fixtures/h2_uds.c +++ b/test/core/end2end/fixtures/h2_uds.c @@ -104,10 +104,9 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack_uds", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack_uds", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fuzzers/api_fuzzer.c b/test/core/end2end/fuzzers/api_fuzzer.c index 278b6dbae0a..88026d9815b 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.c +++ b/test/core/end2end/fuzzers/api_fuzzer.c @@ -314,9 +314,8 @@ static grpc_call_credentials *read_call_creds(input_stream *inp) { cred_artifact_ctx ctx = CRED_ARTIFACT_CTX_INIT; const char *access_token = read_cred_artifact(&ctx, inp, NULL, 0); grpc_call_credentials *out = - access_token == NULL - ? NULL - : grpc_access_token_credentials_create(access_token, NULL); + access_token == NULL ? NULL : grpc_access_token_credentials_create( + access_token, NULL); cred_artifact_ctx_finish(&ctx); return out; } @@ -410,9 +409,8 @@ void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr, r->on_done = on_done; r->addrs = addresses; grpc_timer_init( - exec_ctx, &r->timer, - gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), - gpr_time_from_seconds(1, GPR_TIMESPAN)), + exec_ctx, &r->timer, gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), + gpr_time_from_seconds(1, GPR_TIMESPAN)), grpc_closure_create(finish_resolve, r, grpc_schedule_on_exec_ctx), gpr_now(GPR_CLOCK_MONOTONIC)); } @@ -473,9 +471,8 @@ static void sched_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure, fc->ep = ep; fc->deadline = deadline; grpc_timer_init( - exec_ctx, &fc->timer, - gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), - gpr_time_from_millis(1, GPR_TIMESPAN)), + exec_ctx, &fc->timer, gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), + gpr_time_from_millis(1, GPR_TIMESPAN)), grpc_closure_create(do_connect, fc, grpc_schedule_on_exec_ctx), gpr_now(GPR_CLOCK_MONOTONIC)); } @@ -752,9 +749,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { if (g_server != NULL) { if (!server_shutdown) { grpc_server_shutdown_and_notify( - g_server, cq, - create_validator(assert_success_and_decrement, - &pending_server_shutdowns)); + g_server, cq, create_validator(assert_success_and_decrement, + &pending_server_shutdowns)); server_shutdown = true; pending_server_shutdowns++; } else if (pending_server_shutdowns == 0) { @@ -859,9 +855,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { case 5: { if (g_server != NULL) { grpc_server_shutdown_and_notify( - g_server, cq, - create_validator(assert_success_and_decrement, - &pending_server_shutdowns)); + g_server, cq, create_validator(assert_success_and_decrement, + &pending_server_shutdowns)); pending_server_shutdowns++; server_shutdown = true; } else { diff --git a/test/core/end2end/tests/call_creds.c b/test/core/end2end/tests/call_creds.c index 2a9269345e5..52e7a2a7e47 100644 --- a/test/core/end2end/tests/call_creds.c +++ b/test/core/end2end/tests/call_creds.c @@ -91,8 +91,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), NULL) + GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), + grpc_timeout_seconds_to_deadline(5), + NULL) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; diff --git a/test/core/fling/server.c b/test/core/fling/server.c index 02168c4ea90..4a47fe4cf5a 100644 --- a/test/core/fling/server.c +++ b/test/core/fling/server.c @@ -259,9 +259,8 @@ int main(int argc, char **argv) { shutdown_started = 1; } ev = grpc_completion_queue_next( - cq, - gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(1000000, GPR_TIMESPAN)), + cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(1000000, GPR_TIMESPAN)), NULL); s = ev.tag; switch (ev.type) { diff --git a/test/core/memory_usage/client.c b/test/core/memory_usage/client.c index b2bc2691369..d3eb5ac7c27 100644 --- a/test/core/memory_usage/client.c +++ b/test/core/memory_usage/client.c @@ -261,9 +261,8 @@ int main(int argc, char **argv) { do { event = grpc_completion_queue_next( - cq, - gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(10000, GPR_TIMESPAN)), + cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(10000, GPR_TIMESPAN)), NULL); } while (event.type != GRPC_QUEUE_TIMEOUT); diff --git a/test/core/memory_usage/server.c b/test/core/memory_usage/server.c index 9f4c7fd22ce..437b5473dfc 100644 --- a/test/core/memory_usage/server.c +++ b/test/core/memory_usage/server.c @@ -245,9 +245,8 @@ int main(int argc, char **argv) { shutdown_started = 1; } ev = grpc_completion_queue_next( - cq, - gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(1000000, GPR_TIMESPAN)), + cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(1000000, GPR_TIMESPAN)), NULL); fling_call *s = ev.tag; switch (ev.type) { diff --git a/test/cpp/grpclb/grpclb_test.cc b/test/cpp/grpclb/grpclb_test.cc index 71370ad3b49..c9c569cfbe7 100644 --- a/test/cpp/grpclb/grpclb_test.cc +++ b/test/cpp/grpclb/grpclb_test.cc @@ -354,9 +354,8 @@ static void start_backend_server(server_fixture *sf) { } GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); const string expected_token = - strlen(sf->lb_token_prefix) == 0 - ? "" - : sf->lb_token_prefix + std::to_string(sf->port); + strlen(sf->lb_token_prefix) == 0 ? "" : sf->lb_token_prefix + + std::to_string(sf->port); GPR_ASSERT(contains_metadata(&request_metadata_recv, "lb-token", expected_token.c_str())); From 39bc495a1631a332a551e217de2bb6d69e8bbced Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Fri, 3 Mar 2017 17:48:29 -0800 Subject: [PATCH 032/461] Node: Completion queue API changes --- src/node/ext/completion_queue_threadpool.cc | 19 +++++++++---------- src/node/ext/completion_queue_uv.cc | 21 ++++++++++----------- src/node/ext/server_generic.cc | 5 +++-- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/node/ext/completion_queue_threadpool.cc b/src/node/ext/completion_queue_threadpool.cc index 1917074dc2d..b5227bad650 100644 --- a/src/node/ext/completion_queue_threadpool.cc +++ b/src/node/ext/completion_queue_threadpool.cc @@ -34,14 +34,14 @@ /* I don't like using #ifndef, but I don't see a better way to do this */ #ifndef GRPC_UV -#include #include +#include +#include "call.h" +#include "completion_queue.h" #include "grpc/grpc.h" #include "grpc/support/log.h" #include "grpc/support/time.h" -#include "completion_queue.h" -#include "call.h" namespace grpc { namespace node { @@ -111,8 +111,8 @@ CompletionQueueAsyncWorker::CompletionQueueAsyncWorker() CompletionQueueAsyncWorker::~CompletionQueueAsyncWorker() {} void CompletionQueueAsyncWorker::Execute() { - result = - grpc_completion_queue_next(queue, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + result = grpc_completion_queue_next(queue, gpr_inf_future(GPR_CLOCK_REALTIME), + NULL); if (!result.success) { SetErrorMessage("The async function encountered an error"); } @@ -141,7 +141,8 @@ void CompletionQueueAsyncWorker::Init(Local exports) { Nan::HandleScope scope; current_threads = 0; waiting_next_calls = 0; - queue = grpc_completion_queue_create(NULL); + queue = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); } void CompletionQueueAsyncWorker::HandleOKCallback() { @@ -173,9 +174,7 @@ grpc_completion_queue *GetCompletionQueue() { return CompletionQueueAsyncWorker::GetQueue(); } -void CompletionQueueNext() { - CompletionQueueAsyncWorker::Next(); -} +void CompletionQueueNext() { CompletionQueueAsyncWorker::Next(); } void CompletionQueueInit(Local exports) { CompletionQueueAsyncWorker::Init(exports); @@ -184,4 +183,4 @@ void CompletionQueueInit(Local exports) { } // namespace node } // namespace grpc -#endif /* GRPC_UV */ +#endif /* GRPC_UV */ diff --git a/src/node/ext/completion_queue_uv.cc b/src/node/ext/completion_queue_uv.cc index 615973a6c9b..9c1f093a405 100644 --- a/src/node/ext/completion_queue_uv.cc +++ b/src/node/ext/completion_queue_uv.cc @@ -33,10 +33,10 @@ #ifdef GRPC_UV -#include +#include #include +#include #include -#include #include "call.h" #include "completion_queue.h" @@ -57,18 +57,18 @@ void drain_completion_queue(uv_prepare_t *handle) { grpc_event event; (void)handle; do { - event = grpc_completion_queue_next( - queue, gpr_inf_past(GPR_CLOCK_MONOTONIC), NULL); + event = grpc_completion_queue_next(queue, gpr_inf_past(GPR_CLOCK_MONOTONIC), + NULL); if (event.type == GRPC_OP_COMPLETE) { Nan::Callback *callback = grpc::node::GetTagCallback(event.tag); if (event.success) { Local argv[] = {Nan::Null(), - grpc::node::GetTagNodeValue(event.tag)}; + grpc::node::GetTagNodeValue(event.tag)}; callback->Call(2, argv); } else { - Local argv[] = {Nan::Error( - "The async function encountered an error")}; + Local argv[] = { + Nan::Error("The async function encountered an error")}; callback->Call(1, argv); } grpc::node::CompleteTag(event.tag); @@ -81,9 +81,7 @@ void drain_completion_queue(uv_prepare_t *handle) { } while (event.type != GRPC_QUEUE_TIMEOUT); } -grpc_completion_queue *GetCompletionQueue() { - return queue; -} +grpc_completion_queue *GetCompletionQueue() { return queue; } void CompletionQueueNext() { if (pending_batches == 0) { @@ -94,7 +92,8 @@ void CompletionQueueNext() { } void CompletionQueueInit(Local exports) { - queue = grpc_completion_queue_create(NULL); + queue = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); uv_prepare_init(uv_default_loop(), &prepare); pending_batches = 0; } diff --git a/src/node/ext/server_generic.cc b/src/node/ext/server_generic.cc index 0cf20f754a8..787605aebfa 100644 --- a/src/node/ext/server_generic.cc +++ b/src/node/ext/server_generic.cc @@ -35,8 +35,8 @@ #include "server.h" -#include #include +#include #include "grpc/grpc.h" #include "grpc/support/time.h" @@ -44,7 +44,8 @@ namespace grpc { namespace node { Server::Server(grpc_server *server) : wrapped_server(server) { - shutdown_queue = grpc_completion_queue_create(NULL); + shutdown_queue = grpc_completion_queue_create(GRPC_CQ_PLUCK, + GRPC_CQ_DEFAULT_POLLING, NULL); grpc_server_register_non_listening_completion_queue(server, shutdown_queue, NULL); } From dc1937472a3213ec0d624ed91e72abf470fd6dcc Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 3 Mar 2017 18:25:11 -0800 Subject: [PATCH 033/461] Fix python bug --- .../chttp2/transport/chttp2_transport.c | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 598dae40a05..eec21cf5693 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1339,6 +1339,11 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op, } else { gpr_mu_unlock(&s->buffer_mu); } + gpr_mu_lock(&s->buffer_mu); + if (s->incoming_frames == NULL && s->unprocessed_incoming_frames_buffer.count > 0) { + deframe_unprocessed_incoming_frames(exec_ctx, &s->data_parser, t, s, &s->unprocessed_incoming_frames_buffer, NULL, true); + } + gpr_mu_unlock(&s->buffer_mu); grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); } @@ -1539,18 +1544,23 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, exec_ctx, &s->unprocessed_incoming_frames_buffer); gpr_mu_unlock(&s->buffer_mu); } + gpr_mu_lock(&s->buffer_mu); if (s->incoming_frames != NULL) { *s->recv_message = &s->incoming_frames->base; s->incoming_frames = NULL; GPR_ASSERT(*s->recv_message != NULL); - null_then_run_closure(exec_ctx, &s->recv_message_ready, GRPC_ERROR_NONE); + grpc_closure_sched(exec_ctx, s->recv_message_ready, GRPC_ERROR_NONE); + s->recv_message_ready = NULL; } else if (error != GRPC_ERROR_NONE) { GPR_ASSERT(s->incoming_frames == NULL); - null_then_run_closure(exec_ctx, &s->recv_message_ready, error); + grpc_closure_sched(exec_ctx, s->recv_message_ready, error); + s->recv_message_ready = NULL; } else if (s->published_metadata[1] != GRPC_METADATA_NOT_PUBLISHED) { *s->recv_message = NULL; - null_then_run_closure(exec_ctx, &s->recv_message_ready, GRPC_ERROR_NONE); + grpc_closure_sched(exec_ctx, s->recv_message_ready, GRPC_ERROR_NONE); + s->recv_message_ready = NULL; } + gpr_mu_unlock(&s->buffer_mu); } } @@ -2330,6 +2340,15 @@ static grpc_error *deframe_unprocessed_incoming_frames( exec_ctx, t, s, p->frame_size, message_flags); /* fallthrough */ case GRPC_CHTTP2_DATA_FRAME: { + GPR_ASSERT(p->parsing_frame != NULL); + if (partial_deframe) { + if (cur != end) { + grpc_slice_buffer_undo_take_first(&s->unprocessed_incoming_frames_buffer, + grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + } + grpc_slice_unref_internal(exec_ctx, slice); + return GRPC_ERROR_NONE; + } if (slice_set) { grpc_slice_buffer_undo_take_first( &s->unprocessed_incoming_frames_buffer, @@ -2337,10 +2356,6 @@ static grpc_error *deframe_unprocessed_incoming_frames( grpc_slice_unref_internal(exec_ctx, slice); return GRPC_ERROR_NONE; } - if (p->parsing_frame == NULL) { - - return GRPC_ERROR_NONE; - } uint32_t remaining = (uint32_t)(end - cur); if (cur == end) { grpc_slice_unref_internal(exec_ctx, slice); From 98ab52003a7afbf1dc193d80ebecbb9d503078a9 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Fri, 3 Mar 2017 18:28:47 -0800 Subject: [PATCH 034/461] Ruby: Completion queue creation API changes --- src/ruby/ext/grpc/rb_channel.c | 80 +++++++++++++++++----------------- src/ruby/ext/grpc/rb_server.c | 57 ++++++++++++------------ 2 files changed, 67 insertions(+), 70 deletions(-) diff --git a/src/ruby/ext/grpc/rb_channel.c b/src/ruby/ext/grpc/rb_channel.c index 84e43d3f7bf..2b9f03abd4a 100644 --- a/src/ruby/ext/grpc/rb_channel.c +++ b/src/ruby/ext/grpc/rb_channel.c @@ -33,20 +33,20 @@ #include -#include "rb_grpc_imports.generated.h" -#include "rb_channel.h" #include "rb_byte_buffer.h" +#include "rb_channel.h" +#include "rb_grpc_imports.generated.h" #include #include #include #include #include -#include "rb_grpc.h" #include "rb_call.h" #include "rb_channel_args.h" #include "rb_channel_credentials.h" #include "rb_completion_queue.h" +#include "rb_grpc.h" #include "rb_server.h" /* id_channel is the name of the hidden ivar that preserves a reference to the @@ -104,13 +104,15 @@ static void grpc_rb_channel_mark(void *p) { } } -static rb_data_type_t grpc_channel_data_type = { - "grpc_channel", - {grpc_rb_channel_mark, grpc_rb_channel_free, GRPC_RB_MEMSIZE_UNAVAILABLE, - {NULL, NULL}}, - NULL, NULL, +static rb_data_type_t grpc_channel_data_type = {"grpc_channel", + {grpc_rb_channel_mark, + grpc_rb_channel_free, + GRPC_RB_MEMSIZE_UNAVAILABLE, + {NULL, NULL}}, + NULL, + NULL, #ifdef RUBY_TYPED_FREE_IMMEDIATELY - RUBY_TYPED_FREE_IMMEDIATELY + RUBY_TYPED_FREE_IMMEDIATELY #endif }; @@ -169,7 +171,8 @@ static VALUE grpc_rb_channel_init(int argc, VALUE *argv, VALUE self) { } rb_ivar_set(self, id_target, target); wrapper->wrapped = ch; - wrapper->queue = grpc_completion_queue_create(NULL); + wrapper->queue = grpc_completion_queue_create(GRPC_CQ_PLUCK, + GRPC_CQ_DEFAULT_POLLING, NULL); return self; } @@ -225,14 +228,11 @@ static VALUE grpc_rb_channel_watch_connectivity_state(VALUE self, return Qnil; } grpc_channel_watch_connectivity_state( - ch, - (grpc_connectivity_state)NUM2LONG(last_state), - grpc_rb_time_timeval(deadline, /* absolute time */ 0), - cq, - tag); + ch, (grpc_connectivity_state)NUM2LONG(last_state), + grpc_rb_time_timeval(deadline, /* absolute time */ 0), cq, tag); - event = rb_completion_queue_pluck(cq, tag, - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + event = rb_completion_queue_pluck(cq, tag, gpr_inf_future(GPR_CLOCK_REALTIME), + NULL); if (event.success) { return Qtrue; @@ -243,9 +243,9 @@ static VALUE grpc_rb_channel_watch_connectivity_state(VALUE self, /* Create a call given a grpc_channel, in order to call method. The request is not sent until grpc_call_invoke is called. */ -static VALUE grpc_rb_channel_create_call(VALUE self, VALUE parent, - VALUE mask, VALUE method, - VALUE host, VALUE deadline) { +static VALUE grpc_rb_channel_create_call(VALUE self, VALUE parent, VALUE mask, + VALUE method, VALUE host, + VALUE deadline) { VALUE res = Qnil; grpc_rb_channel *wrapper = NULL; grpc_call *call = NULL; @@ -256,10 +256,11 @@ static VALUE grpc_rb_channel_create_call(VALUE self, VALUE parent, grpc_slice method_slice; grpc_slice host_slice; grpc_slice *host_slice_ptr = NULL; - char* tmp_str = NULL; + char *tmp_str = NULL; if (host != Qnil) { - host_slice = grpc_slice_from_copied_buffer(RSTRING_PTR(host), RSTRING_LEN(host)); + host_slice = + grpc_slice_from_copied_buffer(RSTRING_PTR(host), RSTRING_LEN(host)); host_slice_ptr = &host_slice; } if (mask != Qnil) { @@ -269,7 +270,8 @@ static VALUE grpc_rb_channel_create_call(VALUE self, VALUE parent, parent_call = grpc_rb_get_wrapped_call(parent); } - cq = grpc_completion_queue_create(NULL); + cq = grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING, + NULL); TypedData_Get_Struct(self, grpc_rb_channel, &grpc_channel_data_type, wrapper); ch = wrapper->wrapped; if (ch == NULL) { @@ -277,17 +279,18 @@ static VALUE grpc_rb_channel_create_call(VALUE self, VALUE parent, return Qnil; } - method_slice = grpc_slice_from_copied_buffer(RSTRING_PTR(method), RSTRING_LEN(method)); + method_slice = + grpc_slice_from_copied_buffer(RSTRING_PTR(method), RSTRING_LEN(method)); call = grpc_channel_create_call(ch, parent_call, flags, cq, method_slice, - host_slice_ptr, grpc_rb_time_timeval( - deadline, - /* absolute time */ 0), NULL); + host_slice_ptr, + grpc_rb_time_timeval(deadline, + /* absolute time */ 0), + NULL); if (call == NULL) { tmp_str = grpc_slice_to_c_string(method_slice); - rb_raise(rb_eRuntimeError, "cannot create call with method %s", - tmp_str); + rb_raise(rb_eRuntimeError, "cannot create call with method %s", tmp_str); return Qnil; } @@ -304,7 +307,6 @@ static VALUE grpc_rb_channel_create_call(VALUE self, VALUE parent, return res; } - /* Closes the channel, calling it's destroy method */ static VALUE grpc_rb_channel_destroy(VALUE self) { grpc_rb_channel *wrapper = NULL; @@ -320,12 +322,11 @@ static VALUE grpc_rb_channel_destroy(VALUE self) { return Qnil; } - /* Called to obtain the target that this channel accesses. */ static VALUE grpc_rb_channel_get_target(VALUE self) { grpc_rb_channel *wrapper = NULL; VALUE res = Qnil; - char* target = NULL; + char *target = NULL; TypedData_Get_Struct(self, grpc_rb_channel, &grpc_channel_data_type, wrapper); target = grpc_channel_get_target(wrapper->wrapped); @@ -337,8 +338,8 @@ static VALUE grpc_rb_channel_get_target(VALUE self) { static void Init_grpc_propagate_masks() { /* Constants representing call propagation masks in grpc.h */ - VALUE grpc_rb_mPropagateMasks = rb_define_module_under( - grpc_rb_mGrpcCore, "PropagateMasks"); + VALUE grpc_rb_mPropagateMasks = + rb_define_module_under(grpc_rb_mGrpcCore, "PropagateMasks"); rb_define_const(grpc_rb_mPropagateMasks, "DEADLINE", UINT2NUM(GRPC_PROPAGATE_DEADLINE)); rb_define_const(grpc_rb_mPropagateMasks, "CENSUS_STATS_CONTEXT", @@ -353,8 +354,8 @@ static void Init_grpc_propagate_masks() { static void Init_grpc_connectivity_states() { /* Constants representing call propagation masks in grpc.h */ - VALUE grpc_rb_mConnectivityStates = rb_define_module_under( - grpc_rb_mGrpcCore, "ConnectivityStates"); + VALUE grpc_rb_mConnectivityStates = + rb_define_module_under(grpc_rb_mGrpcCore, "ConnectivityStates"); rb_define_const(grpc_rb_mConnectivityStates, "IDLE", LONG2NUM(GRPC_CHANNEL_IDLE)); rb_define_const(grpc_rb_mConnectivityStates, "CONNECTING", @@ -382,12 +383,11 @@ void Init_grpc_channel() { /* Add ruby analogues of the Channel methods. */ rb_define_method(grpc_rb_cChannel, "connectivity_state", - grpc_rb_channel_get_connectivity_state, - -1); + grpc_rb_channel_get_connectivity_state, -1); rb_define_method(grpc_rb_cChannel, "watch_connectivity_state", grpc_rb_channel_watch_connectivity_state, 4); - rb_define_method(grpc_rb_cChannel, "create_call", - grpc_rb_channel_create_call, 5); + rb_define_method(grpc_rb_cChannel, "create_call", grpc_rb_channel_create_call, + 5); rb_define_method(grpc_rb_cChannel, "target", grpc_rb_channel_get_target, 0); rb_define_method(grpc_rb_cChannel, "destroy", grpc_rb_channel_destroy, 0); rb_define_alias(grpc_rb_cChannel, "close", "destroy"); diff --git a/src/ruby/ext/grpc/rb_server.c b/src/ruby/ext/grpc/rb_server.c index 7b2f5774aa1..a0e8f15294b 100644 --- a/src/ruby/ext/grpc/rb_server.c +++ b/src/ruby/ext/grpc/rb_server.c @@ -37,15 +37,15 @@ #include "rb_server.h" #include -#include #include +#include #include +#include "rb_byte_buffer.h" #include "rb_call.h" #include "rb_channel_args.h" #include "rb_completion_queue.h" -#include "rb_server_credentials.h" -#include "rb_byte_buffer.h" #include "rb_grpc.h" +#include "rb_server_credentials.h" /* grpc_rb_cServer is the ruby class that proxies grpc_server. */ static VALUE grpc_rb_cServer = Qnil; @@ -93,9 +93,8 @@ static void grpc_rb_server_free(void *p) { }; svr = (grpc_rb_server *)p; - deadline = gpr_time_add( - gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_seconds(2, GPR_TIMESPAN)); + deadline = gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_seconds(2, GPR_TIMESPAN)); destroy_server(svr, deadline); @@ -104,13 +103,15 @@ static void grpc_rb_server_free(void *p) { static const rb_data_type_t grpc_rb_server_data_type = { "grpc_server", - {GRPC_RB_GC_NOT_MARKED, grpc_rb_server_free, GRPC_RB_MEMSIZE_UNAVAILABLE, + {GRPC_RB_GC_NOT_MARKED, + grpc_rb_server_free, + GRPC_RB_MEMSIZE_UNAVAILABLE, {NULL, NULL}}, NULL, NULL, #ifdef RUBY_TYPED_FREE_IMMEDIATELY - /* It is unsafe to specify RUBY_TYPED_FREE_IMMEDIATELY because the free function would block - * and we might want to unlock GVL + /* It is unsafe to specify RUBY_TYPED_FREE_IMMEDIATELY because the free + * function would block and we might want to unlock GVL * TODO(yugui) Unlock GVL? */ 0, @@ -131,7 +132,8 @@ static VALUE grpc_rb_server_alloc(VALUE cls) { Initializes server instances. */ static VALUE grpc_rb_server_init(VALUE self, VALUE channel_args) { - grpc_completion_queue *cq = grpc_completion_queue_create(NULL); + grpc_completion_queue *cq = grpc_completion_queue_create( + GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING, NULL); grpc_rb_server *wrapper = NULL; grpc_server *srv = NULL; grpc_channel_args args; @@ -163,7 +165,7 @@ typedef struct request_call_stack { /* grpc_request_call_stack_init ensures the request_call_stack is properly * initialized */ -static void grpc_request_call_stack_init(request_call_stack* st) { +static void grpc_request_call_stack_init(request_call_stack *st) { MEMZERO(st, request_call_stack, 1); grpc_metadata_array_init(&st->md_ary); grpc_call_details_init(&st->details); @@ -171,7 +173,7 @@ static void grpc_request_call_stack_init(request_call_stack* st) { /* grpc_request_call_stack_cleanup ensures the request_call_stack is properly * cleaned up */ -static void grpc_request_call_stack_cleanup(request_call_stack* st) { +static void grpc_request_call_stack_cleanup(request_call_stack *st) { grpc_metadata_array_destroy(&st->md_ary); grpc_call_details_destroy(&st->details); } @@ -187,8 +189,9 @@ static VALUE grpc_rb_server_request_call(VALUE self) { grpc_call_error err; request_call_stack st; VALUE result; - void *tag = (void*)&st; - grpc_completion_queue *call_queue = grpc_completion_queue_create(NULL); + void *tag = (void *)&st; + grpc_completion_queue *call_queue = grpc_completion_queue_create( + GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING, NULL); gpr_timespec deadline; TypedData_Get_Struct(self, grpc_rb_server, &grpc_rb_server_data_type, s); @@ -199,9 +202,8 @@ static VALUE grpc_rb_server_request_call(VALUE self) { grpc_request_call_stack_init(&st); /* call grpc_server_request_call, then wait for it to complete using * pluck_event */ - err = grpc_server_request_call( - s->wrapped, &call, &st.details, &st.md_ary, - call_queue, s->queue, tag); + err = grpc_server_request_call(s->wrapped, &call, &st.details, &st.md_ary, + call_queue, s->queue, tag); if (err != GRPC_CALL_OK) { grpc_request_call_stack_cleanup(&st); rb_raise(grpc_rb_eCallError, @@ -218,8 +220,6 @@ static VALUE grpc_rb_server_request_call(VALUE self) { return Qnil; } - - /* build the NewServerRpc struct result */ deadline = gpr_convert_clock_type(st.details.deadline, GPR_CLOCK_REALTIME); result = rb_struct_new( @@ -299,8 +299,7 @@ static VALUE grpc_rb_server_add_http2_port(VALUE self, VALUE port, return Qnil; } else if (TYPE(rb_creds) == T_SYMBOL) { if (id_insecure_server != SYM2ID(rb_creds)) { - rb_raise(rb_eTypeError, - "bad creds symbol, want :this_port_is_insecure"); + rb_raise(rb_eTypeError, "bad creds symbol, want :this_port_is_insecure"); return Qnil; } recvd_port = @@ -312,9 +311,8 @@ static VALUE grpc_rb_server_add_http2_port(VALUE self, VALUE port, } } else { creds = grpc_rb_get_wrapped_server_credentials(rb_creds); - recvd_port = - grpc_server_add_secure_http2_port(s->wrapped, StringValueCStr(port), - creds); + recvd_port = grpc_server_add_secure_http2_port( + s->wrapped, StringValueCStr(port), creds); if (recvd_port == 0) { rb_raise(rb_eRuntimeError, "could not add secure port %s to server, not sure why", @@ -333,18 +331,17 @@ void Init_grpc_server() { /* Provides a ruby constructor and support for dup/clone. */ rb_define_method(grpc_rb_cServer, "initialize", grpc_rb_server_init, 1); - rb_define_method(grpc_rb_cServer, "initialize_copy", - grpc_rb_cannot_init_copy, 1); + rb_define_method(grpc_rb_cServer, "initialize_copy", grpc_rb_cannot_init_copy, + 1); /* Add the server methods. */ - rb_define_method(grpc_rb_cServer, "request_call", - grpc_rb_server_request_call, 0); + rb_define_method(grpc_rb_cServer, "request_call", grpc_rb_server_request_call, + 0); rb_define_method(grpc_rb_cServer, "start", grpc_rb_server_start, 0); rb_define_method(grpc_rb_cServer, "destroy", grpc_rb_server_destroy, -1); rb_define_alias(grpc_rb_cServer, "close", "destroy"); rb_define_method(grpc_rb_cServer, "add_http2_port", - grpc_rb_server_add_http2_port, - 2); + grpc_rb_server_add_http2_port, 2); id_at = rb_intern("at"); id_insecure_server = rb_intern("this_port_is_insecure"); } From e7e38da2373d369a325a247582732771a196b745 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Fri, 3 Mar 2017 18:38:06 -0800 Subject: [PATCH 035/461] Remove the check that ensures server completion queues are of type GRPC_CQ_NEXT (because ruby uses GRPC_CQ_PLUCK only) --- src/core/lib/surface/server.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/core/lib/surface/server.c b/src/core/lib/surface/server.c index 7dd320a75be..7ebe130751f 100644 --- a/src/core/lib/surface/server.c +++ b/src/core/lib/surface/server.c @@ -1003,10 +1003,11 @@ void grpc_server_register_completion_queue(grpc_server *server, (server, cq, reserved)); if (grpc_get_cq_completion_type(cq) != GRPC_CQ_NEXT) { - gpr_log( - GPR_ERROR, - "Server completion queues must have a completion type of GRPC_CQ_NEXT"); - abort(); + gpr_log(GPR_INFO, + "Completion queue which is not of type GRPC_CQ_NEXT is being " + "registered as a server-completion-queue"); + /* Ideally we should log an error and abort but ruby-wrapped-language API + calls grpc_completion_queue_pluck() on server completion queues */ } register_completion_queue(server, cq, false, reserved); From 6f10b56649fe96859edda8c100256813db602fa9 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 3 Mar 2017 18:41:46 -0800 Subject: [PATCH 036/461] bug fix --- src/core/ext/transport/chttp2/transport/chttp2_transport.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index eec21cf5693..e221ef36a62 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1544,7 +1544,6 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, exec_ctx, &s->unprocessed_incoming_frames_buffer); gpr_mu_unlock(&s->buffer_mu); } - gpr_mu_lock(&s->buffer_mu); if (s->incoming_frames != NULL) { *s->recv_message = &s->incoming_frames->base; s->incoming_frames = NULL; @@ -1560,7 +1559,6 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, grpc_closure_sched(exec_ctx, s->recv_message_ready, GRPC_ERROR_NONE); s->recv_message_ready = NULL; } - gpr_mu_unlock(&s->buffer_mu); } } From 013a8b9a55f899e23429e74a49b5341079095a8f Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Fri, 3 Mar 2017 18:55:48 -0800 Subject: [PATCH 037/461] Objective-C: Completion queue creation API changes --- src/objective-c/GRPCClient/private/GRPCCompletionQueue.m | 4 +++- .../tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m | 3 ++- src/objective-c/tests/CronetUnitTests/CronetUnitTests.m | 8 ++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m index 539b5ab83ce..8edb4ef0488 100644 --- a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m +++ b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m @@ -48,7 +48,9 @@ - (instancetype)init { if ((self = [super init])) { - _unmanagedQueue = grpc_completion_queue_create(NULL); + _unmanagedQueue = grpc_completion_queue_create(GRPC_CQ_NEXT, + GRPC_CQ_DEFAULT_POLLING, + NULL); // This is for the following block to capture the pointer by value (instead // of retaining self and doing self->_unmanagedQueue). This is essential diff --git a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m index 1e0c8024cab..7656fb8d510 100644 --- a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m +++ b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m @@ -79,7 +79,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( gpr_join_host_port(&ffd->localaddr, "127.0.0.1", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(NULL); + f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, + NULL); return f; } diff --git a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m index e97f3d2d1a9..1840894d815 100644 --- a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m +++ b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m @@ -160,7 +160,9 @@ unsigned int parse_h2_length(const char *field) { int port = grpc_pick_unused_port_or_die(); char *addr; gpr_join_host_port(&addr, "127.0.0.1", port); - grpc_completion_queue *cq = grpc_completion_queue_create(NULL); + grpc_completion_queue *cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, + NULL); stream_engine *cronetEngine = [Cronet getGlobalEngine]; grpc_channel *client = grpc_cronet_secure_channel_create(cronetEngine, addr, NULL, NULL); @@ -294,7 +296,9 @@ unsigned int parse_h2_length(const char *field) { int port = grpc_pick_unused_port_or_die(); char *addr; gpr_join_host_port(&addr, "127.0.0.1", port); - grpc_completion_queue *cq = grpc_completion_queue_create(NULL); + grpc_completion_queue *cq = + grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, + NULL); stream_engine *cronetEngine = [Cronet getGlobalEngine]; grpc_channel *client = grpc_cronet_secure_channel_create(cronetEngine, addr, args, NULL); From 15e23ecb74492637f9ef6fa9a262c63ad1d6f259 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sat, 4 Mar 2017 15:01:24 -0800 Subject: [PATCH 038/461] Bug fix and clang-format --- src/core/ext/transport/chttp2/transport/frame_data.c | 10 ++++++++++ src/core/ext/transport/chttp2/transport/internal.h | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c index a53241ad30d..cfa9a3d3c5f 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -189,6 +189,7 @@ grpc_error *parse_inner_buffer(grpc_exec_ctx *exec_ctx, p->state = GRPC_CHTTP2_DATA_ERROR; gpr_mu_unlock(&s->buffer_mu); return GRPC_ERROR_REF(p->error); + fh_0: case GRPC_CHTTP2_DATA_FH_0: if (s->incoming_frames != NULL) { s->stats.incoming.framing_bytes += (size_t)(end - cur); @@ -270,6 +271,15 @@ grpc_error *parse_inner_buffer(grpc_exec_ctx *exec_ctx, exec_ctx, t, s, p->frame_size, message_flags); /* fallthrough */ case GRPC_CHTTP2_DATA_FRAME: + if (p->parsing_frame->remaining_bytes == 0) { + grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, + GRPC_ERROR_NONE); + p->parsing_frame = NULL; + p->state = GRPC_CHTTP2_DATA_FH_0; + if (cur != end) { + goto fh_0; + } + } if (cur == end) { gpr_mu_unlock(&s->buffer_mu); return GRPC_ERROR_NONE; diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 5ec107c3f32..54bfd42357d 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -791,9 +791,9 @@ void grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, void grpc_chttp2_incoming_byte_stream_finished( grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, grpc_error *error); -void grpc_chttp2_incoming_byte_stream_notify(grpc_exec_ctx *exec_ctx, - grpc_chttp2_incoming_byte_stream *bs, - grpc_error *error); +void grpc_chttp2_incoming_byte_stream_notify( + grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, + grpc_error *error); void grpc_chttp2_ack_ping(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, uint64_t id); From 8e6f3371b350030a5f656d1a94e008f30b37f898 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sat, 4 Mar 2017 16:28:11 -0800 Subject: [PATCH 039/461] bug fix --- .../chttp2/transport/chttp2_transport.c | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index e221ef36a62..51bb47127fb 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -2263,12 +2263,11 @@ static grpc_error *deframe_unprocessed_incoming_frames( return GRPC_ERROR_REF(p->error); fh_0: case GRPC_CHTTP2_DATA_FH_0: - GPR_ASSERT(s->incoming_frames == NULL); if (s->incoming_frames != NULL) { - s->stats.incoming.framing_bytes += (size_t)(end - cur); grpc_slice_buffer_undo_take_first( &s->unprocessed_incoming_frames_buffer, grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + grpc_slice_unref_internal(exec_ctx, slice); return GRPC_ERROR_NONE; } p->frame_type = *cur; @@ -2339,7 +2338,7 @@ static grpc_error *deframe_unprocessed_incoming_frames( /* fallthrough */ case GRPC_CHTTP2_DATA_FRAME: { GPR_ASSERT(p->parsing_frame != NULL); - if (partial_deframe) { + if (partial_deframe && p->frame_size > 0) { if (cur != end) { grpc_slice_buffer_undo_take_first(&s->unprocessed_incoming_frames_buffer, grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); @@ -2347,6 +2346,10 @@ static grpc_error *deframe_unprocessed_incoming_frames( grpc_slice_unref_internal(exec_ctx, slice); return GRPC_ERROR_NONE; } + if (cur == end) { + grpc_slice_unref_internal(exec_ctx, slice); + continue; + } if (slice_set) { grpc_slice_buffer_undo_take_first( &s->unprocessed_incoming_frames_buffer, @@ -2355,10 +2358,6 @@ static grpc_error *deframe_unprocessed_incoming_frames( return GRPC_ERROR_NONE; } uint32_t remaining = (uint32_t)(end - cur); - if (cur == end) { - grpc_slice_unref_internal(exec_ctx, slice); - continue; - } if (remaining == p->frame_size) { grpc_chttp2_incoming_byte_stream_push( exec_ctx, p->parsing_frame, @@ -2382,11 +2381,13 @@ static grpc_error *deframe_unprocessed_incoming_frames( continue; } else { GPR_ASSERT(remaining > p->frame_size); - grpc_chttp2_incoming_byte_stream_push( - exec_ctx, p->parsing_frame, - grpc_slice_sub(slice, (size_t)(cur - beg), - (size_t)(cur + p->frame_size - beg)), - slice_out); + if (p->frame_size > 0) { + grpc_chttp2_incoming_byte_stream_push( + exec_ctx, p->parsing_frame, + grpc_slice_sub(slice, (size_t)(cur - beg), + (size_t)(cur + p->frame_size - beg)), + slice_out); + } slice_set = true; grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, GRPC_ERROR_NONE); @@ -2595,7 +2596,9 @@ void grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, exec_ctx, bs, GRPC_ERROR_CREATE("Too many bytes in stream")); } else { bs->remaining_bytes -= (uint32_t)GRPC_SLICE_LENGTH(slice); - *slice_out = slice; + if (slice_out != NULL) { + *slice_out = slice; + } } } From e4f9eb4e6f9ecc6cd61c0fd7d2eaeea266709d94 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sat, 4 Mar 2017 22:07:46 -0800 Subject: [PATCH 040/461] clang-format --- .../chttp2/transport/chttp2_transport.c | 22 ++++++++++++------- .../transport/chttp2/transport/frame_data.c | 3 ++- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 51bb47127fb..b1fa3595f24 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1340,8 +1340,11 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op, gpr_mu_unlock(&s->buffer_mu); } gpr_mu_lock(&s->buffer_mu); - if (s->incoming_frames == NULL && s->unprocessed_incoming_frames_buffer.count > 0) { - deframe_unprocessed_incoming_frames(exec_ctx, &s->data_parser, t, s, &s->unprocessed_incoming_frames_buffer, NULL, true); + if (s->incoming_frames == NULL && + s->unprocessed_incoming_frames_buffer.count > 0) { + deframe_unprocessed_incoming_frames( + exec_ctx, &s->data_parser, t, s, + &s->unprocessed_incoming_frames_buffer, NULL, true); } gpr_mu_unlock(&s->buffer_mu); grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); @@ -2340,8 +2343,10 @@ static grpc_error *deframe_unprocessed_incoming_frames( GPR_ASSERT(p->parsing_frame != NULL); if (partial_deframe && p->frame_size > 0) { if (cur != end) { - grpc_slice_buffer_undo_take_first(&s->unprocessed_incoming_frames_buffer, - grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + grpc_slice_buffer_undo_take_first( + &s->unprocessed_incoming_frames_buffer, + grpc_slice_sub(slice, (size_t)(cur - beg), + (size_t)(end - beg))); } grpc_slice_unref_internal(exec_ctx, slice); return GRPC_ERROR_NONE; @@ -2490,7 +2495,8 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx *exec_ctx, } else { /* Should never reach here. */ GPR_ASSERT(false); - grpc_closure_sched(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_NONE); + grpc_closure_sched(exec_ctx, bs->next_action.on_complete, + GRPC_ERROR_NONE); } } else { bs->on_next = bs->next_action.on_complete; @@ -2602,9 +2608,9 @@ void grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, } } -void grpc_chttp2_incoming_byte_stream_notify(grpc_exec_ctx *exec_ctx, - grpc_chttp2_incoming_byte_stream *bs, - grpc_error *error) { +void grpc_chttp2_incoming_byte_stream_notify( + grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, + grpc_error *error) { gpr_mu_lock(&bs->slice_mu); if (bs->on_next) { grpc_closure_sched(exec_ctx, bs->next_action.on_complete, error); diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c index cfa9a3d3c5f..eed5c923765 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -289,7 +289,8 @@ grpc_error *parse_inner_buffer(grpc_exec_ctx *exec_ctx, grpc_chttp2_unprocessed_frames_buffer_push( exec_ctx, p, s, grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); - grpc_chttp2_incoming_byte_stream_notify(exec_ctx, p->parsing_frame, GRPC_ERROR_NONE); + grpc_chttp2_incoming_byte_stream_notify(exec_ctx, p->parsing_frame, + GRPC_ERROR_NONE); gpr_mu_unlock(&s->buffer_mu); return GRPC_ERROR_NONE; } From bd0a295b2a4f8a35c18330e3e83b6ae5537de4ea Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sun, 5 Mar 2017 16:49:10 -0800 Subject: [PATCH 041/461] Destroy slice buffer bug --- .../ext/transport/chttp2/transport/chttp2_transport.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index b1fa3595f24..9ec0bd02c27 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -630,15 +630,15 @@ static void destroy_stream_locked(grpc_exec_ctx *exec_ctx, void *sp, GPR_ASSERT(grpc_chttp2_stream_map_find(&t->stream_map, s->id) == NULL); } + gpr_mu_lock(&s->buffer_mu); + grpc_slice_buffer_destroy_internal(exec_ctx, + &s->unprocessed_incoming_frames_buffer); if (s->incoming_frames != NULL) { grpc_chttp2_incoming_byte_stream *ibs = s->incoming_frames; s->incoming_frames = NULL; incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, GRPC_ERROR_NONE); - gpr_mu_lock(&s->buffer_mu); - grpc_slice_buffer_destroy_internal(exec_ctx, - &s->unprocessed_incoming_frames_buffer); - gpr_mu_unlock(&s->buffer_mu); } + gpr_mu_unlock(&s->buffer_mu); grpc_chttp2_list_remove_stalled_by_transport(t, s); grpc_chttp2_list_remove_stalled_by_stream(t, s); From 24c131cbfd2201112df63d4f67dd9310a1ae671d Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sun, 5 Mar 2017 19:54:52 -0800 Subject: [PATCH 042/461] Bug fix --- src/core/ext/transport/chttp2/transport/chttp2_transport.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 9ec0bd02c27..618d9336471 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1519,7 +1519,7 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_exec_ctx *exec_ctx, incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, GRPC_ERROR_NONE); gpr_mu_lock(&s->buffer_mu); - grpc_slice_buffer_destroy_internal( + grpc_slice_buffer_reset_and_unref_internal( exec_ctx, &s->unprocessed_incoming_frames_buffer); gpr_mu_unlock(&s->buffer_mu); } @@ -1543,7 +1543,7 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, GRPC_ERROR_NONE); gpr_mu_lock(&s->buffer_mu); - grpc_slice_buffer_destroy_internal( + grpc_slice_buffer_reset_and_unref_internal( exec_ctx, &s->unprocessed_incoming_frames_buffer); gpr_mu_unlock(&s->buffer_mu); } @@ -1578,7 +1578,7 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx *exec_ctx, incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, GRPC_ERROR_NONE); gpr_mu_lock(&s->buffer_mu); - grpc_slice_buffer_destroy_internal( + grpc_slice_buffer_reset_and_unref_internal( exec_ctx, &s->unprocessed_incoming_frames_buffer); gpr_mu_unlock(&s->buffer_mu); } From b4a6f908caf27996e0474c3f482e8929dfb3126c Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Mon, 6 Mar 2017 10:53:47 -0800 Subject: [PATCH 043/461] Python: Completion queue creation API changes --- .../grpc/_cython/_cygrpc/completion_queue.pyx.pxi | 2 +- src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pyx.pxi index d8df6c2ef40..368919b62f0 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pyx.pxi @@ -40,7 +40,7 @@ cdef class CompletionQueue: def __cinit__(self): grpc_init() with nogil: - self.c_completion_queue = grpc_completion_queue_create(NULL) + self.c_completion_queue = grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL) self.is_shutting_down = False self.is_shutdown = False diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi index bbd72424b9b..b26b240b4e5 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi @@ -309,7 +309,20 @@ cdef extern from "grpc/grpc.h": void grpc_init() nogil void grpc_shutdown() nogil - grpc_completion_queue *grpc_completion_queue_create(void *reserved) nogil + ctypedef enum grpc_cq_completion_type: + GRPC_CQ_NEXT = 1 + GRPC_CQ_PLUCK = 2 + + ctypedef enum grpc_cq_polling_type: + GRPC_CQ_DEFAULT_POLLING + GRPC_CQ_NON_LISTENING + GRPC_CQ_NON_POLLING + + grpc_completion_queue *grpc_completion_queue_create( + grpc_cq_completion_type completion_type, + grpc_cq_polling_type polling_type, + void *reserved) nogil + grpc_event grpc_completion_queue_next(grpc_completion_queue *cq, gpr_timespec deadline, void *reserved) nogil From b17764905eb4f589dc9612f37490e165c6548539 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 7 Mar 2017 14:20:40 -0800 Subject: [PATCH 044/461] Fix a bug in receiving_slice_ready --- src/core/lib/surface/call.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 7baa8e10a59..4471ada106e 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -1197,6 +1197,7 @@ static void receiving_slice_ready(grpc_exec_ctx *exec_ctx, void *bctlp, call->receiving_stream = NULL; grpc_byte_buffer_destroy(*call->receiving_buffer); *call->receiving_buffer = NULL; + call->receiving_message = 0; finish_batch_step(exec_ctx, bctl); } } From 5fcb8cc271a66868328d72f6e8e8f20d8316acc5 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Tue, 7 Mar 2017 14:57:35 -0800 Subject: [PATCH 045/461] Php: Completion queue create API changes (and also remove the redundant completion_queue_next() loop in grpc_php_shutdown_completion_queue function as it is no longer needed. This was most likely an artifact of a previous version of grpc-core where completion queues did not have a "one tag in, one tag out" rule --- src/php/ext/grpc/completion_queue.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/php/ext/grpc/completion_queue.c b/src/php/ext/grpc/completion_queue.c index 741204b0b10..441088bf680 100644 --- a/src/php/ext/grpc/completion_queue.c +++ b/src/php/ext/grpc/completion_queue.c @@ -38,13 +38,12 @@ grpc_completion_queue *completion_queue; void grpc_php_init_completion_queue(TSRMLS_D) { - completion_queue = grpc_completion_queue_create(NULL); + completion_queue = grpc_completion_queue_create(GRPC_CQ_PLUCK, + GRPC_CQ_DEFAULT_POLLING, + NULL); } void grpc_php_shutdown_completion_queue(TSRMLS_D) { grpc_completion_queue_shutdown(completion_queue); - while (grpc_completion_queue_next(completion_queue, - gpr_inf_future(GPR_CLOCK_REALTIME), - NULL).type != GRPC_QUEUE_SHUTDOWN); grpc_completion_queue_destroy(completion_queue); } From b7462944ba184c24f545470a5bf631b59584ec4b Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 8 Mar 2017 19:30:21 +0100 Subject: [PATCH 046/461] adapt C# to new cq_create API --- .../Internal/CompletionQueueSafeHandleTest.cs | 10 +++++----- src/csharp/Grpc.Core.Tests/PInvokeTest.cs | 4 ++-- src/csharp/Grpc.Core/Internal/AsyncCall.cs | 2 +- .../Internal/CompletionQueueSafeHandle.cs | 14 ++++++++++---- src/csharp/Grpc.Core/Internal/GrpcThreadPool.cs | 2 +- src/csharp/Grpc.Core/Internal/NativeMethods.cs | 9 ++++++--- src/csharp/ext/grpc_csharp_ext.c | 9 +++++++-- 7 files changed, 32 insertions(+), 18 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/Internal/CompletionQueueSafeHandleTest.cs b/src/csharp/Grpc.Core.Tests/Internal/CompletionQueueSafeHandleTest.cs index e9ec59eb3db..8649906becd 100644 --- a/src/csharp/Grpc.Core.Tests/Internal/CompletionQueueSafeHandleTest.cs +++ b/src/csharp/Grpc.Core.Tests/Internal/CompletionQueueSafeHandleTest.cs @@ -43,19 +43,19 @@ namespace Grpc.Core.Internal.Tests public class CompletionQueueSafeHandleTest { [Test] - public void CreateAndDestroy() + public void CreateSyncAndDestroy() { GrpcEnvironment.AddRef(); - var cq = CompletionQueueSafeHandle.Create(); + var cq = CompletionQueueSafeHandle.CreateSync(); cq.Dispose(); GrpcEnvironment.ReleaseAsync().Wait(); } [Test] - public void CreateAndShutdown() + public void CreateAsyncAndShutdown() { - GrpcEnvironment.AddRef(); - var cq = CompletionQueueSafeHandle.Create(); + var env = GrpcEnvironment.AddRef(); + var cq = CompletionQueueSafeHandle.CreateAsync(new CompletionRegistry(env)); cq.Shutdown(); var ev = cq.Next(); cq.Dispose(); diff --git a/src/csharp/Grpc.Core.Tests/PInvokeTest.cs b/src/csharp/Grpc.Core.Tests/PInvokeTest.cs index d3735c78807..d760717ba6f 100644 --- a/src/csharp/Grpc.Core.Tests/PInvokeTest.cs +++ b/src/csharp/Grpc.Core.Tests/PInvokeTest.cs @@ -53,7 +53,7 @@ namespace Grpc.Core.Tests /// (~1.26us .NET Windows) /// [Test] - public void CompletionQueueCreateDestroyBenchmark() + public void CompletionQueueCreateSyncDestroyBenchmark() { GrpcEnvironment.AddRef(); // completion queue requires gRPC environment being initialized. @@ -61,7 +61,7 @@ namespace Grpc.Core.Tests 10, 10, () => { - CompletionQueueSafeHandle cq = CompletionQueueSafeHandle.Create(); + CompletionQueueSafeHandle cq = CompletionQueueSafeHandle.CreateSync(); cq.Dispose(); }); diff --git a/src/csharp/Grpc.Core/Internal/AsyncCall.cs b/src/csharp/Grpc.Core/Internal/AsyncCall.cs index 1f738a3b6f9..f037b2351af 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCall.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCall.cs @@ -87,7 +87,7 @@ namespace Grpc.Core.Internal var profiler = Profilers.ForCurrentThread(); using (profiler.NewScope("AsyncCall.UnaryCall")) - using (CompletionQueueSafeHandle cq = CompletionQueueSafeHandle.Create()) + using (CompletionQueueSafeHandle cq = CompletionQueueSafeHandle.CreateSync()) { byte[] payload = UnsafeSerialize(msg); diff --git a/src/csharp/Grpc.Core/Internal/CompletionQueueSafeHandle.cs b/src/csharp/Grpc.Core/Internal/CompletionQueueSafeHandle.cs index 6c9a31921eb..577d7044a57 100644 --- a/src/csharp/Grpc.Core/Internal/CompletionQueueSafeHandle.cs +++ b/src/csharp/Grpc.Core/Internal/CompletionQueueSafeHandle.cs @@ -51,14 +51,20 @@ namespace Grpc.Core.Internal { } - public static CompletionQueueSafeHandle Create() + /// + /// Create a completion queue that can only be used for Pluck operations. + /// + public static CompletionQueueSafeHandle CreateSync() { - return Native.grpcsharp_completion_queue_create(); + return Native.grpcsharp_completion_queue_create_sync(); } - public static CompletionQueueSafeHandle Create(CompletionRegistry completionRegistry) + /// + /// Create a completion queue that can only be used for Next operations. + /// + public static CompletionQueueSafeHandle CreateAsync(CompletionRegistry completionRegistry) { - var cq = Native.grpcsharp_completion_queue_create(); + var cq = Native.grpcsharp_completion_queue_create_async(); cq.completionRegistry = completionRegistry; return cq; } diff --git a/src/csharp/Grpc.Core/Internal/GrpcThreadPool.cs b/src/csharp/Grpc.Core/Internal/GrpcThreadPool.cs index 25a6589f115..07fea812b2a 100644 --- a/src/csharp/Grpc.Core/Internal/GrpcThreadPool.cs +++ b/src/csharp/Grpc.Core/Internal/GrpcThreadPool.cs @@ -197,7 +197,7 @@ namespace Grpc.Core.Internal for (int i = 0; i < completionQueueCount; i++) { var completionRegistry = new CompletionRegistry(environment); - list.Add(CompletionQueueSafeHandle.Create(completionRegistry)); + list.Add(CompletionQueueSafeHandle.CreateAsync(completionRegistry)); } return list.AsReadOnly(); } diff --git a/src/csharp/Grpc.Core/Internal/NativeMethods.cs b/src/csharp/Grpc.Core/Internal/NativeMethods.cs index dd65f052172..a98861af616 100644 --- a/src/csharp/Grpc.Core/Internal/NativeMethods.cs +++ b/src/csharp/Grpc.Core/Internal/NativeMethods.cs @@ -115,7 +115,8 @@ namespace Grpc.Core.Internal public readonly Delegates.grpcsharp_sizeof_grpc_event_delegate grpcsharp_sizeof_grpc_event; - public readonly Delegates.grpcsharp_completion_queue_create_delegate grpcsharp_completion_queue_create; + public readonly Delegates.grpcsharp_completion_queue_create_async_delegate grpcsharp_completion_queue_create_async; + public readonly Delegates.grpcsharp_completion_queue_create_sync_delegate grpcsharp_completion_queue_create_sync; public readonly Delegates.grpcsharp_completion_queue_shutdown_delegate grpcsharp_completion_queue_shutdown; public readonly Delegates.grpcsharp_completion_queue_next_delegate grpcsharp_completion_queue_next; public readonly Delegates.grpcsharp_completion_queue_pluck_delegate grpcsharp_completion_queue_pluck; @@ -229,7 +230,8 @@ namespace Grpc.Core.Internal this.grpcsharp_sizeof_grpc_event = GetMethodDelegate(library); - this.grpcsharp_completion_queue_create = GetMethodDelegate(library); + this.grpcsharp_completion_queue_create_async = GetMethodDelegate(library); + this.grpcsharp_completion_queue_create_sync = GetMethodDelegate(library); this.grpcsharp_completion_queue_shutdown = GetMethodDelegate(library); this.grpcsharp_completion_queue_next = GetMethodDelegate(library); this.grpcsharp_completion_queue_pluck = GetMethodDelegate(library); @@ -383,7 +385,8 @@ namespace Grpc.Core.Internal public delegate int grpcsharp_sizeof_grpc_event_delegate(); - public delegate CompletionQueueSafeHandle grpcsharp_completion_queue_create_delegate(); + public delegate CompletionQueueSafeHandle grpcsharp_completion_queue_create_async_delegate(); + public delegate CompletionQueueSafeHandle grpcsharp_completion_queue_create_sync_delegate(); public delegate void grpcsharp_completion_queue_shutdown_delegate(CompletionQueueSafeHandle cq); public delegate CompletionQueueEvent grpcsharp_completion_queue_next_delegate(CompletionQueueSafeHandle cq); public delegate CompletionQueueEvent grpcsharp_completion_queue_pluck_delegate(CompletionQueueSafeHandle cq, IntPtr tag); diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index 491df4de6ad..ceb2671faf8 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -354,8 +354,13 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_shutdown(void) { grpc_shutdown(); } /* Completion queue */ GPR_EXPORT grpc_completion_queue *GPR_CALLTYPE -grpcsharp_completion_queue_create(void) { - return grpc_completion_queue_create(NULL); +grpcsharp_completion_queue_create_async(void) { + return grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); +} + +GPR_EXPORT grpc_completion_queue *GPR_CALLTYPE +grpcsharp_completion_queue_create_sync(void) { + return grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING, NULL); } GPR_EXPORT void GPR_CALLTYPE From a9af945817954a74e5ede427f0ff9248636672e4 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 9 Mar 2017 14:41:44 -0800 Subject: [PATCH 047/461] Fix python bug --- .../chttp2/transport/chttp2_transport.c | 46 ++++++++++++------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 618d9336471..b60f96e342a 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -160,6 +160,9 @@ static grpc_error *deframe_unprocessed_incoming_frames( grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *p, grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_slice_buffer *slices, grpc_slice *slice_out, bool partial_deframe); +static void clean_unprocessed_frames_buffer(grpc_exec_ctx *exec_ctx, + grpc_chttp2_transport *t, + grpc_chttp2_stream *s); /******************************************************************************* * CONSTRUCTION/DESTRUCTION/REFCOUNTING @@ -630,15 +633,12 @@ static void destroy_stream_locked(grpc_exec_ctx *exec_ctx, void *sp, GPR_ASSERT(grpc_chttp2_stream_map_find(&t->stream_map, s->id) == NULL); } - gpr_mu_lock(&s->buffer_mu); - grpc_slice_buffer_destroy_internal(exec_ctx, - &s->unprocessed_incoming_frames_buffer); + clean_unprocessed_frames_buffer(exec_ctx, t, s); if (s->incoming_frames != NULL) { grpc_chttp2_incoming_byte_stream *ibs = s->incoming_frames; s->incoming_frames = NULL; incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, GRPC_ERROR_NONE); } - gpr_mu_unlock(&s->buffer_mu); grpc_chttp2_list_remove_stalled_by_transport(t, s); grpc_chttp2_list_remove_stalled_by_stream(t, s); @@ -1519,8 +1519,7 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_exec_ctx *exec_ctx, incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, GRPC_ERROR_NONE); gpr_mu_lock(&s->buffer_mu); - grpc_slice_buffer_reset_and_unref_internal( - exec_ctx, &s->unprocessed_incoming_frames_buffer); + clean_unprocessed_frames_buffer(exec_ctx, t, s); gpr_mu_unlock(&s->buffer_mu); } } @@ -1534,7 +1533,6 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_exec_ctx *exec_ctx, void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s) { - grpc_error *error = GRPC_ERROR_NONE; if (s->recv_message_ready != NULL) { if (s->final_metadata_requested && s->seen_error && s->incoming_frames != NULL) { @@ -1543,8 +1541,7 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, GRPC_ERROR_NONE); gpr_mu_lock(&s->buffer_mu); - grpc_slice_buffer_reset_and_unref_internal( - exec_ctx, &s->unprocessed_incoming_frames_buffer); + clean_unprocessed_frames_buffer(exec_ctx, t, s); gpr_mu_unlock(&s->buffer_mu); } if (s->incoming_frames != NULL) { @@ -1553,10 +1550,6 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, GPR_ASSERT(*s->recv_message != NULL); grpc_closure_sched(exec_ctx, s->recv_message_ready, GRPC_ERROR_NONE); s->recv_message_ready = NULL; - } else if (error != GRPC_ERROR_NONE) { - GPR_ASSERT(s->incoming_frames == NULL); - grpc_closure_sched(exec_ctx, s->recv_message_ready, error); - s->recv_message_ready = NULL; } else if (s->published_metadata[1] != GRPC_METADATA_NOT_PUBLISHED) { *s->recv_message = NULL; grpc_closure_sched(exec_ctx, s->recv_message_ready, GRPC_ERROR_NONE); @@ -1578,8 +1571,7 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx *exec_ctx, incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, GRPC_ERROR_NONE); gpr_mu_lock(&s->buffer_mu); - grpc_slice_buffer_reset_and_unref_internal( - exec_ctx, &s->unprocessed_incoming_frames_buffer); + clean_unprocessed_frames_buffer(exec_ctx, t, s); gpr_mu_unlock(&s->buffer_mu); } } @@ -1597,11 +1589,33 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx *exec_ctx, static void decrement_active_streams_locked(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s) { - if ((s->all_incoming_byte_streams_finished = gpr_unref(&s->active_streams))) { + gpr_mu_lock(&s->buffer_mu); + if ((s->all_incoming_byte_streams_finished = (gpr_unref(&s->active_streams) && + s->unprocessed_incoming_frames_buffer.length == 0))) { + gpr_mu_unlock(&s->buffer_mu); grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, t, s); + } else { + gpr_mu_unlock(&s->buffer_mu); } } +static void clean_unprocessed_frames_buffer(grpc_exec_ctx *exec_ctx, + grpc_chttp2_transport *t, + grpc_chttp2_stream *s) { + gpr_mu_lock(&s->buffer_mu); + grpc_slice_buffer_destroy_internal(exec_ctx, + &s->unprocessed_incoming_frames_buffer); + // TODO (mxyan): add get ref count in sync.c? + gpr_atm active_streams = gpr_atm_no_barrier_fetch_add(&s->active_streams.count, 0); + if ((s->all_incoming_byte_streams_finished = + (active_streams == 0))) { + gpr_mu_unlock(&s->buffer_mu); + grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, t, s); + } else { + gpr_mu_unlock(&s->buffer_mu); + } +} + static void remove_stream(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, uint32_t id, grpc_error *error) { grpc_chttp2_stream *s = grpc_chttp2_stream_map_delete(&t->stream_map, id); From d54b9e929c85dd02bb883285b801ad90cfd3044b Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 9 Mar 2017 17:45:37 -0800 Subject: [PATCH 048/461] Minor fix --- src/core/ext/transport/chttp2/transport/chttp2_transport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index b60f96e342a..da8131c1a25 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1603,8 +1603,8 @@ static void clean_unprocessed_frames_buffer(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s) { gpr_mu_lock(&s->buffer_mu); - grpc_slice_buffer_destroy_internal(exec_ctx, - &s->unprocessed_incoming_frames_buffer); + grpc_slice_buffer_reset_and_unref_internal(exec_ctx, + &s->unprocessed_incoming_frames_buffer); // TODO (mxyan): add get ref count in sync.c? gpr_atm active_streams = gpr_atm_no_barrier_fetch_add(&s->active_streams.count, 0); if ((s->all_incoming_byte_streams_finished = From 19cd0f3679dc2fae3c6997eb061afa2812fb0aac Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 9 Mar 2017 21:33:40 -0800 Subject: [PATCH 049/461] Bug fix --- .../chttp2/transport/chttp2_transport.c | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index da8131c1a25..cb04c30a080 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1518,10 +1518,10 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_exec_ctx *exec_ctx, s->incoming_frames = NULL; incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, GRPC_ERROR_NONE); - gpr_mu_lock(&s->buffer_mu); - clean_unprocessed_frames_buffer(exec_ctx, t, s); - gpr_mu_unlock(&s->buffer_mu); } + gpr_mu_lock(&s->buffer_mu); + clean_unprocessed_frames_buffer(exec_ctx, t, s); + gpr_mu_unlock(&s->buffer_mu); } grpc_chttp2_incoming_metadata_buffer_publish( exec_ctx, &s->metadata_buffer[0], s->recv_initial_metadata); @@ -1534,12 +1534,13 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s) { if (s->recv_message_ready != NULL) { - if (s->final_metadata_requested && s->seen_error && - s->incoming_frames != NULL) { - grpc_chttp2_incoming_byte_stream *ibs = s->incoming_frames; - s->incoming_frames = NULL; - incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, - GRPC_ERROR_NONE); + if (s->final_metadata_requested && s->seen_error) { + if(s->incoming_frames != NULL) { + grpc_chttp2_incoming_byte_stream *ibs = s->incoming_frames; + s->incoming_frames = NULL; + incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, + GRPC_ERROR_NONE); + } gpr_mu_lock(&s->buffer_mu); clean_unprocessed_frames_buffer(exec_ctx, t, s); gpr_mu_unlock(&s->buffer_mu); @@ -1570,10 +1571,10 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx *exec_ctx, s->incoming_frames = NULL; incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, GRPC_ERROR_NONE); - gpr_mu_lock(&s->buffer_mu); - clean_unprocessed_frames_buffer(exec_ctx, t, s); - gpr_mu_unlock(&s->buffer_mu); } + gpr_mu_lock(&s->buffer_mu); + clean_unprocessed_frames_buffer(exec_ctx, t, s); + gpr_mu_unlock(&s->buffer_mu); } if (s->all_incoming_byte_streams_finished && s->recv_trailing_metadata_finished != NULL) { From bdcdf31fb92011afc7d3642d81dd7cabccfa4f7e Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 9 Mar 2017 22:13:59 -0800 Subject: [PATCH 050/461] Bug fix --- .../chttp2/transport/chttp2_transport.c | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index cb04c30a080..5237a78cfc1 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1519,9 +1519,13 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_exec_ctx *exec_ctx, incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, GRPC_ERROR_NONE); } + size_t length; gpr_mu_lock(&s->buffer_mu); - clean_unprocessed_frames_buffer(exec_ctx, t, s); + length = s->unprocessed_incoming_frames_buffer.length; gpr_mu_unlock(&s->buffer_mu); + if (length > 0) { + clean_unprocessed_frames_buffer(exec_ctx, t, s); + } } grpc_chttp2_incoming_metadata_buffer_publish( exec_ctx, &s->metadata_buffer[0], s->recv_initial_metadata); @@ -1541,9 +1545,13 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, GRPC_ERROR_NONE); } + size_t length; gpr_mu_lock(&s->buffer_mu); - clean_unprocessed_frames_buffer(exec_ctx, t, s); + length = s->unprocessed_incoming_frames_buffer.length; gpr_mu_unlock(&s->buffer_mu); + if (length > 0) { + clean_unprocessed_frames_buffer(exec_ctx, t, s); + } } if (s->incoming_frames != NULL) { *s->recv_message = &s->incoming_frames->base; @@ -1572,9 +1580,13 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx *exec_ctx, incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, GRPC_ERROR_NONE); } + size_t length; gpr_mu_lock(&s->buffer_mu); - clean_unprocessed_frames_buffer(exec_ctx, t, s); + length = s->unprocessed_incoming_frames_buffer.length; gpr_mu_unlock(&s->buffer_mu); + if (length > 0) { + clean_unprocessed_frames_buffer(exec_ctx, t, s); + } } if (s->all_incoming_byte_streams_finished && s->recv_trailing_metadata_finished != NULL) { @@ -1590,13 +1602,13 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx *exec_ctx, static void decrement_active_streams_locked(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s) { + size_t length; gpr_mu_lock(&s->buffer_mu); + length = s->unprocessed_incoming_frames_buffer.length; + gpr_mu_unlock(&s->buffer_mu); if ((s->all_incoming_byte_streams_finished = (gpr_unref(&s->active_streams) && - s->unprocessed_incoming_frames_buffer.length == 0))) { - gpr_mu_unlock(&s->buffer_mu); + length == 0))) { grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, t, s); - } else { - gpr_mu_unlock(&s->buffer_mu); } } @@ -1606,14 +1618,12 @@ static void clean_unprocessed_frames_buffer(grpc_exec_ctx *exec_ctx, gpr_mu_lock(&s->buffer_mu); grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->unprocessed_incoming_frames_buffer); + gpr_mu_unlock(&s->buffer_mu); // TODO (mxyan): add get ref count in sync.c? gpr_atm active_streams = gpr_atm_no_barrier_fetch_add(&s->active_streams.count, 0); if ((s->all_incoming_byte_streams_finished = (active_streams == 0))) { - gpr_mu_unlock(&s->buffer_mu); grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, t, s); - } else { - gpr_mu_unlock(&s->buffer_mu); } } From 6f2e6e68be4aef872342e6e6451c1b74d2a61d9e Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 10 Mar 2017 09:27:50 -0800 Subject: [PATCH 051/461] clang-format --- .../chttp2/transport/chttp2_transport.c | 48 ++++++++++--------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 5237a78cfc1..edcb243c373 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -509,10 +509,11 @@ static void destroy_transport_locked(grpc_exec_ctx *exec_ctx, void *tp, static void destroy_transport(grpc_exec_ctx *exec_ctx, grpc_transport *gt) { grpc_chttp2_transport *t = (grpc_chttp2_transport *)gt; - grpc_closure_sched(exec_ctx, grpc_closure_create( - destroy_transport_locked, t, - grpc_combiner_scheduler(t->combiner, false)), - GRPC_ERROR_NONE); + grpc_closure_sched( + exec_ctx, + grpc_closure_create(destroy_transport_locked, t, + grpc_combiner_scheduler(t->combiner, false)), + GRPC_ERROR_NONE); } static void close_transport_locked(grpc_exec_ctx *exec_ctx, @@ -691,8 +692,9 @@ static void destroy_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, s->destroy_stream_arg = and_free_memory; grpc_closure_sched( - exec_ctx, grpc_closure_init(&s->destroy_stream, destroy_stream_locked, s, - grpc_combiner_scheduler(t->combiner, false)), + exec_ctx, + grpc_closure_init(&s->destroy_stream, destroy_stream_locked, s, + grpc_combiner_scheduler(t->combiner, false)), GRPC_ERROR_NONE); GPR_TIMER_END("destroy_stream", 0); } @@ -1497,9 +1499,10 @@ static void perform_transport_op(grpc_exec_ctx *exec_ctx, grpc_transport *gt, op->transport_private.args[0] = gt; GRPC_CHTTP2_REF_TRANSPORT(t, "transport_op"); grpc_closure_sched( - exec_ctx, grpc_closure_init(&op->transport_private.closure, - perform_transport_op_locked, op, - grpc_combiner_scheduler(t->combiner, false)), + exec_ctx, + grpc_closure_init(&op->transport_private.closure, + perform_transport_op_locked, op, + grpc_combiner_scheduler(t->combiner, false)), GRPC_ERROR_NONE); } @@ -1539,7 +1542,7 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, grpc_chttp2_stream *s) { if (s->recv_message_ready != NULL) { if (s->final_metadata_requested && s->seen_error) { - if(s->incoming_frames != NULL) { + if (s->incoming_frames != NULL) { grpc_chttp2_incoming_byte_stream *ibs = s->incoming_frames; s->incoming_frames = NULL; incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, @@ -1606,8 +1609,8 @@ static void decrement_active_streams_locked(grpc_exec_ctx *exec_ctx, gpr_mu_lock(&s->buffer_mu); length = s->unprocessed_incoming_frames_buffer.length; gpr_mu_unlock(&s->buffer_mu); - if ((s->all_incoming_byte_streams_finished = (gpr_unref(&s->active_streams) && - length == 0))) { + if ((s->all_incoming_byte_streams_finished = + (gpr_unref(&s->active_streams) && length == 0))) { grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, t, s); } } @@ -1616,15 +1619,15 @@ static void clean_unprocessed_frames_buffer(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s) { gpr_mu_lock(&s->buffer_mu); - grpc_slice_buffer_reset_and_unref_internal(exec_ctx, - &s->unprocessed_incoming_frames_buffer); + grpc_slice_buffer_reset_and_unref_internal( + exec_ctx, &s->unprocessed_incoming_frames_buffer); gpr_mu_unlock(&s->buffer_mu); // TODO (mxyan): add get ref count in sync.c? - gpr_atm active_streams = gpr_atm_no_barrier_fetch_add(&s->active_streams.count, 0); - if ((s->all_incoming_byte_streams_finished = - (active_streams == 0))) { - grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, t, s); - } + gpr_atm active_streams = + gpr_atm_no_barrier_fetch_add(&s->active_streams.count, 0); + if ((s->all_incoming_byte_streams_finished = (active_streams == 0))) { + grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, t, s); + } } static void remove_stream(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, @@ -2754,9 +2757,10 @@ static void destructive_reclaimer_locked(grpc_exec_ctx *exec_ctx, void *arg, s->id); } grpc_chttp2_cancel_stream( - exec_ctx, t, s, grpc_error_set_int(GRPC_ERROR_CREATE("Buffers full"), - GRPC_ERROR_INT_HTTP2_ERROR, - GRPC_HTTP2_ENHANCE_YOUR_CALM)); + exec_ctx, t, s, + grpc_error_set_int(GRPC_ERROR_CREATE("Buffers full"), + GRPC_ERROR_INT_HTTP2_ERROR, + GRPC_HTTP2_ENHANCE_YOUR_CALM)); if (n > 1) { /* Since we cancel one stream per destructive reclamation, if there are more streams left, we can immediately post a new From 0901b168f391858ff44ea3c724a5b5fdeb18ea93 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 10 Mar 2017 11:24:09 -0800 Subject: [PATCH 052/461] Bug fix --- src/core/ext/transport/chttp2/transport/chttp2_transport.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index edcb243c373..83b27a49aad 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -634,7 +634,8 @@ static void destroy_stream_locked(grpc_exec_ctx *exec_ctx, void *sp, GPR_ASSERT(grpc_chttp2_stream_map_find(&t->stream_map, s->id) == NULL); } - clean_unprocessed_frames_buffer(exec_ctx, t, s); + grpc_slice_buffer_destroy_internal(exec_ctx, + &s->unprocessed_incoming_frames_buffer); if (s->incoming_frames != NULL) { grpc_chttp2_incoming_byte_stream *ibs = s->incoming_frames; s->incoming_frames = NULL; From 37268d0526036fcd29a319932f734a53ee35ae34 Mon Sep 17 00:00:00 2001 From: DJ Mountney Date: Tue, 7 Mar 2017 09:22:04 -0800 Subject: [PATCH 053/461] Fix for using gem build/install When pre-compiled assets are missing for the current platform, and you run gem install, the compiled native extensions are placed in the first require paths folder. This differs from rake-compiler task, where they are always placed in lib. Setting the lib path as the first require path will ensure the compiled library is placed in the correct folder. --- grpc.gemspec | 2 +- templates/grpc.gemspec.template | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/grpc.gemspec b/grpc.gemspec index 8d5b7b2ab1c..1d2ee0725a8 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -24,7 +24,7 @@ Gem::Specification.new do |s| s.files += Dir.glob('include/grpc/**/*') s.test_files = Dir.glob('src/ruby/spec/**/*') s.bindir = 'src/ruby/bin' - s.require_paths = %w( src/ruby/bin src/ruby/lib src/ruby/pb ) + s.require_paths = %w( src/ruby/lib src/ruby/bin src/ruby/pb ) s.platform = Gem::Platform::RUBY s.add_dependency 'google-protobuf', '~> 3.1' diff --git a/templates/grpc.gemspec.template b/templates/grpc.gemspec.template index 462ea526140..80ce643d802 100644 --- a/templates/grpc.gemspec.template +++ b/templates/grpc.gemspec.template @@ -26,7 +26,7 @@ s.files += Dir.glob('include/grpc/**/*') s.test_files = Dir.glob('src/ruby/spec/**/*') s.bindir = 'src/ruby/bin' - s.require_paths = %w( src/ruby/bin src/ruby/lib src/ruby/pb ) + s.require_paths = %w( src/ruby/lib src/ruby/bin src/ruby/pb ) s.platform = Gem::Platform::RUBY s.add_dependency 'google-protobuf', '~> 3.1' From 033c8cb4751b6580fcff02fa12be6e2dd7dfa8fd Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 14 Mar 2017 13:00:11 -0700 Subject: [PATCH 054/461] Advance ProtoCompiler version --- src/objective-c/!ProtoCompiler.podspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/objective-c/!ProtoCompiler.podspec b/src/objective-c/!ProtoCompiler.podspec index dc4d8e964e6..2e9b944f33d 100644 --- a/src/objective-c/!ProtoCompiler.podspec +++ b/src/objective-c/!ProtoCompiler.podspec @@ -36,7 +36,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' - v = '3.1.0' + v = '3.2.0' s.version = v s.summary = 'The Protobuf Compiler (protoc) generates Objective-C files from .proto files' s.description = <<-DESC @@ -110,7 +110,7 @@ Pod::Spec.new do |s| # Restrict the protobuf runtime version to the one supported by this version of protoc. s.dependency 'Protobuf', '~> 3.0' # For the Protobuf dependency not to complain: - s.ios.deployment_target = '7.1' + s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' # This is only for local development of protoc: If the Podfile brings this pod from a local From 58450914326278bd7b6fe3cb61cc47b33d89c2c8 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 16 Mar 2017 09:42:43 -0700 Subject: [PATCH 055/461] [EXPERIMENTAL] allocate unary response writer against call arena --- .../grpc++/impl/codegen/async_unary_call.h | 53 ++++++++++++++----- include/grpc/grpc.h | 4 ++ src/compiler/cpp_generator.cc | 4 +- src/core/lib/surface/call.c | 4 ++ 4 files changed, 51 insertions(+), 14 deletions(-) diff --git a/include/grpc++/impl/codegen/async_unary_call.h b/include/grpc++/impl/codegen/async_unary_call.h index b77a16b699f..d11986b6ece 100644 --- a/include/grpc++/impl/codegen/async_unary_call.h +++ b/include/grpc++/impl/codegen/async_unary_call.h @@ -34,6 +34,7 @@ #ifndef GRPCXX_IMPL_CODEGEN_ASYNC_UNARY_CALL_H #define GRPCXX_IMPL_CODEGEN_ASYNC_UNARY_CALL_H +#include #include #include #include @@ -41,6 +42,8 @@ #include #include +extern "C" void* grpc_call_arena_alloc(grpc_call* call, size_t size); + namespace grpc { class CompletionQueue; @@ -59,19 +62,33 @@ class ClientAsyncResponseReader final : public ClientAsyncResponseReaderInterface { public: template - ClientAsyncResponseReader(ChannelInterface* channel, CompletionQueue* cq, - const RpcMethod& method, ClientContext* context, - const W& request) - : context_(context), - call_(channel->CreateCall(method, context, cq)), - collection_(std::make_shared()) { - collection_->init_buf_.SetCollection(collection_); - collection_->init_buf_.SendInitialMetadata( + static ClientAsyncResponseReader* Create(ChannelInterface* channel, + CompletionQueue* cq, + const RpcMethod& method, + ClientContext* context, + const W& request) { + Call call = channel->CreateCall(method, context, cq); + ClientAsyncResponseReader* reader = static_cast( + grpc_call_arena_alloc(call.call(), sizeof(*reader))); + new (&reader->call_) Call(std::move(call)); + reader->context_ = context; + new (&reader->collection_) std::shared_ptr( + new (grpc_call_arena_alloc(call.call(), sizeof(CallOpSetCollection))) + CallOpSetCollection()); + reader->collection_->init_buf_.SetCollection(reader->collection_); + reader->collection_->init_buf_.SendInitialMetadata( context->send_initial_metadata_, context->initial_metadata_flags()); // TODO(ctiller): don't assert - GPR_CODEGEN_ASSERT(collection_->init_buf_.SendMessage(request).ok()); - collection_->init_buf_.ClientSendClose(); - call_.PerformOps(&collection_->init_buf_); + GPR_CODEGEN_ASSERT( + reader->collection_->init_buf_.SendMessage(request).ok()); + reader->collection_->init_buf_.ClientSendClose(); + reader->call_.PerformOps(&reader->collection_->init_buf_); + return reader; + } + + // always allocated against a call arena, no memory free required + static void operator delete(void* ptr, std::size_t size) { + assert(size == sizeof(ClientAsyncResponseReader)); } void ReadInitialMetadata(void* tag) { @@ -99,7 +116,10 @@ class ClientAsyncResponseReader final ClientContext* context_; Call call_; - class CallOpSetCollection : public CallOpSetCollectionInterface { + // disable operator new + static void* operator new(std::size_t size); + + class CallOpSetCollection final : public CallOpSetCollectionInterface { public: SneakyCallOpSet @@ -108,6 +128,15 @@ class ClientAsyncResponseReader final CallOpSet, CallOpClientRecvStatus> finish_buf_; + + static void* operator new(std::size_t size, void* p) { return p; } + static void operator delete(void* ptr, std::size_t size) { + assert(size == sizeof(CallOpSetCollection)); + } + + private: + // disable operator new + static void* operator new(std::size_t size); }; std::shared_ptr collection_; }; diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 1b33d48c023..d603f89c284 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -198,6 +198,10 @@ GRPCAPI grpc_call *grpc_channel_create_registered_call( grpc_completion_queue *completion_queue, void *registered_call_handle, gpr_timespec deadline, void *reserved); +/** Allocate memory in the grpc_call arena: this memory is automatically + discarded at call completion */ +GRPCAPI void *grpc_call_arena_alloc(grpc_call *call, size_t size); + /** Start a batch of operations defined in the array ops; when complete, post a completion of type 'tag' to the completion queue bound to the call. The order of ops specified in the batch has no significance. diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index 2908b639f39..d223dacc266 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -1078,8 +1078,8 @@ void PrintSourceClientMethod(Printer *printer, const Method *method, "const $Request$& request, " "::grpc::CompletionQueue* cq) {\n"); printer->Print(*vars, - " return new " - "::grpc::ClientAsyncResponseReader< $Response$>(" + " return " + "::grpc::ClientAsyncResponseReader< $Response$>::Create(" "channel_.get(), cq, " "rpcmethod_$Method$_, " "context, request);\n" diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 2c5d8c0ff35..8b4ed6cda5d 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -268,6 +268,10 @@ static void add_init_error(grpc_error **composite, grpc_error *new) { *composite = grpc_error_add_child(*composite, new); } +void *grpc_call_arena_alloc(grpc_call *call, size_t size) { + return gpr_arena_alloc(call->arena, size); +} + grpc_error *grpc_call_create(grpc_exec_ctx *exec_ctx, const grpc_call_create_args *args, grpc_call **out_call) { From 082b286b77b0f925cb630030a551a900444bcb34 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 16 Mar 2017 17:13:05 -0700 Subject: [PATCH 056/461] Advance dependency version --- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index ab8f82a39e7..f91f42359f9 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -101,7 +101,7 @@ Pod::Spec.new do |s| s.preserve_paths = plugin # Restrict the protoc version to the one supported by this plugin. - s.dependency '!ProtoCompiler', '3.1.0' + s.dependency '!ProtoCompiler', '3.2.0' # For the Protobuf dependency not to complain: s.ios.deployment_target = '7.1' s.osx.deployment_target = '10.9' From 60cbf8fc391a6d1d3ce37b42e95c3439dace9b4b Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 28 Feb 2017 16:14:40 -0800 Subject: [PATCH 057/461] Relieve ios deployment version to 7.0 --- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- templates/gRPC-Core.podspec.template | 2 +- templates/gRPC-ProtoRPC.podspec.template | 2 +- templates/gRPC-RxLibrary.podspec.template | 2 +- templates/gRPC.podspec.template | 2 +- .../src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 027babcda46..a3010d5e37a 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -51,7 +51,7 @@ Pod::Spec.new do |s| :submodules => true, } - s.ios.deployment_target = '7.1' + s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' s.requires_arc = false diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 6ca9fcd3426..1940015782e 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -48,7 +48,7 @@ Pod::Spec.new do |s| :tag => "v#{version}", } - s.ios.deployment_target = '7.1' + s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' name = 'ProtoRPC' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index 51b52c0c440..841a8533633 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -48,7 +48,7 @@ Pod::Spec.new do |s| :tag => "v#{version}", } - s.ios.deployment_target = '7.1' + s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' name = 'RxLibrary' diff --git a/gRPC.podspec b/gRPC.podspec index 83a86803ebc..08ea79118d1 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -47,7 +47,7 @@ Pod::Spec.new do |s| :tag => "v#{version}", } - s.ios.deployment_target = '7.1' + s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' name = 'GRPCClient' diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index f91f42359f9..2f41ad196a6 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -103,7 +103,7 @@ Pod::Spec.new do |s| # Restrict the protoc version to the one supported by this plugin. s.dependency '!ProtoCompiler', '3.2.0' # For the Protobuf dependency not to complain: - s.ios.deployment_target = '7.1' + s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' # Restrict the gRPC runtime version to the one supported by this plugin. s.dependency 'gRPC-ProtoRPC', v diff --git a/templates/gRPC-Core.podspec.template b/templates/gRPC-Core.podspec.template index 9ed32e31cff..11146a490b8 100644 --- a/templates/gRPC-Core.podspec.template +++ b/templates/gRPC-Core.podspec.template @@ -78,7 +78,7 @@ :submodules => true, } - s.ios.deployment_target = '7.1' + s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' s.requires_arc = false diff --git a/templates/gRPC-ProtoRPC.podspec.template b/templates/gRPC-ProtoRPC.podspec.template index 5d7d90d2318..47b22dd2a52 100644 --- a/templates/gRPC-ProtoRPC.podspec.template +++ b/templates/gRPC-ProtoRPC.podspec.template @@ -50,7 +50,7 @@ :tag => "v#{version}", } - s.ios.deployment_target = '7.1' + s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' name = 'ProtoRPC' diff --git a/templates/gRPC-RxLibrary.podspec.template b/templates/gRPC-RxLibrary.podspec.template index 35a06c8a856..48f0df8f9e6 100644 --- a/templates/gRPC-RxLibrary.podspec.template +++ b/templates/gRPC-RxLibrary.podspec.template @@ -50,7 +50,7 @@ :tag => "v#{version}", } - s.ios.deployment_target = '7.1' + s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' name = 'RxLibrary' diff --git a/templates/gRPC.podspec.template b/templates/gRPC.podspec.template index d33ce277dc3..ce473608dd8 100644 --- a/templates/gRPC.podspec.template +++ b/templates/gRPC.podspec.template @@ -49,7 +49,7 @@ :tag => "v#{version}", } - s.ios.deployment_target = '7.1' + s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' name = 'GRPCClient' diff --git a/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template b/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template index 3a10cfab3cc..b100fa7cfe1 100644 --- a/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template +++ b/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template @@ -105,7 +105,7 @@ # Restrict the protoc version to the one supported by this plugin. s.dependency '!ProtoCompiler', '3.1.0' # For the Protobuf dependency not to complain: - s.ios.deployment_target = '7.1' + s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' # Restrict the gRPC runtime version to the one supported by this plugin. s.dependency 'gRPC-ProtoRPC', v From c007888dccf9ebb7b3240db55fc04aeb0dff9dd1 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 16 Mar 2017 20:53:41 -0700 Subject: [PATCH 058/461] Changes to podspecs --- gRPC-Core.podspec | 7 +++---- templates/gRPC-Core.podspec.template | 7 +++---- .../objective-c/!ProtoCompiler-gRPCPlugin.podspec.template | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index a3010d5e37a..73f327460f4 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -887,8 +887,7 @@ Pod::Spec.new do |s| s.subspec 'Cronet-Interface' do |ss| ss.header_mappings_dir = 'include/grpc' - ss.source_files = 'include/grpc/grpc_cronet.h', - 'src/core/ext/transport/cronet/transport/cronet_transport.h' + ss.source_files = 'include/grpc/grpc_cronet.h' end s.subspec 'Cronet-Implementation' do |ss| @@ -899,7 +898,7 @@ Pod::Spec.new do |s| ss.dependency "#{s.name}/Cronet-Interface", version ss.source_files = 'src/core/ext/transport/cronet/client/secure/cronet_channel_create.c', - 'src/core/ext/transport/cronet/transport/cronet_transport.c', + 'src/core/ext/transport/cronet/transport/cronet_transport.{c,h}', 'third_party/objective_c/Cronet/bidirectional_stream_c.h' end @@ -914,7 +913,7 @@ Pod::Spec.new do |s| 'test/core/end2end/end2end_test_utils.c', 'test/core/end2end/tests/*.{c,h}', 'test/core/end2end/data/*.{c,h}', - 'test/core/util/debugger_macros.c', + 'test/core/util/debugger_macros.{c,h}', 'test/core/util/test_config.{c,h}', 'test/core/util/port.h', 'test/core/util/port.c', diff --git a/templates/gRPC-Core.podspec.template b/templates/gRPC-Core.podspec.template index 11146a490b8..e7289111b24 100644 --- a/templates/gRPC-Core.podspec.template +++ b/templates/gRPC-Core.podspec.template @@ -161,8 +161,7 @@ s.subspec 'Cronet-Interface' do |ss| ss.header_mappings_dir = 'include/grpc' - ss.source_files = 'include/grpc/grpc_cronet.h', - 'src/core/ext/transport/cronet/transport/cronet_transport.h' + ss.source_files = 'include/grpc/grpc_cronet.h' end s.subspec 'Cronet-Implementation' do |ss| @@ -173,7 +172,7 @@ ss.dependency "#{s.name}/Cronet-Interface", version ss.source_files = 'src/core/ext/transport/cronet/client/secure/cronet_channel_create.c', - 'src/core/ext/transport/cronet/transport/cronet_transport.c', + 'src/core/ext/transport/cronet/transport/cronet_transport.{c,h}', 'third_party/objective_c/Cronet/bidirectional_stream_c.h' end @@ -188,7 +187,7 @@ 'test/core/end2end/end2end_test_utils.c', 'test/core/end2end/tests/*.{c,h}', 'test/core/end2end/data/*.{c,h}', - 'test/core/util/debugger_macros.c', + 'test/core/util/debugger_macros.{c,h}', 'test/core/util/test_config.{c,h}', 'test/core/util/port.h', 'test/core/util/port.c', diff --git a/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template b/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template index b100fa7cfe1..d7d84f3c774 100644 --- a/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template +++ b/templates/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec.template @@ -103,7 +103,7 @@ s.preserve_paths = plugin # Restrict the protoc version to the one supported by this plugin. - s.dependency '!ProtoCompiler', '3.1.0' + s.dependency '!ProtoCompiler', '3.2.0' # For the Protobuf dependency not to complain: s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' From b5b5f020a38c40e4753ead360151810479b8c664 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 16 Mar 2017 16:42:10 -0700 Subject: [PATCH 059/461] Upgrade Node dependency on Protobuf.js to version 6 --- package.json | 2 +- src/node/index.js | 74 +++++----- src/node/interop/interop_server.js | 2 +- src/node/performance/benchmark_server.js | 2 +- src/node/performance/worker.js | 4 +- src/node/src/client.js | 22 +-- src/node/src/common.js | 115 ++-------------- src/node/src/protobuf_js_5_common.js | 167 +++++++++++++++++++++++ src/node/src/protobuf_js_6_common.js | 154 +++++++++++++++++++++ src/node/src/server.js | 24 +++- src/node/stress/metrics_server.js | 2 +- src/node/test/common_test.js | 35 +++-- src/node/test/credentials_test.js | 2 +- src/node/test/surface_test.js | 116 ++++++++++------ templates/package.json.template | 2 +- 15 files changed, 493 insertions(+), 230 deletions(-) create mode 100644 src/node/src/protobuf_js_5_common.js create mode 100644 src/node/src/protobuf_js_6_common.js diff --git a/package.json b/package.json index 8c0854b1d28..4b216a87ab8 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "lodash": "^4.15.0", "nan": "^2.0.0", "node-pre-gyp": "^0.6.0", - "protobufjs": "^5.0.0" + "protobufjs": "^6.0.0" }, "devDependencies": { "async": "^2.0.1", diff --git a/src/node/index.js b/src/node/index.js index a294aad8ee6..43a4a54dd8d 100644 --- a/src/node/index.js +++ b/src/node/index.js @@ -52,32 +52,36 @@ var Metadata = require('./src/metadata.js'); var grpc = require('./src/grpc_extension'); +var protobuf_js_5_common = require('./src/protobuf_js_5_common'); +var protobuf_js_6_common = require('./src/protobuf_js_6_common'); + grpc.setDefaultRootsPem(fs.readFileSync(SSL_ROOTS_PATH, 'ascii')); -/** - * Load a gRPC object from an existing ProtoBuf.Reflect object. - * @param {ProtoBuf.Reflect.Namespace} value The ProtoBuf object to load. - * @param {Object=} options Options to apply to the loaded object - * @return {Object} The resulting gRPC object - */ exports.loadObject = function loadObject(value, options) { - var result = {}; - if (value.className === 'Namespace') { - _.each(value.children, function(child) { - result[child.name] = loadObject(child, options); - }); - return result; - } else if (value.className === 'Service') { - return client.makeProtobufClientConstructor(value, options); - } else if (value.className === 'Message' || value.className === 'Enum') { - return value.build(); - } else { - return value; + options = _.defaults(options, {'protobufjs_version': 5}); + switch (options.protobufjs_version) { + case 5: return protobuf_js_5_common.loadObject(value, options); + case 6: return protobuf_js_6_common.loadObject(value, options); + default: throw new Error('Unrecognized protobufjs_version:', + options.protobufjs_version); } }; var loadObject = exports.loadObject; +function applyProtoRoot(filename, root) { + if (_.isString(filename)) { + return filename; + } + filename.root = path.resolve(filename.root) + '/'; + root.resolvePath = function(originPath, importPath, alreadyNormalized) { + return ProtoBuf.util.path.resolve(filename.root, + importPath, + alreadyNormalized); + }; + return filename.file; +} + /** * Load a gRPC object from a .proto file. The options object can provide the * following options: @@ -99,29 +103,17 @@ var loadObject = exports.loadObject; * @return {Object} The resulting gRPC object */ exports.load = function load(filename, format, options) { - if (!format) { - format = 'proto'; - } - var convertFieldsToCamelCaseOriginal = ProtoBuf.convertFieldsToCamelCase; - if(options && options.hasOwnProperty('convertFieldsToCamelCase')) { - ProtoBuf.convertFieldsToCamelCase = options.convertFieldsToCamelCase; - } - var builder; - try { - switch(format) { - case 'proto': - builder = ProtoBuf.loadProtoFile(filename); - break; - case 'json': - builder = ProtoBuf.loadJsonFile(filename); - break; - default: - throw new Error('Unrecognized format "' + format + '"'); - } - } finally { - ProtoBuf.convertFieldsToCamelCase = convertFieldsToCamelCaseOriginal; - } - return loadObject(builder.ns, options); + /* Note: format is currently unused, because the API for loading a proto + file or a JSON file is identical in Protobuf.js 6. In the future, there is + still the possibility of adding other formats that would be loaded + differently */ + options = _.defaults(options, common.defaultGrpcOptions); + options.protobufjs_version = 6; + var root = new ProtoBuf.Root(); + var parse_options = {keepCase: !options.convertFieldsToCamelCase}; + return loadObject(root.loadSync(applyProtoRoot(filename, root), + parse_options), + options); }; var log_template = _.template( diff --git a/src/node/interop/interop_server.js b/src/node/interop/interop_server.js index 05f52a1083d..83b8a7c1ec3 100644 --- a/src/node/interop/interop_server.js +++ b/src/node/interop/interop_server.js @@ -228,7 +228,7 @@ function getServer(port, tls) { server_creds = grpc.ServerCredentials.createInsecure(); } var server = new grpc.Server(options); - server.addProtoService(testProto.TestService.service, { + server.addService(testProto.TestService.service, { emptyCall: handleEmpty, unaryCall: handleUnary, streamingOutputCall: handleStreamingOutput, diff --git a/src/node/performance/benchmark_server.js b/src/node/performance/benchmark_server.js index 6abde2e17af..297569164bb 100644 --- a/src/node/performance/benchmark_server.js +++ b/src/node/performance/benchmark_server.js @@ -132,7 +132,7 @@ function BenchmarkServer(host, port, tls, generic, response_size) { streamingCall: makeStreamingGenericCall(response_size) }); } else { - server.addProtoService(serviceProto.BenchmarkService.service, { + server.addService(serviceProto.BenchmarkService.service, { unaryCall: unaryCall, streamingCall: streamingCall }); diff --git a/src/node/performance/worker.js b/src/node/performance/worker.js index 030bf7d7ba0..90a9b7d59cd 100644 --- a/src/node/performance/worker.js +++ b/src/node/performance/worker.js @@ -44,8 +44,8 @@ var serviceProto = grpc.load({ function runServer(port, benchmark_impl) { var server_creds = grpc.ServerCredentials.createInsecure(); var server = new grpc.Server(); - server.addProtoService(serviceProto.WorkerService.service, - new WorkerServiceImpl(benchmark_impl, server)); + server.addService(serviceProto.WorkerService.service, + new WorkerServiceImpl(benchmark_impl, server)); var address = '0.0.0.0:' + port; server.bind(address, server_creds); server.start(); diff --git a/src/node/src/client.js b/src/node/src/client.js index 44081a3a6cd..1aaf35c16cb 100644 --- a/src/node/src/client.js +++ b/src/node/src/client.js @@ -780,6 +780,8 @@ exports.makeClientConstructor = function(methods, serviceName, _.assign(Client.prototype[name], attrs); }); + Client.service = methods; + return Client; }; @@ -822,26 +824,6 @@ exports.waitForClientReady = function(client, deadline, callback) { checkState(); }; -/** - * Creates a constructor for clients for the given service - * @param {ProtoBuf.Reflect.Service} service The service to generate a client - * for - * @param {Object=} options Options to apply to the client - * @return {function(string, Object)} New client constructor - */ -exports.makeProtobufClientConstructor = function(service, options) { - var method_attrs = common.getProtobufServiceAttrs(service, options); - if (!options) { - options = {deprecatedArgumentOrder: false}; - } - var Client = exports.makeClientConstructor( - method_attrs, common.fullyQualifiedName(service), - options); - Client.service = service; - Client.service.grpc_options = options; - return Client; -}; - /** * Map of status code names to status codes */ diff --git a/src/node/src/common.js b/src/node/src/common.js index 98eabf5c0b8..93df5138172 100644 --- a/src/node/src/common.js +++ b/src/node/src/common.js @@ -41,74 +41,6 @@ var _ = require('lodash'); -/** - * Get a function that deserializes a specific type of protobuf. - * @param {function()} cls The constructor of the message type to deserialize - * @param {bool=} binaryAsBase64 Deserialize bytes fields as base64 strings - * instead of Buffers. Defaults to false - * @param {bool=} longsAsStrings Deserialize long values as strings instead of - * objects. Defaults to true - * @return {function(Buffer):cls} The deserialization function - */ -exports.deserializeCls = function deserializeCls(cls, binaryAsBase64, - longsAsStrings) { - if (binaryAsBase64 === undefined || binaryAsBase64 === null) { - binaryAsBase64 = false; - } - if (longsAsStrings === undefined || longsAsStrings === null) { - longsAsStrings = true; - } - /** - * Deserialize a buffer to a message object - * @param {Buffer} arg_buf The buffer to deserialize - * @return {cls} The resulting object - */ - return function deserialize(arg_buf) { - // Convert to a native object with binary fields as Buffers (first argument) - // and longs as strings (second argument) - return cls.decode(arg_buf).toRaw(binaryAsBase64, longsAsStrings); - }; -}; - -var deserializeCls = exports.deserializeCls; - -/** - * Get a function that serializes objects to a buffer by protobuf class. - * @param {function()} Cls The constructor of the message type to serialize - * @return {function(Cls):Buffer} The serialization function - */ -exports.serializeCls = function serializeCls(Cls) { - /** - * Serialize an object to a Buffer - * @param {Object} arg The object to serialize - * @return {Buffer} The serialized object - */ - return function serialize(arg) { - return new Buffer(new Cls(arg).encode().toBuffer()); - }; -}; - -var serializeCls = exports.serializeCls; - -/** - * Get the fully qualified (dotted) name of a ProtoBuf.Reflect value. - * @param {ProtoBuf.Reflect.Namespace} value The value to get the name of - * @return {string} The fully qualified name of the value - */ -exports.fullyQualifiedName = function fullyQualifiedName(value) { - if (value === null || value === undefined) { - return ''; - } - var name = value.name; - var parent_name = fullyQualifiedName(value.parent); - if (parent_name !== '') { - name = parent_name + '.' + name; - } - return name; -}; - -var fullyQualifiedName = exports.fullyQualifiedName; - /** * Wrap a function to pass null-like values through without calling it. If no * function is given, just uses the identity; @@ -127,43 +59,6 @@ exports.wrapIgnoreNull = function wrapIgnoreNull(func) { }; }; -/** - * Return a map from method names to method attributes for the service. - * @param {ProtoBuf.Reflect.Service} service The service to get attributes for - * @param {Object=} options Options to apply to these attributes - * @return {Object} The attributes map - */ -exports.getProtobufServiceAttrs = function getProtobufServiceAttrs(service, - options) { - var prefix = '/' + fullyQualifiedName(service) + '/'; - var binaryAsBase64, longsAsStrings; - if (options) { - binaryAsBase64 = options.binaryAsBase64; - longsAsStrings = options.longsAsStrings; - } - /* This slightly awkward construction is used to make sure we only use - lodash@3.10.1-compatible functions. A previous version used - _.fromPairs, which would be cleaner, but was introduced in lodash - version 4 */ - return _.zipObject(_.map(service.children, function(method) { - return _.camelCase(method.name); - }), _.map(service.children, function(method) { - return { - path: prefix + method.name, - requestStream: method.requestStream, - responseStream: method.responseStream, - requestType: method.resolvedRequestType, - responseType: method.resolvedResponseType, - requestSerialize: serializeCls(method.resolvedRequestType.build()), - requestDeserialize: deserializeCls(method.resolvedRequestType.build(), - binaryAsBase64, longsAsStrings), - responseSerialize: serializeCls(method.resolvedResponseType.build()), - responseDeserialize: deserializeCls(method.resolvedResponseType.build(), - binaryAsBase64, longsAsStrings) - }; - })); -}; - /** * The logger object for the gRPC module. Defaults to console. */ @@ -184,3 +79,13 @@ exports.log = function log(severity, message) { exports.logger.error(message); } }; + +/** + * Default options for loading proto files into gRPC + */ +exports.defaultGrpcOptions = { + convertFieldsToCamelCase: false, + binaryAsBase64: false, + longsAsStrings: true, + deprecatedArgumentOrder: false +}; diff --git a/src/node/src/protobuf_js_5_common.js b/src/node/src/protobuf_js_5_common.js new file mode 100644 index 00000000000..aecb25339bf --- /dev/null +++ b/src/node/src/protobuf_js_5_common.js @@ -0,0 +1,167 @@ +/* + * + * Copyright 2017, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +'use strict'; + +var _ = require('lodash'); +var client = require('./client'); + +/** + * Get a function that deserializes a specific type of protobuf. + * @param {function()} cls The constructor of the message type to deserialize + * @param {bool=} binaryAsBase64 Deserialize bytes fields as base64 strings + * instead of Buffers. Defaults to false + * @param {bool=} longsAsStrings Deserialize long values as strings instead of + * objects. Defaults to true + * @return {function(Buffer):cls} The deserialization function + */ +exports.deserializeCls = function deserializeCls(cls, binaryAsBase64, + longsAsStrings) { + /** + * Deserialize a buffer to a message object + * @param {Buffer} arg_buf The buffer to deserialize + * @return {cls} The resulting object + */ + return function deserialize(arg_buf) { + // Convert to a native object with binary fields as Buffers (first argument) + // and longs as strings (second argument) + return cls.decode(arg_buf).toRaw(binaryAsBase64, longsAsStrings); + }; +}; + +var deserializeCls = exports.deserializeCls; + +/** + * Get a function that serializes objects to a buffer by protobuf class. + * @param {function()} Cls The constructor of the message type to serialize + * @return {function(Cls):Buffer} The serialization function + */ +exports.serializeCls = function serializeCls(Cls) { + /** + * Serialize an object to a Buffer + * @param {Object} arg The object to serialize + * @return {Buffer} The serialized object + */ + return function serialize(arg) { + return new Buffer(new Cls(arg).encode().toBuffer()); + }; +}; + +var serializeCls = exports.serializeCls; + +/** + * Get the fully qualified (dotted) name of a ProtoBuf.Reflect value. + * @param {ProtoBuf.Reflect.Namespace} value The value to get the name of + * @return {string} The fully qualified name of the value + */ +exports.fullyQualifiedName = function fullyQualifiedName(value) { + if (value === null || value === undefined) { + return ''; + } + var name = value.name; + var parent_name = fullyQualifiedName(value.parent); + if (parent_name !== '') { + name = parent_name + '.' + name; + } + return name; +}; + +var fullyQualifiedName = exports.fullyQualifiedName; + +/** + * Return a map from method names to method attributes for the service. + * @param {ProtoBuf.Reflect.Service} service The service to get attributes for + * @param {Object=} options Options to apply to these attributes + * @return {Object} The attributes map + */ +exports.getProtobufServiceAttrs = function getProtobufServiceAttrs(service, + options) { + var prefix = '/' + fullyQualifiedName(service) + '/'; + var binaryAsBase64, longsAsStrings; + if (options) { + binaryAsBase64 = options.binaryAsBase64; + longsAsStrings = options.longsAsStrings; + } + /* This slightly awkward construction is used to make sure we only use + lodash@3.10.1-compatible functions. A previous version used + _.fromPairs, which would be cleaner, but was introduced in lodash + version 4 */ + return _.zipObject(_.map(service.children, function(method) { + return _.camelCase(method.name); + }), _.map(service.children, function(method) { + return { + path: prefix + method.name, + requestStream: method.requestStream, + responseStream: method.responseStream, + requestType: method.resolvedRequestType, + responseType: method.resolvedResponseType, + requestSerialize: serializeCls(method.resolvedRequestType.build()), + requestDeserialize: deserializeCls(method.resolvedRequestType.build(), + binaryAsBase64, longsAsStrings), + responseSerialize: serializeCls(method.resolvedResponseType.build()), + responseDeserialize: deserializeCls(method.resolvedResponseType.build(), + binaryAsBase64, longsAsStrings) + }; + })); +}; + +var getProtobufServiceAttrs = exports.getProtobufServiceAttrs; + +/** + * Load a gRPC object from an existing ProtoBuf.Reflect object. + * @param {ProtoBuf.Reflect.Namespace} value The ProtoBuf object to load. + * @param {Object=} options Options to apply to the loaded object + * @return {Object} The resulting gRPC object + */ +exports.loadObject = function loadObject(value, options) { + var result = {}; + if (!value) { + return value; + } + if (value.hasOwnProperty('ns')) { + return loadObject(value.ns, options); + } + if (value.className === 'Namespace') { + _.each(value.children, function(child) { + result[child.name] = loadObject(child, options); + }); + return result; + } else if (value.className === 'Service') { + return client.makeClientConstructor(getProtobufServiceAttrs(value, options), + options); + } else if (value.className === 'Message' || value.className === 'Enum') { + return value.build(); + } else { + return value; + } +}; diff --git a/src/node/src/protobuf_js_6_common.js b/src/node/src/protobuf_js_6_common.js new file mode 100644 index 00000000000..23e56eecdeb --- /dev/null +++ b/src/node/src/protobuf_js_6_common.js @@ -0,0 +1,154 @@ +/* + * + * Copyright 2017, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +'use strict'; + +var _ = require('lodash'); +var client = require('./client'); + +/** + * Get a function that deserializes a specific type of protobuf. + * @param {function()} cls The constructor of the message type to deserialize + * @param {bool=} binaryAsBase64 Deserialize bytes fields as base64 strings + * instead of Buffers. Defaults to false + * @param {bool=} longsAsStrings Deserialize long values as strings instead of + * objects. Defaults to true + * @return {function(Buffer):cls} The deserialization function + */ +exports.deserializeCls = function deserializeCls(cls, options) { + var conversion_options = { + defaults: true, + bytes: options.binaryAsBase64 ? String : Buffer, + longs: options.longsAsStrings ? String : null, + enums: String + }; + /** + * Deserialize a buffer to a message object + * @param {Buffer} arg_buf The buffer to deserialize + * @return {cls} The resulting object + */ + return function deserialize(arg_buf) { + return cls.decode(arg_buf).toObject(conversion_options); + }; +}; + +var deserializeCls = exports.deserializeCls; + +/** + * Get a function that serializes objects to a buffer by protobuf class. + * @param {function()} Cls The constructor of the message type to serialize + * @return {function(Cls):Buffer} The serialization function + */ +exports.serializeCls = function serializeCls(cls) { + /** + * Serialize an object to a Buffer + * @param {Object} arg The object to serialize + * @return {Buffer} The serialized object + */ + return function serialize(arg) { + return cls.encode(arg).finish(); + }; +}; + +var serializeCls = exports.serializeCls; + +/** + * Get the fully qualified (dotted) name of a ProtoBuf.Reflect value. + * @param {ProtoBuf.ReflectionObject} value The value to get the name of + * @return {string} The fully qualified name of the value + */ +exports.fullyQualifiedName = function fullyQualifiedName(value) { + if (value === null || value === undefined) { + return ''; + } + var name = value.name; + var parent_fqn = fullyQualifiedName(value.parent); + if (parent_fqn !== '') { + name = parent_fqn + '.' + name; + } + return name; +}; + +var fullyQualifiedName = exports.fullyQualifiedName; + +/** + * Return a map from method names to method attributes for the service. + * @param {ProtoBuf.Service} service The service to get attributes for + * @param {Object=} options Options to apply to these attributes + * @return {Object} The attributes map + */ +exports.getProtobufServiceAttrs = function getProtobufServiceAttrs(service, + options) { + var prefix = '/' + fullyQualifiedName(service) + '/'; + service.resolveAll(); + return _.zipObject(_.map(service.methods, function(method) { + return _.camelCase(method.name); + }), _.map(service.methods, function(method) { + return { + path: prefix + method.name, + requestStream: !!method.requestStream, + responseStream: !!method.responseStream, + requestType: method.resolvedRequestType, + responseType: method.resolvedResponseType, + requestSerialize: serializeCls(method.resolvedRequestType), + requestDeserialize: deserializeCls(method.resolvedRequestType, options), + responseSerialize: serializeCls(method.resolvedResponseType), + responseDeserialize: deserializeCls(method.resolvedResponseType, options) + }; + })); +}; + +var getProtobufServiceAttrs = exports.getProtobufServiceAttrs; + +exports.loadObject = function loadObject(value, options) { + var result = {}; + if (!value) { + return value; + } + if (value.hasOwnProperty('methods')) { + // It's a service object + var service_attrs = getProtobufServiceAttrs(value, options); + return client.makeClientConstructor(service_attrs); + } + + if (value.hasOwnProperty('nested')) { + // It's a namespace or root object + _.each(value.nested, function(nested, name) { + result[name] = loadObject(nested, options); + }); + return result; + } + + // Otherwise, it's not something we need to change + return value; +}; diff --git a/src/node/src/server.js b/src/node/src/server.js index a5a0ea26420..9a149ebf0a5 100644 --- a/src/node/src/server.js +++ b/src/node/src/server.js @@ -774,17 +774,33 @@ Server.prototype.addService = function(service, implementation) { /** * Add a proto service to the server, with a corresponding implementation + * @deprecated Use grpc.load and Server#addService instead * @param {Protobuf.Reflect.Service} service The proto service descriptor * @param {Object} implementation Map of method names to * method implementation for the provided service. */ Server.prototype.addProtoService = function(service, implementation) { var options; - if (service.grpc_options) { - options = service.grpc_options; + common.log(grpc.logVerbosity.INFO, + 'Server#addProtoService is deprecated. Use addService instead'); + if (service.hasOwnProperty('children')) { + // Heuristically: this is a Protobuf.js 5 service object + var protobuf_js_5_common = require('./protobuf_js_5_common'); + options = _.defaults(service.grpc_options, common.defaultGrpcOptions); + this.addService( + protobuf_js_5_common.getProtobufServiceAttrs(service, options), + implementation); + } else if (service.hasOwnProperty('methods')) { + // Heuristically: this is a Protobuf.js 6 service object + var protobuf_js_6_common = require('./protobuf_js_6_common'); + options = _.defaults(service.grpc_options, common.defaultGrpcOptions); + this.addService( + protobuf_js_6_common.getProtobufServiceAttrs(service, options), + implementation); + } else { + // We assume that this is a service attributes object + this.addService(service, implementation); } - this.addService(common.getProtobufServiceAttrs(service, options), - implementation); }; /** diff --git a/src/node/stress/metrics_server.js b/src/node/stress/metrics_server.js index 3ab4b4c82d3..b3f939e8f3d 100644 --- a/src/node/stress/metrics_server.js +++ b/src/node/stress/metrics_server.js @@ -63,7 +63,7 @@ function getAllGauges(call) { function MetricsServer(port) { var server = new grpc.Server(); - server.addProtoService(metrics.MetricsService.service, { + server.addService(metrics.MetricsService.service, { getGauge: _.bind(getGauge, this), getAllGauges: _.bind(getAllGauges, this) }); diff --git a/src/node/test/common_test.js b/src/node/test/common_test.js index c57b7388f67..529e82e3242 100644 --- a/src/node/test/common_test.js +++ b/src/node/test/common_test.js @@ -34,17 +34,26 @@ 'use strict'; var assert = require('assert'); +var _ = require('lodash'); -var common = require('../src/common.js'); +var common = require('../src/common'); +var protobuf_js_6_common = require('../src/protobuf_js_6_common'); + +var serializeCls = protobuf_js_6_common.serializeCls; +var deserializeCls = protobuf_js_6_common.deserializeCls; var ProtoBuf = require('protobufjs'); -var messages_proto = ProtoBuf.loadProtoFile( - __dirname + '/test_messages.proto').build(); +var messages_proto = new ProtoBuf.Root(); +messages_proto = messages_proto.loadSync( + __dirname + '/test_messages.proto', {keepCase: true}).resolveAll(); + +var default_options = common.defaultGrpcOptions; describe('Proto message long int serialize and deserialize', function() { - var longSerialize = common.serializeCls(messages_proto.LongValues); - var longDeserialize = common.deserializeCls(messages_proto.LongValues); + var longSerialize = serializeCls(messages_proto.LongValues); + var longDeserialize = deserializeCls(messages_proto.LongValues, + default_options); var pos_value = '314159265358979'; var neg_value = '-27182818284590'; it('should preserve positive int64 values', function() { @@ -88,8 +97,9 @@ describe('Proto message long int serialize and deserialize', function() { neg_value); }); it('should deserialize as a number with the right option set', function() { - var longNumDeserialize = common.deserializeCls(messages_proto.LongValues, - false, false); + var num_options = _.defaults({longsAsStrings: false}, default_options); + var longNumDeserialize = deserializeCls(messages_proto.LongValues, + num_options); var serialized = longSerialize({int_64: pos_value}); assert.strictEqual(typeof longDeserialize(serialized).int_64, 'string'); /* With the longsAsStrings option disabled, long values are represented as @@ -98,11 +108,12 @@ describe('Proto message long int serialize and deserialize', function() { }); }); describe('Proto message bytes serialize and deserialize', function() { - var sequenceSerialize = common.serializeCls(messages_proto.SequenceValues); - var sequenceDeserialize = common.deserializeCls( - messages_proto.SequenceValues); - var sequenceBase64Deserialize = common.deserializeCls( - messages_proto.SequenceValues, true); + var sequenceSerialize = serializeCls(messages_proto.SequenceValues); + var sequenceDeserialize = deserializeCls( + messages_proto.SequenceValues, default_options); + var b64_options = _.defaults({binaryAsBase64: true}, default_options); + var sequenceBase64Deserialize = deserializeCls( + messages_proto.SequenceValues, b64_options); var buffer_val = new Buffer([0x69, 0xb7]); var base64_val = 'abc='; it('should preserve a buffer', function() { diff --git a/src/node/test/credentials_test.js b/src/node/test/credentials_test.js index 305843f665e..b66b4bf5ea4 100644 --- a/src/node/test/credentials_test.js +++ b/src/node/test/credentials_test.js @@ -228,7 +228,7 @@ describe('client credentials', function() { before(function() { var proto = grpc.load(__dirname + '/test_service.proto'); server = new grpc.Server(); - server.addProtoService(proto.TestService.service, { + server.addService(proto.TestService.service, { unary: function(call, cb) { call.sendMetadata(call.metadata); cb(null, {}); diff --git a/src/node/test/surface_test.js b/src/node/test/surface_test.js index 2636ea85ac8..1e3fe8fb575 100644 --- a/src/node/test/surface_test.js +++ b/src/node/test/surface_test.js @@ -34,19 +34,23 @@ 'use strict'; var assert = require('assert'); +var _ = require('lodash'); var surface_client = require('../src/client.js'); +var common = require('../src/common'); var ProtoBuf = require('protobufjs'); var grpc = require('..'); -var math_proto = ProtoBuf.loadProtoFile(__dirname + - '/../../proto/math/math.proto'); +var math_proto = new ProtoBuf.Root(); +math_proto = math_proto.loadSync(__dirname + + '/../../proto/math/math.proto', {keepCase: true}); var mathService = math_proto.lookup('math.Math'); - -var _ = require('lodash'); +var mathServiceAttrs = grpc.loadObject( + mathService, + _.defaults({protobufjs_version: 6}, common.defaultGrpcOptions)).service; /** * This is used for testing functions with multiple asynchronous calls that @@ -87,11 +91,6 @@ describe('File loader', function() { grpc.load(__dirname + '/test_service.json', 'json'); }); }); - it('Should fail to load a file with an unknown format', function() { - assert.throws(function() { - grpc.load(__dirname + '/test_service.proto', 'fake_format'); - }); - }); }); describe('surface Server', function() { var server; @@ -132,29 +131,54 @@ describe('Server.prototype.addProtoService', function() { afterEach(function() { server.forceShutdown(); }); - it('Should succeed with a single service', function() { + it('Should succeed with a single proto service', function() { assert.doesNotThrow(function() { server.addProtoService(mathService, dummyImpls); }); }); + it('Should succeed with a single service attributes object', function() { + assert.doesNotThrow(function() { + server.addProtoService(mathServiceAttrs, dummyImpls); + }); + }); +}); +describe('Server.prototype.addService', function() { + var server; + var dummyImpls = { + 'div': function() {}, + 'divMany': function() {}, + 'fib': function() {}, + 'sum': function() {} + }; + beforeEach(function() { + server = new grpc.Server(); + }); + afterEach(function() { + server.forceShutdown(); + }); + it('Should succeed with a single service', function() { + assert.doesNotThrow(function() { + server.addService(mathServiceAttrs, dummyImpls); + }); + }); it('Should fail with conflicting method names', function() { - server.addProtoService(mathService, dummyImpls); + server.addService(mathServiceAttrs, dummyImpls); assert.throws(function() { - server.addProtoService(mathService, dummyImpls); + server.addService(mathServiceAttrs, dummyImpls); }); }); it('Should fail if the server has been started', function() { server.start(); assert.throws(function() { - server.addProtoService(mathService, dummyImpls); + server.addService(mathServiceAttrs, dummyImpls); }); }); describe('Default handlers', function() { var client; beforeEach(function() { - server.addProtoService(mathService, {}); + server.addService(mathServiceAttrs, {}); var port = server.bind('localhost:0', server_insecure_creds); - var Client = surface_client.makeProtobufClientConstructor(mathService); + var Client = grpc.loadObject(mathService, {protobufjs_version: 6}); client = new Client('localhost:' + port, grpc.credentials.createInsecure()); server.start(); @@ -226,7 +250,7 @@ describe('waitForClientReady', function() { server = new grpc.Server(); port = server.bind('localhost:0', grpc.ServerCredentials.createInsecure()); server.start(); - Client = surface_client.makeProtobufClientConstructor(mathService); + Client = grpc.loadObject(mathService, {protobufjs_version: 6}); }); beforeEach(function() { client = new Client('localhost:' + port, grpc.credentials.createInsecure()); @@ -283,16 +307,18 @@ describe('Echo service', function() { var server; var client; before(function() { - var test_proto = ProtoBuf.loadProtoFile(__dirname + '/echo_service.proto'); + var test_proto = new ProtoBuf.Root(); + test_proto = test_proto.loadSync(__dirname + '/echo_service.proto', + {keepCase: true}); var echo_service = test_proto.lookup('EchoService'); + var Client = grpc.loadObject(echo_service, {protobufjs_version: 6}); server = new grpc.Server(); - server.addProtoService(echo_service, { + server.addService(Client.service, { echo: function(call, callback) { callback(null, call.request); } }); var port = server.bind('localhost:0', server_insecure_creds); - var Client = surface_client.makeProtobufClientConstructor(echo_service); client = new Client('localhost:' + port, grpc.credentials.createInsecure()); server.start(); }); @@ -406,10 +432,13 @@ describe('Echo metadata', function() { var server; var metadata; before(function() { - var test_proto = ProtoBuf.loadProtoFile(__dirname + '/test_service.proto'); + var test_proto = new ProtoBuf.Root(); + test_proto = test_proto.loadSync(__dirname + '/test_service.proto', + {keepCase: true}); var test_service = test_proto.lookup('TestService'); + var Client = grpc.loadObject(test_service, {protobufjs_version: 6}); server = new grpc.Server(); - server.addProtoService(test_service, { + server.addService(Client.service, { unary: function(call, cb) { call.sendMetadata(call.metadata); cb(null, {}); @@ -434,7 +463,6 @@ describe('Echo metadata', function() { } }); var port = server.bind('localhost:0', server_insecure_creds); - var Client = surface_client.makeProtobufClientConstructor(test_service); client = new Client('localhost:' + port, grpc.credentials.createInsecure()); server.start(); metadata = new grpc.Metadata(); @@ -507,7 +535,9 @@ describe('Client malformed response handling', function() { var client; var badArg = new Buffer([0xFF]); before(function() { - var test_proto = ProtoBuf.loadProtoFile(__dirname + '/test_service.proto'); + var test_proto = new ProtoBuf.Root(); + test_proto = test_proto.loadSync(__dirname + '/test_service.proto', + {keepCase: true}); var test_service = test_proto.lookup('TestService'); var malformed_test_service = { unary: { @@ -565,7 +595,7 @@ describe('Client malformed response handling', function() { } }); var port = server.bind('localhost:0', server_insecure_creds); - var Client = surface_client.makeProtobufClientConstructor(test_service); + var Client = grpc.loadObject(test_service, {protobufjs_version: 6}); client = new Client('localhost:' + port, grpc.credentials.createInsecure()); server.start(); }); @@ -614,7 +644,9 @@ describe('Server serialization failure handling', function() { var client; var server; before(function() { - var test_proto = ProtoBuf.loadProtoFile(__dirname + '/test_service.proto'); + var test_proto = new ProtoBuf.Root(); + test_proto = test_proto.loadSync(__dirname + '/test_service.proto', + {keepCase: true}); var test_service = test_proto.lookup('TestService'); var malformed_test_service = { unary: { @@ -672,7 +704,7 @@ describe('Server serialization failure handling', function() { } }); var port = server.bind('localhost:0', server_insecure_creds); - var Client = surface_client.makeProtobufClientConstructor(test_service); + var Client = grpc.loadObject(test_service, {protobufjs_version: 6}); client = new Client('localhost:' + port, grpc.credentials.createInsecure()); server.start(); }); @@ -721,12 +753,15 @@ describe('Other conditions', function() { var server; var port; before(function() { - var test_proto = ProtoBuf.loadProtoFile(__dirname + '/test_service.proto'); + var test_proto = new ProtoBuf.Root(); + test_proto = test_proto.loadSync(__dirname + '/test_service.proto', + {keepCase: true}); test_service = test_proto.lookup('TestService'); + Client = grpc.loadObject(test_service, {protobufjs_version: 6}); server = new grpc.Server(); var trailer_metadata = new grpc.Metadata(); trailer_metadata.add('trailer-present', 'yes'); - server.addProtoService(test_service, { + server.addService(Client.service, { unary: function(call, cb) { var req = call.request; if (req.error) { @@ -786,7 +821,6 @@ describe('Other conditions', function() { } }); port = server.bind('localhost:0', server_insecure_creds); - Client = surface_client.makeProtobufClientConstructor(test_service); client = new Client('localhost:' + port, grpc.credentials.createInsecure()); server.start(); }); @@ -1067,17 +1101,19 @@ describe('Call propagation', function() { var client; var server; before(function() { - var test_proto = ProtoBuf.loadProtoFile(__dirname + '/test_service.proto'); + var test_proto = new ProtoBuf.Root(); + test_proto = test_proto.loadSync(__dirname + '/test_service.proto', + {keepCase: true}); test_service = test_proto.lookup('TestService'); server = new grpc.Server(); - server.addProtoService(test_service, { + Client = grpc.loadObject(test_service, {protobufjs_version: 6}); + server.addService(Client.service, { unary: function(call) {}, clientStream: function(stream) {}, serverStream: function(stream) {}, bidiStream: function(stream) {} }); var port = server.bind('localhost:0', server_insecure_creds); - Client = surface_client.makeProtobufClientConstructor(test_service); client = new Client('localhost:' + port, grpc.credentials.createInsecure()); server.start(); }); @@ -1112,7 +1148,7 @@ describe('Call propagation', function() { }); call.cancel(); }; - proxy.addProtoService(test_service, proxy_impl); + proxy.addService(Client.service, proxy_impl); var proxy_port = proxy.bind('localhost:0', server_insecure_creds); proxy.start(); var proxy_client = new Client('localhost:' + proxy_port, @@ -1134,7 +1170,7 @@ describe('Call propagation', function() { }); call.cancel(); }; - proxy.addProtoService(test_service, proxy_impl); + proxy.addService(Client.service, proxy_impl); var proxy_port = proxy.bind('localhost:0', server_insecure_creds); proxy.start(); var proxy_client = new Client('localhost:' + proxy_port, @@ -1154,7 +1190,7 @@ describe('Call propagation', function() { }); call.cancel(); }; - proxy.addProtoService(test_service, proxy_impl); + proxy.addService(Client.service, proxy_impl); var proxy_port = proxy.bind('localhost:0', server_insecure_creds); proxy.start(); var proxy_client = new Client('localhost:' + proxy_port, @@ -1178,7 +1214,7 @@ describe('Call propagation', function() { }); call.cancel(); }; - proxy.addProtoService(test_service, proxy_impl); + proxy.addService(Client.service, proxy_impl); var proxy_port = proxy.bind('localhost:0', server_insecure_creds); proxy.start(); var proxy_client = new Client('localhost:' + proxy_port, @@ -1209,7 +1245,7 @@ describe('Call propagation', function() { } }); }; - proxy.addProtoService(test_service, proxy_impl); + proxy.addService(Client.service, proxy_impl); var proxy_port = proxy.bind('localhost:0', server_insecure_creds); proxy.start(); var proxy_client = new Client('localhost:' + proxy_port, @@ -1233,7 +1269,7 @@ describe('Call propagation', function() { done(); }); }; - proxy.addProtoService(test_service, proxy_impl); + proxy.addService(Client.service, proxy_impl); var proxy_port = proxy.bind('localhost:0', server_insecure_creds); proxy.start(); var proxy_client = new Client('localhost:' + proxy_port, @@ -1253,14 +1289,14 @@ describe('Cancelling surface client', function() { var server; before(function() { server = new grpc.Server(); - server.addProtoService(mathService, { + server.addService(mathServiceAttrs, { 'div': function(stream) {}, 'divMany': function(stream) {}, 'fib': function(stream) {}, 'sum': function(stream) {} }); var port = server.bind('localhost:0', server_insecure_creds); - var Client = surface_client.makeProtobufClientConstructor(mathService); + var Client = surface_client.makeClientConstructor(mathServiceAttrs); client = new Client('localhost:' + port, grpc.credentials.createInsecure()); server.start(); }); diff --git a/templates/package.json.template b/templates/package.json.template index 316c28e478e..e039408e331 100644 --- a/templates/package.json.template +++ b/templates/package.json.template @@ -36,7 +36,7 @@ "lodash": "^4.15.0", "nan": "^2.0.0", "node-pre-gyp": "^0.6.0", - "protobufjs": "^5.0.0" + "protobufjs": "^6.0.0" }, "devDependencies": { "async": "^2.0.1", From b1a02311b37c35b8813386d2d7fbb02e1e61d616 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 17 Mar 2017 13:45:15 -0700 Subject: [PATCH 060/461] Autodetect ProtoBuf.js version in grpc.loadObject --- src/node/index.js | 18 +++++++++++------- src/node/test/surface_test.js | 19 +++++++++---------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/node/index.js b/src/node/index.js index 43a4a54dd8d..e41664ebf38 100644 --- a/src/node/index.js +++ b/src/node/index.js @@ -58,12 +58,17 @@ var protobuf_js_6_common = require('./src/protobuf_js_6_common'); grpc.setDefaultRootsPem(fs.readFileSync(SSL_ROOTS_PATH, 'ascii')); exports.loadObject = function loadObject(value, options) { - options = _.defaults(options, {'protobufjs_version': 5}); - switch (options.protobufjs_version) { - case 5: return protobuf_js_5_common.loadObject(value, options); - case 6: return protobuf_js_6_common.loadObject(value, options); - default: throw new Error('Unrecognized protobufjs_version:', - options.protobufjs_version); + options = _.defaults(options, common.defaultGrpcOptions); + if (value instanceof ProtoBuf.ReflectionObject) { + return protobuf_js_6_common.loadObject(value, options); + } else { + /* If value is not a ProtoBuf.js 6 reflection object, we assume that it is + a ProtoBuf.js 5 reflection object, for backwards compatibility */ + var deprecation_message = 'Calling grpc.loadObject with an object ' + + 'generated by ProtoBuf.js 5 is deprecated. Please upgrade to ' + + 'ProtoBuf.js 6.'; + common.log(grpc.logVerbosity.INFO, deprecation_message); + return protobuf_js_5_common.loadObject(value, options); } }; @@ -108,7 +113,6 @@ exports.load = function load(filename, format, options) { still the possibility of adding other formats that would be loaded differently */ options = _.defaults(options, common.defaultGrpcOptions); - options.protobufjs_version = 6; var root = new ProtoBuf.Root(); var parse_options = {keepCase: !options.convertFieldsToCamelCase}; return loadObject(root.loadSync(applyProtoRoot(filename, root), diff --git a/src/node/test/surface_test.js b/src/node/test/surface_test.js index 1e3fe8fb575..026d2c7dc25 100644 --- a/src/node/test/surface_test.js +++ b/src/node/test/surface_test.js @@ -49,8 +49,7 @@ math_proto = math_proto.loadSync(__dirname + var mathService = math_proto.lookup('math.Math'); var mathServiceAttrs = grpc.loadObject( - mathService, - _.defaults({protobufjs_version: 6}, common.defaultGrpcOptions)).service; + mathService, common.defaultGrpcOptions).service; /** * This is used for testing functions with multiple asynchronous calls that @@ -178,7 +177,7 @@ describe('Server.prototype.addService', function() { beforeEach(function() { server.addService(mathServiceAttrs, {}); var port = server.bind('localhost:0', server_insecure_creds); - var Client = grpc.loadObject(mathService, {protobufjs_version: 6}); + var Client = grpc.loadObject(mathService); client = new Client('localhost:' + port, grpc.credentials.createInsecure()); server.start(); @@ -250,7 +249,7 @@ describe('waitForClientReady', function() { server = new grpc.Server(); port = server.bind('localhost:0', grpc.ServerCredentials.createInsecure()); server.start(); - Client = grpc.loadObject(mathService, {protobufjs_version: 6}); + Client = grpc.loadObject(mathService); }); beforeEach(function() { client = new Client('localhost:' + port, grpc.credentials.createInsecure()); @@ -311,7 +310,7 @@ describe('Echo service', function() { test_proto = test_proto.loadSync(__dirname + '/echo_service.proto', {keepCase: true}); var echo_service = test_proto.lookup('EchoService'); - var Client = grpc.loadObject(echo_service, {protobufjs_version: 6}); + var Client = grpc.loadObject(echo_service); server = new grpc.Server(); server.addService(Client.service, { echo: function(call, callback) { @@ -436,7 +435,7 @@ describe('Echo metadata', function() { test_proto = test_proto.loadSync(__dirname + '/test_service.proto', {keepCase: true}); var test_service = test_proto.lookup('TestService'); - var Client = grpc.loadObject(test_service, {protobufjs_version: 6}); + var Client = grpc.loadObject(test_service); server = new grpc.Server(); server.addService(Client.service, { unary: function(call, cb) { @@ -595,7 +594,7 @@ describe('Client malformed response handling', function() { } }); var port = server.bind('localhost:0', server_insecure_creds); - var Client = grpc.loadObject(test_service, {protobufjs_version: 6}); + var Client = grpc.loadObject(test_service); client = new Client('localhost:' + port, grpc.credentials.createInsecure()); server.start(); }); @@ -704,7 +703,7 @@ describe('Server serialization failure handling', function() { } }); var port = server.bind('localhost:0', server_insecure_creds); - var Client = grpc.loadObject(test_service, {protobufjs_version: 6}); + var Client = grpc.loadObject(test_service); client = new Client('localhost:' + port, grpc.credentials.createInsecure()); server.start(); }); @@ -757,7 +756,7 @@ describe('Other conditions', function() { test_proto = test_proto.loadSync(__dirname + '/test_service.proto', {keepCase: true}); test_service = test_proto.lookup('TestService'); - Client = grpc.loadObject(test_service, {protobufjs_version: 6}); + Client = grpc.loadObject(test_service); server = new grpc.Server(); var trailer_metadata = new grpc.Metadata(); trailer_metadata.add('trailer-present', 'yes'); @@ -1106,7 +1105,7 @@ describe('Call propagation', function() { {keepCase: true}); test_service = test_proto.lookup('TestService'); server = new grpc.Server(); - Client = grpc.loadObject(test_service, {protobufjs_version: 6}); + Client = grpc.loadObject(test_service); server.addService(Client.service, { unary: function(call) {}, clientStream: function(stream) {}, From 2a63e1b28397d998aca50250990c5e5eef00f561 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 1 Mar 2017 18:48:43 -0800 Subject: [PATCH 061/461] Fix a bug in slice_buffer:maybe_embiggen --- src/core/lib/slice/slice_buffer.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/core/lib/slice/slice_buffer.c b/src/core/lib/slice/slice_buffer.c index 9176dc8a420..451319c50d6 100644 --- a/src/core/lib/slice/slice_buffer.c +++ b/src/core/lib/slice/slice_buffer.c @@ -46,11 +46,6 @@ #define GROW(x) (3 * (x) / 2) static void maybe_embiggen(grpc_slice_buffer *sb) { - if (sb->base_slices != sb->slices) { - memmove(sb->base_slices, sb->slices, sb->count * sizeof(grpc_slice)); - sb->slices = sb->base_slices; - } - /* How far away from sb->base_slices is sb->slices pointer */ size_t slice_offset = (size_t)(sb->slices - sb->base_slices); size_t slice_count = sb->count + slice_offset; @@ -61,12 +56,15 @@ static void maybe_embiggen(grpc_slice_buffer *sb) { if (sb->base_slices == sb->inlined) { sb->base_slices = gpr_malloc(sb->capacity * sizeof(grpc_slice)); memcpy(sb->base_slices, sb->inlined, slice_count * sizeof(grpc_slice)); + sb->slices = sb->base_slices + slice_offset; } else { + if (sb->base_slices != sb->slices) { + memmove(sb->base_slices, sb->slices, sb->count * sizeof(grpc_slice)); + } sb->base_slices = gpr_realloc(sb->base_slices, sb->capacity * sizeof(grpc_slice)); + sb->slices = sb->base_slices; } - - sb->slices = sb->base_slices + slice_offset; } } From c0e6701c57de49e3134ca2a940399f39380ba1d0 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Fri, 17 Mar 2017 20:00:55 -0700 Subject: [PATCH 062/461] Added dependencies in build.yaml to allow building --- CMakeLists.txt | 2 ++ Makefile | 18 +++++++++--------- build.yaml | 3 +++ grpc.def | 1 + src/ruby/ext/grpc/rb_grpc_imports.generated.c | 2 ++ src/ruby/ext/grpc/rb_grpc_imports.generated.h | 3 +++ .../generated/sources_and_headers.json | 2 ++ .../codegen_test_minimal.vcxproj | 8 ++++++++ 8 files changed, 30 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 180f4166091..40db69f1d98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8424,6 +8424,8 @@ target_include_directories(codegen_test_minimal target_link_libraries(codegen_test_minimal ${_gRPC_PROTOBUF_LIBRARIES} ${_gRPC_ALLTARGETS_LIBRARIES} + grpc + gpr ${_gRPC_GFLAGS_LIBRARIES} ) diff --git a/Makefile b/Makefile index 2a9cbc382bb..32bf2ab0bcd 100644 --- a/Makefile +++ b/Makefile @@ -13505,28 +13505,28 @@ $(BINDIR)/$(CONFIG)/codegen_test_minimal: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/codegen_test_minimal: $(PROTOBUF_DEP) $(CODEGEN_TEST_MINIMAL_OBJS) +$(BINDIR)/$(CONFIG)/codegen_test_minimal: $(PROTOBUF_DEP) $(CODEGEN_TEST_MINIMAL_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(CODEGEN_TEST_MINIMAL_OBJS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/codegen_test_minimal + $(Q) $(LDXX) $(LDFLAGS) $(CODEGEN_TEST_MINIMAL_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/codegen_test_minimal endif endif -$(OBJDIR)/$(CONFIG)/src/proto/grpc/testing/control.o: +$(OBJDIR)/$(CONFIG)/src/proto/grpc/testing/control.o: $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a -$(OBJDIR)/$(CONFIG)/src/proto/grpc/testing/messages.o: +$(OBJDIR)/$(CONFIG)/src/proto/grpc/testing/messages.o: $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a -$(OBJDIR)/$(CONFIG)/src/proto/grpc/testing/payloads.o: +$(OBJDIR)/$(CONFIG)/src/proto/grpc/testing/payloads.o: $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a -$(OBJDIR)/$(CONFIG)/src/proto/grpc/testing/services.o: +$(OBJDIR)/$(CONFIG)/src/proto/grpc/testing/services.o: $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a -$(OBJDIR)/$(CONFIG)/src/proto/grpc/testing/stats.o: +$(OBJDIR)/$(CONFIG)/src/proto/grpc/testing/stats.o: $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a -$(OBJDIR)/$(CONFIG)/test/cpp/codegen/codegen_test_minimal.o: +$(OBJDIR)/$(CONFIG)/test/cpp/codegen/codegen_test_minimal.o: $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a -$(OBJDIR)/$(CONFIG)/src/cpp/codegen/codegen_init.o: +$(OBJDIR)/$(CONFIG)/src/cpp/codegen/codegen_init.o: $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a deps_codegen_test_minimal: $(CODEGEN_TEST_MINIMAL_OBJS:.o=.dep) diff --git a/build.yaml b/build.yaml index 997f55df97a..af415f63c27 100644 --- a/build.yaml +++ b/build.yaml @@ -3413,6 +3413,9 @@ targets: - src/proto/grpc/testing/services.proto - src/proto/grpc/testing/stats.proto - test/cpp/codegen/codegen_test_minimal.cc + deps: + - grpc + - gpr filegroups: - grpc++_codegen_base - grpc++_codegen_base_src diff --git a/grpc.def b/grpc.def index 30d60b0d06d..1022e5b7f10 100644 --- a/grpc.def +++ b/grpc.def @@ -67,6 +67,7 @@ EXPORTS grpc_channel_ping grpc_channel_register_call grpc_channel_create_registered_call + grpc_call_arena_alloc grpc_call_start_batch grpc_call_get_peer grpc_call_set_load_reporting_cost_context diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.c b/src/ruby/ext/grpc/rb_grpc_imports.generated.c index 3ef6f0eb299..8afe1e3d36b 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.c +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.c @@ -105,6 +105,7 @@ grpc_channel_create_call_type grpc_channel_create_call_import; grpc_channel_ping_type grpc_channel_ping_import; grpc_channel_register_call_type grpc_channel_register_call_import; grpc_channel_create_registered_call_type grpc_channel_create_registered_call_import; +grpc_call_arena_alloc_type grpc_call_arena_alloc_import; grpc_call_start_batch_type grpc_call_start_batch_import; grpc_call_get_peer_type grpc_call_get_peer_import; grpc_call_set_load_reporting_cost_context_type grpc_call_set_load_reporting_cost_context_import; @@ -399,6 +400,7 @@ void grpc_rb_load_imports(HMODULE library) { grpc_channel_ping_import = (grpc_channel_ping_type) GetProcAddress(library, "grpc_channel_ping"); grpc_channel_register_call_import = (grpc_channel_register_call_type) GetProcAddress(library, "grpc_channel_register_call"); grpc_channel_create_registered_call_import = (grpc_channel_create_registered_call_type) GetProcAddress(library, "grpc_channel_create_registered_call"); + grpc_call_arena_alloc_import = (grpc_call_arena_alloc_type) GetProcAddress(library, "grpc_call_arena_alloc"); grpc_call_start_batch_import = (grpc_call_start_batch_type) GetProcAddress(library, "grpc_call_start_batch"); grpc_call_get_peer_import = (grpc_call_get_peer_type) GetProcAddress(library, "grpc_call_get_peer"); grpc_call_set_load_reporting_cost_context_import = (grpc_call_set_load_reporting_cost_context_type) GetProcAddress(library, "grpc_call_set_load_reporting_cost_context"); diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h index ef9845dfe06..9778f7816f6 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h @@ -266,6 +266,9 @@ extern grpc_channel_register_call_type grpc_channel_register_call_import; typedef grpc_call *(*grpc_channel_create_registered_call_type)(grpc_channel *channel, grpc_call *parent_call, uint32_t propagation_mask, grpc_completion_queue *completion_queue, void *registered_call_handle, gpr_timespec deadline, void *reserved); extern grpc_channel_create_registered_call_type grpc_channel_create_registered_call_import; #define grpc_channel_create_registered_call grpc_channel_create_registered_call_import +typedef void *(*grpc_call_arena_alloc_type)(grpc_call *call, size_t size); +extern grpc_call_arena_alloc_type grpc_call_arena_alloc_import; +#define grpc_call_arena_alloc grpc_call_arena_alloc_import typedef grpc_call_error(*grpc_call_start_batch_type)(grpc_call *call, const grpc_op *ops, size_t nops, void *tag, void *reserved); extern grpc_call_start_batch_type grpc_call_start_batch_import; #define grpc_call_start_batch grpc_call_start_batch_import diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 866d8a55c96..ca23d1d99da 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -2816,6 +2816,8 @@ }, { "deps": [ + "gpr", + "grpc", "grpc++_codegen_base", "grpc++_codegen_base_src" ], diff --git a/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj b/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj index fd014fdc098..d176a36f208 100644 --- a/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj +++ b/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj @@ -256,6 +256,14 @@ + + + {29D16885-7228-4C31-81ED-5F9187C7F2A9} + + + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + From 379be59d0aa65e88ac3754bb3dc4635931263714 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Fri, 17 Mar 2017 20:36:31 -0700 Subject: [PATCH 063/461] Pour one out for shared ptr --- .../grpc++/impl/codegen/async_unary_call.h | 12 +++-- include/grpc++/impl/codegen/call.h | 50 ++++++++++++++----- 2 files changed, 47 insertions(+), 15 deletions(-) diff --git a/include/grpc++/impl/codegen/async_unary_call.h b/include/grpc++/impl/codegen/async_unary_call.h index d11986b6ece..50bb399df62 100644 --- a/include/grpc++/impl/codegen/async_unary_call.h +++ b/include/grpc++/impl/codegen/async_unary_call.h @@ -61,6 +61,11 @@ template class ClientAsyncResponseReader final : public ClientAsyncResponseReaderInterface { public: + ~ClientAsyncResponseReader() { + if (collection_ != nullptr && collection_->Unref()) { + delete collection_; + } + } template static ClientAsyncResponseReader* Create(ChannelInterface* channel, CompletionQueue* cq, @@ -72,9 +77,10 @@ class ClientAsyncResponseReader final grpc_call_arena_alloc(call.call(), sizeof(*reader))); new (&reader->call_) Call(std::move(call)); reader->context_ = context; - new (&reader->collection_) std::shared_ptr( + reader->collection_ = new (grpc_call_arena_alloc(call.call(), sizeof(CallOpSetCollection))) - CallOpSetCollection()); + CallOpSetCollection(); + reader->collection_->init_buf_.SetCollection(reader->collection_); reader->collection_->init_buf_.SendInitialMetadata( context->send_initial_metadata_, context->initial_metadata_flags()); @@ -138,7 +144,7 @@ class ClientAsyncResponseReader final // disable operator new static void* operator new(std::size_t size); }; - std::shared_ptr collection_; + CallOpSetCollection* collection_; }; template diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h index 19a5ca2b2ee..69fe21d0240 100644 --- a/include/grpc++/impl/codegen/call.h +++ b/include/grpc++/impl/codegen/call.h @@ -34,6 +34,7 @@ #ifndef GRPCXX_IMPL_CODEGEN_CALL_H #define GRPCXX_IMPL_CODEGEN_CALL_H +#include #include #include #include @@ -50,6 +51,7 @@ #include #include +#include #include #include @@ -523,14 +525,30 @@ class CallOpClientRecvStatus { /// An abstract collection of CallOpSet's, to be used whenever /// CallOpSet objects must be thought of as a group. Each member -/// of the group should have a shared_ptr back to the collection, -/// as will the object that instantiates the collection, allowing -/// for automatic ref-counting. In practice, any actual use should -/// derive from this base class. This is specifically necessary if -/// some of the CallOpSet's in the collection are "Sneaky" and don't -/// report back to the C++ layer CQ operations -class CallOpSetCollectionInterface - : public std::enable_shared_from_this {}; +/// of the group should reference the collection, as will the object +/// that instantiates the collection, allowing for ref-counting. +/// Any actual use should derive from this base class. This is specifically +/// necessary if some of the CallOpSet's in the collection are "Sneaky" and +/// don't report back to the C++ layer CQ operations +class CallOpSetCollectionInterface { + public: + CallOpSetCollectionInterface() { + gpr_atm_rel_store(&refs_, static_cast(1)); + } + // always allocated against a call arena, no memory free required + static void operator delete(void* ptr, std::size_t size) { + assert(size == sizeof(CallOpSetCollectionInterface)); + } + void Ref() { gpr_atm_no_barrier_fetch_add(&refs_, static_cast(1)); } + bool Unref() { + gpr_atm old = + gpr_atm_no_barrier_fetch_add(&refs_, static_cast(-1)); + return (old == static_cast(1)); + } + + private: + gpr_atm refs_; +}; /// An abstract collection of call ops, used to generate the /// grpc_call_op structure to pass down to the lower layers, @@ -539,18 +557,26 @@ class CallOpSetCollectionInterface /// API. class CallOpSetInterface : public CompletionQueueTag { public: - CallOpSetInterface() {} + CallOpSetInterface() : collection_(nullptr) {} + ~CallOpSetInterface() { ResetCollection(); } /// Fills in grpc_op, starting from ops[*nops] and moving /// upwards. virtual void FillOps(grpc_op* ops, size_t* nops) = 0; /// Mark this as belonging to a collection if needed - void SetCollection(std::shared_ptr collection) { + void SetCollection(CallOpSetCollectionInterface* collection) { collection_ = collection; + collection->Ref(); + } + void ResetCollection() { + if (collection_ != nullptr && collection_->Unref()) { + delete collection_; + } + collection_ = nullptr; } protected: - std::shared_ptr collection_; + CallOpSetCollectionInterface* collection_; }; /// Primary implementaiton of CallOpSetInterface. @@ -588,7 +614,7 @@ class CallOpSet : public CallOpSetInterface, this->Op5::FinishOp(status); this->Op6::FinishOp(status); *tag = return_tag_; - collection_.reset(); // drop the ref at this point + ResetCollection(); // drop the ref at this point return true; } From 408f36bf286928f069ef256577736a655c38e9d1 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sun, 19 Mar 2017 00:25:22 -0700 Subject: [PATCH 064/461] Bug fix --- .../transport/chttp2/transport/chttp2_transport.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 83b27a49aad..79aa05e2124 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1646,15 +1646,18 @@ static void remove_stream(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, bs->push_closed = true; if (bs->on_next != NULL) { gpr_mu_unlock(&bs->slice_mu); + gpr_mu_unlock(&s->buffer_mu); grpc_chttp2_incoming_byte_stream_finished( exec_ctx, s->data_parser.parsing_frame, GRPC_ERROR_REF(error)); s->data_parser.parsing_frame = NULL; } else { bs->error = GRPC_ERROR_REF(error); gpr_mu_unlock(&bs->slice_mu); + gpr_mu_unlock(&s->buffer_mu); } + } else { + gpr_mu_unlock(&s->buffer_mu); } - gpr_mu_unlock(&s->buffer_mu); if (grpc_chttp2_stream_map_size(&t->stream_map) == 0) { post_benign_reclaimer(exec_ctx, t); @@ -2519,8 +2522,9 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx *exec_ctx, GRPC_ERROR_REF(bs->error)); } else if (bs->push_closed) { if (bs->remaining_bytes != 0) { + bs->error = GRPC_ERROR_CREATE("Truncated message"); grpc_closure_sched(exec_ctx, bs->next_action.on_complete, - GRPC_ERROR_CREATE("Truncated message")); + GRPC_ERROR_REF(bs->error)); } else { /* Should never reach here. */ GPR_ASSERT(false); @@ -2557,6 +2561,10 @@ static grpc_error *incoming_byte_stream_pull(grpc_exec_ctx *exec_ctx, gpr_mu_unlock(&s->buffer_mu); return error; } + } else { + bs->error = GRPC_ERROR_CREATE("Truncated message"); + gpr_mu_unlock(&s->buffer_mu); + return bs->error; } gpr_mu_unlock(&s->buffer_mu); GPR_TIMER_END("incoming_byte_stream_pull", 0); From 1f9fd13a15f97d6e3d1a93d942d3a44bd9526471 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sun, 19 Mar 2017 10:39:09 -0700 Subject: [PATCH 065/461] clang-format --- .../chttp2/transport/chttp2_transport.c | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 79aa05e2124..a8962d305d4 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -509,11 +509,10 @@ static void destroy_transport_locked(grpc_exec_ctx *exec_ctx, void *tp, static void destroy_transport(grpc_exec_ctx *exec_ctx, grpc_transport *gt) { grpc_chttp2_transport *t = (grpc_chttp2_transport *)gt; - grpc_closure_sched( - exec_ctx, - grpc_closure_create(destroy_transport_locked, t, - grpc_combiner_scheduler(t->combiner, false)), - GRPC_ERROR_NONE); + grpc_closure_sched(exec_ctx, grpc_closure_create( + destroy_transport_locked, t, + grpc_combiner_scheduler(t->combiner, false)), + GRPC_ERROR_NONE); } static void close_transport_locked(grpc_exec_ctx *exec_ctx, @@ -693,9 +692,8 @@ static void destroy_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, s->destroy_stream_arg = and_free_memory; grpc_closure_sched( - exec_ctx, - grpc_closure_init(&s->destroy_stream, destroy_stream_locked, s, - grpc_combiner_scheduler(t->combiner, false)), + exec_ctx, grpc_closure_init(&s->destroy_stream, destroy_stream_locked, s, + grpc_combiner_scheduler(t->combiner, false)), GRPC_ERROR_NONE); GPR_TIMER_END("destroy_stream", 0); } @@ -1500,10 +1498,9 @@ static void perform_transport_op(grpc_exec_ctx *exec_ctx, grpc_transport *gt, op->transport_private.args[0] = gt; GRPC_CHTTP2_REF_TRANSPORT(t, "transport_op"); grpc_closure_sched( - exec_ctx, - grpc_closure_init(&op->transport_private.closure, - perform_transport_op_locked, op, - grpc_combiner_scheduler(t->combiner, false)), + exec_ctx, grpc_closure_init(&op->transport_private.closure, + perform_transport_op_locked, op, + grpc_combiner_scheduler(t->combiner, false)), GRPC_ERROR_NONE); } @@ -2766,10 +2763,9 @@ static void destructive_reclaimer_locked(grpc_exec_ctx *exec_ctx, void *arg, s->id); } grpc_chttp2_cancel_stream( - exec_ctx, t, s, - grpc_error_set_int(GRPC_ERROR_CREATE("Buffers full"), - GRPC_ERROR_INT_HTTP2_ERROR, - GRPC_HTTP2_ENHANCE_YOUR_CALM)); + exec_ctx, t, s, grpc_error_set_int(GRPC_ERROR_CREATE("Buffers full"), + GRPC_ERROR_INT_HTTP2_ERROR, + GRPC_HTTP2_ENHANCE_YOUR_CALM)); if (n > 1) { /* Since we cancel one stream per destructive reclamation, if there are more streams left, we can immediately post a new From c8e6ac4bf32bee5b22c04541a03ab11517a51651 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 20 Mar 2017 16:50:17 -0700 Subject: [PATCH 066/461] Ensure arguments are validated before they are serialized, unskip some tests --- src/node/src/protobuf_js_6_common.js | 7 ++++++- src/node/test/common_test.js | 26 +++++++++++++++++--------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/node/src/protobuf_js_6_common.js b/src/node/src/protobuf_js_6_common.js index 23e56eecdeb..ddee0ea9ee3 100644 --- a/src/node/src/protobuf_js_6_common.js +++ b/src/node/src/protobuf_js_6_common.js @@ -76,7 +76,12 @@ exports.serializeCls = function serializeCls(cls) { * @return {Buffer} The serialized object */ return function serialize(arg) { - return cls.encode(arg).finish(); + var message = cls.fromObject(arg); + var errMsg = cls.verify(message); + if (errMsg) { + throw errMsg; + } + return cls.encode(message).finish(); }; }; diff --git a/src/node/test/common_test.js b/src/node/test/common_test.js index 529e82e3242..f9efd8231d8 100644 --- a/src/node/test/common_test.js +++ b/src/node/test/common_test.js @@ -131,19 +131,27 @@ describe('Proto message bytes serialize and deserialize', function() { var deserialized = sequenceBase64Deserialize(serialized); assert.strictEqual(deserialized.bytes_field, base64_val); }); - /* The next two tests are specific tests to verify that issue - * https://github.com/grpc/grpc/issues/5174 has been fixed. They are skipped - * because they will not pass until a protobuf.js release has been published - * with a fix for https://github.com/dcodeIO/protobuf.js/issues/390 */ - it.skip('should serialize a repeated field as packed by default', function() { - var expected_serialize = new Buffer([0x12, 0x01, 0x01, 0x0a]); + it('should serialize a repeated field as packed by default', function() { + var expected_serialize = new Buffer([0x12, 0x01, 0x0a]); var serialized = sequenceSerialize({repeated_field: [10]}); assert.strictEqual(expected_serialize.compare(serialized), 0); }); - it.skip('should deserialize packed or unpacked repeated', function() { - var serialized = new Buffer([0x12, 0x01, 0x01, 0x0a]); + it('should deserialize packed or unpacked repeated', function() { + var expectedDeserialize = { + bytes_field: new Buffer(''), + repeated_field: [10] + }; + var packedSerialized = new Buffer([0x12, 0x01, 0x0a]); + var unpackedSerialized = new Buffer([0x10, 0x0a]); + var packedDeserialized; + var unpackedDeserialized; assert.doesNotThrow(function() { - sequenceDeserialize(serialized); + packedDeserialized = sequenceDeserialize(packedSerialized); }); + assert.doesNotThrow(function() { + unpackedDeserialized = sequenceDeserialize(unpackedSerialized); + }); + assert.deepEqual(packedDeserialized, expectedDeserialize); + assert.deepEqual(unpackedDeserialized, expectedDeserialize); }); }); From e8a44e064ab716424567b07b69b3b7acb744385c Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 20 Mar 2017 17:34:09 -0700 Subject: [PATCH 067/461] Dynamically adjust TCP read buffer size --- src/core/lib/iomgr/tcp_posix.c | 47 +++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/src/core/lib/iomgr/tcp_posix.c b/src/core/lib/iomgr/tcp_posix.c index a4381f8fc96..9fba8b3d0e2 100644 --- a/src/core/lib/iomgr/tcp_posix.c +++ b/src/core/lib/iomgr/tcp_posix.c @@ -52,6 +52,7 @@ #include #include #include +#include #include "src/core/lib/debug/trace.h" #include "src/core/lib/iomgr/ev_posix.h" @@ -80,7 +81,8 @@ typedef struct { int fd; bool finished_edge; msg_iovlen_type iov_size; /* Number of slices to allocate per read attempt */ - size_t slice_size; + double target_length; + double bytes_read_this_round; gpr_refcount refcount; gpr_atm shutdown_count; @@ -108,6 +110,29 @@ typedef struct { grpc_resource_user_slice_allocator slice_allocator; } grpc_tcp; +static void add_to_estimate(grpc_tcp *tcp, size_t bytes) { + tcp->bytes_read_this_round += bytes; +} + +static void finish_estimate(grpc_tcp *tcp) { + if (tcp->bytes_read_this_round > tcp->target_length) { + tcp->target_length = 1.5 * tcp->bytes_read_this_round; + } else { + tcp->target_length = + 0.99 * tcp->target_length + 0.01 * tcp->bytes_read_this_round; + } + tcp->bytes_read_this_round = 0; +} + +static size_t get_target_read_size(grpc_tcp *tcp) { + double pressure = grpc_resource_quota_get_memory_pressure( + grpc_resource_user_quota(tcp->resource_user)); + double target = + tcp->target_length * (pressure > 0.8 ? (1.0 - pressure) / 0.2 : 1.0); + return (((size_t)GPR_CLAMP(target, 1024, 4 * 1024 * 1024)) + 255) & + ~(size_t)255; +} + static grpc_error *tcp_annotate_error(grpc_error *src_error, grpc_tcp *tcp) { return grpc_error_set_str( grpc_error_set_int(src_error, GRPC_ERROR_INT_FD, tcp->fd), @@ -231,9 +256,7 @@ static void tcp_do_read(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) { /* NB: After calling call_read_cb a parallel call of the read handler may * be running. */ if (errno == EAGAIN) { - if (tcp->iov_size > 1) { - tcp->iov_size /= 2; - } + finish_estimate(tcp); /* We've consumed the edge, request a new one */ grpc_fd_notify_on_read(exec_ctx, tcp->em_fd, &tcp->read_closure); } else { @@ -250,14 +273,13 @@ static void tcp_do_read(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) { tcp_annotate_error(GRPC_ERROR_CREATE("Socket closed"), tcp)); TCP_UNREF(exec_ctx, tcp, "read"); } else { + add_to_estimate(tcp, (size_t)read_bytes); GPR_ASSERT((size_t)read_bytes <= tcp->incoming_buffer->length); if ((size_t)read_bytes < tcp->incoming_buffer->length) { grpc_slice_buffer_trim_end( tcp->incoming_buffer, tcp->incoming_buffer->length - (size_t)read_bytes, &tcp->last_read_buffer); - } else if (tcp->iov_size < MAX_READ_IOVEC) { - ++tcp->iov_size; } GPR_ASSERT((size_t)read_bytes == tcp->incoming_buffer->length); call_read_cb(exec_ctx, tcp, GRPC_ERROR_NONE); @@ -282,11 +304,11 @@ static void tcp_read_allocation_done(grpc_exec_ctx *exec_ctx, void *tcpp, } static void tcp_continue_read(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) { - if (tcp->incoming_buffer->count < (size_t)tcp->iov_size) { - grpc_resource_user_alloc_slices( - exec_ctx, &tcp->slice_allocator, tcp->slice_size, - (size_t)tcp->iov_size - tcp->incoming_buffer->count, - tcp->incoming_buffer); + size_t target_read_size = get_target_read_size(tcp); + if (tcp->incoming_buffer->length < target_read_size && + tcp->incoming_buffer->count < MAX_READ_IOVEC) { + grpc_resource_user_alloc_slices(exec_ctx, &tcp->slice_allocator, + target_read_size, 1, tcp->incoming_buffer); } else { tcp_do_read(exec_ctx, tcp); } @@ -547,7 +569,8 @@ grpc_endpoint *grpc_tcp_create(grpc_fd *em_fd, tcp->release_fd_cb = NULL; tcp->release_fd = NULL; tcp->incoming_buffer = NULL; - tcp->slice_size = slice_size; + tcp->target_length = slice_size; + tcp->bytes_read_this_round = 0; tcp->iov_size = 1; tcp->finished_edge = true; /* paired with unref in grpc_tcp_destroy */ From 60a41907a0bbb24be89a421ca8ba8fb60a30e773 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Tue, 21 Mar 2017 09:39:11 -0700 Subject: [PATCH 068/461] Remove delete assertion on base class and change to full fetch-add --- include/grpc++/impl/codegen/call.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h index 69fe21d0240..04296dbe15e 100644 --- a/include/grpc++/impl/codegen/call.h +++ b/include/grpc++/impl/codegen/call.h @@ -537,12 +537,11 @@ class CallOpSetCollectionInterface { } // always allocated against a call arena, no memory free required static void operator delete(void* ptr, std::size_t size) { - assert(size == sizeof(CallOpSetCollectionInterface)); } void Ref() { gpr_atm_no_barrier_fetch_add(&refs_, static_cast(1)); } bool Unref() { gpr_atm old = - gpr_atm_no_barrier_fetch_add(&refs_, static_cast(-1)); + gpr_atm_full_fetch_add(&refs_, static_cast(-1)); return (old == static_cast(1)); } From b30685481679ca8a98328bbb98d872b577c7c39b Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 21 Mar 2017 11:25:01 -0700 Subject: [PATCH 069/461] Improve ProtoBuf.js version heuristic, add tests for oneof decoding --- src/node/index.js | 49 ++++++++++++++++++++++++---- src/node/src/protobuf_js_5_common.js | 13 ++++++++ src/node/src/protobuf_js_6_common.js | 13 ++++++++ src/node/src/server.js | 10 +++--- src/node/test/common_test.js | 24 ++++++++++++++ src/node/test/test_messages.proto | 7 ++++ 6 files changed, 103 insertions(+), 13 deletions(-) diff --git a/src/node/index.js b/src/node/index.js index e41664ebf38..ba73e3dac8f 100644 --- a/src/node/index.js +++ b/src/node/index.js @@ -57,18 +57,53 @@ var protobuf_js_6_common = require('./src/protobuf_js_6_common'); grpc.setDefaultRootsPem(fs.readFileSync(SSL_ROOTS_PATH, 'ascii')); +/** + * Load a ProtoBuf.js object as a gRPC object. The options object can provide + * the following options: + * - binaryAsBase64: deserialize bytes values as base64 strings instead of + * Buffers. Defaults to false + * - longsAsStrings: deserialize long values as strings instead of objects. + * Defaults to true + * - deprecatedArgumentOrder: Use the beta method argument order for client + * methods, with optional arguments after the callback. Defaults to false. + * This option is only a temporary stopgap measure to smooth an API breakage. + * It is deprecated, and new code should not use it. + * - protobufjsVersion: Available values are 5, 6, and 'detect'. 5 and 6 + * respectively indicate that an object from the corresponding version of + * ProtoBuf.js is provided in the value argument. If the option is 'detect', + * gRPC will guess what the version is based on the structure of the value. + * Defaults to 'detect'. + * @param {Object} value The ProtoBuf.js reflection object to load + * @param {Object=} options Options to apply to the loaded file + * @return {Object} The resulting gRPC object + */ exports.loadObject = function loadObject(value, options) { options = _.defaults(options, common.defaultGrpcOptions); - if (value instanceof ProtoBuf.ReflectionObject) { - return protobuf_js_6_common.loadObject(value, options); + options = _.defaults(options, {'protobufjsVersion': 'detect'}); + var protobufjsVersion; + if (options.protobufjsVersion === 'detect') { + if (protobuf_js_6_common.isProbablyProtobufJs6(value)) { + protobufjsVersion = 6; + } else if (protobuf_js_5_common.isProbablyProtobufJs5(value)) { + protobufjsVersion = 5; + } else { + var error_message = 'Could not detect ProtoBuf.js version. Please ' + + 'specify the version number with the "protobufjs_version" option'; + throw new Error(error_message); + } } else { - /* If value is not a ProtoBuf.js 6 reflection object, we assume that it is - a ProtoBuf.js 5 reflection object, for backwards compatibility */ + protobufjsVersion = options.protobufjsVersion; + } + switch (protobufjsVersion) { + case 6: return protobuf_js_6_common.loadObject(value, options); + case 5: var deprecation_message = 'Calling grpc.loadObject with an object ' + 'generated by ProtoBuf.js 5 is deprecated. Please upgrade to ' + 'ProtoBuf.js 6.'; common.log(grpc.logVerbosity.INFO, deprecation_message); return protobuf_js_5_common.loadObject(value, options); + default: + throw new Error('Unrecognized protobufjsVersion', protobufjsVersion); } }; @@ -90,9 +125,8 @@ function applyProtoRoot(filename, root) { /** * Load a gRPC object from a .proto file. The options object can provide the * following options: - * - convertFieldsToCamelCase: Loads this file with that option on protobuf.js - * set as specified. See - * https://github.com/dcodeIO/protobuf.js/wiki/Advanced-options for details + * - convertFieldsToCamelCase: Load this file with field names in camel case + * instead of their original case * - binaryAsBase64: deserialize bytes values as base64 strings instead of * Buffers. Defaults to false * - longsAsStrings: deserialize long values as strings instead of objects. @@ -113,6 +147,7 @@ exports.load = function load(filename, format, options) { still the possibility of adding other formats that would be loaded differently */ options = _.defaults(options, common.defaultGrpcOptions); + options.protobufjs_version = 6; var root = new ProtoBuf.Root(); var parse_options = {keepCase: !options.convertFieldsToCamelCase}; return loadObject(root.loadSync(applyProtoRoot(filename, root), diff --git a/src/node/src/protobuf_js_5_common.js b/src/node/src/protobuf_js_5_common.js index aecb25339bf..b16228b9ee8 100644 --- a/src/node/src/protobuf_js_5_common.js +++ b/src/node/src/protobuf_js_5_common.js @@ -165,3 +165,16 @@ exports.loadObject = function loadObject(value, options) { return value; } }; + +/** + * The primary purpose of this method is to distinguish between reflection + * objects from different versions of ProtoBuf.js. This is just a heuristic, + * checking for properties that are (currently) specific to this version of + * ProtoBuf.js + * @param {Object} obj The object to check + * @return {boolean} Whether the object appears to be a Protobuf.js 5 + * ReflectionObject + */ +exports.isProbablyProtobufJs5 = function isProbablyProtobufJs5(obj) { + return _.isArray(obj.children) && (typeof obj.build === 'function'); +}; diff --git a/src/node/src/protobuf_js_6_common.js b/src/node/src/protobuf_js_6_common.js index ddee0ea9ee3..5e2b94e1e21 100644 --- a/src/node/src/protobuf_js_6_common.js +++ b/src/node/src/protobuf_js_6_common.js @@ -157,3 +157,16 @@ exports.loadObject = function loadObject(value, options) { // Otherwise, it's not something we need to change return value; }; + +/** + * The primary purpose of this method is to distinguish between reflection + * objects from different versions of ProtoBuf.js. This is just a heuristic, + * checking for properties that are (currently) specific to this version of + * ProtoBuf.js + * @param {Object} obj The object to check + * @return {boolean} Whether the object appears to be a Protobuf.js 6 + * ReflectionObject + */ +exports.isProbablyProtobufJs6 = function isProbablyProtobufJs6(obj) { + return (typeof obj.root === 'object') && (typeof obj.resolve === 'function'); +}; diff --git a/src/node/src/server.js b/src/node/src/server.js index 9a149ebf0a5..77d50b82505 100644 --- a/src/node/src/server.js +++ b/src/node/src/server.js @@ -781,18 +781,16 @@ Server.prototype.addService = function(service, implementation) { */ Server.prototype.addProtoService = function(service, implementation) { var options; + var protobuf_js_5_common = require('./protobuf_js_5_common'); + var protobuf_js_6_common = require('./protobuf_js_6_common'); common.log(grpc.logVerbosity.INFO, 'Server#addProtoService is deprecated. Use addService instead'); - if (service.hasOwnProperty('children')) { - // Heuristically: this is a Protobuf.js 5 service object - var protobuf_js_5_common = require('./protobuf_js_5_common'); + if (protobuf_js_5_common.isProbablyProtobufJs5(service)) { options = _.defaults(service.grpc_options, common.defaultGrpcOptions); this.addService( protobuf_js_5_common.getProtobufServiceAttrs(service, options), implementation); - } else if (service.hasOwnProperty('methods')) { - // Heuristically: this is a Protobuf.js 6 service object - var protobuf_js_6_common = require('./protobuf_js_6_common'); + } else if (protobuf_js_6_common.isProbablyProtobufJs6(service)) { options = _.defaults(service.grpc_options, common.defaultGrpcOptions); this.addService( protobuf_js_6_common.getProtobufServiceAttrs(service, options), diff --git a/src/node/test/common_test.js b/src/node/test/common_test.js index f9efd8231d8..4b7a8c22537 100644 --- a/src/node/test/common_test.js +++ b/src/node/test/common_test.js @@ -155,3 +155,27 @@ describe('Proto message bytes serialize and deserialize', function() { assert.deepEqual(unpackedDeserialized, expectedDeserialize); }); }); +describe('Proto message oneof serialize and deserialize', function() { + var oneofSerialize = serializeCls(messages_proto.OneOfValues); + var oneofDeserialize = deserializeCls( + messages_proto.OneOfValues, default_options); + it('Should have idempotent round trips', function() { + var test_message = {oneof_choice: 'int_choice', int_choice: 5}; + var serialized1 = oneofSerialize(test_message); + var deserialized1 = oneofDeserialize(serialized1); + assert.equal(deserialized1.int_choice, 5); + var serialized2 = oneofSerialize(deserialized1); + var deserialized2 = oneofDeserialize(serialized2); + assert.deepEqual(deserialized1, deserialized2); + }); + it('Should emit a property indicating which field was chosen', function() { + var test_message1 = {oneof_choice: 'int_choice', int_choice: 5}; + var serialized1 = oneofSerialize(test_message1); + var deserialized1 = oneofDeserialize(serialized1); + assert.equal(deserialized1.oneof_choice, 'int_choice'); + var test_message2 = {oneof_choice: 'string_choice', string_choice: 'abc'}; + var serialized2 = oneofSerialize(test_message2); + var deserialized2 = oneofDeserialize(serialized2); + assert.equal(deserialized2.oneof_choice, 'int_choice'); + }); +}); diff --git a/src/node/test/test_messages.proto b/src/node/test/test_messages.proto index a1a6a32833d..2cd133161b7 100644 --- a/src/node/test/test_messages.proto +++ b/src/node/test/test_messages.proto @@ -41,3 +41,10 @@ message SequenceValues { bytes bytes_field = 1; repeated int32 repeated_field = 2; } + +message OneOfValues { + oneof oneof_choice { + int32 int_choice = 1; + string string_choice = 2; + } +} \ No newline at end of file From 1bfcc40fd32357018cb7bfd729e069018abb3689 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 21 Mar 2017 11:51:40 -0700 Subject: [PATCH 070/461] Clean up byte_stream_next interface usage --- .../chttp2/transport/chttp2_transport.c | 21 ++++++++++++------- .../ext/transport/chttp2/transport/internal.h | 2 -- .../cronet/transport/cronet_transport.c | 12 +++++++++-- src/core/lib/channel/compress_filter.c | 11 ++++++++-- src/core/lib/channel/http_client_filter.c | 11 ++++++++-- src/core/lib/surface/call.c | 5 +++-- src/core/lib/transport/byte_stream.c | 20 ++++++++++++------ src/core/lib/transport/byte_stream.h | 15 +++++++------ 8 files changed, 67 insertions(+), 30 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index a8962d305d4..95f20725f31 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1101,8 +1101,9 @@ static void continue_fetching_send_locked(grpc_exec_ctx *exec_ctx, s->fetching_send_message = NULL; return; /* early out */ } else if (grpc_byte_stream_next(exec_ctx, s->fetching_send_message, - &s->fetching_slice, UINT32_MAX, - &s->complete_fetch_locked)) { + UINT32_MAX, &s->complete_fetch_locked)) { + grpc_byte_stream_pull(exec_ctx, s->fetching_send_message, + &s->fetching_slice); add_fetched_slice_locked(exec_ctx, t, s); } } @@ -1113,9 +1114,15 @@ static void complete_fetch_locked(grpc_exec_ctx *exec_ctx, void *gs, grpc_chttp2_stream *s = gs; grpc_chttp2_transport *t = s->t; if (error == GRPC_ERROR_NONE) { - add_fetched_slice_locked(exec_ctx, t, s); - continue_fetching_send_locked(exec_ctx, t, s); - } else { + error = grpc_byte_stream_pull(exec_ctx, s->fetching_send_message, + &s->fetching_slice); + if (error == GRPC_ERROR_NONE) { + add_fetched_slice_locked(exec_ctx, t, s); + continue_fetching_send_locked(exec_ctx, t, s); + } + } + + if (error != GRPC_ERROR_NONE) { /* TODO(ctiller): what to do here */ abort(); } @@ -2530,7 +2537,6 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx *exec_ctx, } } else { bs->on_next = bs->next_action.on_complete; - bs->next = bs->next_action.slice; } gpr_mu_unlock(&bs->slice_mu); gpr_mu_unlock(&s->buffer_mu); @@ -2570,13 +2576,12 @@ static grpc_error *incoming_byte_stream_pull(grpc_exec_ctx *exec_ctx, static int incoming_byte_stream_next(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, - grpc_slice *slice, size_t max_size_hint, + size_t max_size_hint, grpc_closure *on_complete) { GPR_TIMER_BEGIN("incoming_byte_stream_next", 0); grpc_chttp2_incoming_byte_stream *bs = (grpc_chttp2_incoming_byte_stream *)byte_stream; gpr_ref(&bs->refs); - bs->next_action.slice = slice; bs->next_action.max_size_hint = max_size_hint; bs->next_action.on_complete = on_complete; grpc_closure_sched( diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 54bfd42357d..adbd48c5810 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -197,12 +197,10 @@ struct grpc_chttp2_incoming_byte_stream { gpr_mu slice_mu; // protects slices, on_next grpc_slice_buffer slices; grpc_closure *on_next; - grpc_slice *next; uint32_t remaining_bytes; struct { grpc_closure closure; - grpc_slice *slice; size_t max_size_hint; grpc_closure *on_complete; } next_action; diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c index 01a03533daf..da180e5144b 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.c +++ b/src/core/ext/transport/cronet/transport/cronet_transport.c @@ -908,8 +908,16 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, grpc_slice_buffer write_slice_buffer; grpc_slice slice; grpc_slice_buffer_init(&write_slice_buffer); - grpc_byte_stream_next(NULL, stream_op->send_message, &slice, - stream_op->send_message->length, NULL); + if (1 != grpc_byte_stream_next(exec_ctx, stream_op->send_message, + stream_op->send_message->length, NULL)) { + /* Should never reach here */ + GPR_ASSERT(false); + } + if (GRPC_ERROR_NONE != + grpc_byte_stream_pull(exec_ctx, stream_op->send_message, &slice)) { + /* Should never reach here */ + GPR_ASSERT(false); + } /* Check that compression flag is OFF. We don't support compression yet. */ if (stream_op->send_message->flags != 0) { diff --git a/src/core/lib/channel/compress_filter.c b/src/core/lib/channel/compress_filter.c index aa41014a217..53d3b86f45b 100644 --- a/src/core/lib/channel/compress_filter.c +++ b/src/core/lib/channel/compress_filter.c @@ -220,6 +220,12 @@ static void finish_send_message(grpc_exec_ctx *exec_ctx, static void got_slice(grpc_exec_ctx *exec_ctx, void *elemp, grpc_error *error) { grpc_call_element *elem = elemp; call_data *calld = elem->call_data; + if (GRPC_ERROR_NONE != grpc_byte_stream_pull(exec_ctx, + calld->send_op->send_message, + &calld->incoming_slice)) { + /* Should never reach here */ + abort(); + } grpc_slice_buffer_add(&calld->slices, calld->incoming_slice); if (calld->send_length == calld->slices.length) { finish_send_message(exec_ctx, elem); @@ -232,8 +238,9 @@ static void continue_send_message(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) { call_data *calld = elem->call_data; while (grpc_byte_stream_next(exec_ctx, calld->send_op->send_message, - &calld->incoming_slice, ~(size_t)0, - &calld->got_slice)) { + ~(size_t)0, &calld->got_slice)) { + grpc_byte_stream_pull(exec_ctx, calld->send_op->send_message, + &calld->incoming_slice); grpc_slice_buffer_add(&calld->slices, calld->incoming_slice); if (calld->send_length == calld->slices.length) { finish_send_message(exec_ctx, elem); diff --git a/src/core/lib/channel/http_client_filter.c b/src/core/lib/channel/http_client_filter.c index c031533dd86..af2451e1eb6 100644 --- a/src/core/lib/channel/http_client_filter.c +++ b/src/core/lib/channel/http_client_filter.c @@ -220,8 +220,9 @@ static void continue_send_message(grpc_exec_ctx *exec_ctx, call_data *calld = elem->call_data; uint8_t *wrptr = calld->payload_bytes; while (grpc_byte_stream_next(exec_ctx, calld->send_op.send_message, - &calld->incoming_slice, ~(size_t)0, - &calld->got_slice)) { + ~(size_t)0, &calld->got_slice)) { + grpc_byte_stream_pull(exec_ctx, calld->send_op.send_message, + &calld->incoming_slice); memcpy(wrptr, GRPC_SLICE_START_PTR(calld->incoming_slice), GRPC_SLICE_LENGTH(calld->incoming_slice)); wrptr += GRPC_SLICE_LENGTH(calld->incoming_slice); @@ -237,6 +238,12 @@ static void got_slice(grpc_exec_ctx *exec_ctx, void *elemp, grpc_error *error) { grpc_call_element *elem = elemp; call_data *calld = elem->call_data; calld->send_message_blocked = false; + if (GRPC_ERROR_NONE != grpc_byte_stream_pull(exec_ctx, + calld->send_op.send_message, + &calld->incoming_slice)) { + /* Should never reach here */ + abort(); + } grpc_slice_buffer_add(&calld->slices, calld->incoming_slice); if (calld->send_length == calld->slices.length) { /* Pass down the original send_message op that was blocked.*/ diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 4471ada106e..5dac90c60c9 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -1162,9 +1162,10 @@ static void continue_receiving_slices(grpc_exec_ctx *exec_ctx, finish_batch_step(exec_ctx, bctl); return; } - if (grpc_byte_stream_next(exec_ctx, call->receiving_stream, - &call->receiving_slice, remaining, + if (grpc_byte_stream_next(exec_ctx, call->receiving_stream, remaining, &call->receiving_slice_ready)) { + grpc_byte_stream_pull(exec_ctx, call->receiving_stream, + &call->receiving_slice); grpc_slice_buffer_add(&(*call->receiving_buffer)->data.raw.slice_buffer, call->receiving_slice); } else { diff --git a/src/core/lib/transport/byte_stream.c b/src/core/lib/transport/byte_stream.c index 3a50694670f..79801c4b465 100644 --- a/src/core/lib/transport/byte_stream.c +++ b/src/core/lib/transport/byte_stream.c @@ -40,10 +40,9 @@ #include "src/core/lib/slice/slice_internal.h" int grpc_byte_stream_next(grpc_exec_ctx *exec_ctx, - grpc_byte_stream *byte_stream, grpc_slice *slice, - size_t max_size_hint, grpc_closure *on_complete) { - return byte_stream->next(exec_ctx, byte_stream, slice, max_size_hint, - on_complete); + grpc_byte_stream *byte_stream, size_t max_size_hint, + grpc_closure *on_complete) { + return byte_stream->next(exec_ctx, byte_stream, max_size_hint, on_complete); } grpc_error *grpc_byte_stream_pull(grpc_exec_ctx *exec_ctx, @@ -61,14 +60,22 @@ void grpc_byte_stream_destroy(grpc_exec_ctx *exec_ctx, static int slice_buffer_stream_next(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, - grpc_slice *slice, size_t max_size_hint, + size_t max_size_hint, grpc_closure *on_complete) { grpc_slice_buffer_stream *stream = (grpc_slice_buffer_stream *)byte_stream; GPR_ASSERT(stream->cursor < stream->backing_buffer->count); + return 1; +} + +static grpc_error *slice_buffer_stream_pull(grpc_exec_ctx *exec_ctx, + grpc_byte_stream *byte_stream, + grpc_slice *slice) { + grpc_slice_buffer_stream *stream = (grpc_slice_buffer_stream *)byte_stream; + GPR_ASSERT(stream->cursor < stream->backing_buffer->count); *slice = grpc_slice_ref_internal(stream->backing_buffer->slices[stream->cursor]); stream->cursor++; - return 1; + return GRPC_ERROR_NONE; } static void slice_buffer_stream_destroy(grpc_exec_ctx *exec_ctx, @@ -81,6 +88,7 @@ void grpc_slice_buffer_stream_init(grpc_slice_buffer_stream *stream, stream->base.length = (uint32_t)slice_buffer->length; stream->base.flags = flags; stream->base.next = slice_buffer_stream_next; + stream->base.pull = slice_buffer_stream_pull; stream->base.destroy = slice_buffer_stream_destroy; stream->backing_buffer = slice_buffer; stream->cursor = 0; diff --git a/src/core/lib/transport/byte_stream.h b/src/core/lib/transport/byte_stream.h index 6afba92c523..800e2341f9e 100644 --- a/src/core/lib/transport/byte_stream.h +++ b/src/core/lib/transport/byte_stream.h @@ -50,8 +50,7 @@ struct grpc_byte_stream { uint32_t length; uint32_t flags; int (*next)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, - grpc_slice *slice, size_t max_size_hint, - grpc_closure *on_complete); + size_t max_size_hint, grpc_closure *on_complete); grpc_error *(*pull)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, grpc_slice *slice); void (*destroy)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream); @@ -63,13 +62,17 @@ struct grpc_byte_stream { * * max_size_hint can be set as a hint as to the maximum number * of bytes that would be acceptable to read. - * - * once a slice is returned into *slice, it is owned by the caller. */ int grpc_byte_stream_next(grpc_exec_ctx *exec_ctx, - grpc_byte_stream *byte_stream, grpc_slice *slice, - size_t max_size_hint, grpc_closure *on_complete); + grpc_byte_stream *byte_stream, size_t max_size_hint, + grpc_closure *on_complete); +/* returns the next slice in the byte stream when it is ready (indicated by + * either grpc_byte_stream_next returning 1 or on_complete passed to + * grpc_byte_stream_next is called). + * + * once a slice is returned into *slice, it is owned by the caller. + */ grpc_error *grpc_byte_stream_pull(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, grpc_slice *slice); From c1b758f48859dbfe3ff8fe0c3e9b6adf00a711b8 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 21 Mar 2017 18:21:05 -0700 Subject: [PATCH 071/461] Use new oneofs option in deserialize call --- src/node/src/protobuf_js_6_common.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/node/src/protobuf_js_6_common.js b/src/node/src/protobuf_js_6_common.js index 5e2b94e1e21..6a85e4ac23d 100644 --- a/src/node/src/protobuf_js_6_common.js +++ b/src/node/src/protobuf_js_6_common.js @@ -50,7 +50,8 @@ exports.deserializeCls = function deserializeCls(cls, options) { defaults: true, bytes: options.binaryAsBase64 ? String : Buffer, longs: options.longsAsStrings ? String : null, - enums: String + enums: String, + oneofs: true }; /** * Deserialize a buffer to a message object From 2abbf8a319781ddeb614187c90f3be016fafd036 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Tue, 21 Mar 2017 17:31:03 -0700 Subject: [PATCH 072/461] Changes to use the new API --- include/grpc/grpc.h | 5 ++- src/core/lib/surface/completion_queue.c | 26 ++++++++------- src/core/lib/surface/completion_queue.h | 3 ++ .../lib/surface/completion_queue_factory.c | 33 ++++++++++++++----- 4 files changed, 44 insertions(+), 23 deletions(-) diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 2f7e4ed426b..bddb0c77ec7 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -128,7 +128,6 @@ typedef enum { GRPC_CQ_NON_POLLING } grpc_cq_polling_type; - #define GRPC_CQ_CURRENT_VERSION 1 typedef struct grpc_completion_queue_attributes { /* The version number of this structure. More fields might be added to this @@ -161,8 +160,8 @@ GRPCAPI grpc_completion_queue *grpc_completion_queue_create_for_pluck( /** Create a completion queue */ GRPCAPI grpc_completion_queue *grpc_completion_queue_create( - grpc_cq_completion_type completion_type, grpc_cq_polling_type polling_type, - void *reserved); + const grpc_completion_queue_factory *factory, + const grpc_completion_queue_attributes *attributes, void *reserved); /** Blocks until an event is available, the completion queue is being shut down, or deadline is reached. diff --git a/src/core/lib/surface/completion_queue.c b/src/core/lib/surface/completion_queue.c index e571733a20e..1e88e834497 100644 --- a/src/core/lib/surface/completion_queue.c +++ b/src/core/lib/surface/completion_queue.c @@ -115,15 +115,17 @@ int grpc_cq_event_timeout_trace; static void on_pollset_shutdown_done(grpc_exec_ctx *exec_ctx, void *cc, grpc_error *error); -grpc_completion_queue *grpc_completion_queue_create( - grpc_cq_completion_type completion_type, grpc_cq_polling_type polling_type, - void *reserved) { +grpc_completion_queue *grpc_completion_queue_create_internal( + grpc_cq_completion_type completion_type, + grpc_cq_polling_type polling_type) { grpc_completion_queue *cc; - GPR_ASSERT(!reserved); - GPR_TIMER_BEGIN("grpc_completion_queue_create", 0); + GPR_TIMER_BEGIN("grpc_completion_queue_create_internal", 0); - GRPC_API_TRACE("grpc_completion_queue_create(reserved=%p)", 1, (reserved)); + GRPC_API_TRACE( + "grpc_completion_queue_create_internal(completion_type=%d, " + "polling_type=%d)", + 2, (completion_type, polling_type)); cc = gpr_zalloc(sizeof(grpc_completion_queue) + grpc_pollset_size()); grpc_pollset_init(POLLSET_FROM_CQ(cc), &cc->mu); @@ -153,7 +155,7 @@ grpc_completion_queue *grpc_completion_queue_create( grpc_closure_init(&cc->pollset_shutdown_done, on_pollset_shutdown_done, cc, grpc_schedule_on_exec_ctx); - GPR_TIMER_END("grpc_completion_queue_create", 0); + GPR_TIMER_END("grpc_completion_queue_create_internal", 0); return cc; } @@ -381,8 +383,9 @@ grpc_event grpc_completion_queue_next(grpc_completion_queue *cc, "deadline=gpr_timespec { tv_sec: %" PRId64 ", tv_nsec: %d, clock_type: %d }, " "reserved=%p)", - 5, (cc, deadline.tv_sec, deadline.tv_nsec, (int)deadline.clock_type, - reserved)); + 5, + (cc, deadline.tv_sec, deadline.tv_nsec, (int)deadline.clock_type, + reserved)); GPR_ASSERT(!reserved); dump_pending_tags(cc); @@ -556,8 +559,9 @@ grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cc, void *tag, "deadline=gpr_timespec { tv_sec: %" PRId64 ", tv_nsec: %d, clock_type: %d }, " "reserved=%p)", - 6, (cc, tag, deadline.tv_sec, deadline.tv_nsec, - (int)deadline.clock_type, reserved)); + 6, + (cc, tag, deadline.tv_sec, deadline.tv_nsec, (int)deadline.clock_type, + reserved)); } GPR_ASSERT(!reserved); diff --git a/src/core/lib/surface/completion_queue.h b/src/core/lib/surface/completion_queue.h index 21f28e94249..1ff3d64293a 100644 --- a/src/core/lib/surface/completion_queue.h +++ b/src/core/lib/surface/completion_queue.h @@ -102,4 +102,7 @@ int grpc_cq_is_server_cq(grpc_completion_queue *cc); grpc_cq_completion_type grpc_get_cq_completion_type(grpc_completion_queue *cc); grpc_cq_polling_type grpc_get_cq_polling_type(grpc_completion_queue *cc); +grpc_completion_queue *grpc_completion_queue_create_internal( + grpc_cq_completion_type completion_type, grpc_cq_polling_type polling_type); + #endif /* GRPC_CORE_LIB_SURFACE_COMPLETION_QUEUE_H */ diff --git a/src/core/lib/surface/completion_queue_factory.c b/src/core/lib/surface/completion_queue_factory.c index 138dfeff484..0d789e0f2f1 100644 --- a/src/core/lib/surface/completion_queue_factory.c +++ b/src/core/lib/surface/completion_queue_factory.c @@ -36,12 +36,15 @@ #include -/* TODO (sreek) - Currently this does not use the attributes arg. This will be - added in a future PR */ +/* + * == Default completion queue factory implementation == + */ + static grpc_completion_queue* default_create( const grpc_completion_queue_factory* factory, - const grpc_completion_queue_attributes* attributes) { - return grpc_completion_queue_create(NULL); + const grpc_completion_queue_attributes* attr) { + return grpc_completion_queue_create_internal(attr->cq_type, + attr->cq_polling_type); } static grpc_completion_queue_factory_vtable default_vtable = {default_create}; @@ -49,19 +52,24 @@ static grpc_completion_queue_factory_vtable default_vtable = {default_create}; static const grpc_completion_queue_factory g_default_cq_factory = { "Default Factory", NULL, &default_vtable}; +/* + * == Completion queue factory APIs + */ + const grpc_completion_queue_factory* grpc_completion_queue_factory_lookup( const grpc_completion_queue_attributes* attributes) { - /* As we add more fields to grpc_completion_queue_attributes, we may have to - change this assert to: - GPR_ASSERT (attributes->version >= 1 && - attributes->version <= GRPC_CQ_CURRENT_VERSION) */ - GPR_ASSERT(attributes->version == 1); + GPR_ASSERT(attributes->version >= 1 && + attributes->version <= GRPC_CQ_CURRENT_VERSION); /* The default factory can handle version 1 of the attributes structure. We may have to change this as more fields are added to the structure */ return &g_default_cq_factory; } +/* + * == Completion queue creation APIs == + */ + grpc_completion_queue* grpc_completion_queue_create_for_next(void* reserved) { GPR_ASSERT(!reserved); grpc_completion_queue_attributes attr = {1, GRPC_CQ_NEXT, @@ -75,3 +83,10 @@ grpc_completion_queue* grpc_completion_queue_create_for_pluck(void* reserved) { GRPC_CQ_DEFAULT_POLLING}; return g_default_cq_factory.vtable->create(&g_default_cq_factory, &attr); } + +grpc_completion_queue* grpc_completion_queue_create( + const grpc_completion_queue_factory* factory, + const grpc_completion_queue_attributes* attr, void* reserved) { + GPR_ASSERT(!reserved); + return factory->vtable->create(factory, attr); +} From dbd36187824e7b7d17be0c182187c1ac5952b59f Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 21 Mar 2017 18:59:49 -0700 Subject: [PATCH 073/461] Strategy change --- src/core/lib/slice/slice_buffer.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/core/lib/slice/slice_buffer.c b/src/core/lib/slice/slice_buffer.c index 451319c50d6..c96b9c3b281 100644 --- a/src/core/lib/slice/slice_buffer.c +++ b/src/core/lib/slice/slice_buffer.c @@ -51,19 +51,23 @@ static void maybe_embiggen(grpc_slice_buffer *sb) { size_t slice_count = sb->count + slice_offset; if (slice_count == sb->capacity) { - sb->capacity = GROW(sb->capacity); - GPR_ASSERT(sb->capacity > slice_count); - if (sb->base_slices == sb->inlined) { - sb->base_slices = gpr_malloc(sb->capacity * sizeof(grpc_slice)); - memcpy(sb->base_slices, sb->inlined, slice_count * sizeof(grpc_slice)); - sb->slices = sb->base_slices + slice_offset; + if (sb->base_slices != sb->slices) { + /* Make room by moving elements if there's still space unused */ + memmove(sb->base_slices, sb->slices, sb->count * sizeof(grpc_slice)); + sb->slices = sb->base_slices; } else { - if (sb->base_slices != sb->slices) { - memmove(sb->base_slices, sb->slices, sb->count * sizeof(grpc_slice)); + /* Allocate more memory if no more space is available */ + sb->capacity = GROW(sb->capacity); + GPR_ASSERT(sb->capacity > slice_count); + if (sb->base_slices == sb->inlined) { + sb->base_slices = gpr_malloc(sb->capacity * sizeof(grpc_slice)); + memcpy(sb->base_slices, sb->inlined, slice_count * sizeof(grpc_slice)); + } else { + sb->base_slices = + gpr_realloc(sb->base_slices, sb->capacity * sizeof(grpc_slice)); } - sb->base_slices = - gpr_realloc(sb->base_slices, sb->capacity * sizeof(grpc_slice)); - sb->slices = sb->base_slices; + + sb->slices = sb->base_slices + slice_offset; } } } From b5b6bfd89b642c6a3de305b985d736fd2bd93bab Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Wed, 22 Mar 2017 02:32:01 -0700 Subject: [PATCH 074/461] Updates C Core --- include/grpc/grpc.h | 2 +- .../lib/surface/completion_queue_factory.c | 4 +- test/core/bad_client/bad_client.c | 6 +- test/core/bad_ssl/bad_ssl_test.c | 3 +- test/core/bad_ssl/server_common.c | 11 ++-- test/core/client_channel/lb_policies_test.c | 12 ++-- .../set_initial_connect_string_test.c | 3 +- test/core/end2end/bad_server_response_test.c | 3 +- test/core/end2end/connection_refused_test.c | 3 +- test/core/end2end/dualstack_socket_test.c | 6 +- test/core/end2end/fixtures/h2_census.c | 13 ++--- test/core/end2end/fixtures/h2_compress.c | 13 ++--- test/core/end2end/fixtures/h2_fakesec.c | 6 +- test/core/end2end/fixtures/h2_fd.c | 6 +- test/core/end2end/fixtures/h2_full+pipe.c | 13 ++--- test/core/end2end/fixtures/h2_full+trace.c | 13 ++--- test/core/end2end/fixtures/h2_full.c | 13 ++--- test/core/end2end/fixtures/h2_http_proxy.c | 13 ++--- .../core/end2end/fixtures/h2_load_reporting.c | 6 +- test/core/end2end/fixtures/h2_oauth2.c | 6 +- test/core/end2end/fixtures/h2_proxy.c | 15 +++-- .../core/end2end/fixtures/h2_sockpair+trace.c | 6 +- test/core/end2end/fixtures/h2_sockpair.c | 6 +- .../core/end2end/fixtures/h2_sockpair_1byte.c | 6 +- test/core/end2end/fixtures/h2_ssl.c | 6 +- test/core/end2end/fixtures/h2_ssl_cert.c | 26 ++++----- test/core/end2end/fixtures/h2_ssl_proxy.c | 6 +- test/core/end2end/fixtures/h2_uds.c | 13 ++--- test/core/end2end/fixtures/proxy.c | 3 +- test/core/end2end/fuzzers/api_fuzzer.c | 28 ++++++---- test/core/end2end/fuzzers/client_fuzzer.c | 3 +- test/core/end2end/fuzzers/server_fuzzer.c | 3 +- test/core/end2end/goaway_server_test.c | 3 +- .../core/end2end/invalid_call_argument_test.c | 6 +- .../end2end/multiple_server_queues_test.c | 20 +++++-- test/core/end2end/no_server_test.c | 3 +- test/core/fling/client.c | 3 +- test/core/fling/server.c | 11 ++-- test/core/handshake/client_ssl.c | 3 +- test/core/handshake/server_ssl.c | 3 +- test/core/memory_usage/client.c | 8 +-- test/core/memory_usage/server.c | 11 ++-- test/core/surface/alarm_test.c | 3 +- test/core/surface/completion_queue_test.c | 55 +++++++++++++++---- .../surface/completion_queue_threading_test.c | 6 +- .../surface/concurrent_connectivity_test.c | 6 +- test/core/surface/lame_client_test.c | 3 +- .../surface/sequential_connectivity_test.c | 5 +- test/core/surface/server_chttp2_test.c | 3 +- test/core/surface/server_test.c | 9 +-- 50 files changed, 214 insertions(+), 223 deletions(-) diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index bddb0c77ec7..d2c18795ea6 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -134,7 +134,7 @@ typedef struct grpc_completion_queue_attributes { structure in future. */ int version; /* Set to GRPC_CQ_CURRENT_VERSION */ - grpc_cq_completion_type cq_type; + grpc_cq_completion_type cq_completion_type; grpc_cq_polling_type cq_polling_type; } grpc_completion_queue_attributes; diff --git a/src/core/lib/surface/completion_queue_factory.c b/src/core/lib/surface/completion_queue_factory.c index 0d789e0f2f1..d68b84eddd3 100644 --- a/src/core/lib/surface/completion_queue_factory.c +++ b/src/core/lib/surface/completion_queue_factory.c @@ -43,7 +43,7 @@ static grpc_completion_queue* default_create( const grpc_completion_queue_factory* factory, const grpc_completion_queue_attributes* attr) { - return grpc_completion_queue_create_internal(attr->cq_type, + return grpc_completion_queue_create_internal(attr->cq_completion_type, attr->cq_polling_type); } @@ -79,7 +79,7 @@ grpc_completion_queue* grpc_completion_queue_create_for_next(void* reserved) { grpc_completion_queue* grpc_completion_queue_create_for_pluck(void* reserved) { GPR_ASSERT(!reserved); - grpc_completion_queue_attributes attr = {1, GRPC_CQ_NEXT, + grpc_completion_queue_attributes attr = {1, GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING}; return g_default_cq_factory.vtable->create(&g_default_cq_factory, &attr); } diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.c index 2ecb75883bd..cf3d9f6c6a4 100644 --- a/test/core/bad_client/bad_client.c +++ b/test/core/bad_client/bad_client.c @@ -125,8 +125,7 @@ void grpc_run_bad_client_test( /* Create server, completion events */ a.server = grpc_server_create(NULL, NULL); - a.cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + a.cq = grpc_completion_queue_create_for_next(NULL); gpr_event_init(&a.done_thd); gpr_event_init(&a.done_write); a.validator = server_validator; @@ -198,8 +197,7 @@ void grpc_run_bad_client_test( grpc_exec_ctx_finish(&exec_ctx); } - shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); + shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); grpc_server_shutdown_and_notify(a.server, shutdown_cq, NULL); GPR_ASSERT(grpc_completion_queue_pluck( shutdown_cq, NULL, grpc_timeout_seconds_to_deadline(1), NULL) diff --git a/test/core/bad_ssl/bad_ssl_test.c b/test/core/bad_ssl/bad_ssl_test.c index e0f1d2789f8..b961ffacd78 100644 --- a/test/core/bad_ssl/bad_ssl_test.c +++ b/test/core/bad_ssl/bad_ssl_test.c @@ -61,8 +61,7 @@ static void run_test(const char *target, size_t nops) { grpc_status_code status; grpc_call_error error; gpr_timespec deadline = grpc_timeout_seconds_to_deadline(5); - grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL); cq_verifier *cqv = cq_verifier_create(cq); grpc_op ops[6]; diff --git a/test/core/bad_ssl/server_common.c b/test/core/bad_ssl/server_common.c index 1176c079b23..67404711cd0 100644 --- a/test/core/bad_ssl/server_common.c +++ b/test/core/bad_ssl/server_common.c @@ -67,8 +67,7 @@ void bad_ssl_run(grpc_server *server) { grpc_call_details call_details; grpc_metadata_array request_metadata_recv; - grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL); grpc_completion_queue *shutdown_cq; grpc_call_details_init(&call_details); @@ -85,8 +84,7 @@ void bad_ssl_run(grpc_server *server) { while (!shutdown_finished) { if (got_sigint && !shutdown_started) { gpr_log(GPR_INFO, "Shutting down due to SIGINT"); - shutdown_cq = grpc_completion_queue_create(GRPC_CQ_PLUCK, - GRPC_CQ_NON_POLLING, NULL); + shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); grpc_server_shutdown_and_notify(server, shutdown_cq, NULL); GPR_ASSERT( grpc_completion_queue_pluck(shutdown_cq, NULL, @@ -97,8 +95,9 @@ void bad_ssl_run(grpc_server *server) { shutdown_started = 1; } ev = grpc_completion_queue_next( - cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(1000000, GPR_TIMESPAN)), + cq, + gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(1000000, GPR_TIMESPAN)), NULL); switch (ev.type) { case GRPC_OP_COMPLETE: diff --git a/test/core/client_channel/lb_policies_test.c b/test/core/client_channel/lb_policies_test.c index f440e3348ca..433f77db82c 100644 --- a/test/core/client_channel/lb_policies_test.c +++ b/test/core/client_channel/lb_policies_test.c @@ -65,9 +65,9 @@ typedef struct servers_fixture { } servers_fixture; typedef struct request_sequences { - size_t n; /* number of iterations */ - int *connections; /* indexed by the interation number, value is the index of - the server it connected to or -1 if none */ + size_t n; /* number of iterations */ + int *connections; /* indexed by the interation number, value is the index of + the server it connected to or -1 if none */ int *connectivity_states; /* indexed by the interation number, value is the client connectivity state */ } request_sequences; @@ -197,10 +197,8 @@ static servers_fixture *setup_servers(const char *server_host, /* Create servers. */ f->servers = gpr_malloc(sizeof(grpc_server *) * num_servers); f->servers_hostports = gpr_malloc(sizeof(char *) * num_servers); - f->cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); - f->shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); + f->cq = grpc_completion_queue_create_for_next(NULL); + f->shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); for (i = 0; i < num_servers; i++) { grpc_metadata_array_init(&f->request_metadata_recv[i]); gpr_join_host_port(&f->servers_hostports[i], server_host, diff --git a/test/core/client_channel/set_initial_connect_string_test.c b/test/core/client_channel/set_initial_connect_string_test.c index 999c89bdbd6..7f38418ea7a 100644 --- a/test/core/client_channel/set_initial_connect_string_test.c +++ b/test/core/client_channel/set_initial_connect_string_test.c @@ -130,8 +130,7 @@ static gpr_timespec n_sec_deadline(int seconds) { } static void start_rpc(int use_creds, int target_port) { - state.cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + state.cq = grpc_completion_queue_create_for_next(NULL); if (use_creds) { state.creds = grpc_fake_transport_security_credentials_create(); } else { diff --git a/test/core/end2end/bad_server_response_test.c b/test/core/end2end/bad_server_response_test.c index e4dc3831dcd..96052ed7fda 100644 --- a/test/core/end2end/bad_server_response_test.c +++ b/test/core/end2end/bad_server_response_test.c @@ -178,8 +178,7 @@ static void start_rpc(int target_port, grpc_status_code expected_status, cq_verifier *cqv; grpc_slice details; - state.cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + state.cq = grpc_completion_queue_create_for_next(NULL); cqv = cq_verifier_create(state.cq); gpr_join_host_port(&state.target, "127.0.0.1", target_port); state.channel = grpc_insecure_channel_create(state.target, NULL, NULL); diff --git a/test/core/end2end/connection_refused_test.c b/test/core/end2end/connection_refused_test.c index fe203ddf4de..4d9908fba64 100644 --- a/test/core/end2end/connection_refused_test.c +++ b/test/core/end2end/connection_refused_test.c @@ -69,8 +69,7 @@ static void run_test(bool wait_for_ready, bool use_service_config) { grpc_metadata_array_init(&trailing_metadata_recv); - cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + cq = grpc_completion_queue_create_for_next(NULL); cqv = cq_verifier_create(cq); /* if using service config, create channel args */ diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.c index 19f947865a2..c61ea6d2603 100644 --- a/test/core/end2end/dualstack_socket_test.c +++ b/test/core/end2end/dualstack_socket_test.c @@ -108,8 +108,7 @@ void test_connect(const char *server_host, const char *client_host, int port, grpc_call_details_init(&call_details); /* Create server. */ - cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + cq = grpc_completion_queue_create_for_next(NULL); server = grpc_server_create(NULL, NULL); grpc_server_register_completion_queue(server, cq, NULL); GPR_ASSERT((got_port = grpc_server_add_insecure_http2_port( @@ -261,8 +260,7 @@ void test_connect(const char *server_host, const char *client_host, int port, grpc_channel_destroy(client); /* Destroy server. */ - shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); + shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); grpc_server_shutdown_and_notify(server, shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), diff --git a/test/core/end2end/fixtures/h2_census.c b/test/core/end2end/fixtures/h2_census.c index 35a52fa9a91..1a754835f0e 100644 --- a/test/core/end2end/fixtures/h2_census.c +++ b/test/core/end2end/fixtures/h2_census.c @@ -65,10 +65,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); - f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); + f.cq = grpc_completion_queue_create_for_next(NULL); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); return f; } @@ -122,9 +120,10 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack+census", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack+census", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_compress.c b/test/core/end2end/fixtures/h2_compress.c index e6270071519..b73d6d787a3 100644 --- a/test/core/end2end/fixtures/h2_compress.c +++ b/test/core/end2end/fixtures/h2_compress.c @@ -69,10 +69,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_compression( memset(&f, 0, sizeof(f)); f.fixture_data = ffd; - f.cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); - f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); + f.cq = grpc_completion_queue_create_for_next(NULL); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); return f; } @@ -122,9 +120,10 @@ void chttp2_tear_down_fullstack_compression(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack_compression", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack_compression", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack_compression, chttp2_init_client_fullstack_compression, chttp2_init_server_fullstack_compression, diff --git a/test/core/end2end/fixtures/h2_fakesec.c b/test/core/end2end/fixtures/h2_fakesec.c index 59ae3f0cb35..5969b110e69 100644 --- a/test/core/end2end/fixtures/h2_fakesec.c +++ b/test/core/end2end/fixtures/h2_fakesec.c @@ -60,10 +60,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); - f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); + f.cq = grpc_completion_queue_create_for_next(NULL); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); return f; } diff --git a/test/core/end2end/fixtures/h2_fd.c b/test/core/end2end/fixtures/h2_fd.c index b01b52c9960..53888dbc5b6 100644 --- a/test/core/end2end/fixtures/h2_fd.c +++ b/test/core/end2end/fixtures/h2_fd.c @@ -70,10 +70,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); f.fixture_data = fixture_data; - f.cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); - f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); + f.cq = grpc_completion_queue_create_for_next(NULL); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); create_sockets(fixture_data->fd_pair); diff --git a/test/core/end2end/fixtures/h2_full+pipe.c b/test/core/end2end/fixtures/h2_full+pipe.c index 6add99707fa..927ca8ae01c 100644 --- a/test/core/end2end/fixtures/h2_full+pipe.c +++ b/test/core/end2end/fixtures/h2_full+pipe.c @@ -70,10 +70,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); - f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); + f.cq = grpc_completion_queue_create_for_next(NULL); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); return f; } @@ -105,9 +103,10 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_full+trace.c b/test/core/end2end/fixtures/h2_full+trace.c index 25a76ca266c..bb24f966c1b 100644 --- a/test/core/end2end/fixtures/h2_full+trace.c +++ b/test/core/end2end/fixtures/h2_full+trace.c @@ -70,10 +70,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); - f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); + f.cq = grpc_completion_queue_create_for_next(NULL); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); return f; } @@ -105,9 +103,10 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_full.c b/test/core/end2end/fixtures/h2_full.c index 435d9dfd45f..d8d4d95177d 100644 --- a/test/core/end2end/fixtures/h2_full.c +++ b/test/core/end2end/fixtures/h2_full.c @@ -64,10 +64,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); - f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); + f.cq = grpc_completion_queue_create_for_next(NULL); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); return f; } @@ -99,9 +97,10 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_http_proxy.c b/test/core/end2end/fixtures/h2_http_proxy.c index 7f8f55f71f8..451c55677fb 100644 --- a/test/core/end2end/fixtures/h2_http_proxy.c +++ b/test/core/end2end/fixtures/h2_http_proxy.c @@ -69,10 +69,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( ffd->proxy = grpc_end2end_http_proxy_create(); f.fixture_data = ffd; - f.cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); - f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); + f.cq = grpc_completion_queue_create_for_next(NULL); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); return f; } @@ -110,9 +108,10 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_load_reporting.c b/test/core/end2end/fixtures/h2_load_reporting.c index 5b8721adbd6..31f9a465623 100644 --- a/test/core/end2end/fixtures/h2_load_reporting.c +++ b/test/core/end2end/fixtures/h2_load_reporting.c @@ -67,10 +67,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_load_reporting( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); - f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); + f.cq = grpc_completion_queue_create_for_next(NULL); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); return f; } diff --git a/test/core/end2end/fixtures/h2_oauth2.c b/test/core/end2end/fixtures/h2_oauth2.c index 19920473ffa..c94f1f6239c 100644 --- a/test/core/end2end/fixtures/h2_oauth2.c +++ b/test/core/end2end/fixtures/h2_oauth2.c @@ -113,10 +113,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); - f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); + f.cq = grpc_completion_queue_create_for_next(NULL); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); return f; } diff --git a/test/core/end2end/fixtures/h2_proxy.c b/test/core/end2end/fixtures/h2_proxy.c index 55eec11b81c..af7d2776890 100644 --- a/test/core/end2end/fixtures/h2_proxy.c +++ b/test/core/end2end/fixtures/h2_proxy.c @@ -79,10 +79,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( ffd->proxy = grpc_end2end_proxy_create(&proxy_def, client_args, server_args); f.fixture_data = ffd; - f.cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); - f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); + f.cq = grpc_completion_queue_create_for_next(NULL); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); return f; } @@ -116,10 +114,11 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack+proxy", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_REQUEST_PROXYING | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack+proxy", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_REQUEST_PROXYING | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.c b/test/core/end2end/fixtures/h2_sockpair+trace.c index 069b880238a..0528b5d308a 100644 --- a/test/core/end2end/fixtures/h2_sockpair+trace.c +++ b/test/core/end2end/fixtures/h2_sockpair+trace.c @@ -94,10 +94,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); f.fixture_data = sfd; - f.cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); - f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); + f.cq = grpc_completion_queue_create_for_next(NULL); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); grpc_resource_quota *resource_quota = grpc_resource_quota_create("fixture"); *sfd = grpc_iomgr_create_endpoint_pair("fixture", resource_quota, 65536); diff --git a/test/core/end2end/fixtures/h2_sockpair.c b/test/core/end2end/fixtures/h2_sockpair.c index c19d4854031..ca16de075b1 100644 --- a/test/core/end2end/fixtures/h2_sockpair.c +++ b/test/core/end2end/fixtures/h2_sockpair.c @@ -88,10 +88,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); f.fixture_data = sfd; - f.cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); - f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); + f.cq = grpc_completion_queue_create_for_next(NULL); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); grpc_resource_quota *resource_quota = grpc_resource_quota_create("fixture"); *sfd = grpc_iomgr_create_endpoint_pair("fixture", resource_quota, 65536); diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.c b/test/core/end2end/fixtures/h2_sockpair_1byte.c index 05883b5ef4c..79b39aa9156 100644 --- a/test/core/end2end/fixtures/h2_sockpair_1byte.c +++ b/test/core/end2end/fixtures/h2_sockpair_1byte.c @@ -88,10 +88,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); f.fixture_data = sfd; - f.cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); - f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); + f.cq = grpc_completion_queue_create_for_next(NULL); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); grpc_resource_quota *resource_quota = grpc_resource_quota_create("fixture"); *sfd = grpc_iomgr_create_endpoint_pair("fixture", resource_quota, 1); diff --git a/test/core/end2end/fixtures/h2_ssl.c b/test/core/end2end/fixtures/h2_ssl.c index d704b97e1cf..c6a1ca09f83 100644 --- a/test/core/end2end/fixtures/h2_ssl.c +++ b/test/core/end2end/fixtures/h2_ssl.c @@ -64,10 +64,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); - f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); + f.cq = grpc_completion_queue_create_for_next(NULL); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); return f; } diff --git a/test/core/end2end/fixtures/h2_ssl_cert.c b/test/core/end2end/fixtures/h2_ssl_cert.c index cf3bc457418..59a728307b1 100644 --- a/test/core/end2end/fixtures/h2_ssl_cert.c +++ b/test/core/end2end/fixtures/h2_ssl_cert.c @@ -67,10 +67,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); - f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); + f.cq = grpc_completion_queue_create_for_next(NULL); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); return f; } @@ -206,15 +204,17 @@ CLIENT_INIT(BAD_CERT_PAIR) typedef enum { SUCCESS, FAIL } test_result; -#define SSL_TEST(request_type, cert_type, result) \ - { \ - {TEST_NAME(request_type, cert_type, result), \ - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | \ - FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | \ - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL, \ - chttp2_create_fixture_secure_fullstack, CLIENT_INIT_NAME(cert_type), \ - SERVER_INIT_NAME(request_type), chttp2_tear_down_secure_fullstack}, \ - result \ +#define SSL_TEST(request_type, cert_type, result) \ + { \ + {TEST_NAME(request_type, cert_type, result), \ + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | \ + FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | \ + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL, \ + chttp2_create_fixture_secure_fullstack, \ + CLIENT_INIT_NAME(cert_type), \ + SERVER_INIT_NAME(request_type), \ + chttp2_tear_down_secure_fullstack}, \ + result \ } /* All test configurations */ diff --git a/test/core/end2end/fixtures/h2_ssl_proxy.c b/test/core/end2end/fixtures/h2_ssl_proxy.c index 61bcfebbbe9..9a6c9f558f1 100644 --- a/test/core/end2end/fixtures/h2_ssl_proxy.c +++ b/test/core/end2end/fixtures/h2_ssl_proxy.c @@ -100,10 +100,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( ffd->proxy = grpc_end2end_proxy_create(&proxy_def, client_args, server_args); f.fixture_data = ffd; - f.cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); - f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); + f.cq = grpc_completion_queue_create_for_next(NULL); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); return f; } diff --git a/test/core/end2end/fixtures/h2_uds.c b/test/core/end2end/fixtures/h2_uds.c index 8f043566b16..89b4b5e64b2 100644 --- a/test/core/end2end/fixtures/h2_uds.c +++ b/test/core/end2end/fixtures/h2_uds.c @@ -70,10 +70,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( unique++); f.fixture_data = ffd; - f.cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); - f.shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); + f.cq = grpc_completion_queue_create_for_next(NULL); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); return f; } @@ -104,9 +102,10 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack_uds", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack_uds", + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/proxy.c b/test/core/end2end/fixtures/proxy.c index 7d306c60326..b8b1e5c6c98 100644 --- a/test/core/end2end/fixtures/proxy.c +++ b/test/core/end2end/fixtures/proxy.c @@ -104,8 +104,7 @@ grpc_end2end_proxy *grpc_end2end_proxy_create(const grpc_end2end_proxy_def *def, gpr_log(GPR_DEBUG, "PROXY ADDR:%s BACKEND:%s", proxy->proxy_port, proxy->server_port); - proxy->cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + proxy->cq = grpc_completion_queue_create_for_next(NULL); proxy->server = def->create_server(proxy->proxy_port, server_args); proxy->client = def->create_client(proxy->server_port, client_args); diff --git a/test/core/end2end/fuzzers/api_fuzzer.c b/test/core/end2end/fuzzers/api_fuzzer.c index 88026d9815b..afeaf738984 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.c +++ b/test/core/end2end/fuzzers/api_fuzzer.c @@ -314,8 +314,9 @@ static grpc_call_credentials *read_call_creds(input_stream *inp) { cred_artifact_ctx ctx = CRED_ARTIFACT_CTX_INIT; const char *access_token = read_cred_artifact(&ctx, inp, NULL, 0); grpc_call_credentials *out = - access_token == NULL ? NULL : grpc_access_token_credentials_create( - access_token, NULL); + access_token == NULL + ? NULL + : grpc_access_token_credentials_create(access_token, NULL); cred_artifact_ctx_finish(&ctx); return out; } @@ -409,8 +410,9 @@ void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr, r->on_done = on_done; r->addrs = addresses; grpc_timer_init( - exec_ctx, &r->timer, gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), - gpr_time_from_seconds(1, GPR_TIMESPAN)), + exec_ctx, &r->timer, + gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), + gpr_time_from_seconds(1, GPR_TIMESPAN)), grpc_closure_create(finish_resolve, r, grpc_schedule_on_exec_ctx), gpr_now(GPR_CLOCK_MONOTONIC)); } @@ -471,8 +473,9 @@ static void sched_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure, fc->ep = ep; fc->deadline = deadline; grpc_timer_init( - exec_ctx, &fc->timer, gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), - gpr_time_from_millis(1, GPR_TIMESPAN)), + exec_ctx, &fc->timer, + gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), + gpr_time_from_millis(1, GPR_TIMESPAN)), grpc_closure_create(do_connect, fc, grpc_schedule_on_exec_ctx), gpr_now(GPR_CLOCK_MONOTONIC)); } @@ -735,8 +738,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { g_active_call = new_call(NULL, ROOT); g_resource_quota = grpc_resource_quota_create("api_fuzzer"); - grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL); while (!is_eof(&inp) || g_channel != NULL || g_server != NULL || pending_channel_watches > 0 || pending_pings > 0 || @@ -749,8 +751,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { if (g_server != NULL) { if (!server_shutdown) { grpc_server_shutdown_and_notify( - g_server, cq, create_validator(assert_success_and_decrement, - &pending_server_shutdowns)); + g_server, cq, + create_validator(assert_success_and_decrement, + &pending_server_shutdowns)); server_shutdown = true; pending_server_shutdowns++; } else if (pending_server_shutdowns == 0) { @@ -855,8 +858,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { case 5: { if (g_server != NULL) { grpc_server_shutdown_and_notify( - g_server, cq, create_validator(assert_success_and_decrement, - &pending_server_shutdowns)); + g_server, cq, + create_validator(assert_success_and_decrement, + &pending_server_shutdowns)); pending_server_shutdowns++; server_shutdown = true; } else { diff --git a/test/core/end2end/fuzzers/client_fuzzer.c b/test/core/end2end/fuzzers/client_fuzzer.c index 46acf7d70a2..bc322e45a39 100644 --- a/test/core/end2end/fuzzers/client_fuzzer.c +++ b/test/core/end2end/fuzzers/client_fuzzer.c @@ -65,8 +65,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { grpc_mock_endpoint_create(discard_write, resource_quota); grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); - grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL); grpc_transport *transport = grpc_create_chttp2_transport(&exec_ctx, NULL, mock_endpoint, 1); grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL); diff --git a/test/core/end2end/fuzzers/server_fuzzer.c b/test/core/end2end/fuzzers/server_fuzzer.c index 33c8ed4e727..97b436cdf9d 100644 --- a/test/core/end2end/fuzzers/server_fuzzer.c +++ b/test/core/end2end/fuzzers/server_fuzzer.c @@ -67,8 +67,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { grpc_slice_from_copied_buffer((const char *)data, size)); grpc_server *server = grpc_server_create(NULL, NULL); - grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL); grpc_server_register_completion_queue(server, cq, NULL); // TODO(ctiller): add registered methods (one for POST, one for PUT) // void *registered_method = diff --git a/test/core/end2end/goaway_server_test.c b/test/core/end2end/goaway_server_test.c index 92ea7a72ef5..c394a032c0c 100644 --- a/test/core/end2end/goaway_server_test.c +++ b/test/core/end2end/goaway_server_test.c @@ -121,8 +121,7 @@ int main(int argc, char **argv) { grpc_metadata_array_init(&request_metadata2); grpc_call_details_init(&request_details2); - cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + cq = grpc_completion_queue_create_for_next(NULL); cqv = cq_verifier_create(cq); /* reserve two ports */ diff --git a/test/core/end2end/invalid_call_argument_test.c b/test/core/end2end/invalid_call_argument_test.c index 7aa8d98933c..6890cfd0a8f 100644 --- a/test/core/end2end/invalid_call_argument_test.c +++ b/test/core/end2end/invalid_call_argument_test.c @@ -73,8 +73,7 @@ static void prepare_test(int is_client) { grpc_metadata_array_init(&g_state.initial_metadata_recv); grpc_metadata_array_init(&g_state.trailing_metadata_recv); g_state.deadline = grpc_timeout_seconds_to_deadline(2); - g_state.cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + g_state.cq = grpc_completion_queue_create_for_next(NULL); g_state.cqv = cq_verifier_create(g_state.cq); g_state.details = grpc_empty_slice(); memset(g_state.ops, 0, sizeof(g_state.ops)); @@ -133,8 +132,7 @@ static void cleanup_test() { grpc_metadata_array_destroy(&g_state.trailing_metadata_recv); if (!g_state.is_client) { - shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); + shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); grpc_call_destroy(g_state.server_call); grpc_server_shutdown_and_notify(g_state.server, shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(shutdown_cq, tag(1000), diff --git a/test/core/end2end/multiple_server_queues_test.c b/test/core/end2end/multiple_server_queues_test.c index 7da5ee55aef..4696ecd813c 100644 --- a/test/core/end2end/multiple_server_queues_test.c +++ b/test/core/end2end/multiple_server_queues_test.c @@ -38,14 +38,26 @@ int main(int argc, char **argv) { grpc_completion_queue *cq1; grpc_completion_queue *cq2; grpc_completion_queue *cq3; + grpc_completion_queue_attributes attr; + grpc_server *server; grpc_test_init(argc, argv); grpc_init(); - cq1 = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); - cq2 = grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_NON_LISTENING, NULL); - cq3 = grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_NON_POLLING, NULL); + + attr.version = 1; + attr.cq_completion_type = GRPC_CQ_NEXT; + attr.cq_polling_type = GRPC_CQ_DEFAULT_POLLING; + cq1 = grpc_completion_queue_create( + grpc_completion_queue_factory_lookup(&attr), &attr, NULL); + + attr.cq_polling_type = GRPC_CQ_NON_LISTENING; + cq2 = grpc_completion_queue_create( + grpc_completion_queue_factory_lookup(&attr), &attr, NULL); + + attr.cq_polling_type = GRPC_CQ_NON_POLLING; + cq3 = grpc_completion_queue_create( + grpc_completion_queue_factory_lookup(&attr), &attr, NULL); server = grpc_server_create(NULL, NULL); grpc_server_register_completion_queue(server, cq1, NULL); diff --git a/test/core/end2end/no_server_test.c b/test/core/end2end/no_server_test.c index fd8a2f8a399..dd18b0c6923 100644 --- a/test/core/end2end/no_server_test.c +++ b/test/core/end2end/no_server_test.c @@ -59,8 +59,7 @@ int main(int argc, char **argv) { grpc_metadata_array_init(&trailing_metadata_recv); - cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + cq = grpc_completion_queue_create_for_next(NULL); cqv = cq_verifier_create(cq); /* create a call, channel to a non existant server */ diff --git a/test/core/fling/client.c b/test/core/fling/client.c index a9f6a3d5161..ecb73cfbdb2 100644 --- a/test/core/fling/client.c +++ b/test/core/fling/client.c @@ -208,8 +208,7 @@ int main(int argc, char **argv) { } channel = grpc_insecure_channel_create(target, NULL, NULL); - cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + cq = grpc_completion_queue_create_for_next(NULL); the_buffer = grpc_raw_byte_buffer_create(&slice, (size_t)payload_size); histogram = gpr_histogram_create(0.01, 60e9); diff --git a/test/core/fling/server.c b/test/core/fling/server.c index 4a47fe4cf5a..ebcb8f05f09 100644 --- a/test/core/fling/server.c +++ b/test/core/fling/server.c @@ -215,8 +215,7 @@ int main(int argc, char **argv) { } gpr_log(GPR_INFO, "creating server on: %s", addr); - cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + cq = grpc_completion_queue_create_for_next(NULL); if (secure) { grpc_ssl_pem_key_cert_pair pem_key_cert_pair = {test_server1_key, test_server1_cert}; @@ -245,8 +244,7 @@ int main(int argc, char **argv) { if (got_sigint && !shutdown_started) { gpr_log(GPR_INFO, "Shutting down due to SIGINT"); - shutdown_cq = grpc_completion_queue_create(GRPC_CQ_PLUCK, - GRPC_CQ_NON_POLLING, NULL); + shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); grpc_server_shutdown_and_notify(server, shutdown_cq, tag(1000)); GPR_ASSERT( @@ -259,8 +257,9 @@ int main(int argc, char **argv) { shutdown_started = 1; } ev = grpc_completion_queue_next( - cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(1000000, GPR_TIMESPAN)), + cq, + gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(1000000, GPR_TIMESPAN)), NULL); s = ev.tag; switch (ev.type) { diff --git a/test/core/handshake/client_ssl.c b/test/core/handshake/client_ssl.c index 5ebbc426092..16a1f47e8e7 100644 --- a/test/core/handshake/client_ssl.c +++ b/test/core/handshake/client_ssl.c @@ -289,8 +289,7 @@ static bool client_ssl_test(char *server_alpn_preferred) { // completed and we know that the client's ALPN list satisfied the server. int retries = 10; grpc_connectivity_state state = GRPC_CHANNEL_IDLE; - grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL); while (state != GRPC_CHANNEL_READY && retries-- > 0) { grpc_channel_watch_connectivity_state( diff --git a/test/core/handshake/server_ssl.c b/test/core/handshake/server_ssl.c index 6ac22eaae5c..2f93277417f 100644 --- a/test/core/handshake/server_ssl.c +++ b/test/core/handshake/server_ssl.c @@ -104,8 +104,7 @@ static void server_thread(void *arg) { GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, ssl_creds)); free(addr); - grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL); grpc_server_register_completion_queue(server, cq, NULL); grpc_server_start(server); diff --git a/test/core/memory_usage/client.c b/test/core/memory_usage/client.c index 582ede48a83..4fb99217b69 100644 --- a/test/core/memory_usage/client.c +++ b/test/core/memory_usage/client.c @@ -223,8 +223,7 @@ int main(int argc, char **argv) { calls[k].details = grpc_empty_slice(); } - cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + cq = grpc_completion_queue_create_for_next(NULL); struct grpc_memory_counters client_channel_start = grpc_memory_counters_snapshot(); @@ -262,8 +261,9 @@ int main(int argc, char **argv) { do { event = grpc_completion_queue_next( - cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(10000, GPR_TIMESPAN)), + cq, + gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(10000, GPR_TIMESPAN)), NULL); } while (event.type != GRPC_QUEUE_TIMEOUT); diff --git a/test/core/memory_usage/server.c b/test/core/memory_usage/server.c index 437b5473dfc..94d90a58a6a 100644 --- a/test/core/memory_usage/server.c +++ b/test/core/memory_usage/server.c @@ -189,8 +189,7 @@ int main(int argc, char **argv) { } gpr_log(GPR_INFO, "creating server on: %s", addr); - cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + cq = grpc_completion_queue_create_for_next(NULL); struct grpc_memory_counters before_server_create = grpc_memory_counters_snapshot(); @@ -233,8 +232,7 @@ int main(int argc, char **argv) { if (got_sigint && !shutdown_started) { gpr_log(GPR_INFO, "Shutting down due to SIGINT"); - shutdown_cq = grpc_completion_queue_create(GRPC_CQ_PLUCK, - GRPC_CQ_NON_POLLING, NULL); + shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); grpc_server_shutdown_and_notify(server, shutdown_cq, tag(1000)); GPR_ASSERT( grpc_completion_queue_pluck(shutdown_cq, tag(1000), @@ -245,8 +243,9 @@ int main(int argc, char **argv) { shutdown_started = 1; } ev = grpc_completion_queue_next( - cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(1000000, GPR_TIMESPAN)), + cq, + gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(1000000, GPR_TIMESPAN)), NULL); fling_call *s = ev.tag; switch (ev.type) { diff --git a/test/core/surface/alarm_test.c b/test/core/surface/alarm_test.c index 2c555db5ddf..6ea3444fe21 100644 --- a/test/core/surface/alarm_test.c +++ b/test/core/surface/alarm_test.c @@ -58,8 +58,7 @@ static void test_alarm(void) { grpc_completion_queue *cc; LOG_TEST("test_alarm"); - cc = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + cc = grpc_completion_queue_create_for_next(NULL); { /* regular expiry */ grpc_event ev; diff --git a/test/core/surface/completion_queue_test.c b/test/core/surface/completion_queue_test.c index c90e72cde68..4489057b2f2 100644 --- a/test/core/surface/completion_queue_test.c +++ b/test/core/surface/completion_queue_test.c @@ -78,12 +78,15 @@ static void test_no_op(void) { grpc_cq_completion_type completion_types[] = {GRPC_CQ_NEXT, GRPC_CQ_PLUCK}; grpc_cq_polling_type polling_types[] = { GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING}; + grpc_completion_queue_attributes attr; LOG_TEST("test_no_op"); for (size_t i = 0; i < GPR_ARRAY_SIZE(completion_types); i++) { for (size_t j = 0; j < GPR_ARRAY_SIZE(polling_types); j++) { + attr.cq_completion_type = completion_types[i]; + attr.cq_polling_type = polling_types[j]; shutdown_and_destroy(grpc_completion_queue_create( - completion_types[i], polling_types[j], NULL)); + grpc_completion_queue_factory_lookup(&attr), &attr, NULL)); } } } @@ -93,13 +96,16 @@ static void test_pollset_conversion(void) { grpc_cq_polling_type polling_types[] = {GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING}; grpc_completion_queue *cq; + grpc_completion_queue_attributes attr; LOG_TEST("test_pollset_conversion"); for (size_t i = 0; i < GPR_ARRAY_SIZE(completion_types); i++) { for (size_t j = 0; j < GPR_ARRAY_SIZE(polling_types); j++) { - cq = grpc_completion_queue_create(completion_types[i], polling_types[j], - NULL); + attr.cq_completion_type = completion_types[i]; + attr.cq_polling_type = polling_types[j]; + cq = grpc_completion_queue_create( + grpc_completion_queue_factory_lookup(&attr), &attr, NULL); GPR_ASSERT(grpc_cq_from_pollset(grpc_cq_pollset(cq)) == cq); shutdown_and_destroy(cq); } @@ -110,12 +116,17 @@ static void test_wait_empty(void) { grpc_cq_polling_type polling_types[] = { GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING}; grpc_completion_queue *cc; + grpc_completion_queue_attributes attr; grpc_event event; LOG_TEST("test_wait_empty"); + attr.cq_completion_type = GRPC_CQ_NEXT; + for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) { - cc = grpc_completion_queue_create(GRPC_CQ_NEXT, polling_types[i], NULL); + attr.cq_polling_type = polling_types[i]; + cc = grpc_completion_queue_create( + grpc_completion_queue_factory_lookup(&attr), &attr, NULL); event = grpc_completion_queue_next(cc, gpr_now(GPR_CLOCK_REALTIME), NULL); GPR_ASSERT(event.type == GRPC_QUEUE_TIMEOUT); shutdown_and_destroy(cc); @@ -131,16 +142,20 @@ static void test_cq_end_op(void) { grpc_cq_completion completion; grpc_cq_polling_type polling_types[] = { GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING}; - + grpc_completion_queue_attributes attr; grpc_exec_ctx init_exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx; void *tag = create_test_tag(); LOG_TEST("test_cq_end_op"); + attr.cq_completion_type = GRPC_CQ_NEXT; + for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) { exec_ctx = init_exec_ctx; // Reset exec_ctx - cc = grpc_completion_queue_create(GRPC_CQ_NEXT, polling_types[i], NULL); + attr.cq_polling_type = polling_types[i]; + cc = grpc_completion_queue_create( + grpc_completion_queue_factory_lookup(&attr), &attr, NULL); grpc_cq_begin_op(cc, tag); grpc_cq_end_op(&exec_ctx, cc, tag, GRPC_ERROR_NONE, @@ -160,11 +175,16 @@ static void test_shutdown_then_next_polling(void) { grpc_cq_polling_type polling_types[] = { GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING}; grpc_completion_queue *cc; + grpc_completion_queue_attributes attr; grpc_event event; LOG_TEST("test_shutdown_then_next_polling"); + attr.cq_completion_type = GRPC_CQ_NEXT; + for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) { - cc = grpc_completion_queue_create(GRPC_CQ_NEXT, polling_types[i], NULL); + attr.cq_polling_type = polling_types[i]; + cc = grpc_completion_queue_create( + grpc_completion_queue_factory_lookup(&attr), &attr, NULL); grpc_completion_queue_shutdown(cc); event = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), NULL); @@ -177,11 +197,16 @@ static void test_shutdown_then_next_with_timeout(void) { grpc_cq_polling_type polling_types[] = { GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING}; grpc_completion_queue *cc; + grpc_completion_queue_attributes attr; grpc_event event; LOG_TEST("test_shutdown_then_next_with_timeout"); + attr.cq_completion_type = GRPC_CQ_NEXT; + for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) { - cc = grpc_completion_queue_create(GRPC_CQ_NEXT, polling_types[i], NULL); + attr.cq_polling_type = polling_types[i]; + cc = grpc_completion_queue_create( + grpc_completion_queue_factory_lookup(&attr), &attr, NULL); grpc_completion_queue_shutdown(cc); event = grpc_completion_queue_next(cc, gpr_inf_future(GPR_CLOCK_REALTIME), @@ -198,6 +223,7 @@ static void test_pluck(void) { grpc_cq_completion completions[GPR_ARRAY_SIZE(tags)]; grpc_cq_polling_type polling_types[] = { GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING}; + grpc_completion_queue_attributes attr; grpc_exec_ctx init_exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx; unsigned i, j; @@ -211,9 +237,13 @@ static void test_pluck(void) { } } + attr.cq_completion_type = GRPC_CQ_PLUCK; + for (size_t pidx = 0; pidx < GPR_ARRAY_SIZE(polling_types); pidx++) { exec_ctx = init_exec_ctx; // reset exec_ctx - cc = grpc_completion_queue_create(GRPC_CQ_PLUCK, polling_types[pidx], NULL); + attr.cq_polling_type = polling_types[pidx]; + cc = grpc_completion_queue_create( + grpc_completion_queue_factory_lookup(&attr), &attr, NULL); for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { grpc_cq_begin_op(cc, tags[i]); @@ -249,11 +279,16 @@ static void test_pluck_after_shutdown(void) { GRPC_CQ_DEFAULT_POLLING, GRPC_CQ_NON_LISTENING, GRPC_CQ_NON_POLLING}; grpc_event ev; grpc_completion_queue *cc; + grpc_completion_queue_attributes attr; LOG_TEST("test_pluck_after_shutdown"); + attr.cq_completion_type = GRPC_CQ_PLUCK; + for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) { - cc = grpc_completion_queue_create(GRPC_CQ_PLUCK, polling_types[i], NULL); + attr.cq_polling_type = polling_types[i]; + cc = grpc_completion_queue_create( + grpc_completion_queue_factory_lookup(&attr), &attr, NULL); grpc_completion_queue_shutdown(cc); ev = grpc_completion_queue_pluck(cc, NULL, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); diff --git a/test/core/surface/completion_queue_threading_test.c b/test/core/surface/completion_queue_threading_test.c index 6a23aee5373..bff69ec74fd 100644 --- a/test/core/surface/completion_queue_threading_test.c +++ b/test/core/surface/completion_queue_threading_test.c @@ -101,8 +101,7 @@ static void test_too_many_plucks(void) { LOG_TEST("test_too_many_plucks"); - cc = grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING, - NULL); + cc = grpc_completion_queue_create_for_pluck(NULL); gpr_thd_options_set_joinable(&thread_options); for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { @@ -228,8 +227,7 @@ static void test_threading(size_t producers, size_t consumers) { gpr_malloc((producers + consumers) * sizeof(test_thread_options)); gpr_event phase1 = GPR_EVENT_INIT; gpr_event phase2 = GPR_EVENT_INIT; - grpc_completion_queue *cc = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + grpc_completion_queue *cc = grpc_completion_queue_create_for_next(NULL); size_t i; size_t total_consumed = 0; static int optid = 101; diff --git a/test/core/surface/concurrent_connectivity_test.c b/test/core/surface/concurrent_connectivity_test.c index 69f00f4d48c..f9197fb8fc7 100644 --- a/test/core/surface/concurrent_connectivity_test.c +++ b/test/core/surface/concurrent_connectivity_test.c @@ -66,8 +66,7 @@ static int detag(void *p) { return (int)(uintptr_t)p; } void create_loop_destroy(void *addr) { for (int i = 0; i < NUM_OUTER_LOOPS; ++i) { - grpc_completion_queue *cq = grpc_completion_queue_create( - GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL); grpc_channel *chan = grpc_insecure_channel_create((char *)addr, NULL, NULL); for (int j = 0; j < NUM_INNER_LOOPS; ++j) { @@ -196,8 +195,7 @@ int main(int argc, char **argv) { gpr_asprintf(&args.addr, "localhost:%d", port); args.server = grpc_server_create(NULL, NULL); grpc_server_add_insecure_http2_port(args.server, args.addr); - args.cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + args.cq = grpc_completion_queue_create_for_next(NULL); grpc_server_register_completion_queue(args.server, args.cq, NULL); grpc_server_start(args.server); gpr_thd_new(&server, server_thread, &args, &options); diff --git a/test/core/surface/lame_client_test.c b/test/core/surface/lame_client_test.c index 6531e5eb182..6c14a5dcdfe 100644 --- a/test/core/surface/lame_client_test.c +++ b/test/core/surface/lame_client_test.c @@ -108,8 +108,7 @@ int main(int argc, char **argv) { GPR_ASSERT(GRPC_CHANNEL_SHUTDOWN == grpc_channel_check_connectivity_state(chan, 0)); - cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + cq = grpc_completion_queue_create_for_next(NULL); grpc_slice host = grpc_slice_from_static_string("anywhere"); call = grpc_channel_create_call(chan, NULL, GRPC_PROPAGATE_DEFAULTS, cq, diff --git a/test/core/surface/sequential_connectivity_test.c b/test/core/surface/sequential_connectivity_test.c index 1880c0b8591..fbecdd7e388 100644 --- a/test/core/surface/sequential_connectivity_test.c +++ b/test/core/surface/sequential_connectivity_test.c @@ -77,7 +77,7 @@ static void run_test(const test_fixture *fixture) { grpc_server *server = grpc_server_create(NULL, NULL); fixture->add_server_port(server, addr); grpc_completion_queue *server_cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + grpc_completion_queue_create_for_next(NULL); grpc_server_register_completion_queue(server, server_cq, NULL); grpc_server_start(server); @@ -87,8 +87,7 @@ static void run_test(const test_fixture *fixture) { gpr_thd_options_set_joinable(&thdopt); gpr_thd_new(&server_thread, server_thread_func, &sta, &thdopt); - grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL); grpc_channel *channels[NUM_CONNECTIONS]; for (size_t i = 0; i < NUM_CONNECTIONS; i++) { channels[i] = fixture->create_channel(addr); diff --git a/test/core/surface/server_chttp2_test.c b/test/core/surface/server_chttp2_test.c index 47e8eeab1e3..0d4de0e28bc 100644 --- a/test/core/surface/server_chttp2_test.c +++ b/test/core/surface/server_chttp2_test.c @@ -60,8 +60,7 @@ void test_add_same_port_twice() { int port = grpc_pick_unused_port_or_die(); char *addr = NULL; - grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); + grpc_completion_queue *cq = grpc_completion_queue_create_for_pluck(NULL); grpc_server *server = grpc_server_create(&args, NULL); grpc_server_credentials *fake_creds = grpc_fake_transport_security_server_credentials_create(); diff --git a/test/core/surface/server_test.c b/test/core/surface/server_test.c index e488966b931..81a39de216d 100644 --- a/test/core/surface/server_test.c +++ b/test/core/surface/server_test.c @@ -70,8 +70,7 @@ void test_register_method_fail(void) { } void test_request_call_on_no_server_cq(void) { - grpc_completion_queue *cc = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + grpc_completion_queue *cc = grpc_completion_queue_create_for_next(NULL); grpc_server *server = grpc_server_create(NULL, NULL); GPR_ASSERT(GRPC_CALL_ERROR_NOT_SERVER_COMPLETION_QUEUE == grpc_server_request_call(server, NULL, NULL, NULL, cc, cc, NULL)); @@ -92,8 +91,7 @@ void test_bind_server_twice(void) { char *addr; grpc_server *server1 = grpc_server_create(&args, NULL); grpc_server *server2 = grpc_server_create(&args, NULL); - grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL); int port = grpc_pick_unused_port_or_die(); gpr_asprintf(&addr, "[::]:%d", port); grpc_server_register_completion_queue(server1, cq, NULL); @@ -130,8 +128,7 @@ void test_bind_server_to_addr(const char *host, bool secure) { } else { GPR_ASSERT(grpc_server_add_insecure_http2_port(server, addr)); } - grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL); grpc_server_register_completion_queue(server, cq, NULL); grpc_server_start(server); grpc_server_shutdown_and_notify(server, cq, NULL); From f2c32150efe7d980882f1fb2c89c7d0db551cf6c Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Wed, 22 Mar 2017 03:01:24 -0700 Subject: [PATCH 075/461] Update C++ code --- .../grpc++/impl/codegen/client_unary_call.h | 2 +- .../grpc++/impl/codegen/completion_queue.h | 19 ++++++++++++------- include/grpc++/impl/codegen/core_codegen.h | 7 ++++--- .../impl/codegen/core_codegen_interface.h | 7 ++++--- include/grpc++/impl/codegen/sync_stream.h | 8 ++++---- src/cpp/common/core_codegen.cc | 11 +++++++---- src/cpp/server/server_cc.cc | 5 +---- test/cpp/grpclb/grpclb_test.cc | 13 ++++++------- test/cpp/microbenchmarks/bm_call_create.cc | 3 +-- test/cpp/microbenchmarks/bm_cq.cc | 12 ++++-------- 10 files changed, 44 insertions(+), 43 deletions(-) diff --git a/include/grpc++/impl/codegen/client_unary_call.h b/include/grpc++/impl/codegen/client_unary_call.h index d8085a0a7f8..6218e3ed1b1 100644 --- a/include/grpc++/impl/codegen/client_unary_call.h +++ b/include/grpc++/impl/codegen/client_unary_call.h @@ -52,7 +52,7 @@ template Status BlockingUnaryCall(ChannelInterface* channel, const RpcMethod& method, ClientContext* context, const InputMessage& request, OutputMessage* result) { - CompletionQueue cq(GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING); + CompletionQueue cq(true); // Pluckable completion queue Call call(channel->CreateCall(method, context, &cq)); CallOpSet, diff --git a/include/grpc++/impl/codegen/completion_queue.h b/include/grpc++/impl/codegen/completion_queue.h index f34b82dad29..0130e9ca0f1 100644 --- a/include/grpc++/impl/codegen/completion_queue.h +++ b/include/grpc++/impl/codegen/completion_queue.h @@ -103,7 +103,7 @@ class CompletionQueue : private GrpcLibraryCodegen { public: /// Default constructor. Implicitly creates a \a grpc_completion_queue /// instance. - CompletionQueue() : CompletionQueue(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING) {} + CompletionQueue() : CompletionQueue(false) {} /// Wrap \a take, taking ownership of the instance. /// @@ -147,8 +147,9 @@ class CompletionQueue : private GrpcLibraryCodegen { /// /// \return true if read a regular event, false if the queue is shutting down. bool Next(void** tag, bool* ok) { - return (AsyncNextInternal(tag, ok, g_core_codegen_interface->gpr_inf_future( - GPR_CLOCK_REALTIME)) != SHUTDOWN); + return (AsyncNextInternal(tag, ok, + g_core_codegen_interface->gpr_inf_future( + GPR_CLOCK_REALTIME)) != SHUTDOWN); } /// Request the shutdown of the queue. @@ -217,10 +218,14 @@ class CompletionQueue : private GrpcLibraryCodegen { OutputMessage* result); /// Private constructor of CompletionQueue only visible to friend classes - CompletionQueue(grpc_cq_completion_type completion_type, - grpc_cq_polling_type polling_type) { - cq_ = g_core_codegen_interface->grpc_completion_queue_create( - completion_type, polling_type, nullptr); + CompletionQueue(bool is_pluck) { + if (is_pluck) { + cq_ = g_core_codegen_interface->grpc_completion_queue_create_for_pluck( + nullptr); + } else { + cq_ = g_core_codegen_interface->grpc_completion_queue_create_for_next( + nullptr); + } InitialAvalanching(); // reserve this for the future shutdown } diff --git a/include/grpc++/impl/codegen/core_codegen.h b/include/grpc++/impl/codegen/core_codegen.h index 4c8567f7702..af7abdf898b 100644 --- a/include/grpc++/impl/codegen/core_codegen.h +++ b/include/grpc++/impl/codegen/core_codegen.h @@ -46,9 +46,10 @@ namespace grpc { /// Implementation of the core codegen interface. class CoreCodegen : public CoreCodegenInterface { private: - grpc_completion_queue* grpc_completion_queue_create( - grpc_cq_completion_type completion_type, - grpc_cq_polling_type polling_type, void* reserved) override; + grpc_completion_queue* grpc_completion_queue_create_for_next( + void* reserved) override; + grpc_completion_queue* grpc_completion_queue_create_for_pluck( + void* reserved) override; void grpc_completion_queue_destroy(grpc_completion_queue* cq) override; grpc_event grpc_completion_queue_pluck(grpc_completion_queue* cq, void* tag, gpr_timespec deadline, diff --git a/include/grpc++/impl/codegen/core_codegen_interface.h b/include/grpc++/impl/codegen/core_codegen_interface.h index 8f2b4a3b76e..fd4767a80ae 100644 --- a/include/grpc++/impl/codegen/core_codegen_interface.h +++ b/include/grpc++/impl/codegen/core_codegen_interface.h @@ -60,9 +60,10 @@ class CoreCodegenInterface { virtual void assert_fail(const char* failed_assertion, const char* file, int line) = 0; - virtual grpc_completion_queue* grpc_completion_queue_create( - grpc_cq_completion_type completion_type, - grpc_cq_polling_type polling_type, void* reserved) = 0; + virtual grpc_completion_queue* grpc_completion_queue_create_for_next( + void* reserved) = 0; + virtual grpc_completion_queue* grpc_completion_queue_create_for_pluck( + void* reserved) = 0; virtual void grpc_completion_queue_destroy(grpc_completion_queue* cq) = 0; virtual grpc_event grpc_completion_queue_pluck(grpc_completion_queue* cq, void* tag, diff --git a/include/grpc++/impl/codegen/sync_stream.h b/include/grpc++/impl/codegen/sync_stream.h index c09ab5e647c..4e12f3261e5 100644 --- a/include/grpc++/impl/codegen/sync_stream.h +++ b/include/grpc++/impl/codegen/sync_stream.h @@ -138,7 +138,7 @@ class ClientReader final : public ClientReaderInterface { ClientReader(ChannelInterface* channel, const RpcMethod& method, ClientContext* context, const W& request) : context_(context), - cq_(GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING), + cq_(true), // Pluckable cq call_(channel->CreateCall(method, context, &cq_)) { CallOpSet @@ -212,7 +212,7 @@ class ClientWriter : public ClientWriterInterface { ClientWriter(ChannelInterface* channel, const RpcMethod& method, ClientContext* context, R* response) : context_(context), - cq_(GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING), + cq_(true), // Pluckable cq call_(channel->CreateCall(method, context, &cq_)) { finish_ops_.RecvMessage(response); finish_ops_.AllowNoMessage(); @@ -297,7 +297,7 @@ class ClientReaderWriter final : public ClientReaderWriterInterface { ClientReaderWriter(ChannelInterface* channel, const RpcMethod& method, ClientContext* context) : context_(context), - cq_(GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING), + cq_(true), // Pluckable cq call_(channel->CreateCall(method, context, &cq_)) { CallOpSet ops; ops.SendInitialMetadata(context->send_initial_metadata_, @@ -512,7 +512,7 @@ class ServerReaderWriterBody final { Call* const call_; ServerContext* const ctx_; }; -} +} // namespace internal // class to represent the user API for a bidirectional streaming call template diff --git a/src/cpp/common/core_codegen.cc b/src/cpp/common/core_codegen.cc index 81b32938b85..7d8a733912f 100644 --- a/src/cpp/common/core_codegen.cc +++ b/src/cpp/common/core_codegen.cc @@ -54,11 +54,14 @@ struct grpc_byte_buffer; namespace grpc { -grpc_completion_queue* CoreCodegen::grpc_completion_queue_create( - grpc_cq_completion_type completion_type, grpc_cq_polling_type polling_type, +grpc_completion_queue* CoreCodegen::grpc_completion_queue_create_for_next( void* reserved) { - return ::grpc_completion_queue_create(completion_type, polling_type, - reserved); + return ::grpc_completion_queue_create_for_next(reserved); +} + +grpc_completion_queue* CoreCodegen::grpc_completion_queue_create_for_pluck( + void* reserved) { + return ::grpc_completion_queue_create_for_pluck(reserved); } void CoreCodegen::grpc_completion_queue_destroy(grpc_completion_queue* cq) { diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index b11ea725e12..6adabef7636 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -153,10 +153,7 @@ class Server::SyncRequest final : public CompletionQueueTag { grpc_metadata_array_destroy(&request_metadata_); } - void SetupRequest() { - cq_ = grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING, - nullptr); - } + void SetupRequest() { cq_ = grpc_completion_queue_create_for_pluck(nullptr); } void TeardownRequest() { grpc_completion_queue_destroy(cq_); diff --git a/test/cpp/grpclb/grpclb_test.cc b/test/cpp/grpclb/grpclb_test.cc index c9c569cfbe7..b85ad949a52 100644 --- a/test/cpp/grpclb/grpclb_test.cc +++ b/test/cpp/grpclb/grpclb_test.cc @@ -354,8 +354,9 @@ static void start_backend_server(server_fixture *sf) { } GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); const string expected_token = - strlen(sf->lb_token_prefix) == 0 ? "" : sf->lb_token_prefix + - std::to_string(sf->port); + strlen(sf->lb_token_prefix) == 0 + ? "" + : sf->lb_token_prefix + std::to_string(sf->port); GPR_ASSERT(contains_metadata(&request_metadata_recv, "lb-token", expected_token.c_str())); @@ -593,8 +594,7 @@ static void setup_client(const server_fixture *lb_server, grpc_channel_args_copy_and_add(NULL, &expected_target_arg, 1); gpr_free(expected_target_names); - cf->cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + cf->cq = grpc_completion_queue_create_for_next(NULL); cf->server_uri = lb_uri; grpc_channel_credentials *fake_creds = grpc_fake_transport_security_credentials_create(); @@ -617,8 +617,7 @@ static void teardown_client(client_fixture *cf) { static void setup_server(const char *host, server_fixture *sf) { int assigned_port; - sf->cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + sf->cq = grpc_completion_queue_create_for_next(NULL); const char *colon_idx = strchr(host, ':'); if (colon_idx) { const char *port_str = colon_idx + 1; @@ -647,7 +646,7 @@ static void teardown_server(server_fixture *sf) { gpr_log(GPR_INFO, "Server[%s] shutting down", sf->servers_hostport); grpc_completion_queue *shutdown_cq = - grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_NON_POLLING, NULL); + grpc_completion_queue_create_for_pluck(NULL); grpc_server_shutdown_and_notify(sf->server, shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index ec6073e7869..24d2a1b85f9 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -114,8 +114,7 @@ template static void BM_CallCreateDestroy(benchmark::State &state) { TrackCounters track_counters; Fixture fixture; - grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL); gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); void *method_hdl = grpc_channel_register_call(fixture.channel(), "/foo/bar", NULL, NULL); diff --git a/test/cpp/microbenchmarks/bm_cq.cc b/test/cpp/microbenchmarks/bm_cq.cc index 14eae82717f..eaba7d858cb 100644 --- a/test/cpp/microbenchmarks/bm_cq.cc +++ b/test/cpp/microbenchmarks/bm_cq.cc @@ -64,8 +64,7 @@ static void BM_CreateDestroyCore(benchmark::State& state) { while (state.KeepRunning()) { // TODO: sreek Templatize this benchmark and pass completion type and // polling type as parameters - grpc_completion_queue_destroy(grpc_completion_queue_create( - GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL)); + grpc_completion_queue_destroy(grpc_completion_queue_create_for_next(NULL)); } track_counters.Finish(state); } @@ -102,8 +101,7 @@ BENCHMARK(BM_Pass1Cpp); static void BM_Pass1Core(benchmark::State& state) { TrackCounters track_counters; // TODO: sreek Templatize this benchmark and pass polling_type as a param - grpc_completion_queue* cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL); gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); while (state.KeepRunning()) { grpc_cq_completion completion; @@ -122,8 +120,7 @@ BENCHMARK(BM_Pass1Core); static void BM_Pluck1Core(benchmark::State& state) { TrackCounters track_counters; // TODO: sreek Templatize this benchmark and pass polling_type as a param - grpc_completion_queue* cq = grpc_completion_queue_create( - GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING, NULL); + grpc_completion_queue* cq = grpc_completion_queue_create_for_pluck(NULL); gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); while (state.KeepRunning()) { grpc_cq_completion completion; @@ -142,8 +139,7 @@ BENCHMARK(BM_Pluck1Core); static void BM_EmptyCore(benchmark::State& state) { TrackCounters track_counters; // TODO: sreek Templatize this benchmark and pass polling_type as a param - grpc_completion_queue* cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL); gpr_timespec deadline = gpr_inf_past(GPR_CLOCK_MONOTONIC); while (state.KeepRunning()) { grpc_completion_queue_next(cq, deadline, NULL); From def3354c9ac0a71e1868ae2733657c00b8f990e7 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Wed, 22 Mar 2017 03:07:01 -0700 Subject: [PATCH 076/461] Fix test bug and generate_projects.sh --- src/ruby/ext/grpc/rb_grpc_imports.generated.h | 2 +- test/core/surface/completion_queue_test.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h index 6f1f1bd4dbb..e036ff7bd63 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h @@ -233,7 +233,7 @@ extern grpc_completion_queue_create_for_next_type grpc_completion_queue_create_f typedef grpc_completion_queue *(*grpc_completion_queue_create_for_pluck_type)(void *reserved); extern grpc_completion_queue_create_for_pluck_type grpc_completion_queue_create_for_pluck_import; #define grpc_completion_queue_create_for_pluck grpc_completion_queue_create_for_pluck_import -typedef grpc_completion_queue *(*grpc_completion_queue_create_type)(grpc_cq_completion_type completion_type, grpc_cq_polling_type polling_type, void *reserved); +typedef grpc_completion_queue *(*grpc_completion_queue_create_type)(const grpc_completion_queue_factory *factory, const grpc_completion_queue_attributes *attributes, void *reserved); extern grpc_completion_queue_create_type grpc_completion_queue_create_import; #define grpc_completion_queue_create grpc_completion_queue_create_import typedef grpc_event(*grpc_completion_queue_next_type)(grpc_completion_queue *cq, gpr_timespec deadline, void *reserved); diff --git a/test/core/surface/completion_queue_test.c b/test/core/surface/completion_queue_test.c index 4489057b2f2..35bda5b6418 100644 --- a/test/core/surface/completion_queue_test.c +++ b/test/core/surface/completion_queue_test.c @@ -81,6 +81,7 @@ static void test_no_op(void) { grpc_completion_queue_attributes attr; LOG_TEST("test_no_op"); + attr.version = 1; for (size_t i = 0; i < GPR_ARRAY_SIZE(completion_types); i++) { for (size_t j = 0; j < GPR_ARRAY_SIZE(polling_types); j++) { attr.cq_completion_type = completion_types[i]; @@ -100,6 +101,7 @@ static void test_pollset_conversion(void) { LOG_TEST("test_pollset_conversion"); + attr.version = 1; for (size_t i = 0; i < GPR_ARRAY_SIZE(completion_types); i++) { for (size_t j = 0; j < GPR_ARRAY_SIZE(polling_types); j++) { attr.cq_completion_type = completion_types[i]; @@ -121,8 +123,8 @@ static void test_wait_empty(void) { LOG_TEST("test_wait_empty"); + attr.version = 1; attr.cq_completion_type = GRPC_CQ_NEXT; - for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) { attr.cq_polling_type = polling_types[i]; cc = grpc_completion_queue_create( @@ -149,8 +151,8 @@ static void test_cq_end_op(void) { LOG_TEST("test_cq_end_op"); + attr.version = 1; attr.cq_completion_type = GRPC_CQ_NEXT; - for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) { exec_ctx = init_exec_ctx; // Reset exec_ctx attr.cq_polling_type = polling_types[i]; @@ -179,8 +181,8 @@ static void test_shutdown_then_next_polling(void) { grpc_event event; LOG_TEST("test_shutdown_then_next_polling"); + attr.version = 1; attr.cq_completion_type = GRPC_CQ_NEXT; - for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) { attr.cq_polling_type = polling_types[i]; cc = grpc_completion_queue_create( @@ -201,8 +203,8 @@ static void test_shutdown_then_next_with_timeout(void) { grpc_event event; LOG_TEST("test_shutdown_then_next_with_timeout"); + attr.version = 1; attr.cq_completion_type = GRPC_CQ_NEXT; - for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) { attr.cq_polling_type = polling_types[i]; cc = grpc_completion_queue_create( @@ -237,8 +239,8 @@ static void test_pluck(void) { } } + attr.version = 1; attr.cq_completion_type = GRPC_CQ_PLUCK; - for (size_t pidx = 0; pidx < GPR_ARRAY_SIZE(polling_types); pidx++) { exec_ctx = init_exec_ctx; // reset exec_ctx attr.cq_polling_type = polling_types[pidx]; @@ -283,8 +285,8 @@ static void test_pluck_after_shutdown(void) { LOG_TEST("test_pluck_after_shutdown"); + attr.version = 1; attr.cq_completion_type = GRPC_CQ_PLUCK; - for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) { attr.cq_polling_type = polling_types[i]; cc = grpc_completion_queue_create( From 615e468b08362237d5fedc788b3b3e524a3b1914 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Wed, 22 Mar 2017 12:34:17 -0700 Subject: [PATCH 077/461] C# changes --- src/csharp/ext/grpc_csharp_ext.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index ceb2671faf8..27de7bc11f1 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -355,12 +355,12 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_shutdown(void) { grpc_shutdown(); } GPR_EXPORT grpc_completion_queue *GPR_CALLTYPE grpcsharp_completion_queue_create_async(void) { - return grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + return grpc_completion_queue_create_for_next(NULL); } GPR_EXPORT grpc_completion_queue *GPR_CALLTYPE grpcsharp_completion_queue_create_sync(void) { - return grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING, NULL); + return grpc_completion_queue_create_for_pluck(NULL); } GPR_EXPORT void GPR_CALLTYPE From ef8857e4af2062f20c9e3e4cfad0c1576c31d9e6 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Wed, 22 Mar 2017 12:35:09 -0700 Subject: [PATCH 078/461] Node changes --- src/node/ext/completion_queue_threadpool.cc | 3 +-- src/node/ext/completion_queue_uv.cc | 3 +-- src/node/ext/server_generic.cc | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/node/ext/completion_queue_threadpool.cc b/src/node/ext/completion_queue_threadpool.cc index b5227bad650..0b8bc019e0c 100644 --- a/src/node/ext/completion_queue_threadpool.cc +++ b/src/node/ext/completion_queue_threadpool.cc @@ -141,8 +141,7 @@ void CompletionQueueAsyncWorker::Init(Local exports) { Nan::HandleScope scope; current_threads = 0; waiting_next_calls = 0; - queue = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + queue = grpc_completion_queue_create_for_next(NULL); } void CompletionQueueAsyncWorker::HandleOKCallback() { diff --git a/src/node/ext/completion_queue_uv.cc b/src/node/ext/completion_queue_uv.cc index 9c1f093a405..72900501e03 100644 --- a/src/node/ext/completion_queue_uv.cc +++ b/src/node/ext/completion_queue_uv.cc @@ -92,8 +92,7 @@ void CompletionQueueNext() { } void CompletionQueueInit(Local exports) { - queue = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL); + queue = grpc_completion_queue_create_for_next(NULL); uv_prepare_init(uv_default_loop(), &prepare); pending_batches = 0; } diff --git a/src/node/ext/server_generic.cc b/src/node/ext/server_generic.cc index 787605aebfa..24573bd52f5 100644 --- a/src/node/ext/server_generic.cc +++ b/src/node/ext/server_generic.cc @@ -44,8 +44,7 @@ namespace grpc { namespace node { Server::Server(grpc_server *server) : wrapped_server(server) { - shutdown_queue = grpc_completion_queue_create(GRPC_CQ_PLUCK, - GRPC_CQ_DEFAULT_POLLING, NULL); + shutdown_queue = grpc_completion_queue_create_for_pluck(NULL); grpc_server_register_non_listening_completion_queue(server, shutdown_queue, NULL); } From ffc69a7644fc96e63b255776749312c650b51127 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Wed, 22 Mar 2017 12:35:19 -0700 Subject: [PATCH 079/461] Objective-C changes --- src/objective-c/GRPCClient/private/GRPCCompletionQueue.m | 4 +--- .../tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m | 3 +-- src/objective-c/tests/CronetUnitTests/CronetUnitTests.m | 8 ++------ 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m index 8edb4ef0488..5ff77eac4c5 100644 --- a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m +++ b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m @@ -48,9 +48,7 @@ - (instancetype)init { if ((self = [super init])) { - _unmanagedQueue = grpc_completion_queue_create(GRPC_CQ_NEXT, - GRPC_CQ_DEFAULT_POLLING, - NULL); + _unmanagedQueue = grpc_completion_queue_create_for_next(NULL); // This is for the following block to capture the pointer by value (instead // of retaining self and doing self->_unmanagedQueue). This is essential diff --git a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m index 7656fb8d510..54c3ed0e946 100644 --- a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m +++ b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m @@ -79,8 +79,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( gpr_join_host_port(&ffd->localaddr, "127.0.0.1", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, - NULL); + f.cq = grpc_completion_queue_create_for_next(NULL); return f; } diff --git a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m index 1840894d815..6fe4706af67 100644 --- a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m +++ b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m @@ -160,9 +160,7 @@ unsigned int parse_h2_length(const char *field) { int port = grpc_pick_unused_port_or_die(); char *addr; gpr_join_host_port(&addr, "127.0.0.1", port); - grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, - NULL); + grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL); stream_engine *cronetEngine = [Cronet getGlobalEngine]; grpc_channel *client = grpc_cronet_secure_channel_create(cronetEngine, addr, NULL, NULL); @@ -296,9 +294,7 @@ unsigned int parse_h2_length(const char *field) { int port = grpc_pick_unused_port_or_die(); char *addr; gpr_join_host_port(&addr, "127.0.0.1", port); - grpc_completion_queue *cq = - grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, - NULL); + grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL); stream_engine *cronetEngine = [Cronet getGlobalEngine]; grpc_channel *client = grpc_cronet_secure_channel_create(cronetEngine, addr, args, NULL); From 3a55efaed727ae472baf3b824918e4561baca36d Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Wed, 22 Mar 2017 12:37:07 -0700 Subject: [PATCH 080/461] PHP changes --- src/php/ext/grpc/completion_queue.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/php/ext/grpc/completion_queue.c b/src/php/ext/grpc/completion_queue.c index 441088bf680..c75a524530e 100644 --- a/src/php/ext/grpc/completion_queue.c +++ b/src/php/ext/grpc/completion_queue.c @@ -38,9 +38,7 @@ grpc_completion_queue *completion_queue; void grpc_php_init_completion_queue(TSRMLS_D) { - completion_queue = grpc_completion_queue_create(GRPC_CQ_PLUCK, - GRPC_CQ_DEFAULT_POLLING, - NULL); + completion_queue = grpc_completion_queue_create_for_pluck(NULL); } void grpc_php_shutdown_completion_queue(TSRMLS_D) { From 56b1032feb1bc1bdd6f622906fd737ad1bc12e56 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Wed, 22 Mar 2017 12:37:17 -0700 Subject: [PATCH 081/461] Python changes --- .../grpc/_cython/_cygrpc/completion_queue.pyx.pxi | 2 +- src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi | 14 +------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pyx.pxi index 368919b62f0..34b2623d346 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/completion_queue.pyx.pxi @@ -40,7 +40,7 @@ cdef class CompletionQueue: def __cinit__(self): grpc_init() with nogil: - self.c_completion_queue = grpc_completion_queue_create(GRPC_CQ_NEXT, GRPC_CQ_DEFAULT_POLLING, NULL) + self.c_completion_queue = grpc_completion_queue_create_for_next(NULL) self.is_shutting_down = False self.is_shutdown = False diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi index b26b240b4e5..0b2bdef48be 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi @@ -309,19 +309,7 @@ cdef extern from "grpc/grpc.h": void grpc_init() nogil void grpc_shutdown() nogil - ctypedef enum grpc_cq_completion_type: - GRPC_CQ_NEXT = 1 - GRPC_CQ_PLUCK = 2 - - ctypedef enum grpc_cq_polling_type: - GRPC_CQ_DEFAULT_POLLING - GRPC_CQ_NON_LISTENING - GRPC_CQ_NON_POLLING - - grpc_completion_queue *grpc_completion_queue_create( - grpc_cq_completion_type completion_type, - grpc_cq_polling_type polling_type, - void *reserved) nogil + grpc_completion_queue *grpc_completion_queue_create_for_next(void *reserved) nogil grpc_event grpc_completion_queue_next(grpc_completion_queue *cq, gpr_timespec deadline, From 8d8bb7a51557b0ce61ad79324bc5cb538918f6ac Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Wed, 22 Mar 2017 12:37:29 -0700 Subject: [PATCH 082/461] Ruby changes --- src/ruby/ext/grpc/rb_channel.c | 6 ++---- src/ruby/ext/grpc/rb_server.c | 7 +++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/ruby/ext/grpc/rb_channel.c b/src/ruby/ext/grpc/rb_channel.c index 2b9f03abd4a..54b178ad870 100644 --- a/src/ruby/ext/grpc/rb_channel.c +++ b/src/ruby/ext/grpc/rb_channel.c @@ -171,8 +171,7 @@ static VALUE grpc_rb_channel_init(int argc, VALUE *argv, VALUE self) { } rb_ivar_set(self, id_target, target); wrapper->wrapped = ch; - wrapper->queue = grpc_completion_queue_create(GRPC_CQ_PLUCK, - GRPC_CQ_DEFAULT_POLLING, NULL); + wrapper->queue = grpc_completion_queue_create_for_pluck(NULL); return self; } @@ -270,8 +269,7 @@ static VALUE grpc_rb_channel_create_call(VALUE self, VALUE parent, VALUE mask, parent_call = grpc_rb_get_wrapped_call(parent); } - cq = grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING, - NULL); + cq = grpc_completion_queue_create_for_pluck(NULL); TypedData_Get_Struct(self, grpc_rb_channel, &grpc_channel_data_type, wrapper); ch = wrapper->wrapped; if (ch == NULL) { diff --git a/src/ruby/ext/grpc/rb_server.c b/src/ruby/ext/grpc/rb_server.c index a0e8f15294b..ef57d5b07ed 100644 --- a/src/ruby/ext/grpc/rb_server.c +++ b/src/ruby/ext/grpc/rb_server.c @@ -132,8 +132,7 @@ static VALUE grpc_rb_server_alloc(VALUE cls) { Initializes server instances. */ static VALUE grpc_rb_server_init(VALUE self, VALUE channel_args) { - grpc_completion_queue *cq = grpc_completion_queue_create( - GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING, NULL); + grpc_completion_queue *cq = grpc_completion_queue_create_for_pluck(NULL); grpc_rb_server *wrapper = NULL; grpc_server *srv = NULL; grpc_channel_args args; @@ -190,8 +189,8 @@ static VALUE grpc_rb_server_request_call(VALUE self) { request_call_stack st; VALUE result; void *tag = (void *)&st; - grpc_completion_queue *call_queue = grpc_completion_queue_create( - GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING, NULL); + grpc_completion_queue *call_queue = + grpc_completion_queue_create_for_pluck(NULL); gpr_timespec deadline; TypedData_Get_Struct(self, grpc_rb_server, &grpc_rb_server_data_type, s); From 2ae4fc2601c23f026e8abff2f1c1f817b72ef0b3 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Wed, 22 Mar 2017 13:11:27 -0700 Subject: [PATCH 083/461] Minor formatting --- include/grpc/grpc.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index d2c18795ea6..42cf201da44 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -117,14 +117,14 @@ typedef enum { GRPC_CQ_DEFAULT_POLLING, /** Similar to GRPC_CQ_DEFAULT_POLLING except that the completion queues will - not contain any 'listening file descriptors' (i.e file descriptors used to - listen to incoming channels) */ + not contain any 'listening file descriptors' (i.e file descriptors used to + listen to incoming channels) */ GRPC_CQ_NON_LISTENING, /** The completion queue will not have an associated pollset. Note that - grpc_completion_queue_next() or grpc_completion_queue_pluck() MUST still be - called to pop events from the completion queue; it is not required to call - them actively to make I/O progress */ + grpc_completion_queue_next() or grpc_completion_queue_pluck() MUST still + be called to pop events from the completion queue; it is not required to + call them actively to make I/O progress */ GRPC_CQ_NON_POLLING } grpc_cq_polling_type; From e76604fc3607cc49cf7256caec665ce3da630671 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 23 Mar 2017 20:27:26 +0100 Subject: [PATCH 084/461] link grpc_csharp_ext with static runtime --- tools/run_tests/helper_scripts/pre_build_csharp.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/run_tests/helper_scripts/pre_build_csharp.bat b/tools/run_tests/helper_scripts/pre_build_csharp.bat index 99df1c66268..bee430ac868 100644 --- a/tools/run_tests/helper_scripts/pre_build_csharp.bat +++ b/tools/run_tests/helper_scripts/pre_build_csharp.bat @@ -43,7 +43,7 @@ cd build mkdir %ARCHITECTURE% cd %ARCHITECTURE% @rem TODO(jtattermusch): Stop hardcoding path to yasm once Jenkins workers can locate yasm correctly -cmake -G "Visual Studio 14 2015" -A %ARCHITECTURE% -DgRPC_BUILD_TESTS=OFF -DCMAKE_ASM_NASM_COMPILER="C:/Program Files (x86)/yasm/yasm.exe" ../../.. || goto :error +cmake -G "Visual Studio 14 2015" -A %ARCHITECTURE% -DgRPC_BUILD_TESTS=OFF -DgRPC_MSVC_STATIC_RUNTIME=ON -DCMAKE_ASM_NASM_COMPILER="C:/Program Files (x86)/yasm/yasm.exe" ../../.. || goto :error cd ..\..\.. @rem Location of nuget.exe From ac7f90da26522965c420623a7c008c2eede464f3 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 23 Mar 2017 18:00:09 -0700 Subject: [PATCH 085/461] Add enumsAsStrings option, as the original upgrade PR did --- src/node/index.js | 4 ++++ src/node/src/common.js | 1 + src/node/src/protobuf_js_6_common.js | 2 +- src/node/test/common_test.js | 22 ++++++++++++++++++++++ src/node/test/test_messages.proto | 10 ++++++++++ 5 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/node/index.js b/src/node/index.js index ba73e3dac8f..071bfd7927b 100644 --- a/src/node/index.js +++ b/src/node/index.js @@ -64,6 +64,8 @@ grpc.setDefaultRootsPem(fs.readFileSync(SSL_ROOTS_PATH, 'ascii')); * Buffers. Defaults to false * - longsAsStrings: deserialize long values as strings instead of objects. * Defaults to true + * - enumsAsStrings: deserialize enum values as strings instead of numbers. + * Defaults to true * - deprecatedArgumentOrder: Use the beta method argument order for client * methods, with optional arguments after the callback. Defaults to false. * This option is only a temporary stopgap measure to smooth an API breakage. @@ -131,6 +133,8 @@ function applyProtoRoot(filename, root) { * Buffers. Defaults to false * - longsAsStrings: deserialize long values as strings instead of objects. * Defaults to true + * - enumsAsStrings: deserialize enum values as strings instead of numbers. + * Defaults to true * - deprecatedArgumentOrder: Use the beta method argument order for client * methods, with optional arguments after the callback. Defaults to false. * This option is only a temporary stopgap measure to smooth an API breakage. diff --git a/src/node/src/common.js b/src/node/src/common.js index 93df5138172..757969dbddb 100644 --- a/src/node/src/common.js +++ b/src/node/src/common.js @@ -87,5 +87,6 @@ exports.defaultGrpcOptions = { convertFieldsToCamelCase: false, binaryAsBase64: false, longsAsStrings: true, + enumsAsStrings: true, deprecatedArgumentOrder: false }; diff --git a/src/node/src/protobuf_js_6_common.js b/src/node/src/protobuf_js_6_common.js index 6a85e4ac23d..baa62cce866 100644 --- a/src/node/src/protobuf_js_6_common.js +++ b/src/node/src/protobuf_js_6_common.js @@ -50,7 +50,7 @@ exports.deserializeCls = function deserializeCls(cls, options) { defaults: true, bytes: options.binaryAsBase64 ? String : Buffer, longs: options.longsAsStrings ? String : null, - enums: String, + enums: options.enumsAsStrings ? String : null, oneofs: true }; /** diff --git a/src/node/test/common_test.js b/src/node/test/common_test.js index 4b7a8c22537..39ff6a5f1fc 100644 --- a/src/node/test/common_test.js +++ b/src/node/test/common_test.js @@ -179,3 +179,25 @@ describe('Proto message oneof serialize and deserialize', function() { assert.equal(deserialized2.oneof_choice, 'int_choice'); }); }); +describe('Proto message enum serialize and deserialize', function() { + var enumSerialize = serializeCls(messages_proto.EnumValues); + var enumDeserialize = deserializeCls( + messages_proto.EnumValues, default_options); + var enumIntOptions = _.defaults({enumsAsStrings: false}, default_options); + var enumIntDeserialize = deserializeCls( + messages_proto.EnumValues, enumIntOptions); + it('Should accept both names and numbers', function() { + var nameSerialized = enumSerialize({enum_value: 'ONE'}); + var numberSerialized = enumSerialize({enum_value: 1}); + assert.strictEqual(messages_proto.TestEnum.ONE, 1); + assert.deepEqual(enumDeserialize(nameSerialized), + enumDeserialize(numberSerialized)); + }); + it('Should deserialize as a string the enumsAsStrings option', function() { + var serialized = enumSerialize({enum_value: 'TWO'}); + var nameDeserialized = enumDeserialize(serialized); + var numberDeserialized = enumIntDeserialize(serialized); + assert.deepEqual(nameDeserialized, {enum_value: 'TWO'}); + assert.deepEqual(numberDeserialized, {enum_value: 2}); + }); +}); diff --git a/src/node/test/test_messages.proto b/src/node/test/test_messages.proto index 2cd133161b7..ae70f6e152a 100644 --- a/src/node/test/test_messages.proto +++ b/src/node/test/test_messages.proto @@ -47,4 +47,14 @@ message OneOfValues { int32 int_choice = 1; string string_choice = 2; } +} + +enum TestEnum { + ZERO = 0; + ONE = 1; + TWO = 2; +} + +message EnumValues { + TestEnum enum_value = 1; } \ No newline at end of file From 27338de44531467941f5dafb823560c0e1e3d401 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Thu, 23 Mar 2017 18:23:49 -0700 Subject: [PATCH 086/461] add test in that sends a sigint to client while its making an rpc ona child thread - segfaults on mac --- .../end2end/killed_client_thread_client.rb | 55 ++++++++ .../end2end/killed_client_thread_driver.rb | 132 ++++++++++++++++++ 2 files changed, 187 insertions(+) create mode 100755 src/ruby/end2end/killed_client_thread_client.rb create mode 100755 src/ruby/end2end/killed_client_thread_driver.rb diff --git a/src/ruby/end2end/killed_client_thread_client.rb b/src/ruby/end2end/killed_client_thread_client.rb new file mode 100755 index 00000000000..9a69161736e --- /dev/null +++ b/src/ruby/end2end/killed_client_thread_client.rb @@ -0,0 +1,55 @@ +#!/usr/bin/env ruby + +# Copyright 2015, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +require_relative './end2end_common' + +def main + server_port = '' + OptionParser.new do |opts| + opts.on('--client_control_port=P', String) do + STDERR.puts 'client control port not used' + end + opts.on('--server_port=P', String) do |p| + server_port = p + end + end.parse! + + thd = Thread.new do + stub = Echo::EchoServer::Stub.new("localhost:#{server_port}", + :this_channel_is_insecure) + stub.echo(Echo::EchoRequest.new(request: 'hello')) + raise 'the clients rpc in this test shouldnt complete. ' \ + 'expecting SIGINT to happen in the middle of the call' + end + thd.join +end + +main diff --git a/src/ruby/end2end/killed_client_thread_driver.rb b/src/ruby/end2end/killed_client_thread_driver.rb new file mode 100755 index 00000000000..71d5db276df --- /dev/null +++ b/src/ruby/end2end/killed_client_thread_driver.rb @@ -0,0 +1,132 @@ +#!/usr/bin/env ruby + +# Copyright 2016, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +require_relative './end2end_common' + +class SleepingEchoServerImpl < Echo::EchoServer::Service + def initialize(call_started, call_started_mu, call_started_cv) + @call_started = call_started + @call_started_mu = call_started_mu + @call_started_cv = call_started_cv + end + def echo(echo_req, _) + @call_started_mu.synchronize do + @call_started.set_true + @call_started_cv.signal + end + sleep 1000 + Echo::EchoReply.new(response: echo_req.request) + end +end + +class SleepingServerRunner + def initialize(service_impl) + @service_impl = service_impl + end + + def run + @srv = GRPC::RpcServer.new + port = @srv.add_http2_port('0.0.0.0:0', :this_port_is_insecure) + @srv.handle(@service_impl) + + @thd = Thread.new do + @srv.run + end + @srv.wait_till_running + port + end + + def stop + @srv.stop + @thd.join + fail 'server not stopped' unless @srv.stopped? + end +end + +class BoolHolder + def init + @val = false + end + def set_true + @val = true + end + def get_val + @val + end +end + + +def main + STDERR.puts 'start server' + + call_started = BoolHolder.new + call_started_mu = Mutex.new + call_started_cv = ConditionVariable.new + + service_impl = SleepingEchoServerImpl.new(call_started, call_started_mu, call_started_cv) + server_runner = SleepingServerRunner.new(service_impl) + server_port = server_runner.run + + STDERR.puts 'start client' + _, client_pid = start_client('killed_client_thread_client.rb', + server_port) + + call_started_mu.synchronize do + while !call_started.get_val do + call_started_cv.wait(call_started_mu) + end + end + + Process.kill('SIGINT', client_pid) + STDERR.puts 'sent shutdown' + + begin + Timeout.timeout(10) do + Process.wait(client_pid) + end + rescue Timeout::Error + STDERR.puts "timeout wait for client pid #{client_pid}" + Process.kill('SIGKILL', client_pid) + Process.wait(client_pid) + STDERR.puts 'killed client child' + raise 'Timed out waiting for client process. It likely hangs when ' \ + 'killed while in the middle of an rpc' + end + + client_exit_code = $CHILD_STATUS + if client_exit_code.termsig != 2 # SIGINT + fail "expected client exit from SIGINT but got child status: #{client_exit_code}" + end + + server_runner.stop +end + +main From 34bb6df108742cf5c17d019ee5d010c7ff12a55b Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Thu, 23 Mar 2017 22:18:02 -0700 Subject: [PATCH 087/461] allocated run batch stack on the heap --- src/ruby/ext/grpc/rb_call.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/ruby/ext/grpc/rb_call.c b/src/ruby/ext/grpc/rb_call.c index 82d340b2544..cf62564667a 100644 --- a/src/ruby/ext/grpc/rb_call.c +++ b/src/ruby/ext/grpc/rb_call.c @@ -784,7 +784,7 @@ static VALUE grpc_run_batch_stack_build_result(run_batch_stack *st) { Only one operation of each type can be active at once in any given batch */ static VALUE grpc_rb_call_run_batch(VALUE self, VALUE ops_hash) { - run_batch_stack st; + run_batch_stack *st; grpc_rb_call *call = NULL; grpc_event ev; grpc_call_error err; @@ -792,6 +792,8 @@ static VALUE grpc_rb_call_run_batch(VALUE self, VALUE ops_hash) { VALUE rb_write_flag = rb_ivar_get(self, id_write_flag); unsigned write_flag = 0; void *tag = (void*)&st; + st = gpr_malloc(sizeof(run_batch_stack)); + if (RTYPEDDATA_DATA(self) == NULL) { rb_raise(grpc_rb_eCallError, "Cannot run batch on closed call"); return Qnil; @@ -806,14 +808,15 @@ static VALUE grpc_rb_call_run_batch(VALUE self, VALUE ops_hash) { if (rb_write_flag != Qnil) { write_flag = NUM2UINT(rb_write_flag); } - grpc_run_batch_stack_init(&st, write_flag); - grpc_run_batch_stack_fill_ops(&st, ops_hash); + grpc_run_batch_stack_init(st, write_flag); + grpc_run_batch_stack_fill_ops(st, ops_hash); /* call grpc_call_start_batch, then wait for it to complete using * pluck_event */ - err = grpc_call_start_batch(call->wrapped, st.ops, st.op_num, tag, NULL); + err = grpc_call_start_batch(call->wrapped, st->ops, st->op_num, tag, NULL); if (err != GRPC_CALL_OK) { - grpc_run_batch_stack_cleanup(&st); + grpc_run_batch_stack_cleanup(st); + gpr_free(st); rb_raise(grpc_rb_eCallError, "grpc_call_start_batch failed with %s (code=%d)", grpc_call_error_detail_of(err), err); @@ -826,8 +829,9 @@ static VALUE grpc_rb_call_run_batch(VALUE self, VALUE ops_hash) { } /* Build and return the BatchResult struct result, if there is an error, it's reflected in the status */ - result = grpc_run_batch_stack_build_result(&st); - grpc_run_batch_stack_cleanup(&st); + result = grpc_run_batch_stack_build_result(st); + grpc_run_batch_stack_cleanup(st); + gpr_free(st); return result; } From 6ac703d1fd943d219ef2b747b8d46466b663b2d9 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Fri, 24 Mar 2017 09:53:01 -0700 Subject: [PATCH 088/461] Fix after merge with master --- test/cpp/microbenchmarks/bm_call_create.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index 3ed4c05e215..bb52a08a54a 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -567,7 +567,7 @@ class IsolatedCallFixture : public TrackCounters { GRPC_CLIENT_CHANNEL); grpc_exec_ctx_finish(&exec_ctx); } - cq_ = grpc_completion_queue_create(NULL); + cq_ = grpc_completion_queue_create_for_next(NULL); } void Finish(benchmark::State &state) { From 077f890965766b13d3a5d19a1589b987e47c0570 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Fri, 24 Mar 2017 09:53:40 -0700 Subject: [PATCH 089/461] conform test to formatter --- src/ruby/end2end/channel_closing_driver.rb | 2 +- src/ruby/end2end/channel_state_driver.rb | 2 +- src/ruby/end2end/end2end_common.rb | 5 +- .../end2end/killed_client_thread_client.rb | 5 +- .../end2end/killed_client_thread_driver.rb | 56 +++++++------------ src/ruby/end2end/sig_handling_driver.rb | 2 +- .../sig_int_during_channel_watch_driver.rb | 2 +- .../helper_scripts/run_ruby_end2end_tests.sh | 1 + 8 files changed, 31 insertions(+), 44 deletions(-) diff --git a/src/ruby/end2end/channel_closing_driver.rb b/src/ruby/end2end/channel_closing_driver.rb index 43e2fe8cbbd..d3e5373b0bb 100755 --- a/src/ruby/end2end/channel_closing_driver.rb +++ b/src/ruby/end2end/channel_closing_driver.rb @@ -36,7 +36,7 @@ require_relative './end2end_common' def main STDERR.puts 'start server' - server_runner = ServerRunner.new + server_runner = ServerRunner.new(EchoServerImpl) server_port = server_runner.run sleep 1 diff --git a/src/ruby/end2end/channel_state_driver.rb b/src/ruby/end2end/channel_state_driver.rb index c3184bf9392..80fb62899e5 100755 --- a/src/ruby/end2end/channel_state_driver.rb +++ b/src/ruby/end2end/channel_state_driver.rb @@ -35,7 +35,7 @@ require_relative './end2end_common' def main STDERR.puts 'start server' - server_runner = ServerRunner.new + server_runner = ServerRunner.new(EchoServerImpl) server_port = server_runner.run sleep 1 diff --git a/src/ruby/end2end/end2end_common.rb b/src/ruby/end2end/end2end_common.rb index 9534bb20787..1c87ceddf1d 100755 --- a/src/ruby/end2end/end2end_common.rb +++ b/src/ruby/end2end/end2end_common.rb @@ -55,13 +55,14 @@ end # ServerRunner starts an "echo server" that test clients can make calls to class ServerRunner - def initialize + def initialize(service_impl) + @service_impl = service_impl end def run @srv = GRPC::RpcServer.new port = @srv.add_http2_port('0.0.0.0:0', :this_port_is_insecure) - @srv.handle(EchoServerImpl) + @srv.handle(@service_impl) @thd = Thread.new do @srv.run diff --git a/src/ruby/end2end/killed_client_thread_client.rb b/src/ruby/end2end/killed_client_thread_client.rb index 9a69161736e..d5a7db7d586 100755 --- a/src/ruby/end2end/killed_client_thread_client.rb +++ b/src/ruby/end2end/killed_client_thread_client.rb @@ -29,6 +29,9 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# Attempt to reproduce +# https://github.com/GoogleCloudPlatform/google-cloud-ruby/issues/1327 + require_relative './end2end_common' def main @@ -46,7 +49,7 @@ def main stub = Echo::EchoServer::Stub.new("localhost:#{server_port}", :this_channel_is_insecure) stub.echo(Echo::EchoRequest.new(request: 'hello')) - raise 'the clients rpc in this test shouldnt complete. ' \ + fail 'the clients rpc in this test shouldnt complete. ' \ 'expecting SIGINT to happen in the middle of the call' end thd.join diff --git a/src/ruby/end2end/killed_client_thread_driver.rb b/src/ruby/end2end/killed_client_thread_driver.rb index 71d5db276df..2963a287c59 100755 --- a/src/ruby/end2end/killed_client_thread_driver.rb +++ b/src/ruby/end2end/killed_client_thread_driver.rb @@ -31,12 +31,15 @@ require_relative './end2end_common' +# Service that sleeps for a long time upon receiving an 'echo request' +# Also, this notified @call_started_cv once it has received a request. class SleepingEchoServerImpl < Echo::EchoServer::Service def initialize(call_started, call_started_mu, call_started_cv) @call_started = call_started @call_started_mu = call_started_mu @call_started_cv = call_started_cv end + def echo(echo_req, _) @call_started_mu.synchronize do @call_started.set_true @@ -47,43 +50,19 @@ class SleepingEchoServerImpl < Echo::EchoServer::Service end end -class SleepingServerRunner - def initialize(service_impl) - @service_impl = service_impl - end - - def run - @srv = GRPC::RpcServer.new - port = @srv.add_http2_port('0.0.0.0:0', :this_port_is_insecure) - @srv.handle(@service_impl) - - @thd = Thread.new do - @srv.run - end - @srv.wait_till_running - port - end - - def stop - @srv.stop - @thd.join - fail 'server not stopped' unless @srv.stopped? - end -end - +# Mutable boolean class BoolHolder + attr_reader :val + def init @val = false end + def set_true @val = true end - def get_val - @val - end end - def main STDERR.puts 'start server' @@ -91,20 +70,22 @@ def main call_started_mu = Mutex.new call_started_cv = ConditionVariable.new - service_impl = SleepingEchoServerImpl.new(call_started, call_started_mu, call_started_cv) - server_runner = SleepingServerRunner.new(service_impl) + service_impl = SleepingEchoServerImpl.new(call_started, + call_started_mu, + call_started_cv) + server_runner = ServerRunner.new(service_impl) server_port = server_runner.run STDERR.puts 'start client' _, client_pid = start_client('killed_client_thread_client.rb', - server_port) + server_port) call_started_mu.synchronize do - while !call_started.get_val do - call_started_cv.wait(call_started_mu) - end + call_started_cv.wait(call_started_mu) until call_started.val end + # SIGINT the child process not that it's + # in the middle of an RPC (happening on a non-main thread) Process.kill('SIGINT', client_pid) STDERR.puts 'sent shutdown' @@ -117,13 +98,14 @@ def main Process.kill('SIGKILL', client_pid) Process.wait(client_pid) STDERR.puts 'killed client child' - raise 'Timed out waiting for client process. It likely hangs when ' \ - 'killed while in the middle of an rpc' + raise 'Timed out waiting for client process. ' \ + 'It likely hangs when killed while in the middle of an rpc' end client_exit_code = $CHILD_STATUS if client_exit_code.termsig != 2 # SIGINT - fail "expected client exit from SIGINT but got child status: #{client_exit_code}" + fail 'expected client exit from SIGINT ' \ + "but got child status: #{client_exit_code}" end server_runner.stop diff --git a/src/ruby/end2end/sig_handling_driver.rb b/src/ruby/end2end/sig_handling_driver.rb index c5d46e074cb..6691464dc69 100755 --- a/src/ruby/end2end/sig_handling_driver.rb +++ b/src/ruby/end2end/sig_handling_driver.rb @@ -36,7 +36,7 @@ require_relative './end2end_common' def main STDERR.puts 'start server' - server_runner = ServerRunner.new + server_runner = ServerRunner.new(EchoServerImpl) server_port = server_runner.run sleep 1 diff --git a/src/ruby/end2end/sig_int_during_channel_watch_driver.rb b/src/ruby/end2end/sig_int_during_channel_watch_driver.rb index 84d039bf19d..670cda0919f 100755 --- a/src/ruby/end2end/sig_int_during_channel_watch_driver.rb +++ b/src/ruby/end2end/sig_int_during_channel_watch_driver.rb @@ -36,7 +36,7 @@ require_relative './end2end_common' def main STDERR.puts 'start server' - server_runner = ServerRunner.new + server_runner = ServerRunner.new(EchoServerImpl) server_port = server_runner.run sleep 1 diff --git a/tools/run_tests/helper_scripts/run_ruby_end2end_tests.sh b/tools/run_tests/helper_scripts/run_ruby_end2end_tests.sh index d7da6364d8f..92d69757073 100755 --- a/tools/run_tests/helper_scripts/run_ruby_end2end_tests.sh +++ b/tools/run_tests/helper_scripts/run_ruby_end2end_tests.sh @@ -38,4 +38,5 @@ ruby src/ruby/end2end/sig_handling_driver.rb || EXIT_CODE=1 ruby src/ruby/end2end/channel_state_driver.rb || EXIT_CODE=1 ruby src/ruby/end2end/channel_closing_driver.rb || EXIT_CODE=1 ruby src/ruby/end2end/sig_int_during_channel_watch_driver.rb || EXIT_CODE=1 +ruby src/ruby/end2end/killed_client_thread_driver.rb || EXIT_CODE=1 exit $EXIT_CODE From a69599141c5ebdfbccd544ff8dcd75149c96ba16 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Fri, 24 Mar 2017 09:56:50 -0700 Subject: [PATCH 090/461] Remove a file that wasn't properly deleted after the merge --- .../set_initial_connect_string_test.c | 268 ------------------ 1 file changed, 268 deletions(-) delete mode 100644 test/core/client_channel/set_initial_connect_string_test.c diff --git a/test/core/client_channel/set_initial_connect_string_test.c b/test/core/client_channel/set_initial_connect_string_test.c deleted file mode 100644 index 7f38418ea7a..00000000000 --- a/test/core/client_channel/set_initial_connect_string_test.c +++ /dev/null @@ -1,268 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/* With the addition of a libuv endpoint, sockaddr.h now includes uv.h when - using that endpoint. Because of various transitive includes in uv.h, - including windows.h on Windows, uv.h must be included before other system - headers. Therefore, sockaddr.h must always be included first */ -#include "src/core/lib/iomgr/sockaddr.h" - -#include - -#include -#include -#include -#include -#include -#include - -#include "src/core/ext/client_channel/initial_connect_string.h" -#include "src/core/lib/iomgr/sockaddr.h" -#include "src/core/lib/security/credentials/fake/fake_credentials.h" -#include "src/core/lib/slice/slice_string_helpers.h" -#include "src/core/lib/support/string.h" -#include "test/core/util/port.h" -#include "test/core/util/test_config.h" -#include "test/core/util/test_tcp_server.h" - -struct rpc_state { - char *target; - grpc_channel_credentials *creds; - grpc_completion_queue *cq; - grpc_channel *channel; - grpc_call *call; - grpc_op op; - grpc_slice_buffer incoming_buffer; - grpc_slice_buffer temp_incoming_buffer; - grpc_endpoint *tcp; - gpr_atm done_atm; -}; - -static const char *magic_connect_string = "magic initial string"; -static int server_port; -static struct rpc_state state; -static grpc_closure on_read; - -static void handle_read(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - GPR_ASSERT(error == GRPC_ERROR_NONE); - grpc_slice_buffer_move_into(&state.temp_incoming_buffer, - &state.incoming_buffer); - gpr_log(GPR_DEBUG, "got %" PRIuPTR " bytes, magic is %" PRIuPTR " bytes", - state.incoming_buffer.length, strlen(magic_connect_string)); - if (state.incoming_buffer.length > strlen(magic_connect_string)) { - gpr_atm_rel_store(&state.done_atm, 1); - grpc_endpoint_shutdown( - exec_ctx, state.tcp, - GRPC_ERROR_CREATE("Incoming buffer longer than magic_connect_string")); - grpc_endpoint_destroy(exec_ctx, state.tcp); - } else { - grpc_endpoint_read(exec_ctx, state.tcp, &state.temp_incoming_buffer, - &on_read); - } -} - -static void on_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *tcp, - grpc_pollset *accepting_pollset, - grpc_tcp_server_acceptor *acceptor) { - gpr_free(acceptor); - test_tcp_server *server = arg; - grpc_closure_init(&on_read, handle_read, NULL, grpc_schedule_on_exec_ctx); - grpc_slice_buffer_init(&state.incoming_buffer); - grpc_slice_buffer_init(&state.temp_incoming_buffer); - state.tcp = tcp; - grpc_endpoint_add_to_pollset(exec_ctx, tcp, server->pollset); - grpc_endpoint_read(exec_ctx, tcp, &state.temp_incoming_buffer, &on_read); -} - -static void set_magic_initial_string(grpc_resolved_address **addr, - grpc_slice *connect_string) { - GPR_ASSERT(addr); - GPR_ASSERT((*addr)->len); - *connect_string = grpc_slice_from_copied_string(magic_connect_string); -} - -static void reset_addr_and_set_magic_string(grpc_resolved_address **addr, - grpc_slice *connect_string) { - struct sockaddr_in target; - *connect_string = grpc_slice_from_copied_string(magic_connect_string); - gpr_free(*addr); - target.sin_family = AF_INET; - target.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - target.sin_port = htons((uint16_t)server_port); - *addr = (grpc_resolved_address *)gpr_malloc(sizeof(grpc_resolved_address)); - (*addr)->len = sizeof(target); - memcpy((*addr)->addr, &target, sizeof(target)); -} - -static gpr_timespec n_sec_deadline(int seconds) { - return gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_seconds(seconds, GPR_TIMESPAN)); -} - -static void start_rpc(int use_creds, int target_port) { - state.cq = grpc_completion_queue_create_for_next(NULL); - if (use_creds) { - state.creds = grpc_fake_transport_security_credentials_create(); - } else { - state.creds = NULL; - } - gpr_join_host_port(&state.target, "127.0.0.1", target_port); - if (use_creds) { - state.channel = - grpc_secure_channel_create(state.creds, state.target, NULL, NULL); - } else { - state.channel = grpc_insecure_channel_create(state.target, NULL, NULL); - } - grpc_slice host = grpc_slice_from_static_string("localhost"); - state.call = grpc_channel_create_call( - state.channel, NULL, GRPC_PROPAGATE_DEFAULTS, state.cq, - grpc_slice_from_static_string("/Service/Method"), &host, - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); - memset(&state.op, 0, sizeof(state.op)); - state.op.op = GRPC_OP_SEND_INITIAL_METADATA; - state.op.data.send_initial_metadata.count = 0; - state.op.flags = 0; - state.op.reserved = NULL; - GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(state.call, &state.op, - (size_t)(1), NULL, NULL)); - grpc_completion_queue_next(state.cq, n_sec_deadline(5), NULL); -} - -static void cleanup_rpc(void) { - grpc_event ev; - grpc_slice_buffer_destroy(&state.incoming_buffer); - grpc_slice_buffer_destroy(&state.temp_incoming_buffer); - grpc_channel_credentials_release(state.creds); - grpc_call_destroy(state.call); - grpc_completion_queue_shutdown(state.cq); - do { - ev = grpc_completion_queue_next(state.cq, n_sec_deadline(1), NULL); - } while (ev.type != GRPC_QUEUE_SHUTDOWN); - grpc_completion_queue_destroy(state.cq); - grpc_channel_destroy(state.channel); - gpr_free(state.target); -} - -typedef struct { - test_tcp_server *server; - gpr_event *signal_when_done; -} poll_args; - -static void actually_poll_server(void *arg) { - poll_args *pa = arg; - gpr_timespec deadline = n_sec_deadline(10); - while (true) { - bool done = gpr_atm_acq_load(&state.done_atm) != 0; - gpr_timespec time_left = - gpr_time_sub(deadline, gpr_now(GPR_CLOCK_REALTIME)); - gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRId64 ".%09" PRId32, done, - time_left.tv_sec, time_left.tv_nsec); - if (done || gpr_time_cmp(time_left, gpr_time_0(GPR_TIMESPAN)) < 0) { - break; - } - test_tcp_server_poll(pa->server, 1); - } - gpr_event_set(pa->signal_when_done, (void *)1); - gpr_free(pa); -} - -static void poll_server_until_read_done(test_tcp_server *server, - gpr_event *signal_when_done) { - gpr_atm_rel_store(&state.done_atm, 0); - gpr_thd_id id; - poll_args *pa = gpr_malloc(sizeof(*pa)); - pa->server = server; - pa->signal_when_done = signal_when_done; - gpr_thd_new(&id, actually_poll_server, pa, NULL); -} - -static void match_initial_magic_string(grpc_slice_buffer *buffer) { - size_t i, j, cmp_length; - size_t magic_length = strlen(magic_connect_string); - GPR_ASSERT(buffer->length >= magic_length); - for (i = 0, j = 0; i < state.incoming_buffer.count && j < magic_length; i++) { - char *dump = grpc_slice_to_c_string(state.incoming_buffer.slices[i]); - cmp_length = GPR_MIN(strlen(dump), magic_length - j); - GPR_ASSERT(strncmp(dump, magic_connect_string + j, cmp_length) == 0); - j += cmp_length; - gpr_free(dump); - } -} - -static void test_initial_string(test_tcp_server *server, int secure) { - gpr_event ev; - gpr_event_init(&ev); - grpc_test_set_initial_connect_string_function(set_magic_initial_string); - poll_server_until_read_done(server, &ev); - start_rpc(secure, server_port); - gpr_event_wait(&ev, gpr_inf_future(GPR_CLOCK_REALTIME)); - match_initial_magic_string(&state.incoming_buffer); - cleanup_rpc(); -} - -static void test_initial_string_with_redirect(test_tcp_server *server, - int secure) { - gpr_event ev; - gpr_event_init(&ev); - int another_port = grpc_pick_unused_port_or_die(); - grpc_test_set_initial_connect_string_function( - reset_addr_and_set_magic_string); - poll_server_until_read_done(server, &ev); - start_rpc(secure, another_port); - gpr_event_wait(&ev, gpr_inf_future(GPR_CLOCK_REALTIME)); - match_initial_magic_string(&state.incoming_buffer); - cleanup_rpc(); -} - -static void run_test(void (*test)(test_tcp_server *server, int secure), - int secure) { - test_tcp_server test_server; - server_port = grpc_pick_unused_port_or_die(); - test_tcp_server_init(&test_server, on_connect, &test_server); - test_tcp_server_start(&test_server, server_port); - test(&test_server, secure); - test_tcp_server_destroy(&test_server); -} - -int main(int argc, char **argv) { - grpc_test_init(argc, argv); - grpc_init(); - - run_test(test_initial_string, 0); - run_test(test_initial_string, 1); - run_test(test_initial_string_with_redirect, 0); - run_test(test_initial_string_with_redirect, 1); - - grpc_shutdown(); - return 0; -} From 5bec133ba03f8cdffc7e2ace03a06aa5b48aed5c Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Fri, 24 Mar 2017 10:03:22 -0700 Subject: [PATCH 091/461] clang format --- .../grpc++/impl/codegen/client_unary_call.h | 2 +- .../grpc++/impl/codegen/completion_queue.h | 5 ++-- include/grpc++/impl/codegen/sync_stream.h | 6 ++--- src/core/lib/surface/completion_queue.c | 10 +++----- test/core/bad_ssl/server_common.c | 5 ++-- test/core/client_channel/lb_policies_test.c | 6 ++--- test/core/end2end/fixtures/h2_census.c | 7 +++--- test/core/end2end/fixtures/h2_compress.c | 7 +++--- test/core/end2end/fixtures/h2_full+pipe.c | 7 +++--- test/core/end2end/fixtures/h2_full+trace.c | 7 +++--- test/core/end2end/fixtures/h2_full.c | 7 +++--- test/core/end2end/fixtures/h2_http_proxy.c | 7 +++--- test/core/end2end/fixtures/h2_proxy.c | 9 +++---- test/core/end2end/fixtures/h2_ssl_cert.c | 20 +++++++-------- test/core/end2end/fixtures/h2_uds.c | 7 +++--- test/core/end2end/fuzzers/api_fuzzer.c | 25 ++++++++----------- test/core/fling/server.c | 5 ++-- test/core/memory_usage/client.c | 5 ++-- test/core/memory_usage/server.c | 5 ++-- test/cpp/grpclb/grpclb_test.cc | 5 ++-- 20 files changed, 67 insertions(+), 90 deletions(-) diff --git a/include/grpc++/impl/codegen/client_unary_call.h b/include/grpc++/impl/codegen/client_unary_call.h index 6218e3ed1b1..a5a4f3d7398 100644 --- a/include/grpc++/impl/codegen/client_unary_call.h +++ b/include/grpc++/impl/codegen/client_unary_call.h @@ -52,7 +52,7 @@ template Status BlockingUnaryCall(ChannelInterface* channel, const RpcMethod& method, ClientContext* context, const InputMessage& request, OutputMessage* result) { - CompletionQueue cq(true); // Pluckable completion queue + CompletionQueue cq(true); // Pluckable completion queue Call call(channel->CreateCall(method, context, &cq)); CallOpSet, diff --git a/include/grpc++/impl/codegen/completion_queue.h b/include/grpc++/impl/codegen/completion_queue.h index 0130e9ca0f1..025eea3ef5b 100644 --- a/include/grpc++/impl/codegen/completion_queue.h +++ b/include/grpc++/impl/codegen/completion_queue.h @@ -147,9 +147,8 @@ class CompletionQueue : private GrpcLibraryCodegen { /// /// \return true if read a regular event, false if the queue is shutting down. bool Next(void** tag, bool* ok) { - return (AsyncNextInternal(tag, ok, - g_core_codegen_interface->gpr_inf_future( - GPR_CLOCK_REALTIME)) != SHUTDOWN); + return (AsyncNextInternal(tag, ok, g_core_codegen_interface->gpr_inf_future( + GPR_CLOCK_REALTIME)) != SHUTDOWN); } /// Request the shutdown of the queue. diff --git a/include/grpc++/impl/codegen/sync_stream.h b/include/grpc++/impl/codegen/sync_stream.h index 4e12f3261e5..1ed290966cd 100644 --- a/include/grpc++/impl/codegen/sync_stream.h +++ b/include/grpc++/impl/codegen/sync_stream.h @@ -138,7 +138,7 @@ class ClientReader final : public ClientReaderInterface { ClientReader(ChannelInterface* channel, const RpcMethod& method, ClientContext* context, const W& request) : context_(context), - cq_(true), // Pluckable cq + cq_(true), // Pluckable cq call_(channel->CreateCall(method, context, &cq_)) { CallOpSet @@ -212,7 +212,7 @@ class ClientWriter : public ClientWriterInterface { ClientWriter(ChannelInterface* channel, const RpcMethod& method, ClientContext* context, R* response) : context_(context), - cq_(true), // Pluckable cq + cq_(true), // Pluckable cq call_(channel->CreateCall(method, context, &cq_)) { finish_ops_.RecvMessage(response); finish_ops_.AllowNoMessage(); @@ -297,7 +297,7 @@ class ClientReaderWriter final : public ClientReaderWriterInterface { ClientReaderWriter(ChannelInterface* channel, const RpcMethod& method, ClientContext* context) : context_(context), - cq_(true), // Pluckable cq + cq_(true), // Pluckable cq call_(channel->CreateCall(method, context, &cq_)) { CallOpSet ops; ops.SendInitialMetadata(context->send_initial_metadata_, diff --git a/src/core/lib/surface/completion_queue.c b/src/core/lib/surface/completion_queue.c index 1e88e834497..aecc393edfc 100644 --- a/src/core/lib/surface/completion_queue.c +++ b/src/core/lib/surface/completion_queue.c @@ -383,9 +383,8 @@ grpc_event grpc_completion_queue_next(grpc_completion_queue *cc, "deadline=gpr_timespec { tv_sec: %" PRId64 ", tv_nsec: %d, clock_type: %d }, " "reserved=%p)", - 5, - (cc, deadline.tv_sec, deadline.tv_nsec, (int)deadline.clock_type, - reserved)); + 5, (cc, deadline.tv_sec, deadline.tv_nsec, (int)deadline.clock_type, + reserved)); GPR_ASSERT(!reserved); dump_pending_tags(cc); @@ -559,9 +558,8 @@ grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cc, void *tag, "deadline=gpr_timespec { tv_sec: %" PRId64 ", tv_nsec: %d, clock_type: %d }, " "reserved=%p)", - 6, - (cc, tag, deadline.tv_sec, deadline.tv_nsec, (int)deadline.clock_type, - reserved)); + 6, (cc, tag, deadline.tv_sec, deadline.tv_nsec, + (int)deadline.clock_type, reserved)); } GPR_ASSERT(!reserved); diff --git a/test/core/bad_ssl/server_common.c b/test/core/bad_ssl/server_common.c index 67404711cd0..0ec14676c66 100644 --- a/test/core/bad_ssl/server_common.c +++ b/test/core/bad_ssl/server_common.c @@ -95,9 +95,8 @@ void bad_ssl_run(grpc_server *server) { shutdown_started = 1; } ev = grpc_completion_queue_next( - cq, - gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(1000000, GPR_TIMESPAN)), + cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(1000000, GPR_TIMESPAN)), NULL); switch (ev.type) { case GRPC_OP_COMPLETE: diff --git a/test/core/client_channel/lb_policies_test.c b/test/core/client_channel/lb_policies_test.c index 433f77db82c..50ec08b1db7 100644 --- a/test/core/client_channel/lb_policies_test.c +++ b/test/core/client_channel/lb_policies_test.c @@ -65,9 +65,9 @@ typedef struct servers_fixture { } servers_fixture; typedef struct request_sequences { - size_t n; /* number of iterations */ - int *connections; /* indexed by the interation number, value is the index of - the server it connected to or -1 if none */ + size_t n; /* number of iterations */ + int *connections; /* indexed by the interation number, value is the index of + the server it connected to or -1 if none */ int *connectivity_states; /* indexed by the interation number, value is the client connectivity state */ } request_sequences; diff --git a/test/core/end2end/fixtures/h2_census.c b/test/core/end2end/fixtures/h2_census.c index 1a754835f0e..7fc965a7188 100644 --- a/test/core/end2end/fixtures/h2_census.c +++ b/test/core/end2end/fixtures/h2_census.c @@ -120,10 +120,9 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack+census", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack+census", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_compress.c b/test/core/end2end/fixtures/h2_compress.c index b73d6d787a3..8636324ca18 100644 --- a/test/core/end2end/fixtures/h2_compress.c +++ b/test/core/end2end/fixtures/h2_compress.c @@ -120,10 +120,9 @@ void chttp2_tear_down_fullstack_compression(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack_compression", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack_compression", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack_compression, chttp2_init_client_fullstack_compression, chttp2_init_server_fullstack_compression, diff --git a/test/core/end2end/fixtures/h2_full+pipe.c b/test/core/end2end/fixtures/h2_full+pipe.c index 927ca8ae01c..bc99d265504 100644 --- a/test/core/end2end/fixtures/h2_full+pipe.c +++ b/test/core/end2end/fixtures/h2_full+pipe.c @@ -103,10 +103,9 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_full+trace.c b/test/core/end2end/fixtures/h2_full+trace.c index bb24f966c1b..f849496d214 100644 --- a/test/core/end2end/fixtures/h2_full+trace.c +++ b/test/core/end2end/fixtures/h2_full+trace.c @@ -103,10 +103,9 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_full.c b/test/core/end2end/fixtures/h2_full.c index d8d4d95177d..92bd28eea73 100644 --- a/test/core/end2end/fixtures/h2_full.c +++ b/test/core/end2end/fixtures/h2_full.c @@ -97,10 +97,9 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_http_proxy.c b/test/core/end2end/fixtures/h2_http_proxy.c index 451c55677fb..ebab96943de 100644 --- a/test/core/end2end/fixtures/h2_http_proxy.c +++ b/test/core/end2end/fixtures/h2_http_proxy.c @@ -108,10 +108,9 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_proxy.c b/test/core/end2end/fixtures/h2_proxy.c index af7d2776890..9078001e3b1 100644 --- a/test/core/end2end/fixtures/h2_proxy.c +++ b/test/core/end2end/fixtures/h2_proxy.c @@ -114,11 +114,10 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack+proxy", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_REQUEST_PROXYING | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack+proxy", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_REQUEST_PROXYING | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fixtures/h2_ssl_cert.c b/test/core/end2end/fixtures/h2_ssl_cert.c index 59a728307b1..7aa0e16bf6c 100644 --- a/test/core/end2end/fixtures/h2_ssl_cert.c +++ b/test/core/end2end/fixtures/h2_ssl_cert.c @@ -204,17 +204,15 @@ CLIENT_INIT(BAD_CERT_PAIR) typedef enum { SUCCESS, FAIL } test_result; -#define SSL_TEST(request_type, cert_type, result) \ - { \ - {TEST_NAME(request_type, cert_type, result), \ - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | \ - FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | \ - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL, \ - chttp2_create_fixture_secure_fullstack, \ - CLIENT_INIT_NAME(cert_type), \ - SERVER_INIT_NAME(request_type), \ - chttp2_tear_down_secure_fullstack}, \ - result \ +#define SSL_TEST(request_type, cert_type, result) \ + { \ + {TEST_NAME(request_type, cert_type, result), \ + FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | \ + FEATURE_MASK_SUPPORTS_PER_CALL_CREDENTIALS | \ + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL, \ + chttp2_create_fixture_secure_fullstack, CLIENT_INIT_NAME(cert_type), \ + SERVER_INIT_NAME(request_type), chttp2_tear_down_secure_fullstack}, \ + result \ } /* All test configurations */ diff --git a/test/core/end2end/fixtures/h2_uds.c b/test/core/end2end/fixtures/h2_uds.c index 89b4b5e64b2..60c5c497c73 100644 --- a/test/core/end2end/fixtures/h2_uds.c +++ b/test/core/end2end/fixtures/h2_uds.c @@ -102,10 +102,9 @@ void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { /* All test configurations */ static grpc_end2end_test_config configs[] = { - {"chttp2/fullstack_uds", - FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | - FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | - FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, + {"chttp2/fullstack_uds", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION | + FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL | + FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER, chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, }; diff --git a/test/core/end2end/fuzzers/api_fuzzer.c b/test/core/end2end/fuzzers/api_fuzzer.c index c8384346f0f..2eff2f103e7 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.c +++ b/test/core/end2end/fuzzers/api_fuzzer.c @@ -314,9 +314,8 @@ static grpc_call_credentials *read_call_creds(input_stream *inp) { cred_artifact_ctx ctx = CRED_ARTIFACT_CTX_INIT; const char *access_token = read_cred_artifact(&ctx, inp, NULL, 0); grpc_call_credentials *out = - access_token == NULL - ? NULL - : grpc_access_token_credentials_create(access_token, NULL); + access_token == NULL ? NULL : grpc_access_token_credentials_create( + access_token, NULL); cred_artifact_ctx_finish(&ctx); return out; } @@ -410,9 +409,8 @@ void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr, r->on_done = on_done; r->addrs = addresses; grpc_timer_init( - exec_ctx, &r->timer, - gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), - gpr_time_from_seconds(1, GPR_TIMESPAN)), + exec_ctx, &r->timer, gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), + gpr_time_from_seconds(1, GPR_TIMESPAN)), grpc_closure_create(finish_resolve, r, grpc_schedule_on_exec_ctx), gpr_now(GPR_CLOCK_MONOTONIC)); } @@ -473,9 +471,8 @@ static void sched_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure, fc->ep = ep; fc->deadline = deadline; grpc_timer_init( - exec_ctx, &fc->timer, - gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), - gpr_time_from_millis(1, GPR_TIMESPAN)), + exec_ctx, &fc->timer, gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), + gpr_time_from_millis(1, GPR_TIMESPAN)), grpc_closure_create(do_connect, fc, grpc_schedule_on_exec_ctx), gpr_now(GPR_CLOCK_MONOTONIC)); } @@ -751,9 +748,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { if (g_server != NULL) { if (!server_shutdown) { grpc_server_shutdown_and_notify( - g_server, cq, - create_validator(assert_success_and_decrement, - &pending_server_shutdowns)); + g_server, cq, create_validator(assert_success_and_decrement, + &pending_server_shutdowns)); server_shutdown = true; pending_server_shutdowns++; } else if (pending_server_shutdowns == 0) { @@ -858,9 +854,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { case 5: { if (g_server != NULL) { grpc_server_shutdown_and_notify( - g_server, cq, - create_validator(assert_success_and_decrement, - &pending_server_shutdowns)); + g_server, cq, create_validator(assert_success_and_decrement, + &pending_server_shutdowns)); pending_server_shutdowns++; server_shutdown = true; } else { diff --git a/test/core/fling/server.c b/test/core/fling/server.c index ebcb8f05f09..7edff3d1329 100644 --- a/test/core/fling/server.c +++ b/test/core/fling/server.c @@ -257,9 +257,8 @@ int main(int argc, char **argv) { shutdown_started = 1; } ev = grpc_completion_queue_next( - cq, - gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(1000000, GPR_TIMESPAN)), + cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(1000000, GPR_TIMESPAN)), NULL); s = ev.tag; switch (ev.type) { diff --git a/test/core/memory_usage/client.c b/test/core/memory_usage/client.c index 4fb99217b69..d0ec060aca5 100644 --- a/test/core/memory_usage/client.c +++ b/test/core/memory_usage/client.c @@ -261,9 +261,8 @@ int main(int argc, char **argv) { do { event = grpc_completion_queue_next( - cq, - gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(10000, GPR_TIMESPAN)), + cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(10000, GPR_TIMESPAN)), NULL); } while (event.type != GRPC_QUEUE_TIMEOUT); diff --git a/test/core/memory_usage/server.c b/test/core/memory_usage/server.c index 94d90a58a6a..44c5488014e 100644 --- a/test/core/memory_usage/server.c +++ b/test/core/memory_usage/server.c @@ -243,9 +243,8 @@ int main(int argc, char **argv) { shutdown_started = 1; } ev = grpc_completion_queue_next( - cq, - gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_micros(1000000, GPR_TIMESPAN)), + cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), + gpr_time_from_micros(1000000, GPR_TIMESPAN)), NULL); fling_call *s = ev.tag; switch (ev.type) { diff --git a/test/cpp/grpclb/grpclb_test.cc b/test/cpp/grpclb/grpclb_test.cc index b85ad949a52..e0ae86955e2 100644 --- a/test/cpp/grpclb/grpclb_test.cc +++ b/test/cpp/grpclb/grpclb_test.cc @@ -354,9 +354,8 @@ static void start_backend_server(server_fixture *sf) { } GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); const string expected_token = - strlen(sf->lb_token_prefix) == 0 - ? "" - : sf->lb_token_prefix + std::to_string(sf->port); + strlen(sf->lb_token_prefix) == 0 ? "" : sf->lb_token_prefix + + std::to_string(sf->port); GPR_ASSERT(contains_metadata(&request_metadata_recv, "lb-token", expected_token.c_str())); From d166e38e938db324e10a8d009e9c819a99ba11e6 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 24 Mar 2017 10:03:10 -0700 Subject: [PATCH 092/461] Fix soname version mismatch in Makefile --- Makefile | 14 +++++++------- templates/Makefile.template | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 4a32fed2c96..23886d1dc62 100644 --- a/Makefile +++ b/Makefile @@ -465,7 +465,7 @@ SHARED_VERSION_CORE = -3 SHARED_VERSION_CPP = -1 SHARED_VERSION_CSHARP = -1 else ifeq ($(SYSTEM),Darwin) -EXECUTABLE_SUFFIX = +EXECUTABLE_SUFFIX = SHARED_EXT_CORE = dylib SHARED_EXT_CPP = dylib SHARED_EXT_CSHARP = dylib @@ -474,7 +474,7 @@ SHARED_VERSION_CORE = SHARED_VERSION_CPP = SHARED_VERSION_CSHARP = else -EXECUTABLE_SUFFIX = +EXECUTABLE_SUFFIX = SHARED_EXT_CORE = so.$(CORE_VERSION) SHARED_EXT_CPP = so.$(CPP_VERSION) SHARED_EXT_CSHARP = so.$(CSHARP_VERSION) @@ -4100,7 +4100,7 @@ $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC+ ifeq ($(SYSTEM),Darwin) $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_OBJS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgrpc else - $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++.so.3 -o $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_OBJS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgrpc + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++.so.1 -o $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_OBJS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgrpc $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).so.1 $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).so endif @@ -4491,7 +4491,7 @@ $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(L ifeq ($(SYSTEM),Darwin) $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_CRONET_OBJS) $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgpr -lgrpc_cronet else - $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_cronet.so.3 -o $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_CRONET_OBJS) $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgpr -lgrpc_cronet + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_cronet.so.1 -o $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_CRONET_OBJS) $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgpr -lgrpc_cronet $(Q) ln -sf $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).so.1 $(Q) ln -sf $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).so endif @@ -4614,7 +4614,7 @@ $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): ifeq ($(SYSTEM),Darwin) $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_REFLECTION_OBJS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgrpc++ else - $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_reflection.so.3 -o $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_REFLECTION_OBJS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgrpc++ + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_reflection.so.1 -o $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_REFLECTION_OBJS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgrpc++ $(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP).so.1 $(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP).so endif @@ -4970,7 +4970,7 @@ $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $ ifeq ($(SYSTEM),Darwin) $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_UNSECURE_OBJS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgpr -lgrpc_unsecure else - $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_unsecure.so.3 -o $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_UNSECURE_OBJS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgpr -lgrpc_unsecure + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_unsecure.so.1 -o $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_UNSECURE_OBJS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgpr -lgrpc_unsecure $(Q) ln -sf $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP).so.1 $(Q) ln -sf $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP).so endif @@ -5560,7 +5560,7 @@ $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHA ifeq ($(SYSTEM),Darwin) $(Q) $(LD) $(LDFLAGS) $(if $(subst Linux,,$(SYSTEM)),,-Wl$(comma)-wrap$(comma)memcpy) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBGRPC_CSHARP_EXT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(LDLIBS) else - $(Q) $(LD) $(LDFLAGS) $(if $(subst Linux,,$(SYSTEM)),,-Wl$(comma)-wrap$(comma)memcpy) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_csharp_ext.so.3 -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBGRPC_CSHARP_EXT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(LDLIBS) + $(Q) $(LD) $(LDFLAGS) $(if $(subst Linux,,$(SYSTEM)),,-Wl$(comma)-wrap$(comma)memcpy) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_csharp_ext.so.1 -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBGRPC_CSHARP_EXT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(LDLIBS) $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).so.1 $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).so endif diff --git a/templates/Makefile.template b/templates/Makefile.template index f81d6439913..9fc1fe898b2 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -405,7 +405,7 @@ SHARED_VERSION_CPP = -${settings.cpp_version.major} SHARED_VERSION_CSHARP = -${settings.csharp_version.major} else ifeq ($(SYSTEM),Darwin) - EXECUTABLE_SUFFIX = + EXECUTABLE_SUFFIX = SHARED_EXT_CORE = dylib SHARED_EXT_CPP = dylib SHARED_EXT_CSHARP = dylib @@ -414,7 +414,7 @@ SHARED_VERSION_CPP = SHARED_VERSION_CSHARP = else - EXECUTABLE_SUFFIX = + EXECUTABLE_SUFFIX = SHARED_EXT_CORE = so.$(CORE_VERSION) SHARED_EXT_CPP = so.$(CPP_VERSION) SHARED_EXT_CSHARP = so.$(CSHARP_VERSION) @@ -1559,7 +1559,7 @@ ifeq ($(SYSTEM),Darwin) $(Q) ${ld} ${ldflags} -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) -dynamiclib -o ${out_libbase}.$(SHARED_EXT_${lang_to_var[lib.language]}) ${common}${link_libs} else - $(Q) ${ld} ${ldflags} -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,lib${lib.name}.so.${settings.core_version.major} -o ${out_libbase}.$(SHARED_EXT_${lang_to_var[lib.language]}) ${common}${link_libs} + $(Q) ${ld} ${ldflags} -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,lib${lib.name}.so.${settings.get(lang_to_var[lib.language].lower() + '_version').major} -o ${out_libbase}.$(SHARED_EXT_${lang_to_var[lib.language]}) ${common}${link_libs} $(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) ${out_libbase}.so.${settings.get(lang_to_var[lib.language].lower() + '_version').major} $(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) ${out_libbase}.so endif From ed3e300d8a42fd3b586761563d6ff1ca4bbc486f Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 24 Mar 2017 10:24:20 -0700 Subject: [PATCH 093/461] Tagging fields to identify protection --- .../ext/transport/chttp2/transport/internal.h | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index adbd48c5810..31f2f06bba7 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -186,24 +186,24 @@ typedef struct grpc_chttp2_write_cb { struct grpc_chttp2_incoming_byte_stream { grpc_byte_stream base; gpr_refcount refs; - struct grpc_chttp2_incoming_byte_stream *next_message; - grpc_error *error; - bool push_closed; + struct grpc_chttp2_incoming_byte_stream *next_message; /* unused; should be removed */ + grpc_error *error; /* protected by slice_mu */ + bool push_closed; /* protected by slice_mu */ - grpc_chttp2_transport *transport; - grpc_chttp2_stream *stream; - bool is_tail; + grpc_chttp2_transport *transport; /* immutable */ + grpc_chttp2_stream *stream; /* immutable */ + bool is_tail; /* immutable */ - gpr_mu slice_mu; // protects slices, on_next - grpc_slice_buffer slices; - grpc_closure *on_next; - uint32_t remaining_bytes; + gpr_mu slice_mu; + grpc_slice_buffer slices; /* unused; should be removed */ + grpc_closure *on_next; /* protected by slice_mu */ + uint32_t remaining_bytes; /* guaranteed one thread access */ struct { grpc_closure closure; size_t max_size_hint; grpc_closure *on_complete; - } next_action; + } next_action; /* guaranteed one thread access */ grpc_closure destroy_action; grpc_closure finished_action; }; @@ -488,10 +488,10 @@ struct grpc_chttp2_stream { grpc_chttp2_incoming_metadata_buffer metadata_buffer[2]; - grpc_chttp2_incoming_byte_stream *incoming_frames; + grpc_chttp2_incoming_byte_stream *incoming_frames; /* protected by buffer_mu */ gpr_mu buffer_mu; /* protects unprocessed_incoming_frames_buffer and - parse_data */ - grpc_slice_buffer unprocessed_incoming_frames_buffer; + data_parser */ + grpc_slice_buffer unprocessed_incoming_frames_buffer; /* protected by buffer_mu */ gpr_timespec deadline; @@ -504,7 +504,7 @@ struct grpc_chttp2_stream { * incoming_window = incoming_window_delta + transport.initial_window_size */ int64_t incoming_window_delta; /** parsing state for data frames */ - grpc_chttp2_data_parser data_parser; + grpc_chttp2_data_parser data_parser; /* protected by buffer_mu */ /** number of bytes received - reset at end of parse thread execution */ int64_t received_bytes; From 8d8dce8db31dc9f54f606417ed6bc1ec93f9d76b Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Fri, 24 Mar 2017 10:32:15 -0700 Subject: [PATCH 094/461] malloc run_batch_stack after type checks --- src/ruby/ext/grpc/rb_call.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ruby/ext/grpc/rb_call.c b/src/ruby/ext/grpc/rb_call.c index cf62564667a..344cb941ffb 100644 --- a/src/ruby/ext/grpc/rb_call.c +++ b/src/ruby/ext/grpc/rb_call.c @@ -784,7 +784,7 @@ static VALUE grpc_run_batch_stack_build_result(run_batch_stack *st) { Only one operation of each type can be active at once in any given batch */ static VALUE grpc_rb_call_run_batch(VALUE self, VALUE ops_hash) { - run_batch_stack *st; + run_batch_stack *st = NULL; grpc_rb_call *call = NULL; grpc_event ev; grpc_call_error err; @@ -792,7 +792,6 @@ static VALUE grpc_rb_call_run_batch(VALUE self, VALUE ops_hash) { VALUE rb_write_flag = rb_ivar_get(self, id_write_flag); unsigned write_flag = 0; void *tag = (void*)&st; - st = gpr_malloc(sizeof(run_batch_stack)); if (RTYPEDDATA_DATA(self) == NULL) { rb_raise(grpc_rb_eCallError, "Cannot run batch on closed call"); @@ -808,6 +807,7 @@ static VALUE grpc_rb_call_run_batch(VALUE self, VALUE ops_hash) { if (rb_write_flag != Qnil) { write_flag = NUM2UINT(rb_write_flag); } + st = gpr_malloc(sizeof(run_batch_stack)); grpc_run_batch_stack_init(st, write_flag); grpc_run_batch_stack_fill_ops(st, ops_hash); From 4364ded9b16c5a0e1259af7423780c254d0465e6 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Fri, 24 Mar 2017 10:41:37 -0700 Subject: [PATCH 095/461] wording fix in comments --- src/ruby/end2end/killed_client_thread_driver.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ruby/end2end/killed_client_thread_driver.rb b/src/ruby/end2end/killed_client_thread_driver.rb index 2963a287c59..f76d3e1746d 100755 --- a/src/ruby/end2end/killed_client_thread_driver.rb +++ b/src/ruby/end2end/killed_client_thread_driver.rb @@ -32,7 +32,7 @@ require_relative './end2end_common' # Service that sleeps for a long time upon receiving an 'echo request' -# Also, this notified @call_started_cv once it has received a request. +# Also, this notifies @call_started_cv once it has received a request. class SleepingEchoServerImpl < Echo::EchoServer::Service def initialize(call_started, call_started_mu, call_started_cv) @call_started = call_started @@ -84,7 +84,7 @@ def main call_started_cv.wait(call_started_mu) until call_started.val end - # SIGINT the child process not that it's + # SIGINT the child process now that it's # in the middle of an RPC (happening on a non-main thread) Process.kill('SIGINT', client_pid) STDERR.puts 'sent shutdown' From e3c566431e1e8a3e49c413ef3525218d20759b48 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 24 Mar 2017 11:19:25 -0700 Subject: [PATCH 096/461] Merge upstream for error interface changes --- .../ext/transport/chttp2/transport/chttp2_transport.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index a3e596fda71..1b0606ed9af 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -2351,13 +2351,13 @@ static grpc_error *deframe_unprocessed_incoming_frames( break; default: gpr_asprintf(&msg, "Bad GRPC frame type 0x%02x", p->frame_type); - p->error = GRPC_ERROR_CREATE(msg); + p->error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg); p->error = grpc_error_set_int(p->error, GRPC_ERROR_INT_STREAM_ID, (intptr_t)s->id); gpr_free(msg); msg = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); p->error = - grpc_error_set_str(p->error, GRPC_ERROR_STR_RAW_BYTES, msg); + grpc_error_set_str(p->error, GRPC_ERROR_STR_RAW_BYTES, grpc_slice_from_copied_string(msg)); gpr_free(msg); p->error = grpc_error_set_int(p->error, GRPC_ERROR_INT_OFFSET, cur - beg); @@ -2558,7 +2558,7 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx *exec_ctx, GRPC_ERROR_REF(bs->error)); } else if (bs->push_closed) { if (bs->remaining_bytes != 0) { - bs->error = GRPC_ERROR_CREATE("Truncated message"); + bs->error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message"); grpc_closure_sched(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_REF(bs->error)); } else { @@ -2597,7 +2597,7 @@ static grpc_error *incoming_byte_stream_pull(grpc_exec_ctx *exec_ctx, return error; } } else { - bs->error = GRPC_ERROR_CREATE("Truncated message"); + bs->error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message"); gpr_mu_unlock(&s->buffer_mu); return bs->error; } From 69c2717c808b297ff1024e31ae45eb5b588cffa7 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Fri, 24 Mar 2017 11:39:52 -0700 Subject: [PATCH 097/461] bump v1.2.x branch version to 1.2.1-pre2 --- CMakeLists.txt | 2 +- Makefile | 4 ++-- build.yaml | 2 +- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.json | 2 +- package.xml | 4 ++-- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Auth/project.json | 4 ++-- src/csharp/Grpc.Core.Testing/project.json | 4 ++-- src/csharp/Grpc.Core/VersionInfo.cs | 2 +- src/csharp/Grpc.Core/project.json | 2 +- src/csharp/Grpc.HealthCheck/project.json | 4 ++-- src/csharp/Grpc.Reflection/project.json | 4 ++-- src/csharp/build_packages_dotnetcli.bat | 2 +- src/csharp/build_packages_dotnetcli.sh | 4 ++-- src/node/health_check/package.json | 4 ++-- src/node/tools/package.json | 2 +- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/private/version.h | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- 31 files changed, 39 insertions(+), 39 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a0787e2f1a..1543140c0aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,7 @@ cmake_minimum_required(VERSION 2.8) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.2.1-pre1") +set(PACKAGE_VERSION "1.2.1-pre2") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index 4a32fed2c96..041e4f5c7c5 100644 --- a/Makefile +++ b/Makefile @@ -412,8 +412,8 @@ Q = @ endif CORE_VERSION = 3.0.0-dev -CPP_VERSION = 1.2.1-pre1 -CSHARP_VERSION = 1.2.1-pre1 +CPP_VERSION = 1.2.1-pre2 +CSHARP_VERSION = 1.2.1-pre2 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/build.yaml b/build.yaml index 1ec134645ce..49d64bd1da0 100644 --- a/build.yaml +++ b/build.yaml @@ -14,7 +14,7 @@ settings: '#10': See the expand_version.py for all the quirks here core_version: 3.0.0-dev g_stands_for: green - version: 1.2.1-pre1 + version: 1.2.1-pre2 filegroups: - name: census public_headers: diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index c502c4440eb..fe1f3e008b8 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -37,7 +37,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.2.1-pre1' + version = '1.2.1-pre2' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'http://www.grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 5fddf8fd820..b5c172ee82e 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -36,7 +36,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.2.1-pre1' + version = '1.2.1-pre2' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'http://www.grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index 84478f56ea7..6c2736cd78e 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -36,7 +36,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.2.1-pre1' + version = '1.2.1-pre2' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'http://www.grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index dc1dd38a6e8..7031b3d1449 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -35,7 +35,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.2.1-pre1' + version = '1.2.1-pre2' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'http://www.grpc.io' diff --git a/package.json b/package.json index 004f968ea2f..e75dfa88206 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grpc", - "version": "1.2.1-pre1", + "version": "1.2.1-pre2", "author": "Google Inc.", "description": "gRPC Library for Node", "homepage": "http://www.grpc.io/", diff --git a/package.xml b/package.xml index fc3d0923728..44a15c23a96 100644 --- a/package.xml +++ b/package.xml @@ -13,8 +13,8 @@ 2017-03-01 - 1.2.1RC1 - 1.2.1RC1 + 1.2.1RC2 + 1.2.1RC2 beta diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index a40f8f0a284..593e17e7706 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -37,5 +37,5 @@ #include namespace grpc { -grpc::string Version() { return "1.2.1-pre1"; } +grpc::string Version() { return "1.2.1-pre2"; } } diff --git a/src/csharp/Grpc.Auth/project.json b/src/csharp/Grpc.Auth/project.json index 16584f9b14b..6345946c39c 100644 --- a/src/csharp/Grpc.Auth/project.json +++ b/src/csharp/Grpc.Auth/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.1-pre1", + "version": "1.2.1-pre2", "title": "gRPC C# Auth", "authors": [ "Google Inc." ], "copyright": "Copyright 2015, Google Inc.", @@ -21,7 +21,7 @@ } }, "dependencies": { - "Grpc.Core": "1.2.1-pre1", + "Grpc.Core": "1.2.1-pre2", "Google.Apis.Auth": "1.21.0" }, "frameworks": { diff --git a/src/csharp/Grpc.Core.Testing/project.json b/src/csharp/Grpc.Core.Testing/project.json index 960774c0d95..7337e2d15a8 100644 --- a/src/csharp/Grpc.Core.Testing/project.json +++ b/src/csharp/Grpc.Core.Testing/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.1-pre1", + "version": "1.2.1-pre2", "title": "gRPC C# Core Testing", "authors": [ "Google Inc." ], "copyright": "Copyright 2017, Google Inc.", @@ -21,7 +21,7 @@ } }, "dependencies": { - "Grpc.Core": "1.2.1-pre1" + "Grpc.Core": "1.2.1-pre2" }, "frameworks": { "net45": { diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs index 25be59a61ce..976508dfac2 100644 --- a/src/csharp/Grpc.Core/VersionInfo.cs +++ b/src/csharp/Grpc.Core/VersionInfo.cs @@ -53,6 +53,6 @@ namespace Grpc.Core /// /// Current version of gRPC C# /// - public const string CurrentVersion = "1.2.1-pre1"; + public const string CurrentVersion = "1.2.1-pre2"; } } diff --git a/src/csharp/Grpc.Core/project.json b/src/csharp/Grpc.Core/project.json index 5338011dd25..d0eb7759782 100644 --- a/src/csharp/Grpc.Core/project.json +++ b/src/csharp/Grpc.Core/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.1-pre1", + "version": "1.2.1-pre2", "title": "gRPC C# Core", "authors": [ "Google Inc." ], "copyright": "Copyright 2015, Google Inc.", diff --git a/src/csharp/Grpc.HealthCheck/project.json b/src/csharp/Grpc.HealthCheck/project.json index 2a7ec78852d..ff5429dba6b 100644 --- a/src/csharp/Grpc.HealthCheck/project.json +++ b/src/csharp/Grpc.HealthCheck/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.1-pre1", + "version": "1.2.1-pre2", "title": "gRPC C# Healthchecking", "authors": [ "Google Inc." ], "copyright": "Copyright 2015, Google Inc.", @@ -21,7 +21,7 @@ } }, "dependencies": { - "Grpc.Core": "1.2.1-pre1", + "Grpc.Core": "1.2.1-pre2", "Google.Protobuf": "3.2.0" }, "frameworks": { diff --git a/src/csharp/Grpc.Reflection/project.json b/src/csharp/Grpc.Reflection/project.json index 18bc2d8d699..ac7696e9074 100644 --- a/src/csharp/Grpc.Reflection/project.json +++ b/src/csharp/Grpc.Reflection/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.1-pre1", + "version": "1.2.1-pre2", "title": "gRPC C# Reflection", "authors": [ "Google Inc." ], "copyright": "Copyright 2016, Google Inc.", @@ -21,7 +21,7 @@ } }, "dependencies": { - "Grpc.Core": "1.2.1-pre1", + "Grpc.Core": "1.2.1-pre2", "Google.Protobuf": "3.2.0" }, "frameworks": { diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat index e4f75d3ba01..8a6f22f1fa3 100755 --- a/src/csharp/build_packages_dotnetcli.bat +++ b/src/csharp/build_packages_dotnetcli.bat @@ -28,7 +28,7 @@ @rem OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @rem Current package versions -set VERSION=1.2.1-pre1 +set VERSION=1.2.1-pre2 set PROTOBUF_VERSION=3.0.0 @rem Adjust the location of nuget.exe diff --git a/src/csharp/build_packages_dotnetcli.sh b/src/csharp/build_packages_dotnetcli.sh index a5a6b6108a8..56e24de1993 100755 --- a/src/csharp/build_packages_dotnetcli.sh +++ b/src/csharp/build_packages_dotnetcli.sh @@ -66,7 +66,7 @@ dotnet pack --configuration Release Grpc.Auth/project.json --output ../../artifa dotnet pack --configuration Release Grpc.HealthCheck/project.json --output ../../artifacts dotnet pack --configuration Release Grpc.Reflection/project.json --output ../../artifacts -nuget pack Grpc.nuspec -Version "1.2.1-pre1" -OutputDirectory ../../artifacts -nuget pack Grpc.Tools.nuspec -Version "1.2.1-pre1" -OutputDirectory ../../artifacts +nuget pack Grpc.nuspec -Version "1.2.1-pre2" -OutputDirectory ../../artifacts +nuget pack Grpc.Tools.nuspec -Version "1.2.1-pre2" -OutputDirectory ../../artifacts (cd ../../artifacts && zip csharp_nugets_dotnetcli.zip *.nupkg) diff --git a/src/node/health_check/package.json b/src/node/health_check/package.json index a3966a4abbf..630b3cba006 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.2.1-pre1", + "version": "1.2.1-pre2", "author": "Google Inc.", "description": "Health check service for use with gRPC", "repository": { @@ -15,7 +15,7 @@ } ], "dependencies": { - "grpc": "^1.2.1-pre1", + "grpc": "^1.2.1-pre2", "lodash": "^3.9.3", "google-protobuf": "^3.0.0" }, diff --git a/src/node/tools/package.json b/src/node/tools/package.json index de64cca844b..98863c1d776 100644 --- a/src/node/tools/package.json +++ b/src/node/tools/package.json @@ -1,6 +1,6 @@ { "name": "grpc-tools", - "version": "1.2.1-pre1", + "version": "1.2.1-pre2", "author": "Google Inc.", "description": "Tools for developing with gRPC on Node.js", "homepage": "http://www.grpc.io/", diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index 906fea86b71..636b9f792aa 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.2.1-pre1' + v = '1.2.1-pre2' 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 a623d2d772c..9339adce431 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -38,4 +38,4 @@ // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.2.1-pre1" +#define GRPC_OBJC_VERSION_STRING @"1.2.1-pre2" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index 5a0cf4df2e3..418ca993bc7 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION='1.2.1rc1' +VERSION='1.2.1rc2' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index c401cdbbcaa..00b7680a0f5 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION='1.2.1rc1' +VERSION='1.2.1rc2' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index 83f5d950b14..cf42d123ae3 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION='1.2.1rc1' +VERSION='1.2.1rc2' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index 3613aeee130..acd2b85c95e 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION='1.2.1rc1' +VERSION='1.2.1rc2' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index e9759ad206e..7d54034a298 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -29,5 +29,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.2.1.pre1' + VERSION = '1.2.1.pre2' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index a11e53cb2be..d6a7be76efa 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -29,6 +29,6 @@ module GRPC module Tools - VERSION = '1.2.1.pre1' + VERSION = '1.2.1.pre2' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index 73f06ba875d..fede4440800 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION='1.2.1rc1' +VERSION='1.2.1rc2' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 8b69893696b..13734e8d76a 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.2.1-pre1 +PROJECT_NUMBER = 1.2.1-pre2 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 823f9b01688..dfef610a00b 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.2.1-pre1 +PROJECT_NUMBER = 1.2.1-pre2 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a From ef033aa6a865584fe9e8aa805e342b2b0e69ef8c Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 24 Mar 2017 11:50:13 -0700 Subject: [PATCH 098/461] Remove duplicated code --- .../ext/transport/chttp2/transport/chttp2_transport.c | 11 ----------- src/core/ext/transport/chttp2/transport/frame_data.c | 2 -- 2 files changed, 13 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 1b0606ed9af..8c197f2b85f 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -2680,17 +2680,6 @@ void grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, } } -void grpc_chttp2_incoming_byte_stream_notify( - grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, - grpc_error *error) { - gpr_mu_lock(&bs->slice_mu); - if (bs->on_next) { - grpc_closure_sched(exec_ctx, bs->next_action.on_complete, error); - bs->on_next = NULL; - } - gpr_mu_unlock(&bs->slice_mu); -} - void grpc_chttp2_incoming_byte_stream_finished( grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, grpc_error *error) { diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c index 921dcef11c4..ecd53e2ce96 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -291,8 +291,6 @@ grpc_error *parse_inner_buffer(grpc_exec_ctx *exec_ctx, grpc_chttp2_unprocessed_frames_buffer_push( exec_ctx, p, s, grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); - grpc_chttp2_incoming_byte_stream_notify(exec_ctx, p->parsing_frame, - GRPC_ERROR_NONE); gpr_mu_unlock(&s->buffer_mu); return GRPC_ERROR_NONE; } From 057230b0cd08ebb4ecacd079589deaecfdcbd415 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Fri, 24 Mar 2017 15:03:55 -0700 Subject: [PATCH 099/461] Minor bug --- include/grpc++/impl/codegen/completion_queue.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/grpc++/impl/codegen/completion_queue.h b/include/grpc++/impl/codegen/completion_queue.h index 025eea3ef5b..bd2b33d27b0 100644 --- a/include/grpc++/impl/codegen/completion_queue.h +++ b/include/grpc++/impl/codegen/completion_queue.h @@ -103,7 +103,9 @@ class CompletionQueue : private GrpcLibraryCodegen { public: /// Default constructor. Implicitly creates a \a grpc_completion_queue /// instance. - CompletionQueue() : CompletionQueue(false) {} + CompletionQueue() : CompletionQueue(false) { + InitialAvalanching(); // reserve this for the future shutdown + } /// Wrap \a take, taking ownership of the instance. /// From 74f419fe743d998bd65014d4211d843569c3cfd3 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Fri, 24 Mar 2017 15:11:06 -0700 Subject: [PATCH 100/461] undo prev change --- include/grpc++/impl/codegen/completion_queue.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/grpc++/impl/codegen/completion_queue.h b/include/grpc++/impl/codegen/completion_queue.h index bd2b33d27b0..025eea3ef5b 100644 --- a/include/grpc++/impl/codegen/completion_queue.h +++ b/include/grpc++/impl/codegen/completion_queue.h @@ -103,9 +103,7 @@ class CompletionQueue : private GrpcLibraryCodegen { public: /// Default constructor. Implicitly creates a \a grpc_completion_queue /// instance. - CompletionQueue() : CompletionQueue(false) { - InitialAvalanching(); // reserve this for the future shutdown - } + CompletionQueue() : CompletionQueue(false) {} /// Wrap \a take, taking ownership of the instance. /// From 0cb20efaec8169e606f380770daad6257146b661 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Fri, 24 Mar 2017 15:50:06 -0700 Subject: [PATCH 101/461] update to 1.2.1-pre2 in BUILD file too --- BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD b/BUILD index db08f57fbf1..faaef5198ab 100644 --- a/BUILD +++ b/BUILD @@ -41,7 +41,7 @@ g_stands_for = "green" core_version = "3.0.0-dev" -version = "1.2.0" +version = "1.2.1-pre2" grpc_cc_library( name = "gpr", From 397a6684cbec4812cff3580da80255fa1a00d087 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 24 Mar 2017 17:27:19 -0700 Subject: [PATCH 102/461] clang-format --- .../chttp2/transport/chttp2_transport.c | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 8c197f2b85f..719a17fe104 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -511,10 +511,11 @@ static void destroy_transport_locked(grpc_exec_ctx *exec_ctx, void *tp, static void destroy_transport(grpc_exec_ctx *exec_ctx, grpc_transport *gt) { grpc_chttp2_transport *t = (grpc_chttp2_transport *)gt; - grpc_closure_sched(exec_ctx, grpc_closure_create( - destroy_transport_locked, t, - grpc_combiner_scheduler(t->combiner, false)), - GRPC_ERROR_NONE); + grpc_closure_sched( + exec_ctx, + grpc_closure_create(destroy_transport_locked, t, + grpc_combiner_scheduler(t->combiner, false)), + GRPC_ERROR_NONE); } static void close_transport_locked(grpc_exec_ctx *exec_ctx, @@ -696,8 +697,9 @@ static void destroy_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, s->destroy_stream_arg = then_schedule_closure; grpc_closure_sched( - exec_ctx, grpc_closure_init(&s->destroy_stream, destroy_stream_locked, s, - grpc_combiner_scheduler(t->combiner, false)), + exec_ctx, + grpc_closure_init(&s->destroy_stream, destroy_stream_locked, s, + grpc_combiner_scheduler(t->combiner, false)), GRPC_ERROR_NONE); GPR_TIMER_END("destroy_stream", 0); } @@ -1511,9 +1513,10 @@ static void perform_transport_op(grpc_exec_ctx *exec_ctx, grpc_transport *gt, op->transport_private.args[0] = gt; GRPC_CHTTP2_REF_TRANSPORT(t, "transport_op"); grpc_closure_sched( - exec_ctx, grpc_closure_init(&op->transport_private.closure, - perform_transport_op_locked, op, - grpc_combiner_scheduler(t->combiner, false)), + exec_ctx, + grpc_closure_init(&op->transport_private.closure, + perform_transport_op_locked, op, + grpc_combiner_scheduler(t->combiner, false)), GRPC_ERROR_NONE); } @@ -2256,8 +2259,9 @@ static void keepalive_watchdog_fired_locked(grpc_exec_ctx *exec_ctx, void *arg, if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) { if (error == GRPC_ERROR_NONE) { t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DYING; - close_transport_locked(exec_ctx, t, GRPC_ERROR_CREATE_FROM_STATIC_STRING( - "keepalive watchdog timeout")); + close_transport_locked( + exec_ctx, t, + GRPC_ERROR_CREATE_FROM_STATIC_STRING("keepalive watchdog timeout")); } } else { /** The watchdog timer should have been cancelled by @@ -2356,8 +2360,8 @@ static grpc_error *deframe_unprocessed_incoming_frames( (intptr_t)s->id); gpr_free(msg); msg = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); - p->error = - grpc_error_set_str(p->error, GRPC_ERROR_STR_RAW_BYTES, grpc_slice_from_copied_string(msg)); + p->error = grpc_error_set_str(p->error, GRPC_ERROR_STR_RAW_BYTES, + grpc_slice_from_copied_string(msg)); gpr_free(msg); p->error = grpc_error_set_int(p->error, GRPC_ERROR_INT_OFFSET, cur - beg); From 9e760da81a61afb6b9fe4c8ca3a30fae879002f2 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 24 Mar 2017 17:45:00 -0700 Subject: [PATCH 103/461] Fix c++ test --- test/cpp/microbenchmarks/bm_chttp2_transport.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/cpp/microbenchmarks/bm_chttp2_transport.cc b/test/cpp/microbenchmarks/bm_chttp2_transport.cc index 254d57de205..265a5a6b220 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_transport.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_transport.cc @@ -541,9 +541,11 @@ static void BM_TransportStreamRecv(benchmark::State &state) { grpc_closure_sched(exec_ctx, c.get(), GRPC_ERROR_NONE); return; } - } while (grpc_byte_stream_next(exec_ctx, recv_stream, &recv_slice, + } while (grpc_byte_stream_next(exec_ctx, recv_stream, recv_stream->length - received, - drain_continue.get())); + drain_continue.get()) && + GRPC_ERROR_NONE == grpc_byte_stream_pull(exec_ctx, recv_stream, + &recv_slice)); }); drain_continue = MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) { From 547cb4b283273a68c61da28f97b149b8c55c8daf Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 28 Mar 2017 09:50:33 -0700 Subject: [PATCH 104/461] Make chunk sizes configurable, push channel args down a little deeper --- .../server/insecure/server_chttp2_posix.c | 7 +- src/core/lib/iomgr/endpoint_pair.h | 5 +- src/core/lib/iomgr/endpoint_pair_posix.c | 17 +++-- src/core/lib/iomgr/tcp_client.h | 4 -- src/core/lib/iomgr/tcp_client_posix.c | 24 +------ src/core/lib/iomgr/tcp_posix.c | 70 ++++++++++++++++--- src/core/lib/iomgr/tcp_posix.h | 13 +++- src/core/lib/iomgr/tcp_server_posix.c | 22 ++---- src/core/lib/iomgr/tcp_server_utils_posix.h | 3 +- test/core/bad_client/bad_client.c | 5 +- .../core/end2end/fixtures/h2_sockpair+trace.c | 4 +- test/core/end2end/fixtures/h2_sockpair.c | 4 +- .../core/end2end/fixtures/h2_sockpair_1byte.c | 15 +++- test/core/iomgr/endpoint_pair_test.c | 11 +-- test/core/iomgr/fd_conservation_posix_test.c | 2 +- test/core/iomgr/tcp_posix_test.c | 55 +++++++++------ test/core/security/secure_endpoint_test.c | 11 +-- 17 files changed, 155 insertions(+), 117 deletions(-) diff --git a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c index f46e8499326..6ab176e8ad7 100644 --- a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +++ b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c @@ -57,12 +57,9 @@ void grpc_server_add_insecure_channel_from_fd(grpc_server *server, char *name; gpr_asprintf(&name, "fd:%d", fd); - grpc_resource_quota *resource_quota = grpc_resource_quota_from_channel_args( - grpc_server_get_channel_args(server)); grpc_endpoint *server_endpoint = - grpc_tcp_create(grpc_fd_create(fd, name), resource_quota, - GRPC_TCP_DEFAULT_READ_SLICE_SIZE, name); - grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); + grpc_tcp_create(&exec_ctx, grpc_fd_create(fd, name), + grpc_server_get_channel_args(server), name); gpr_free(name); diff --git a/src/core/lib/iomgr/endpoint_pair.h b/src/core/lib/iomgr/endpoint_pair.h index f9de0c715ec..6407a6ad3f3 100644 --- a/src/core/lib/iomgr/endpoint_pair.h +++ b/src/core/lib/iomgr/endpoint_pair.h @@ -41,8 +41,7 @@ typedef struct { grpc_endpoint *server; } grpc_endpoint_pair; -grpc_endpoint_pair grpc_iomgr_create_endpoint_pair( - const char *name, grpc_resource_quota *resource_quota, - size_t read_slice_size); +grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(const char *name, + grpc_channel_args *args); #endif /* GRPC_CORE_LIB_IOMGR_ENDPOINT_PAIR_H */ diff --git a/src/core/lib/iomgr/endpoint_pair_posix.c b/src/core/lib/iomgr/endpoint_pair_posix.c index b9ff969e810..5542a372d8b 100644 --- a/src/core/lib/iomgr/endpoint_pair_posix.c +++ b/src/core/lib/iomgr/endpoint_pair_posix.c @@ -62,22 +62,25 @@ static void create_sockets(int sv[2]) { GPR_ASSERT(grpc_set_socket_no_sigpipe_if_possible(sv[1]) == GRPC_ERROR_NONE); } -grpc_endpoint_pair grpc_iomgr_create_endpoint_pair( - const char *name, grpc_resource_quota *resource_quota, - size_t read_slice_size) { +grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(const char *name, + grpc_channel_args *args) { int sv[2]; grpc_endpoint_pair p; char *final_name; create_sockets(sv); + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + gpr_asprintf(&final_name, "%s:client", name); - p.client = grpc_tcp_create(grpc_fd_create(sv[1], final_name), resource_quota, - read_slice_size, "socketpair-server"); + p.client = grpc_tcp_create(&exec_ctx, grpc_fd_create(sv[1], final_name), args, + "socketpair-server"); gpr_free(final_name); gpr_asprintf(&final_name, "%s:server", name); - p.server = grpc_tcp_create(grpc_fd_create(sv[0], final_name), resource_quota, - read_slice_size, "socketpair-client"); + p.server = grpc_tcp_create(&exec_ctx, grpc_fd_create(sv[0], final_name), args, + "socketpair-client"); gpr_free(final_name); + + grpc_exec_ctx_finish(&exec_ctx); return p; } diff --git a/src/core/lib/iomgr/tcp_client.h b/src/core/lib/iomgr/tcp_client.h index 0485661316a..bc367bdfa5d 100644 --- a/src/core/lib/iomgr/tcp_client.h +++ b/src/core/lib/iomgr/tcp_client.h @@ -40,10 +40,6 @@ #include "src/core/lib/iomgr/pollset_set.h" #include "src/core/lib/iomgr/resolve_address.h" -/* Channel arg (integer) setting how large a slice to try and read from the wire - each time recvmsg (or equivalent) is called */ -#define GRPC_ARG_TCP_READ_CHUNK_SIZE "grpc.experimental.tcp_read_chunk_size" - /* Asynchronously connect to an address (specified as (addr, len)), and call cb with arg and the completed connection when done (or call cb with arg and NULL on failure). diff --git a/src/core/lib/iomgr/tcp_client_posix.c b/src/core/lib/iomgr/tcp_client_posix.c index a108b10da6f..a2692707d9e 100644 --- a/src/core/lib/iomgr/tcp_client_posix.c +++ b/src/core/lib/iomgr/tcp_client_posix.c @@ -137,29 +137,7 @@ static void tc_on_alarm(grpc_exec_ctx *exec_ctx, void *acp, grpc_error *error) { grpc_endpoint *grpc_tcp_client_create_from_fd( grpc_exec_ctx *exec_ctx, grpc_fd *fd, const grpc_channel_args *channel_args, const char *addr_str) { - size_t tcp_read_chunk_size = GRPC_TCP_DEFAULT_READ_SLICE_SIZE; - grpc_resource_quota *resource_quota = grpc_resource_quota_create(NULL); - if (channel_args != NULL) { - for (size_t i = 0; i < channel_args->num_args; i++) { - if (0 == - strcmp(channel_args->args[i].key, GRPC_ARG_TCP_READ_CHUNK_SIZE)) { - grpc_integer_options options = {(int)tcp_read_chunk_size, 1, - 8 * 1024 * 1024}; - tcp_read_chunk_size = (size_t)grpc_channel_arg_get_integer( - &channel_args->args[i], options); - } else if (0 == - strcmp(channel_args->args[i].key, GRPC_ARG_RESOURCE_QUOTA)) { - grpc_resource_quota_unref_internal(exec_ctx, resource_quota); - resource_quota = grpc_resource_quota_ref_internal( - channel_args->args[i].value.pointer.p); - } - } - } - - grpc_endpoint *ep = - grpc_tcp_create(fd, resource_quota, tcp_read_chunk_size, addr_str); - grpc_resource_quota_unref_internal(exec_ctx, resource_quota); - return ep; + return grpc_tcp_create(exec_ctx, fd, channel_args, addr_str); } static void on_writable(grpc_exec_ctx *exec_ctx, void *acp, grpc_error *error) { diff --git a/src/core/lib/iomgr/tcp_posix.c b/src/core/lib/iomgr/tcp_posix.c index 74429e3a566..bfc7de59f20 100644 --- a/src/core/lib/iomgr/tcp_posix.c +++ b/src/core/lib/iomgr/tcp_posix.c @@ -54,6 +54,7 @@ #include #include +#include "src/core/lib/channel/channel_args.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/profiling/timers.h" @@ -86,6 +87,9 @@ typedef struct { gpr_refcount refcount; gpr_atm shutdown_count; + int min_read_chunk_size; + int max_read_chunk_size; + /* garbage after the last read */ grpc_slice_buffer last_read_buffer; @@ -111,12 +115,16 @@ typedef struct { } grpc_tcp; static void add_to_estimate(grpc_tcp *tcp, size_t bytes) { - tcp->bytes_read_this_round += bytes; + tcp->bytes_read_this_round += (double)bytes; } static void finish_estimate(grpc_tcp *tcp) { - if (tcp->bytes_read_this_round > tcp->target_length) { - tcp->target_length = 1.5 * tcp->bytes_read_this_round; + /* If we read >80% of the target buffer in one read loop, increase the size + of the target buffer to either the amount read, or twice its previous + value */ + if (tcp->bytes_read_this_round > tcp->target_length * 0.8) { + tcp->target_length = + GPR_MAX(2 * tcp->target_length, tcp->bytes_read_this_round); } else { tcp->target_length = 0.99 * tcp->target_length + 0.01 * tcp->bytes_read_this_round; @@ -129,7 +137,9 @@ static size_t get_target_read_size(grpc_tcp *tcp) { grpc_resource_user_quota(tcp->resource_user)); double target = tcp->target_length * (pressure > 0.8 ? (1.0 - pressure) / 0.2 : 1.0); - return (((size_t)GPR_CLAMP(target, 1024, 4 * 1024 * 1024)) + 255) & + return (((size_t)GPR_CLAMP(target, tcp->min_read_chunk_size, + tcp->max_read_chunk_size)) + + 255) & ~(size_t)255; } @@ -562,9 +572,50 @@ static const grpc_endpoint_vtable vtable = {tcp_read, tcp_get_peer, tcp_get_fd}; -grpc_endpoint *grpc_tcp_create(grpc_fd *em_fd, - grpc_resource_quota *resource_quota, - size_t slice_size, const char *peer_string) { +#define MAX_CHUNK_SIZE 32 * 1024 * 1024 + +grpc_endpoint *grpc_tcp_create(grpc_exec_ctx *exec_ctx, grpc_fd *em_fd, + const grpc_channel_args *channel_args, + const char *peer_string) { + int tcp_read_chunk_size = GRPC_TCP_DEFAULT_READ_SLICE_SIZE; + int tcp_max_read_chunk_size = 4 * 1024 * 1024; + int tcp_min_read_chunk_size = 256; + grpc_resource_quota *resource_quota = grpc_resource_quota_create(NULL); + if (channel_args != NULL) { + for (size_t i = 0; i < channel_args->num_args; i++) { + if (0 == + strcmp(channel_args->args[i].key, GRPC_ARG_TCP_READ_CHUNK_SIZE)) { + grpc_integer_options options = {(int)tcp_read_chunk_size, 1, + MAX_CHUNK_SIZE}; + tcp_read_chunk_size = + grpc_channel_arg_get_integer(&channel_args->args[i], options); + } else if (0 == strcmp(channel_args->args[i].key, + GRPC_ARG_TCP_MIN_READ_CHUNK_SIZE)) { + grpc_integer_options options = {(int)tcp_read_chunk_size, 1, + MAX_CHUNK_SIZE}; + tcp_min_read_chunk_size = + grpc_channel_arg_get_integer(&channel_args->args[i], options); + } else if (0 == strcmp(channel_args->args[i].key, + GRPC_ARG_TCP_MAX_READ_CHUNK_SIZE)) { + grpc_integer_options options = {(int)tcp_read_chunk_size, 1, + MAX_CHUNK_SIZE}; + tcp_max_read_chunk_size = + grpc_channel_arg_get_integer(&channel_args->args[i], options); + } else if (0 == + strcmp(channel_args->args[i].key, GRPC_ARG_RESOURCE_QUOTA)) { + grpc_resource_quota_unref_internal(exec_ctx, resource_quota); + resource_quota = grpc_resource_quota_ref_internal( + channel_args->args[i].value.pointer.p); + } + } + } + + if (tcp_min_read_chunk_size > tcp_max_read_chunk_size) { + tcp_min_read_chunk_size = tcp_max_read_chunk_size; + } + tcp_read_chunk_size = GPR_CLAMP(tcp_read_chunk_size, tcp_min_read_chunk_size, + tcp_max_read_chunk_size); + grpc_tcp *tcp = (grpc_tcp *)gpr_malloc(sizeof(grpc_tcp)); tcp->base.vtable = &vtable; tcp->peer_string = gpr_strdup(peer_string); @@ -574,7 +625,9 @@ grpc_endpoint *grpc_tcp_create(grpc_fd *em_fd, tcp->release_fd_cb = NULL; tcp->release_fd = NULL; tcp->incoming_buffer = NULL; - tcp->target_length = slice_size; + tcp->target_length = (double)tcp_read_chunk_size; + tcp->min_read_chunk_size = tcp_min_read_chunk_size; + tcp->max_read_chunk_size = tcp_max_read_chunk_size; tcp->bytes_read_this_round = 0; tcp->iov_size = 1; tcp->finished_edge = true; @@ -592,6 +645,7 @@ grpc_endpoint *grpc_tcp_create(grpc_fd *em_fd, &tcp->slice_allocator, tcp->resource_user, tcp_read_allocation_done, tcp); /* Tell network status tracker about new endpoint */ grpc_network_status_register_endpoint(&tcp->base); + grpc_resource_quota_unref_internal(exec_ctx, resource_quota); return &tcp->base; } diff --git a/src/core/lib/iomgr/tcp_posix.h b/src/core/lib/iomgr/tcp_posix.h index 1c0d13f96e2..3bf93dfcf85 100644 --- a/src/core/lib/iomgr/tcp_posix.h +++ b/src/core/lib/iomgr/tcp_posix.h @@ -49,12 +49,21 @@ #define GRPC_TCP_DEFAULT_READ_SLICE_SIZE 8192 +/* Channel arg (integer) setting how large a slice to try and read from the wire + each time recvmsg (or equivalent) is called */ +#define GRPC_ARG_TCP_READ_CHUNK_SIZE "grpc.experimental.tcp_read_chunk_size" +#define GRPC_ARG_TCP_MIN_READ_CHUNK_SIZE \ + "grpc.experimental.tcp_min_read_chunk_size" +#define GRPC_ARG_TCP_MAX_READ_CHUNK_SIZE \ + "grpc.experimental.tcp_max_read_chunk_size" + extern int grpc_tcp_trace; /* Create a tcp endpoint given a file desciptor and a read slice size. Takes ownership of fd. */ -grpc_endpoint *grpc_tcp_create(grpc_fd *fd, grpc_resource_quota *resource_quota, - size_t read_slice_size, const char *peer_string); +grpc_endpoint *grpc_tcp_create(grpc_exec_ctx *exec_ctx, grpc_fd *fd, + const grpc_channel_args *args, + const char *peer_string); /* Return the tcp endpoint's fd, or -1 if this is not available. Does not release the fd. diff --git a/src/core/lib/iomgr/tcp_server_posix.c b/src/core/lib/iomgr/tcp_server_posix.c index d6a017cf7f6..e66ffc9b1c2 100644 --- a/src/core/lib/iomgr/tcp_server_posix.c +++ b/src/core/lib/iomgr/tcp_server_posix.c @@ -59,6 +59,7 @@ #include #include +#include "src/core/lib/channel/channel_args.h" #include "src/core/lib/iomgr/resolve_address.h" #include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/iomgr/sockaddr_utils.h" @@ -90,7 +91,6 @@ grpc_error *grpc_tcp_server_create(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s = gpr_zalloc(sizeof(grpc_tcp_server)); s->so_reuseport = has_so_reuseport; - s->resource_quota = grpc_resource_quota_create(NULL); s->expand_wildcard_addrs = false; for (size_t i = 0; i < (args == NULL ? 0 : args->num_args); i++) { if (0 == strcmp(GRPC_ARG_ALLOW_REUSEPORT, args->args[i].key)) { @@ -98,27 +98,14 @@ grpc_error *grpc_tcp_server_create(grpc_exec_ctx *exec_ctx, s->so_reuseport = has_so_reuseport && (args->args[i].value.integer != 0); } else { - grpc_resource_quota_unref_internal(exec_ctx, s->resource_quota); gpr_free(s); return GRPC_ERROR_CREATE_FROM_STATIC_STRING(GRPC_ARG_ALLOW_REUSEPORT " must be an integer"); } - } else if (0 == strcmp(GRPC_ARG_RESOURCE_QUOTA, args->args[i].key)) { - if (args->args[i].type == GRPC_ARG_POINTER) { - grpc_resource_quota_unref_internal(exec_ctx, s->resource_quota); - s->resource_quota = - grpc_resource_quota_ref_internal(args->args[i].value.pointer.p); - } else { - grpc_resource_quota_unref_internal(exec_ctx, s->resource_quota); - gpr_free(s); - return GRPC_ERROR_CREATE_FROM_STATIC_STRING( - GRPC_ARG_RESOURCE_QUOTA " must be a pointer to a buffer pool"); - } } else if (0 == strcmp(GRPC_ARG_EXPAND_WILDCARD_ADDRS, args->args[i].key)) { if (args->args[i].type == GRPC_ARG_INTEGER) { s->expand_wildcard_addrs = (args->args[i].value.integer != 0); } else { - grpc_resource_quota_unref_internal(exec_ctx, s->resource_quota); gpr_free(s); return GRPC_ERROR_CREATE_FROM_STATIC_STRING( GRPC_ARG_EXPAND_WILDCARD_ADDRS " must be an integer"); @@ -138,6 +125,7 @@ grpc_error *grpc_tcp_server_create(grpc_exec_ctx *exec_ctx, s->head = NULL; s->tail = NULL; s->nports = 0; + s->channel_args = grpc_channel_args_copy(args); gpr_atm_no_barrier_store(&s->next_pollset_to_assign, 0); *server = s; return GRPC_ERROR_NONE; @@ -158,8 +146,7 @@ static void finish_shutdown(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) { s->head = sp->next; gpr_free(sp); } - - grpc_resource_quota_unref_internal(exec_ctx, s->resource_quota); + grpc_channel_args_destroy(exec_ctx, s->channel_args); gpr_free(s); } @@ -286,8 +273,7 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *err) { sp->server->on_accept_cb( exec_ctx, sp->server->on_accept_cb_arg, - grpc_tcp_create(fdobj, sp->server->resource_quota, - GRPC_TCP_DEFAULT_READ_SLICE_SIZE, addr_str), + grpc_tcp_create(exec_ctx, fdobj, sp->server->channel_args, addr_str), read_notifier_pollset, acceptor); gpr_free(name); diff --git a/src/core/lib/iomgr/tcp_server_utils_posix.h b/src/core/lib/iomgr/tcp_server_utils_posix.h index f5dc8532f9f..c15e2e1493a 100644 --- a/src/core/lib/iomgr/tcp_server_utils_posix.h +++ b/src/core/lib/iomgr/tcp_server_utils_posix.h @@ -103,7 +103,8 @@ struct grpc_tcp_server { /* next pollset to assign a channel to */ gpr_atm next_pollset_to_assign; - grpc_resource_quota *resource_quota; + /* channel args for this server */ + grpc_channel_args *channel_args; }; /* If successful, add a listener to \a s for \a addr, set \a dsmode for the diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.c index 4870dc1a536..9a566e6484c 100644 --- a/test/core/bad_client/bad_client.c +++ b/test/core/bad_client/bad_client.c @@ -117,10 +117,7 @@ void grpc_run_bad_client_test( grpc_init(); /* Create endpoints */ - grpc_resource_quota *resource_quota = - grpc_resource_quota_create("bad_client_test"); - sfd = grpc_iomgr_create_endpoint_pair("fixture", resource_quota, 65536); - grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); + sfd = grpc_iomgr_create_endpoint_pair("fixture", NULL); /* Create server, completion events */ a.server = grpc_server_create(NULL, NULL); diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.c b/test/core/end2end/fixtures/h2_sockpair+trace.c index edf42a40702..9b4526cb75c 100644 --- a/test/core/end2end/fixtures/h2_sockpair+trace.c +++ b/test/core/end2end/fixtures/h2_sockpair+trace.c @@ -96,9 +96,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( f.fixture_data = sfd; f.cq = grpc_completion_queue_create(NULL); - grpc_resource_quota *resource_quota = grpc_resource_quota_create("fixture"); - *sfd = grpc_iomgr_create_endpoint_pair("fixture", resource_quota, 65536); - grpc_resource_quota_unref(resource_quota); + *sfd = grpc_iomgr_create_endpoint_pair("fixture", NULL); return f; } diff --git a/test/core/end2end/fixtures/h2_sockpair.c b/test/core/end2end/fixtures/h2_sockpair.c index 94b2623b3ea..3aaa0ce6fb3 100644 --- a/test/core/end2end/fixtures/h2_sockpair.c +++ b/test/core/end2end/fixtures/h2_sockpair.c @@ -90,9 +90,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( f.fixture_data = sfd; f.cq = grpc_completion_queue_create(NULL); - grpc_resource_quota *resource_quota = grpc_resource_quota_create("fixture"); - *sfd = grpc_iomgr_create_endpoint_pair("fixture", resource_quota, 65536); - grpc_resource_quota_unref(resource_quota); + *sfd = grpc_iomgr_create_endpoint_pair("fixture", NULL); return f; } diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.c b/test/core/end2end/fixtures/h2_sockpair_1byte.c index 6f9cf8fe26a..87410dd1e98 100644 --- a/test/core/end2end/fixtures/h2_sockpair_1byte.c +++ b/test/core/end2end/fixtures/h2_sockpair_1byte.c @@ -48,6 +48,7 @@ #include "src/core/lib/channel/http_server_filter.h" #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/iomgr/iomgr.h" +#include "src/core/lib/iomgr/tcp_posix.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/completion_queue.h" #include "src/core/lib/surface/server.h" @@ -90,9 +91,17 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( f.fixture_data = sfd; f.cq = grpc_completion_queue_create(NULL); - grpc_resource_quota *resource_quota = grpc_resource_quota_create("fixture"); - *sfd = grpc_iomgr_create_endpoint_pair("fixture", resource_quota, 1); - grpc_resource_quota_unref(resource_quota); + grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE, + .type = GRPC_ARG_INTEGER, + .value.integer = 1}, + {.key = GRPC_ARG_TCP_MIN_READ_CHUNK_SIZE, + .type = GRPC_ARG_INTEGER, + .value.integer = 1}, + {.key = GRPC_ARG_TCP_MAX_READ_CHUNK_SIZE, + .type = GRPC_ARG_INTEGER, + .value.integer = 1}}; + grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a}; + *sfd = grpc_iomgr_create_endpoint_pair("fixture", &args); return f; } diff --git a/test/core/iomgr/endpoint_pair_test.c b/test/core/iomgr/endpoint_pair_test.c index 4b98ef257e5..491b05f41fd 100644 --- a/test/core/iomgr/endpoint_pair_test.c +++ b/test/core/iomgr/endpoint_pair_test.c @@ -37,6 +37,7 @@ #include #include #include +#include "src/core/lib/iomgr/tcp_posix.h" #include "test/core/iomgr/endpoint_tests.h" #include "test/core/util/test_config.h" @@ -49,11 +50,11 @@ static grpc_endpoint_test_fixture create_fixture_endpoint_pair( size_t slice_size) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_endpoint_test_fixture f; - grpc_resource_quota *resource_quota = - grpc_resource_quota_create("endpoint_pair_test"); - grpc_endpoint_pair p = - grpc_iomgr_create_endpoint_pair("test", resource_quota, slice_size); - grpc_resource_quota_unref(resource_quota); + grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE, + .type = GRPC_ARG_INTEGER, + .value.integer = (int)slice_size}}; + grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a}; + grpc_endpoint_pair p = grpc_iomgr_create_endpoint_pair("test", &args); f.client_ep = p.client; f.server_ep = p.server; diff --git a/test/core/iomgr/fd_conservation_posix_test.c b/test/core/iomgr/fd_conservation_posix_test.c index 3dffa02c3c8..6ac322bb014 100644 --- a/test/core/iomgr/fd_conservation_posix_test.c +++ b/test/core/iomgr/fd_conservation_posix_test.c @@ -57,7 +57,7 @@ int main(int argc, char **argv) { for (i = 0; i < 100; i++) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - p = grpc_iomgr_create_endpoint_pair("test", resource_quota, 1); + p = grpc_iomgr_create_endpoint_pair("test", NULL); grpc_endpoint_destroy(&exec_ctx, p.client); grpc_endpoint_destroy(&exec_ctx, p.server); grpc_exec_ctx_finish(&exec_ctx); diff --git a/test/core/iomgr/tcp_posix_test.c b/test/core/iomgr/tcp_posix_test.c index 5a55be888fe..2c53a003d23 100644 --- a/test/core/iomgr/tcp_posix_test.c +++ b/test/core/iomgr/tcp_posix_test.c @@ -183,10 +183,12 @@ static void read_test(size_t num_bytes, size_t slice_size) { create_sockets(sv); - grpc_resource_quota *resource_quota = grpc_resource_quota_create("read_test"); - ep = grpc_tcp_create(grpc_fd_create(sv[1], "read_test"), resource_quota, - slice_size, "test"); - grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); + grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE, + .type = GRPC_ARG_INTEGER, + .value.integer = (int)slice_size}}; + grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a}; + ep = grpc_tcp_create(&exec_ctx, grpc_fd_create(sv[1], "read_test"), &args, + "test"); grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset); written_bytes = fill_socket_partial(sv[0], num_bytes); @@ -233,11 +235,12 @@ static void large_read_test(size_t slice_size) { create_sockets(sv); - grpc_resource_quota *resource_quota = - grpc_resource_quota_create("large_read_test"); - ep = grpc_tcp_create(grpc_fd_create(sv[1], "large_read_test"), resource_quota, - slice_size, "test"); - grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); + grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE, + .type = GRPC_ARG_INTEGER, + .value.integer = (int)slice_size}}; + grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a}; + ep = grpc_tcp_create(&exec_ctx, grpc_fd_create(sv[1], "large_read_test"), + &args, "test"); grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset); written_bytes = fill_socket(sv[0]); @@ -372,11 +375,12 @@ static void write_test(size_t num_bytes, size_t slice_size) { create_sockets(sv); - grpc_resource_quota *resource_quota = - grpc_resource_quota_create("write_test"); - ep = grpc_tcp_create(grpc_fd_create(sv[1], "write_test"), resource_quota, - GRPC_TCP_DEFAULT_READ_SLICE_SIZE, "test"); - grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); + grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE, + .type = GRPC_ARG_INTEGER, + .value.integer = (int)slice_size}}; + grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a}; + ep = grpc_tcp_create(&exec_ctx, grpc_fd_create(sv[1], "write_test"), &args, + "test"); grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset); state.ep = ep; @@ -441,12 +445,13 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) { create_sockets(sv); - grpc_resource_quota *resource_quota = - grpc_resource_quota_create("release_fd_test"); - ep = grpc_tcp_create(grpc_fd_create(sv[1], "read_test"), resource_quota, - slice_size, "test"); + grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE, + .type = GRPC_ARG_INTEGER, + .value.integer = (int)slice_size}}; + grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a}; + ep = grpc_tcp_create(&exec_ctx, grpc_fd_create(sv[1], "read_test"), &args, + "test"); GPR_ASSERT(grpc_tcp_fd(ep) == sv[1] && sv[1] >= 0); - grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset); written_bytes = fill_socket_partial(sv[0], num_bytes); @@ -534,10 +539,14 @@ static grpc_endpoint_test_fixture create_fixture_tcp_socketpair( create_sockets(sv); grpc_resource_quota *resource_quota = grpc_resource_quota_create("tcp_posix_test_socketpair"); - f.client_ep = grpc_tcp_create(grpc_fd_create(sv[0], "fixture:client"), - resource_quota, slice_size, "test"); - f.server_ep = grpc_tcp_create(grpc_fd_create(sv[1], "fixture:server"), - resource_quota, slice_size, "test"); + grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE, + .type = GRPC_ARG_INTEGER, + .value.integer = (int)slice_size}}; + grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a}; + f.client_ep = grpc_tcp_create( + &exec_ctx, grpc_fd_create(sv[0], "fixture:client"), &args, "test"); + f.server_ep = grpc_tcp_create( + &exec_ctx, grpc_fd_create(sv[1], "fixture:server"), &args, "test"); grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); grpc_endpoint_add_to_pollset(&exec_ctx, f.client_ep, g_pollset); grpc_endpoint_add_to_pollset(&exec_ctx, f.server_ep, g_pollset); diff --git a/test/core/security/secure_endpoint_test.c b/test/core/security/secure_endpoint_test.c index b3775e91a72..e6e3d91be5d 100644 --- a/test/core/security/secure_endpoint_test.c +++ b/test/core/security/secure_endpoint_test.c @@ -39,8 +39,10 @@ #include #include #include +#include #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/iomgr/iomgr.h" +#include "src/core/lib/iomgr/tcp_posix.h" #include "src/core/lib/security/transport/secure_endpoint.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/tsi/fake_transport_security.h" @@ -57,10 +59,11 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair( grpc_endpoint_test_fixture f; grpc_endpoint_pair tcp; - grpc_resource_quota *resource_quota = - grpc_resource_quota_create("secure_endpoint_test"); - tcp = grpc_iomgr_create_endpoint_pair("fixture", resource_quota, slice_size); - grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); + grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE, + .type = GRPC_ARG_INTEGER, + .value.integer = (int)slice_size}}; + grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a}; + tcp = grpc_iomgr_create_endpoint_pair("fixture", &args); grpc_endpoint_add_to_pollset(&exec_ctx, tcp.client, g_pollset); grpc_endpoint_add_to_pollset(&exec_ctx, tcp.server, g_pollset); From 2c614a7a7b19633c2f1d962d05e3282486895034 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Tue, 28 Mar 2017 12:54:20 -0700 Subject: [PATCH 105/461] clang --- include/grpc++/impl/codegen/sync_stream.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/grpc++/impl/codegen/sync_stream.h b/include/grpc++/impl/codegen/sync_stream.h index 7657f337f89..328d5cb1e83 100644 --- a/include/grpc++/impl/codegen/sync_stream.h +++ b/include/grpc++/impl/codegen/sync_stream.h @@ -330,7 +330,7 @@ class ClientReaderWriter final : public ClientReaderWriterInterface { ClientReaderWriter(ChannelInterface* channel, const RpcMethod& method, ClientContext* context) : context_(context), - cq_(true), // Pluckable cq + cq_(true), // Pluckable cq call_(channel->CreateCall(method, context, &cq_)) { if (!context_->initial_metadata_corked_) { CallOpSet ops; From c9a3aaaa541f6915c0ea886acc1026eba27da881 Mon Sep 17 00:00:00 2001 From: Ken Payson Date: Tue, 28 Mar 2017 15:50:25 -0700 Subject: [PATCH 106/461] Fix Python poll() server spinlock bug --- src/python/grpcio/grpc/_server.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/python/grpcio/grpc/_server.py b/src/python/grpcio/grpc/_server.py index 47838c2c986..f29c44a4cfd 100644 --- a/src/python/grpcio/grpc/_server.py +++ b/src/python/grpcio/grpc/_server.py @@ -705,6 +705,10 @@ def _serve(state): state.rpc_states.remove(rpc_state) if _stop_serving(state): return + # We want to force the deletion of the previous event + # ~before~ we poll again; if the event has a reference + # to a shutdown Call object, this can induce spinlock. + event = None def _stop(state, grace): From 9f4133080cebd9a9a6bbe00df5c20e6b29f79f53 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 28 Mar 2017 16:42:49 -0700 Subject: [PATCH 107/461] Allow resource quota overcommit --- src/core/lib/iomgr/resource_quota.c | 35 ++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/src/core/lib/iomgr/resource_quota.c b/src/core/lib/iomgr/resource_quota.c index 511ffdcdf13..3a0fd5d81ac 100644 --- a/src/core/lib/iomgr/resource_quota.c +++ b/src/core/lib/iomgr/resource_quota.c @@ -246,7 +246,8 @@ static void rulist_remove(grpc_resource_user *resource_user, grpc_rulist list) { */ static bool rq_alloc(grpc_exec_ctx *exec_ctx, - grpc_resource_quota *resource_quota); + grpc_resource_quota *resource_quota, + bool check_memory_usage); static bool rq_reclaim_from_per_user_free_pool( grpc_exec_ctx *exec_ctx, grpc_resource_quota *resource_quota); static bool rq_reclaim(grpc_exec_ctx *exec_ctx, @@ -256,11 +257,20 @@ static void rq_step(grpc_exec_ctx *exec_ctx, void *rq, grpc_error *error) { grpc_resource_quota *resource_quota = rq; resource_quota->step_scheduled = false; do { - if (rq_alloc(exec_ctx, resource_quota)) goto done; + if (rq_alloc(exec_ctx, resource_quota, false)) goto done; } while (rq_reclaim_from_per_user_free_pool(exec_ctx, resource_quota)); if (!rq_reclaim(exec_ctx, resource_quota, false)) { - rq_reclaim(exec_ctx, resource_quota, true); + if (!rq_reclaim(exec_ctx, resource_quota, true)) { + /* no reclaimation possible, but we've still got allocation requests: + start satisfying them without regard to memory utilization to avoid + infinitely stuck requests */ + gpr_log(GPR_DEBUG, + "ResourceQuota WARNING: allocating requests without free pool " + "available"); + while (!rq_alloc(exec_ctx, resource_quota, true)) + ; + } } done: @@ -286,15 +296,22 @@ static void rq_update_estimate(grpc_resource_quota *resource_quota) { MEMORY_USAGE_ESTIMATION_MAX)); } +static bool fits_pool(int64_t want, int64_t have, bool check) { + if (!check) return true; + return want <= have; +} + /* returns true if all allocations are completed */ static bool rq_alloc(grpc_exec_ctx *exec_ctx, - grpc_resource_quota *resource_quota) { + grpc_resource_quota *resource_quota, + bool check_memory_usage) { grpc_resource_user *resource_user; while ((resource_user = rulist_pop_head(resource_quota, GRPC_RULIST_AWAITING_ALLOCATION))) { gpr_mu_lock(&resource_user->mu); if (resource_user->free_pool < 0 && - -resource_user->free_pool <= resource_quota->free_pool) { + fits_pool(-resource_user->free_pool, resource_quota->free_pool, + check_memory_usage)) { int64_t amt = -resource_user->free_pool; resource_user->free_pool = 0; resource_quota->free_pool -= amt; @@ -314,6 +331,11 @@ static bool rq_alloc(grpc_exec_ctx *exec_ctx, grpc_closure_list_sched(exec_ctx, &resource_user->on_allocated); gpr_mu_unlock(&resource_user->mu); } else { + gpr_log(GPR_DEBUG, "RQ %s %s: delay alloc %" PRId64 + " bytes; rq_free_pool = %" PRId64, + resource_quota->name, resource_user->name, + -resource_user->free_pool, resource_quota->free_pool); + GPR_ASSERT(check_memory_usage); rulist_add_head(resource_user, GRPC_RULIST_AWAITING_ALLOCATION); gpr_mu_unlock(&resource_user->mu); return false; @@ -333,6 +355,9 @@ static bool rq_reclaim_from_per_user_free_pool( int64_t amt = resource_user->free_pool; resource_user->free_pool = 0; resource_quota->free_pool += amt; + if (resource_quota->free_pool > resource_quota->size) { + resource_quota->free_pool = resource_quota->size; + } rq_update_estimate(resource_quota); if (grpc_resource_quota_trace) { gpr_log(GPR_DEBUG, "RQ %s %s: reclaim_from_per_user_free_pool %" PRId64 From 484871bb03dc877a0bb84bbeab7614a1419d6e08 Mon Sep 17 00:00:00 2001 From: Ken Payson Date: Tue, 28 Mar 2017 18:00:33 -0700 Subject: [PATCH 108/461] Bump version to 1.2.1 --- CMakeLists.txt | 2 +- Makefile | 4 ++-- build.yaml | 2 +- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.json | 2 +- package.xml | 4 ++-- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Auth/project.json | 4 ++-- src/csharp/Grpc.Core.Testing/project.json | 4 ++-- src/csharp/Grpc.Core/VersionInfo.cs | 2 +- src/csharp/Grpc.Core/project.json | 2 +- src/csharp/Grpc.HealthCheck/project.json | 4 ++-- src/csharp/Grpc.Reflection/project.json | 4 ++-- src/csharp/build_packages_dotnetcli.bat | 2 +- src/csharp/build_packages_dotnetcli.sh | 4 ++-- src/node/health_check/package.json | 4 ++-- src/node/tools/package.json | 2 +- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/private/version.h | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- 31 files changed, 39 insertions(+), 39 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1543140c0aa..f9ca86266bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,7 @@ cmake_minimum_required(VERSION 2.8) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.2.1-pre2") +set(PACKAGE_VERSION "1.2.1") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index 041e4f5c7c5..5655ae36858 100644 --- a/Makefile +++ b/Makefile @@ -412,8 +412,8 @@ Q = @ endif CORE_VERSION = 3.0.0-dev -CPP_VERSION = 1.2.1-pre2 -CSHARP_VERSION = 1.2.1-pre2 +CPP_VERSION = 1.2.1 +CSHARP_VERSION = 1.2.1 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/build.yaml b/build.yaml index 49d64bd1da0..1c3a23bf6b7 100644 --- a/build.yaml +++ b/build.yaml @@ -14,7 +14,7 @@ settings: '#10': See the expand_version.py for all the quirks here core_version: 3.0.0-dev g_stands_for: green - version: 1.2.1-pre2 + version: 1.2.1 filegroups: - name: census public_headers: diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index fe1f3e008b8..585713c0e61 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -37,7 +37,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.2.1-pre2' + version = '1.2.1' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'http://www.grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index b5c172ee82e..cc9817a02a9 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -36,7 +36,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.2.1-pre2' + version = '1.2.1' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'http://www.grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index 6c2736cd78e..e631ee5104a 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -36,7 +36,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.2.1-pre2' + version = '1.2.1' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'http://www.grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index 7031b3d1449..ea78d5f91ea 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -35,7 +35,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.2.1-pre2' + version = '1.2.1' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'http://www.grpc.io' diff --git a/package.json b/package.json index e75dfa88206..31846bf2e79 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grpc", - "version": "1.2.1-pre2", + "version": "1.2.1", "author": "Google Inc.", "description": "gRPC Library for Node", "homepage": "http://www.grpc.io/", diff --git a/package.xml b/package.xml index 44a15c23a96..24a0bf01a8b 100644 --- a/package.xml +++ b/package.xml @@ -13,8 +13,8 @@ 2017-03-01 - 1.2.1RC2 - 1.2.1RC2 + 1.2.1 + 1.2.1 beta diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index 593e17e7706..5cac8cdf781 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -37,5 +37,5 @@ #include namespace grpc { -grpc::string Version() { return "1.2.1-pre2"; } +grpc::string Version() { return "1.2.1"; } } diff --git a/src/csharp/Grpc.Auth/project.json b/src/csharp/Grpc.Auth/project.json index 6345946c39c..66b3fa93d6a 100644 --- a/src/csharp/Grpc.Auth/project.json +++ b/src/csharp/Grpc.Auth/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.1-pre2", + "version": "1.2.1", "title": "gRPC C# Auth", "authors": [ "Google Inc." ], "copyright": "Copyright 2015, Google Inc.", @@ -21,7 +21,7 @@ } }, "dependencies": { - "Grpc.Core": "1.2.1-pre2", + "Grpc.Core": "1.2.1", "Google.Apis.Auth": "1.21.0" }, "frameworks": { diff --git a/src/csharp/Grpc.Core.Testing/project.json b/src/csharp/Grpc.Core.Testing/project.json index 7337e2d15a8..c4e015f4186 100644 --- a/src/csharp/Grpc.Core.Testing/project.json +++ b/src/csharp/Grpc.Core.Testing/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.1-pre2", + "version": "1.2.1", "title": "gRPC C# Core Testing", "authors": [ "Google Inc." ], "copyright": "Copyright 2017, Google Inc.", @@ -21,7 +21,7 @@ } }, "dependencies": { - "Grpc.Core": "1.2.1-pre2" + "Grpc.Core": "1.2.1" }, "frameworks": { "net45": { diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs index 976508dfac2..42881c9f065 100644 --- a/src/csharp/Grpc.Core/VersionInfo.cs +++ b/src/csharp/Grpc.Core/VersionInfo.cs @@ -53,6 +53,6 @@ namespace Grpc.Core /// /// Current version of gRPC C# /// - public const string CurrentVersion = "1.2.1-pre2"; + public const string CurrentVersion = "1.2.1"; } } diff --git a/src/csharp/Grpc.Core/project.json b/src/csharp/Grpc.Core/project.json index d0eb7759782..f9f617772a8 100644 --- a/src/csharp/Grpc.Core/project.json +++ b/src/csharp/Grpc.Core/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.1-pre2", + "version": "1.2.1", "title": "gRPC C# Core", "authors": [ "Google Inc." ], "copyright": "Copyright 2015, Google Inc.", diff --git a/src/csharp/Grpc.HealthCheck/project.json b/src/csharp/Grpc.HealthCheck/project.json index ff5429dba6b..0a564fde5af 100644 --- a/src/csharp/Grpc.HealthCheck/project.json +++ b/src/csharp/Grpc.HealthCheck/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.1-pre2", + "version": "1.2.1", "title": "gRPC C# Healthchecking", "authors": [ "Google Inc." ], "copyright": "Copyright 2015, Google Inc.", @@ -21,7 +21,7 @@ } }, "dependencies": { - "Grpc.Core": "1.2.1-pre2", + "Grpc.Core": "1.2.1", "Google.Protobuf": "3.2.0" }, "frameworks": { diff --git a/src/csharp/Grpc.Reflection/project.json b/src/csharp/Grpc.Reflection/project.json index ac7696e9074..ac948d45f04 100644 --- a/src/csharp/Grpc.Reflection/project.json +++ b/src/csharp/Grpc.Reflection/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.1-pre2", + "version": "1.2.1", "title": "gRPC C# Reflection", "authors": [ "Google Inc." ], "copyright": "Copyright 2016, Google Inc.", @@ -21,7 +21,7 @@ } }, "dependencies": { - "Grpc.Core": "1.2.1-pre2", + "Grpc.Core": "1.2.1", "Google.Protobuf": "3.2.0" }, "frameworks": { diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat index 8a6f22f1fa3..da6556dc27e 100755 --- a/src/csharp/build_packages_dotnetcli.bat +++ b/src/csharp/build_packages_dotnetcli.bat @@ -28,7 +28,7 @@ @rem OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @rem Current package versions -set VERSION=1.2.1-pre2 +set VERSION=1.2.1 set PROTOBUF_VERSION=3.0.0 @rem Adjust the location of nuget.exe diff --git a/src/csharp/build_packages_dotnetcli.sh b/src/csharp/build_packages_dotnetcli.sh index 56e24de1993..c0d58d667a9 100755 --- a/src/csharp/build_packages_dotnetcli.sh +++ b/src/csharp/build_packages_dotnetcli.sh @@ -66,7 +66,7 @@ dotnet pack --configuration Release Grpc.Auth/project.json --output ../../artifa dotnet pack --configuration Release Grpc.HealthCheck/project.json --output ../../artifacts dotnet pack --configuration Release Grpc.Reflection/project.json --output ../../artifacts -nuget pack Grpc.nuspec -Version "1.2.1-pre2" -OutputDirectory ../../artifacts -nuget pack Grpc.Tools.nuspec -Version "1.2.1-pre2" -OutputDirectory ../../artifacts +nuget pack Grpc.nuspec -Version "1.2.1" -OutputDirectory ../../artifacts +nuget pack Grpc.Tools.nuspec -Version "1.2.1" -OutputDirectory ../../artifacts (cd ../../artifacts && zip csharp_nugets_dotnetcli.zip *.nupkg) diff --git a/src/node/health_check/package.json b/src/node/health_check/package.json index 630b3cba006..177b27b9112 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.2.1-pre2", + "version": "1.2.1", "author": "Google Inc.", "description": "Health check service for use with gRPC", "repository": { @@ -15,7 +15,7 @@ } ], "dependencies": { - "grpc": "^1.2.1-pre2", + "grpc": "^1.2.1", "lodash": "^3.9.3", "google-protobuf": "^3.0.0" }, diff --git a/src/node/tools/package.json b/src/node/tools/package.json index 98863c1d776..5867db6bb9b 100644 --- a/src/node/tools/package.json +++ b/src/node/tools/package.json @@ -1,6 +1,6 @@ { "name": "grpc-tools", - "version": "1.2.1-pre2", + "version": "1.2.1", "author": "Google Inc.", "description": "Tools for developing with gRPC on Node.js", "homepage": "http://www.grpc.io/", diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index 636b9f792aa..226e36fd866 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.2.1-pre2' + v = '1.2.1' 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 9339adce431..60866a078af 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -38,4 +38,4 @@ // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.2.1-pre2" +#define GRPC_OBJC_VERSION_STRING @"1.2.1" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index 418ca993bc7..330c20dd8f3 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION='1.2.1rc2' +VERSION='1.2.1' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index 00b7680a0f5..c06086d5b8c 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION='1.2.1rc2' +VERSION='1.2.1' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index cf42d123ae3..f774e403f50 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION='1.2.1rc2' +VERSION='1.2.1' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index acd2b85c95e..9a1a472afcc 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION='1.2.1rc2' +VERSION='1.2.1' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index 7d54034a298..3ee48ae328f 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -29,5 +29,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.2.1.pre2' + VERSION = '1.2.1' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index d6a7be76efa..d037014852f 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -29,6 +29,6 @@ module GRPC module Tools - VERSION = '1.2.1.pre2' + VERSION = '1.2.1' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index fede4440800..e125d189220 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION='1.2.1rc2' +VERSION='1.2.1' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 13734e8d76a..4d427640503 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.2.1-pre2 +PROJECT_NUMBER = 1.2.1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index dfef610a00b..8e5730a0d32 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.2.1-pre2 +PROJECT_NUMBER = 1.2.1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a From 72240e1c1b42c32eb40de8803a120a8c72ec8e43 Mon Sep 17 00:00:00 2001 From: Ken Payson Date: Tue, 28 Mar 2017 18:19:46 -0700 Subject: [PATCH 109/461] Update BUILD file --- BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD b/BUILD index faaef5198ab..0c6daee4bb8 100644 --- a/BUILD +++ b/BUILD @@ -41,7 +41,7 @@ g_stands_for = "green" core_version = "3.0.0-dev" -version = "1.2.1-pre2" +version = "1.2.1" grpc_cc_library( name = "gpr", From d89bf42e205c2011127d46de399400fb55d9916a Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 29 Mar 2017 09:05:36 -0700 Subject: [PATCH 110/461] Revert "Allow resource quota overcommit" This reverts commit 9f4133080cebd9a9a6bbe00df5c20e6b29f79f53. --- src/core/lib/iomgr/resource_quota.c | 35 +++++------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/src/core/lib/iomgr/resource_quota.c b/src/core/lib/iomgr/resource_quota.c index 3a0fd5d81ac..511ffdcdf13 100644 --- a/src/core/lib/iomgr/resource_quota.c +++ b/src/core/lib/iomgr/resource_quota.c @@ -246,8 +246,7 @@ static void rulist_remove(grpc_resource_user *resource_user, grpc_rulist list) { */ static bool rq_alloc(grpc_exec_ctx *exec_ctx, - grpc_resource_quota *resource_quota, - bool check_memory_usage); + grpc_resource_quota *resource_quota); static bool rq_reclaim_from_per_user_free_pool( grpc_exec_ctx *exec_ctx, grpc_resource_quota *resource_quota); static bool rq_reclaim(grpc_exec_ctx *exec_ctx, @@ -257,20 +256,11 @@ static void rq_step(grpc_exec_ctx *exec_ctx, void *rq, grpc_error *error) { grpc_resource_quota *resource_quota = rq; resource_quota->step_scheduled = false; do { - if (rq_alloc(exec_ctx, resource_quota, false)) goto done; + if (rq_alloc(exec_ctx, resource_quota)) goto done; } while (rq_reclaim_from_per_user_free_pool(exec_ctx, resource_quota)); if (!rq_reclaim(exec_ctx, resource_quota, false)) { - if (!rq_reclaim(exec_ctx, resource_quota, true)) { - /* no reclaimation possible, but we've still got allocation requests: - start satisfying them without regard to memory utilization to avoid - infinitely stuck requests */ - gpr_log(GPR_DEBUG, - "ResourceQuota WARNING: allocating requests without free pool " - "available"); - while (!rq_alloc(exec_ctx, resource_quota, true)) - ; - } + rq_reclaim(exec_ctx, resource_quota, true); } done: @@ -296,22 +286,15 @@ static void rq_update_estimate(grpc_resource_quota *resource_quota) { MEMORY_USAGE_ESTIMATION_MAX)); } -static bool fits_pool(int64_t want, int64_t have, bool check) { - if (!check) return true; - return want <= have; -} - /* returns true if all allocations are completed */ static bool rq_alloc(grpc_exec_ctx *exec_ctx, - grpc_resource_quota *resource_quota, - bool check_memory_usage) { + grpc_resource_quota *resource_quota) { grpc_resource_user *resource_user; while ((resource_user = rulist_pop_head(resource_quota, GRPC_RULIST_AWAITING_ALLOCATION))) { gpr_mu_lock(&resource_user->mu); if (resource_user->free_pool < 0 && - fits_pool(-resource_user->free_pool, resource_quota->free_pool, - check_memory_usage)) { + -resource_user->free_pool <= resource_quota->free_pool) { int64_t amt = -resource_user->free_pool; resource_user->free_pool = 0; resource_quota->free_pool -= amt; @@ -331,11 +314,6 @@ static bool rq_alloc(grpc_exec_ctx *exec_ctx, grpc_closure_list_sched(exec_ctx, &resource_user->on_allocated); gpr_mu_unlock(&resource_user->mu); } else { - gpr_log(GPR_DEBUG, "RQ %s %s: delay alloc %" PRId64 - " bytes; rq_free_pool = %" PRId64, - resource_quota->name, resource_user->name, - -resource_user->free_pool, resource_quota->free_pool); - GPR_ASSERT(check_memory_usage); rulist_add_head(resource_user, GRPC_RULIST_AWAITING_ALLOCATION); gpr_mu_unlock(&resource_user->mu); return false; @@ -355,9 +333,6 @@ static bool rq_reclaim_from_per_user_free_pool( int64_t amt = resource_user->free_pool; resource_user->free_pool = 0; resource_quota->free_pool += amt; - if (resource_quota->free_pool > resource_quota->size) { - resource_quota->free_pool = resource_quota->size; - } rq_update_estimate(resource_quota); if (grpc_resource_quota_trace) { gpr_log(GPR_DEBUG, "RQ %s %s: reclaim_from_per_user_free_pool %" PRId64 From 9a7bab5b76413f49fdeb35a2d40021ca3a0bdf04 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Wed, 29 Mar 2017 11:51:25 -0700 Subject: [PATCH 111/461] Core version bump to 4.0.0 --- Makefile | 48 ++++++++++++++-------------- build.yaml | 2 +- build_config.rb | 2 +- src/core/lib/surface/version.c | 2 +- tools/doxygen/Doxyfile.core | 2 +- tools/doxygen/Doxyfile.core.internal | 2 +- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Makefile b/Makefile index bfc43aab28e..94f5a8fd75a 100644 --- a/Makefile +++ b/Makefile @@ -411,7 +411,7 @@ E = @echo Q = @ endif -CORE_VERSION = 3.0.0-dev +CORE_VERSION = 4.0.0-dev CPP_VERSION = 1.3.0-dev CSHARP_VERSION = 1.3.0-dev @@ -461,7 +461,7 @@ SHARED_EXT_CORE = dll SHARED_EXT_CPP = dll SHARED_EXT_CSHARP = dll SHARED_PREFIX = -SHARED_VERSION_CORE = -3 +SHARED_VERSION_CORE = -4 SHARED_VERSION_CPP = -1 SHARED_VERSION_CSHARP = -1 else ifeq ($(SYSTEM),Darwin) @@ -2510,7 +2510,7 @@ install-shared_c: shared_c strip-shared_c install-pkg-config_c ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE)-dll.a $(prefix)/lib/libgpr.a else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgpr.so.3 + $(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgpr.so.4 $(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgpr.so endif $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)" @@ -2519,7 +2519,7 @@ endif ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE)-dll.a $(prefix)/lib/libgrpc.a else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc.so.3 + $(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc.so.4 $(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc.so endif $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)" @@ -2528,7 +2528,7 @@ endif ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE)-dll.a $(prefix)/lib/libgrpc_cronet.a else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc_cronet.so.3 + $(Q) ln -sf $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc_cronet.so.4 $(Q) ln -sf $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc_cronet.so endif $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)" @@ -2537,7 +2537,7 @@ endif ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE)-dll.a $(prefix)/lib/libgrpc_unsecure.a else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc_unsecure.so.3 + $(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc_unsecure.so.4 $(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(prefix)/lib/libgrpc_unsecure.so endif ifneq ($(SYSTEM),MINGW32) @@ -2554,7 +2554,7 @@ install-shared_cxx: shared_cxx strip-shared_cxx install-shared_c install-pkg-con ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP)-dll.a $(prefix)/lib/libgrpc++.a else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++.so.3 + $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++.so.4 $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++.so endif $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" @@ -2563,7 +2563,7 @@ endif ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP)-dll.a $(prefix)/lib/libgrpc++_cronet.a else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_cronet.so.3 + $(Q) ln -sf $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_cronet.so.4 $(Q) ln -sf $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_cronet.so endif $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" @@ -2572,7 +2572,7 @@ endif ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP)-dll.a $(prefix)/lib/libgrpc++_reflection.a else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_reflection.so.3 + $(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_reflection.so.4 $(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_reflection.so endif $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" @@ -2581,7 +2581,7 @@ endif ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP)-dll.a $(prefix)/lib/libgrpc++_unsecure.a else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_unsecure.so.3 + $(Q) ln -sf $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_unsecure.so.4 $(Q) ln -sf $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_unsecure.so endif ifneq ($(SYSTEM),MINGW32) @@ -2598,7 +2598,7 @@ install-shared_csharp: shared_csharp strip-shared_csharp ifeq ($(SYSTEM),MINGW32) $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP)-dll.a $(prefix)/lib/libgrpc_csharp_ext.a else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(prefix)/lib/libgrpc_csharp_ext.so.3 + $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(prefix)/lib/libgrpc_csharp_ext.so.4 $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(prefix)/lib/libgrpc_csharp_ext.so endif ifneq ($(SYSTEM),MINGW32) @@ -2764,8 +2764,8 @@ $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGPR_OB ifeq ($(SYSTEM),Darwin) $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGPR_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBS) else - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgpr.so.3 -o $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGPR_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBS) - $(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).so.3 + $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgpr.so.4 -o $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGPR_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBS) + $(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).so.4 $(Q) ln -sf $(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgpr$(SHARED_VERSION_CORE).so endif endif @@ -3104,8 +3104,8 @@ $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(LIBGRPC_ ifeq ($(SYSTEM),Darwin) $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBS) else - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc.so.3 -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBS) - $(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).so.3 + $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc.so.4 -o $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBS) + $(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).so.4 $(Q) ln -sf $(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc$(SHARED_VERSION_CORE).so endif endif @@ -3392,8 +3392,8 @@ $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $(L ifeq ($(SYSTEM),Darwin) $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_CRONET_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBS) else - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_cronet.so.3 -o $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_CRONET_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBS) - $(Q) ln -sf $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).so.3 + $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_cronet.so.4 -o $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_CRONET_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBS) + $(Q) ln -sf $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).so.4 $(Q) ln -sf $(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_cronet$(SHARED_VERSION_CORE).so endif endif @@ -3921,8 +3921,8 @@ $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE): $ ifeq ($(SYSTEM),Darwin) $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBS) else - $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_unsecure.so.3 -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBS) - $(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).so.3 + $(Q) $(LD) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_unsecure.so.4 -o $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBGRPC_UNSECURE_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBS) + $(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).so.4 $(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure$(SHARED_VERSION_CORE).so endif endif @@ -4198,7 +4198,7 @@ $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC+ ifeq ($(SYSTEM),Darwin) $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgrpc else - $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++.so.3 -o $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgrpc + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++.so.4 -o $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgrpc $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).so.1 $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++$(SHARED_VERSION_CPP).so endif @@ -4596,7 +4596,7 @@ $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(L ifeq ($(SYSTEM),Darwin) $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_CRONET_OBJS) $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgpr -lgrpc_cronet else - $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_cronet.so.3 -o $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_CRONET_OBJS) $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgpr -lgrpc_cronet + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_cronet.so.4 -o $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_CRONET_OBJS) $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgpr -lgrpc_cronet $(Q) ln -sf $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).so.1 $(Q) ln -sf $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_cronet$(SHARED_VERSION_CPP).so endif @@ -4719,7 +4719,7 @@ $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): ifeq ($(SYSTEM),Darwin) $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_REFLECTION_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgrpc++ else - $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_reflection.so.3 -o $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_REFLECTION_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgrpc++ + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_reflection.so.4 -o $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_REFLECTION_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgrpc++ $(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP).so.1 $(Q) ln -sf $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection$(SHARED_VERSION_CPP).so endif @@ -5077,7 +5077,7 @@ $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $ ifeq ($(SYSTEM),Darwin) $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_UNSECURE_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgpr -lgrpc_unsecure else - $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_unsecure.so.3 -o $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_UNSECURE_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgpr -lgrpc_unsecure + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_unsecure.so.4 -o $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_UNSECURE_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgpr -lgrpc_unsecure $(Q) ln -sf $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP).so.1 $(Q) ln -sf $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure$(SHARED_VERSION_CPP).so endif @@ -5667,7 +5667,7 @@ $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHA ifeq ($(SYSTEM),Darwin) $(Q) $(LD) $(LDFLAGS) $(if $(subst Linux,,$(SYSTEM)),,-Wl$(comma)-wrap$(comma)memcpy) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBGRPC_CSHARP_EXT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBS) else - $(Q) $(LD) $(LDFLAGS) $(if $(subst Linux,,$(SYSTEM)),,-Wl$(comma)-wrap$(comma)memcpy) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_csharp_ext.so.3 -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBGRPC_CSHARP_EXT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBS) + $(Q) $(LD) $(LDFLAGS) $(if $(subst Linux,,$(SYSTEM)),,-Wl$(comma)-wrap$(comma)memcpy) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc_csharp_ext.so.4 -o $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBGRPC_CSHARP_EXT_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBS) $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).so.1 $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext$(SHARED_VERSION_CSHARP).so endif diff --git a/build.yaml b/build.yaml index 6e590f4ca6b..5b701a8dd3e 100644 --- a/build.yaml +++ b/build.yaml @@ -12,7 +12,7 @@ settings: '#08': Use "-preN" suffixes to identify pre-release versions '#09': Per-language overrides are possible with (eg) ruby_version tag here '#10': See the expand_version.py for all the quirks here - core_version: 3.0.0-dev + core_version: 4.0.0-dev g_stands_for: gentle version: 1.3.0-dev filegroups: diff --git a/build_config.rb b/build_config.rb index b5a8c2020ba..9a69070dc71 100644 --- a/build_config.rb +++ b/build_config.rb @@ -28,5 +28,5 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. module GrpcBuildConfig - CORE_WINDOWS_DLL = '/tmp/libs/opt/grpc-3.dll' + CORE_WINDOWS_DLL = '/tmp/libs/opt/grpc-4.dll' end diff --git a/src/core/lib/surface/version.c b/src/core/lib/surface/version.c index ba80bd801ee..3793845559c 100644 --- a/src/core/lib/surface/version.c +++ b/src/core/lib/surface/version.c @@ -36,6 +36,6 @@ #include -const char *grpc_version_string(void) { return "3.0.0-dev"; } +const char *grpc_version_string(void) { return "4.0.0-dev"; } const char *grpc_g_stands_for(void) { return "gentle"; } diff --git a/tools/doxygen/Doxyfile.core b/tools/doxygen/Doxyfile.core index 272bb4cebf3..c796f10fc6a 100644 --- a/tools/doxygen/Doxyfile.core +++ b/tools/doxygen/Doxyfile.core @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Core" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 3.0.0-dev +PROJECT_NUMBER = 4.0.0-dev # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index d09ddaa04dc..8d9898ab666 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Core" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 3.0.0-dev +PROJECT_NUMBER = 4.0.0-dev # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a From b58de7238981dc5fa3a18db4941bddca75c0d521 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 29 Mar 2017 14:15:12 -0700 Subject: [PATCH 112/461] Lazily allocate batch control objects --- src/core/lib/surface/call.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 50ddbc92aa4..03b1fbf11aa 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -163,7 +163,7 @@ struct grpc_call { /* have we received initial metadata */ bool has_initial_md_been_received; - batch_control active_batches[MAX_CONCURRENT_BATCHES]; + batch_control *active_batches[MAX_CONCURRENT_BATCHES]; grpc_transport_stream_op_payload stream_op_payload; /* first idx: is_receiving, second idx: is_trailing */ @@ -1022,7 +1022,11 @@ static batch_control *allocate_batch_control(grpc_call *call, const grpc_op *ops, size_t num_ops) { int slot = batch_slot_for_op(ops[0].op); - batch_control *bctl = &call->active_batches[slot]; + batch_control **pslot = &call->active_batches[slot]; + if (*pslot == NULL) { + *pslot = gpr_arena_alloc(call->arena, sizeof(batch_control)); + } + batch_control *bctl = *pslot; if (bctl->call != NULL) { return NULL; } From 1c10a7b3b4330244ab038ab6985247ffb4a62836 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 29 Mar 2017 14:35:16 -0700 Subject: [PATCH 113/461] Lazily track parenting --- src/core/lib/surface/call.c | 135 ++++++++++++++++++++++-------------- 1 file changed, 84 insertions(+), 51 deletions(-) diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 50ddbc92aa4..946ad1b83ed 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -133,16 +133,28 @@ typedef struct batch_control { grpc_transport_stream_op op; } batch_control; +typedef struct { + gpr_mu child_list_mu; + grpc_call *first_child; +} parent_call; + +typedef struct { + grpc_call *parent; + /** siblings: children of the same parent form a list, and this list is + protected under + parent->mu */ + grpc_call *sibling_next; + grpc_call *sibling_prev; +} child_call; + struct grpc_call { gpr_arena *arena; grpc_completion_queue *cq; grpc_polling_entity pollent; grpc_channel *channel; - grpc_call *parent; - grpc_call *first_child; gpr_timespec start_time; - /* protects first_child, and child next/prev links */ - gpr_mu child_list_mu; + /* parent_call* */ gpr_atm parent_call_atm; + child_call *child_call; /* client or server call */ bool is_client; @@ -194,12 +206,6 @@ struct grpc_call { int send_extra_metadata_count; gpr_timespec send_deadline; - /** siblings: children of the same parent form a list, and this list is - protected under - parent->mu */ - grpc_call *sibling_next; - grpc_call *sibling_prev; - grpc_slice_buffer_stream sending_stream; grpc_byte_stream *receiving_stream; @@ -264,6 +270,23 @@ static void add_init_error(grpc_error **composite, grpc_error *new) { *composite = grpc_error_add_child(*composite, new); } +static parent_call *get_or_create_parent_call(grpc_call *call) { + parent_call *p = (parent_call *)gpr_atm_acq_load(&call->parent_call_atm); + if (p == NULL) { + p = gpr_arena_alloc(call->arena, sizeof(*p)); + gpr_mu_init(&p->child_list_mu); + if (!gpr_atm_rel_cas(&call->parent_call_atm, (gpr_atm)NULL, (gpr_atm)p)) { + gpr_mu_destroy(&p->child_list_mu); + p = (parent_call *)gpr_atm_acq_load(&call->parent_call_atm); + } + } + return p; +} + +static parent_call *get_parent_call(grpc_call *call) { + return (parent_call *)gpr_atm_acq_load(&call->parent_call_atm); +} + grpc_error *grpc_call_create(grpc_exec_ctx *exec_ctx, const grpc_call_create_args *args, grpc_call **out_call) { @@ -279,10 +302,8 @@ grpc_error *grpc_call_create(grpc_exec_ctx *exec_ctx, sizeof(grpc_call) + channel_stack->call_stack_size); call->arena = arena; *out_call = call; - gpr_mu_init(&call->child_list_mu); call->channel = args->channel; call->cq = args->cq; - call->parent = args->parent_call; call->start_time = gpr_now(GPR_CLOCK_MONOTONIC); /* Always support no compression */ GPR_BITSET(&call->encodings_accepted_by_peer, GRPC_COMPRESS_NONE); @@ -314,11 +335,17 @@ grpc_error *grpc_call_create(grpc_exec_ctx *exec_ctx, gpr_convert_clock_type(args->send_deadline, GPR_CLOCK_MONOTONIC); if (args->parent_call != NULL) { + child_call *cc = call->child_call = + gpr_arena_alloc(arena, sizeof(child_call)); + call->child_call->parent = args->parent_call; + GRPC_CALL_INTERNAL_REF(args->parent_call, "child"); GPR_ASSERT(call->is_client); GPR_ASSERT(!args->parent_call->is_client); - gpr_mu_lock(&args->parent_call->child_list_mu); + parent_call *pc = get_or_create_parent_call(args->parent_call); + + gpr_mu_lock(&pc->child_list_mu); if (args->propagation_mask & GRPC_PROPAGATE_DEADLINE) { send_deadline = gpr_time_min( @@ -352,17 +379,17 @@ grpc_error *grpc_call_create(grpc_exec_ctx *exec_ctx, } } - if (args->parent_call->first_child == NULL) { - args->parent_call->first_child = call; - call->sibling_next = call->sibling_prev = call; + if (pc->first_child == NULL) { + pc->first_child = call; + cc->sibling_next = cc->sibling_prev = call; } else { - call->sibling_next = args->parent_call->first_child; - call->sibling_prev = args->parent_call->first_child->sibling_prev; - call->sibling_next->sibling_prev = call->sibling_prev->sibling_next = - call; + cc->sibling_next = pc->first_child; + cc->sibling_prev = pc->first_child->child_call->sibling_prev; + cc->sibling_next->child_call->sibling_prev = + cc->sibling_prev->child_call->sibling_next = call; } - gpr_mu_unlock(&args->parent_call->child_list_mu); + gpr_mu_unlock(&pc->child_list_mu); } call->send_deadline = send_deadline; @@ -457,7 +484,10 @@ static void destroy_call(grpc_exec_ctx *exec_ctx, void *call, if (c->receiving_stream != NULL) { grpc_byte_stream_destroy(exec_ctx, c->receiving_stream); } - gpr_mu_destroy(&c->child_list_mu); + parent_call *pc = get_parent_call(c); + if (pc != NULL) { + gpr_mu_destroy(&pc->child_list_mu); + } for (ii = 0; ii < c->send_extra_metadata_count; ii++) { GRPC_MDELEM_UNREF(exec_ctx, c->send_extra_metadata[ii].md); } @@ -487,31 +517,31 @@ static void destroy_call(grpc_exec_ctx *exec_ctx, void *call, } void grpc_call_destroy(grpc_call *c) { - int cancel; - grpc_call *parent = c->parent; + parent_call *pc = get_parent_call(c); + child_call *cc = c->child_call; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; GPR_TIMER_BEGIN("grpc_call_destroy", 0); GRPC_API_TRACE("grpc_call_destroy(c=%p)", 1, (c)); - if (parent) { - gpr_mu_lock(&parent->child_list_mu); - if (c == parent->first_child) { - parent->first_child = c->sibling_next; - if (c == parent->first_child) { - parent->first_child = NULL; + if (pc) { + gpr_mu_lock(&pc->child_list_mu); + if (c == pc->first_child) { + pc->first_child = cc->sibling_next; + if (c == pc->first_child) { + pc->first_child = NULL; } - c->sibling_prev->sibling_next = c->sibling_next; - c->sibling_next->sibling_prev = c->sibling_prev; } - gpr_mu_unlock(&parent->child_list_mu); - GRPC_CALL_INTERNAL_UNREF(&exec_ctx, parent, "child"); + cc->sibling_prev->child_call->sibling_next = cc->sibling_next; + cc->sibling_next->child_call->sibling_prev = cc->sibling_prev; + gpr_mu_unlock(&pc->child_list_mu); + GRPC_CALL_INTERNAL_UNREF(&exec_ctx, cc->parent, "child"); } GPR_ASSERT(!c->destroy_called); c->destroy_called = 1; - cancel = gpr_atm_acq_load(&c->any_ops_sent_atm) && - !gpr_atm_acq_load(&c->received_final_op_atm); + bool cancel = gpr_atm_acq_load(&c->any_ops_sent_atm) != 0 && + gpr_atm_acq_load(&c->received_final_op_atm) == 0; if (cancel) { cancel_with_error(&exec_ctx, c, STATUS_FROM_API_OVERRIDE, GRPC_ERROR_CANCELLED); @@ -1063,7 +1093,6 @@ static grpc_error *consolidate_batch_errors(batch_control *bctl) { static void post_batch_completion(grpc_exec_ctx *exec_ctx, batch_control *bctl) { - grpc_call *child_call; grpc_call *next_child_call; grpc_call *call = bctl->call; grpc_error *error = consolidate_batch_errors(bctl); @@ -1088,21 +1117,25 @@ static void post_batch_completion(grpc_exec_ctx *exec_ctx, /* propagate cancellation to any interested children */ gpr_atm_rel_store(&call->received_final_op_atm, 1); - gpr_mu_lock(&call->child_list_mu); - child_call = call->first_child; - if (child_call != NULL) { - do { - next_child_call = child_call->sibling_next; - if (child_call->cancellation_is_inherited) { - GRPC_CALL_INTERNAL_REF(child_call, "propagate_cancel"); - cancel_with_error(exec_ctx, child_call, STATUS_FROM_API_OVERRIDE, - GRPC_ERROR_CANCELLED); - GRPC_CALL_INTERNAL_UNREF(exec_ctx, child_call, "propagate_cancel"); - } - child_call = next_child_call; - } while (child_call != call->first_child); + parent_call *pc = get_parent_call(call); + if (pc != NULL) { + grpc_call *child; + gpr_mu_lock(&pc->child_list_mu); + child = pc->first_child; + if (child != NULL) { + do { + next_child_call = child->child_call->sibling_next; + if (child->cancellation_is_inherited) { + GRPC_CALL_INTERNAL_REF(child, "propagate_cancel"); + cancel_with_error(exec_ctx, child, STATUS_FROM_API_OVERRIDE, + GRPC_ERROR_CANCELLED); + GRPC_CALL_INTERNAL_UNREF(exec_ctx, child, "propagate_cancel"); + } + child = next_child_call; + } while (child != pc->first_child); + } + gpr_mu_unlock(&pc->child_list_mu); } - gpr_mu_unlock(&call->child_list_mu); if (call->is_client) { get_final_status(call, set_status_value_directly, From 561c703afc0e57bae50878394c7c2d9adb15d0ce Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 30 Mar 2017 20:22:31 +0200 Subject: [PATCH 114/461] fix msvc_static_runtime.cmake --- cmake/msvc_static_runtime.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/msvc_static_runtime.cmake b/cmake/msvc_static_runtime.cmake index 5a31ab3d242..fc6d1d62d32 100644 --- a/cmake/msvc_static_runtime.cmake +++ b/cmake/msvc_static_runtime.cmake @@ -3,6 +3,8 @@ option(gRPC_MSVC_STATIC_RUNTIME "Link with static msvc runtime libraries" OFF) if(gRPC_MSVC_STATIC_RUNTIME) # switch from dynamic to static linking of msvcrt foreach(flag_var + CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE + CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) From d9a776d4bbf9e8d3989c818c1acce8c61284289a Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 30 Mar 2017 12:37:11 -0700 Subject: [PATCH 115/461] Clamp read sizes based on resource quota --- src/core/lib/iomgr/resource_quota.c | 9 +++++++++ src/core/lib/iomgr/resource_quota.h | 2 ++ src/core/lib/iomgr/tcp_posix.c | 19 +++++++++++++------ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/core/lib/iomgr/resource_quota.c b/src/core/lib/iomgr/resource_quota.c index 8dcd80d0011..c3ee8786517 100644 --- a/src/core/lib/iomgr/resource_quota.c +++ b/src/core/lib/iomgr/resource_quota.c @@ -142,6 +142,8 @@ struct grpc_resource_quota { /* Amount of free memory in the resource quota */ int64_t free_pool; + gpr_atm last_size; + /* Has rq_step been scheduled to occur? */ bool step_scheduled; /* Are we currently reclaiming memory */ @@ -581,6 +583,7 @@ grpc_resource_quota *grpc_resource_quota_create(const char *name) { resource_quota->combiner = grpc_combiner_create(NULL); resource_quota->free_pool = INT64_MAX; resource_quota->size = INT64_MAX; + gpr_atm_no_barrier_store(&resource_quota->last_size, GPR_ATM_MAX); resource_quota->step_scheduled = false; resource_quota->reclaiming = false; gpr_atm_no_barrier_store(&resource_quota->memory_usage_estimation, 0); @@ -643,11 +646,17 @@ void grpc_resource_quota_resize(grpc_resource_quota *resource_quota, rq_resize_args *a = gpr_malloc(sizeof(*a)); a->resource_quota = grpc_resource_quota_ref_internal(resource_quota); a->size = (int64_t)size; + gpr_atm_no_barrier_store(&resource_quota->last_size, + (gpr_atm)GPR_MIN((size_t)GPR_ATM_MAX, size)); grpc_closure_init(&a->closure, rq_resize, a, grpc_schedule_on_exec_ctx); grpc_closure_sched(&exec_ctx, &a->closure, GRPC_ERROR_NONE); grpc_exec_ctx_finish(&exec_ctx); } +size_t grpc_resource_quota_peek_size(grpc_resource_quota *resource_quota) { + return (size_t)gpr_atm_no_barrier_load(&resource_quota->last_size); +} + /******************************************************************************* * grpc_resource_user channel args api */ diff --git a/src/core/lib/iomgr/resource_quota.h b/src/core/lib/iomgr/resource_quota.h index b9f62cbf83f..6f99be0d512 100644 --- a/src/core/lib/iomgr/resource_quota.h +++ b/src/core/lib/iomgr/resource_quota.h @@ -90,6 +90,8 @@ grpc_resource_quota *grpc_resource_quota_from_channel_args( double grpc_resource_quota_get_memory_pressure( grpc_resource_quota *resource_quota); +size_t grpc_resource_quota_peek_size(grpc_resource_quota *resource_quota); + typedef struct grpc_resource_user grpc_resource_user; grpc_resource_user *grpc_resource_user_create( diff --git a/src/core/lib/iomgr/tcp_posix.c b/src/core/lib/iomgr/tcp_posix.c index bfc7de59f20..5f4b38de2b9 100644 --- a/src/core/lib/iomgr/tcp_posix.c +++ b/src/core/lib/iomgr/tcp_posix.c @@ -133,14 +133,21 @@ static void finish_estimate(grpc_tcp *tcp) { } static size_t get_target_read_size(grpc_tcp *tcp) { - double pressure = grpc_resource_quota_get_memory_pressure( - grpc_resource_user_quota(tcp->resource_user)); + grpc_resource_quota *rq = grpc_resource_user_quota(tcp->resource_user); + double pressure = grpc_resource_quota_get_memory_pressure(rq); double target = tcp->target_length * (pressure > 0.8 ? (1.0 - pressure) / 0.2 : 1.0); - return (((size_t)GPR_CLAMP(target, tcp->min_read_chunk_size, - tcp->max_read_chunk_size)) + - 255) & - ~(size_t)255; + size_t sz = (((size_t)GPR_CLAMP(target, tcp->min_read_chunk_size, + tcp->max_read_chunk_size)) + + 255) & + ~(size_t)255; + /* don't use more than 1/16th of the overall resource quota for a single read + * alloc */ + size_t rqmax = grpc_resource_quota_peek_size(rq); + if (sz > rqmax / 16 && rqmax > 1024) { + sz = rqmax / 16; + } + return sz; } static grpc_error *tcp_annotate_error(grpc_error *src_error, grpc_tcp *tcp) { From 08bbdb8801f212ef3930bd4e4e3c31106756acab Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Thu, 30 Mar 2017 13:25:06 -0700 Subject: [PATCH 116/461] Fix cq creation code after merge --- test/cpp/microbenchmarks/bm_cq.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/cpp/microbenchmarks/bm_cq.cc b/test/cpp/microbenchmarks/bm_cq.cc index 6f153f77f50..8b26bf977ca 100644 --- a/test/cpp/microbenchmarks/bm_cq.cc +++ b/test/cpp/microbenchmarks/bm_cq.cc @@ -62,7 +62,8 @@ BENCHMARK(BM_CreateDestroyCpp); static void BM_CreateDestroyCpp2(benchmark::State& state) { TrackCounters track_counters; while (state.KeepRunning()) { - grpc_completion_queue* core_cq = grpc_completion_queue_create(NULL); + grpc_completion_queue* core_cq = + grpc_completion_queue_create_for_next(NULL); CompletionQueue cq(core_cq); } track_counters.Finish(state); From 609eca0e362764f31b9e17ef2babb957fcdd322c Mon Sep 17 00:00:00 2001 From: Wenbo Zhu Date: Thu, 30 Mar 2017 16:18:14 -0700 Subject: [PATCH 117/461] Update PROTOCOL-WEB.md Clarify the use of U-A header. --- doc/PROTOCOL-WEB.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/PROTOCOL-WEB.md b/doc/PROTOCOL-WEB.md index 5f01af36273..6bb280894ab 100644 --- a/doc/PROTOCOL-WEB.md +++ b/doc/PROTOCOL-WEB.md @@ -83,7 +83,8 @@ in the body. User Agent -* U-A: grpc-web-javascript +* Do NOT use User-Agent header (which is to be set by browsers, by default) +* Use X-User-Agent: grpc-web-javascript/0.1 (follow the same format as specified in [gRPC over HTTP2](http://www.grpc.io/docs/guides/wire.html)) --- From 5e17020d610f743cd7525413856060306f1614be Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 31 Mar 2017 07:30:35 -0700 Subject: [PATCH 118/461] Fix compile --- test/cpp/microbenchmarks/fullstack_fixtures.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/cpp/microbenchmarks/fullstack_fixtures.h b/test/cpp/microbenchmarks/fullstack_fixtures.h index dc297010599..acc56bf39bf 100644 --- a/test/cpp/microbenchmarks/fullstack_fixtures.h +++ b/test/cpp/microbenchmarks/fullstack_fixtures.h @@ -212,8 +212,8 @@ class EndpointPairFixture : public BaseFixture { class SockPair : public EndpointPairFixture { public: SockPair(Service* service) - : EndpointPairFixture(service, grpc_iomgr_create_endpoint_pair( - "test", Library::get().rq(), 8192)) {} + : EndpointPairFixture(service, + grpc_iomgr_create_endpoint_pair("test", NULL)) {} }; class InProcessCHTTP2 : public EndpointPairFixture { From dd36b15315cd691e86a94d4574bd9f3e3a33633f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 31 Mar 2017 08:27:28 -0700 Subject: [PATCH 119/461] Call ref/unref, bugfixes --- grpc.def | 2 +- .../grpc++/impl/codegen/async_unary_call.h | 75 +++++++------------ include/grpc++/impl/codegen/call.h | 50 +------------ include/grpc/grpc.h | 12 ++- src/core/ext/lb_policy/grpclb/grpclb.c | 2 +- src/core/lib/surface/call.c | 18 +++-- src/core/lib/surface/server.c | 2 +- src/cpp/client/client_context.cc | 2 +- src/cpp/server/server_context.cc | 2 +- src/csharp/ext/grpc_csharp_ext.c | 2 +- src/node/ext/call.cc | 4 +- .../GRPCClient/private/GRPCWrappedCall.m | 2 +- .../tests/CronetUnitTests/CronetUnitTests.m | 4 +- src/php/ext/grpc/call.c | 2 +- .../grpcio/grpc/_cython/_cygrpc/call.pyx.pxi | 2 +- .../grpcio/grpc/_cython/_cygrpc/grpc.pxi | 2 +- src/ruby/ext/grpc/rb_call.c | 2 +- src/ruby/ext/grpc/rb_grpc_imports.generated.c | 4 +- src/ruby/ext/grpc/rb_grpc_imports.generated.h | 6 +- .../bad_client/tests/head_of_line_blocking.c | 2 +- test/core/bad_client/tests/large_metadata.c | 4 +- .../tests/server_registered_method.c | 4 +- test/core/bad_client/tests/simple_request.c | 2 +- test/core/bad_ssl/bad_ssl_test.c | 2 +- test/core/client_channel/lb_policies_test.c | 6 +- test/core/end2end/bad_server_response_test.c | 2 +- test/core/end2end/connection_refused_test.c | 2 +- test/core/end2end/dualstack_socket_test.c | 4 +- test/core/end2end/fixtures/h2_ssl_cert.c | 2 +- test/core/end2end/fixtures/proxy.c | 4 +- test/core/end2end/fuzzers/api_fuzzer.c | 2 +- test/core/end2end/fuzzers/client_fuzzer.c | 2 +- test/core/end2end/fuzzers/server_fuzzer.c | 2 +- test/core/end2end/goaway_server_test.c | 8 +- .../core/end2end/invalid_call_argument_test.c | 4 +- test/core/end2end/no_server_test.c | 2 +- .../end2end/tests/authority_not_supported.c | 2 +- test/core/end2end/tests/bad_hostname.c | 2 +- test/core/end2end/tests/binary_metadata.c | 4 +- test/core/end2end/tests/call_creds.c | 6 +- test/core/end2end/tests/cancel_after_accept.c | 4 +- .../end2end/tests/cancel_after_client_done.c | 4 +- test/core/end2end/tests/cancel_after_invoke.c | 2 +- .../core/end2end/tests/cancel_before_invoke.c | 2 +- test/core/end2end/tests/cancel_in_a_vacuum.c | 2 +- test/core/end2end/tests/cancel_with_status.c | 2 +- test/core/end2end/tests/compressed_payload.c | 8 +- test/core/end2end/tests/default_host.c | 4 +- test/core/end2end/tests/disappearing_server.c | 4 +- test/core/end2end/tests/empty_batch.c | 2 +- .../end2end/tests/filter_call_init_fails.c | 2 +- test/core/end2end/tests/filter_causes_close.c | 2 +- test/core/end2end/tests/filter_latency.c | 4 +- .../end2end/tests/graceful_server_shutdown.c | 4 +- test/core/end2end/tests/high_initial_seqno.c | 4 +- test/core/end2end/tests/hpack_size.c | 4 +- test/core/end2end/tests/idempotent_request.c | 4 +- .../core/end2end/tests/invoke_large_request.c | 4 +- test/core/end2end/tests/keepalive_timeout.c | 4 +- test/core/end2end/tests/large_metadata.c | 4 +- test/core/end2end/tests/load_reporting_hook.c | 4 +- .../end2end/tests/max_concurrent_streams.c | 26 +++---- test/core/end2end/tests/max_message_length.c | 8 +- test/core/end2end/tests/negative_deadline.c | 2 +- .../end2end/tests/network_status_change.c | 4 +- test/core/end2end/tests/no_logging.c | 4 +- test/core/end2end/tests/payload.c | 4 +- test/core/end2end/tests/ping_pong_streaming.c | 4 +- test/core/end2end/tests/registered_call.c | 4 +- test/core/end2end/tests/request_with_flags.c | 2 +- .../core/end2end/tests/request_with_payload.c | 4 +- .../end2end/tests/resource_quota_server.c | 4 +- .../end2end/tests/server_finishes_request.c | 4 +- .../end2end/tests/shutdown_finishes_calls.c | 4 +- .../end2end/tests/simple_cacheable_request.c | 4 +- .../end2end/tests/simple_delayed_request.c | 4 +- test/core/end2end/tests/simple_metadata.c | 4 +- test/core/end2end/tests/simple_request.c | 4 +- .../end2end/tests/streaming_error_response.c | 4 +- test/core/end2end/tests/trailing_metadata.c | 4 +- test/core/end2end/tests/write_buffering.c | 4 +- .../end2end/tests/write_buffering_at_end.c | 4 +- test/core/fling/client.c | 4 +- test/core/fling/server.c | 4 +- test/core/memory_usage/client.c | 4 +- test/core/memory_usage/server.c | 4 +- test/core/surface/lame_client_test.c | 2 +- test/cpp/grpclb/grpclb_test.cc | 6 +- test/cpp/microbenchmarks/bm_call_create.cc | 8 +- 89 files changed, 213 insertions(+), 262 deletions(-) diff --git a/grpc.def b/grpc.def index 39f06d8cc0a..266ca593ce1 100644 --- a/grpc.def +++ b/grpc.def @@ -83,7 +83,7 @@ EXPORTS grpc_channel_destroy grpc_call_cancel grpc_call_cancel_with_status - grpc_call_destroy + grpc_call_unref grpc_server_request_call grpc_server_register_method grpc_server_request_registered_call diff --git a/include/grpc++/impl/codegen/async_unary_call.h b/include/grpc++/impl/codegen/async_unary_call.h index 50bb399df62..dd65cf89d6e 100644 --- a/include/grpc++/impl/codegen/async_unary_call.h +++ b/include/grpc++/impl/codegen/async_unary_call.h @@ -61,11 +61,6 @@ template class ClientAsyncResponseReader final : public ClientAsyncResponseReaderInterface { public: - ~ClientAsyncResponseReader() { - if (collection_ != nullptr && collection_->Unref()) { - delete collection_; - } - } template static ClientAsyncResponseReader* Create(ChannelInterface* channel, CompletionQueue* cq, @@ -77,18 +72,13 @@ class ClientAsyncResponseReader final grpc_call_arena_alloc(call.call(), sizeof(*reader))); new (&reader->call_) Call(std::move(call)); reader->context_ = context; - reader->collection_ = - new (grpc_call_arena_alloc(call.call(), sizeof(CallOpSetCollection))) - CallOpSetCollection(); - reader->collection_->init_buf_.SetCollection(reader->collection_); - reader->collection_->init_buf_.SendInitialMetadata( - context->send_initial_metadata_, context->initial_metadata_flags()); + reader->init_buf_.SendInitialMetadata(context->send_initial_metadata_, + context->initial_metadata_flags()); // TODO(ctiller): don't assert - GPR_CODEGEN_ASSERT( - reader->collection_->init_buf_.SendMessage(request).ok()); - reader->collection_->init_buf_.ClientSendClose(); - reader->call_.PerformOps(&reader->collection_->init_buf_); + GPR_CODEGEN_ASSERT(reader->init_buf_.SendMessage(request).ok()); + reader->init_buf_.ClientSendClose(); + reader->call_.PerformOps(&reader->init_buf_); return reader; } @@ -100,22 +90,20 @@ class ClientAsyncResponseReader final void ReadInitialMetadata(void* tag) { GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_); - collection_->meta_buf_.SetCollection(collection_); - collection_->meta_buf_.set_output_tag(tag); - collection_->meta_buf_.RecvInitialMetadata(context_); - call_.PerformOps(&collection_->meta_buf_); + meta_buf_.set_output_tag(tag); + meta_buf_.RecvInitialMetadata(context_); + call_.PerformOps(&meta_buf_); } void Finish(R* msg, Status* status, void* tag) { - collection_->finish_buf_.SetCollection(collection_); - collection_->finish_buf_.set_output_tag(tag); + finish_buf_.set_output_tag(tag); if (!context_->initial_metadata_received_) { - collection_->finish_buf_.RecvInitialMetadata(context_); + finish_buf_.RecvInitialMetadata(context_); } - collection_->finish_buf_.RecvMessage(msg); - collection_->finish_buf_.AllowNoMessage(); - collection_->finish_buf_.ClientRecvStatus(context_, status); - call_.PerformOps(&collection_->finish_buf_); + finish_buf_.RecvMessage(msg); + finish_buf_.AllowNoMessage(); + finish_buf_.ClientRecvStatus(context_, status); + call_.PerformOps(&finish_buf_); } private: @@ -125,26 +113,13 @@ class ClientAsyncResponseReader final // disable operator new static void* operator new(std::size_t size); - class CallOpSetCollection final : public CallOpSetCollectionInterface { - public: - SneakyCallOpSet - init_buf_; - CallOpSet meta_buf_; - CallOpSet, - CallOpClientRecvStatus> - finish_buf_; - - static void* operator new(std::size_t size, void* p) { return p; } - static void operator delete(void* ptr, std::size_t size) { - assert(size == sizeof(CallOpSetCollection)); - } - - private: - // disable operator new - static void* operator new(std::size_t size); - }; - CallOpSetCollection* collection_; + SneakyCallOpSet + init_buf_; + CallOpSet meta_buf_; + CallOpSet, + CallOpClientRecvStatus> + finish_buf_; }; template @@ -214,4 +189,12 @@ class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface { } // namespace grpc +namespace std { +template +class default_delete> { + public: + void operator()(void* p) {} +}; +} + #endif // GRPCXX_IMPL_CODEGEN_ASYNC_UNARY_CALL_H diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h index 9c8611a1167..4a52c2cbcfa 100644 --- a/include/grpc++/impl/codegen/call.h +++ b/include/grpc++/impl/codegen/call.h @@ -561,32 +561,6 @@ class CallOpClientRecvStatus { grpc_slice status_details_; }; -/// An abstract collection of CallOpSet's, to be used whenever -/// CallOpSet objects must be thought of as a group. Each member -/// of the group should reference the collection, as will the object -/// that instantiates the collection, allowing for ref-counting. -/// Any actual use should derive from this base class. This is specifically -/// necessary if some of the CallOpSet's in the collection are "Sneaky" and -/// don't report back to the C++ layer CQ operations -class CallOpSetCollectionInterface { - public: - CallOpSetCollectionInterface() { - gpr_atm_rel_store(&refs_, static_cast(1)); - } - // always allocated against a call arena, no memory free required - static void operator delete(void* ptr, std::size_t size) { - } - void Ref() { gpr_atm_no_barrier_fetch_add(&refs_, static_cast(1)); } - bool Unref() { - gpr_atm old = - gpr_atm_full_fetch_add(&refs_, static_cast(-1)); - return (old == static_cast(1)); - } - - private: - gpr_atm refs_; -}; - /// An abstract collection of call ops, used to generate the /// grpc_call_op structure to pass down to the lower layers, /// and as it is-a CompletionQueueTag, also massages the final @@ -594,26 +568,9 @@ class CallOpSetCollectionInterface { /// API. class CallOpSetInterface : public CompletionQueueTag { public: - CallOpSetInterface() : collection_(nullptr) {} - ~CallOpSetInterface() { ResetCollection(); } /// Fills in grpc_op, starting from ops[*nops] and moving /// upwards. virtual void FillOps(grpc_op* ops, size_t* nops) = 0; - - /// Mark this as belonging to a collection if needed - void SetCollection(CallOpSetCollectionInterface* collection) { - collection_ = collection; - collection->Ref(); - } - void ResetCollection() { - if (collection_ != nullptr && collection_->Unref()) { - delete collection_; - } - collection_ = nullptr; - } - - protected: - CallOpSetCollectionInterface* collection_; }; /// Primary implementaiton of CallOpSetInterface. @@ -634,16 +591,17 @@ class CallOpSet : public CallOpSetInterface, public Op6 { public: CallOpSet() : return_tag_(this) {} - void FillOps(grpc_op* ops, size_t* nops) override { + void FillOps(grpc_call* call, grpc_op* ops, size_t* nops) override { this->Op1::AddOp(ops, nops); this->Op2::AddOp(ops, nops); this->Op3::AddOp(ops, nops); this->Op4::AddOp(ops, nops); this->Op5::AddOp(ops, nops); this->Op6::AddOp(ops, nops); + grpc_call_ref(call); } - bool FinalizeResult(void** tag, bool* status) override { + bool FinalizeResult(grpc_call* call, void** tag, bool* status) override { this->Op1::FinishOp(status); this->Op2::FinishOp(status); this->Op3::FinishOp(status); @@ -651,7 +609,7 @@ class CallOpSet : public CallOpSetInterface, this->Op5::FinishOp(status); this->Op6::FinishOp(status); *tag = return_tag_; - ResetCollection(); // drop the ref at this point + grpc_call_unref(call); return true; } diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 3430cd31e95..3af0ca25c95 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -349,7 +349,7 @@ GRPCAPI void grpc_channel_destroy(grpc_channel *channel); /** Called by clients to cancel an RPC on the server. Can be called multiple times, from any thread. THREAD-SAFETY grpc_call_cancel and grpc_call_cancel_with_status - are thread-safe, and can be called at any point before grpc_call_destroy + are thread-safe, and can be called at any point before grpc_call_unref is called.*/ GRPCAPI grpc_call_error grpc_call_cancel(grpc_call *call, void *reserved); @@ -364,9 +364,13 @@ GRPCAPI grpc_call_error grpc_call_cancel_with_status(grpc_call *call, const char *description, void *reserved); -/** Destroy a call. - THREAD SAFETY: grpc_call_destroy is thread-compatible */ -GRPCAPI void grpc_call_destroy(grpc_call *call); +/** Ref a call. + THREAD SAFETY: grpc_call_unref is thread-compatible */ +GRPCAPI void grpc_call_ref(grpc_call *call); + +/** Unref a call. + THREAD SAFETY: grpc_call_unref is thread-compatible */ +GRPCAPI void grpc_call_unref(grpc_call *call); /** Request notification of a new call. Once a call is received, a notification tagged with \a tag_new is added to diff --git a/src/core/ext/lb_policy/grpclb/grpclb.c b/src/core/ext/lb_policy/grpclb/grpclb.c index 601b0e643bd..a86612c68ba 100644 --- a/src/core/ext/lb_policy/grpclb/grpclb.c +++ b/src/core/ext/lb_policy/grpclb/grpclb.c @@ -1150,7 +1150,7 @@ static void lb_call_init_locked(grpc_exec_ctx *exec_ctx, static void lb_call_destroy_locked(grpc_exec_ctx *exec_ctx, glb_lb_policy *glb_policy) { GPR_ASSERT(glb_policy->lb_call != NULL); - grpc_call_destroy(glb_policy->lb_call); + grpc_call_unref(glb_policy->lb_call); glb_policy->lb_call = NULL; grpc_metadata_array_destroy(&glb_policy->lb_initial_metadata_recv); diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 71c65d86ee5..810bce44b99 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -139,6 +139,7 @@ typedef struct batch_control { } batch_control; struct grpc_call { + gpr_refcount ext_ref; gpr_arena *arena; grpc_completion_queue *cq; grpc_polling_entity pollent; @@ -151,7 +152,7 @@ struct grpc_call { /* client or server call */ bool is_client; - /** has grpc_call_destroy been called */ + /** has grpc_call_unref been called */ bool destroy_called; /** flag indicating that cancellation is inherited */ bool cancellation_is_inherited; @@ -285,6 +286,7 @@ grpc_error *grpc_call_create(grpc_exec_ctx *exec_ctx, gpr_arena_create(grpc_channel_get_call_size_estimate(args->channel)); call = gpr_arena_alloc(arena, sizeof(grpc_call) + channel_stack->call_stack_size); + gpr_ref_init(&call->ext_ref, 1); call->arena = arena; *out_call = call; gpr_mu_init(&call->child_list_mu); @@ -375,7 +377,7 @@ grpc_error *grpc_call_create(grpc_exec_ctx *exec_ctx, call->send_deadline = send_deadline; GRPC_CHANNEL_INTERNAL_REF(args->channel, "call"); - /* initial refcount dropped by grpc_call_destroy */ + /* initial refcount dropped by grpc_call_unref */ grpc_call_element_args call_args = { .call_stack = CALL_STACK_FROM_CALL(call), .server_transport_data = args->server_transport_data, @@ -493,13 +495,17 @@ static void destroy_call(grpc_exec_ctx *exec_ctx, void *call, GPR_TIMER_END("destroy_call", 0); } -void grpc_call_destroy(grpc_call *c) { +void grpc_call_ref(grpc_call *c) { gpr_ref(&c->ext_ref); } + +void grpc_call_unref(grpc_call *c) { + if (!gpr_unref(&c->ext_ref)) return; + int cancel; grpc_call *parent = c->parent; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - GPR_TIMER_BEGIN("grpc_call_destroy", 0); - GRPC_API_TRACE("grpc_call_destroy(c=%p)", 1, (c)); + GPR_TIMER_BEGIN("grpc_call_unref", 0); + GRPC_API_TRACE("grpc_call_unref(c=%p)", 1, (c)); if (parent) { gpr_mu_lock(&parent->child_list_mu); @@ -525,7 +531,7 @@ void grpc_call_destroy(grpc_call *c) { } GRPC_CALL_INTERNAL_UNREF(&exec_ctx, c, "destroy"); grpc_exec_ctx_finish(&exec_ctx); - GPR_TIMER_END("grpc_call_destroy", 0); + GPR_TIMER_END("grpc_call_unref", 0); } grpc_call_error grpc_call_cancel(grpc_call *call, void *reserved) { diff --git a/src/core/lib/surface/server.c b/src/core/lib/surface/server.c index a123c9ca433..1f92751b0f0 100644 --- a/src/core/lib/surface/server.c +++ b/src/core/lib/surface/server.c @@ -340,7 +340,7 @@ static void request_matcher_destroy(request_matcher *rm) { static void kill_zombie(grpc_exec_ctx *exec_ctx, void *elem, grpc_error *error) { - grpc_call_destroy(grpc_call_from_top_element(elem)); + grpc_call_unref(grpc_call_from_top_element(elem)); } static void request_matcher_zombify_all_pending_calls(grpc_exec_ctx *exec_ctx, diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc index 3d884cf62e4..25162328408 100644 --- a/src/cpp/client/client_context.cc +++ b/src/cpp/client/client_context.cc @@ -74,7 +74,7 @@ ClientContext::ClientContext() ClientContext::~ClientContext() { if (call_) { - grpc_call_destroy(call_); + grpc_call_unref(call_); } g_client_callbacks->Destructor(this); } diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 3a408eb23ed..c0c40fda7be 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -151,7 +151,7 @@ ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata_array* arr) ServerContext::~ServerContext() { if (call_) { - grpc_call_destroy(call_); + grpc_call_unref(call_); } if (completion_op_) { completion_op_->Unref(); diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index 491df4de6ad..b6ac4e6eb2a 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -517,7 +517,7 @@ GPR_EXPORT void GPR_CALLTYPE gprsharp_free(void *p) { } GPR_EXPORT void GPR_CALLTYPE grpcsharp_call_destroy(grpc_call *call) { - grpc_call_destroy(call); + grpc_call_unref(call); } GPR_EXPORT grpc_call_error GPR_CALLTYPE diff --git a/src/node/ext/call.cc b/src/node/ext/call.cc index 244546d3d78..88bcd6db0b8 100644 --- a/src/node/ext/call.cc +++ b/src/node/ext/call.cc @@ -520,7 +520,7 @@ Call::Call(grpc_call *call) : wrapped_call(call), Call::~Call() { if (wrapped_call != NULL) { - grpc_call_destroy(wrapped_call); + grpc_call_unref(wrapped_call); } } @@ -568,7 +568,7 @@ void Call::CompleteBatch(bool is_final_op) { } this->pending_batches--; if (this->has_final_op_completed && this->pending_batches == 0) { - grpc_call_destroy(this->wrapped_call); + grpc_call_unref(this->wrapped_call); this->wrapped_call = NULL; } } diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m index 46e9fee7e1f..1faba3e20b9 100644 --- a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m +++ b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m @@ -315,7 +315,7 @@ } - (void)dealloc { - grpc_call_destroy(_call); + grpc_call_unref(_call); } @end diff --git a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m index a76e45416bf..93c648dc376 100644 --- a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m +++ b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m @@ -258,7 +258,7 @@ unsigned int parse_h2_length(const char *field) { grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); + grpc_call_unref(c); cq_verifier_destroy(cqv); @@ -437,7 +437,7 @@ unsigned int parse_h2_length(const char *field) { grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); + grpc_call_unref(c); cq_verifier_destroy(cqv); diff --git a/src/php/ext/grpc/call.c b/src/php/ext/grpc/call.c index 48a374fa08e..d3fd88416b4 100644 --- a/src/php/ext/grpc/call.c +++ b/src/php/ext/grpc/call.c @@ -65,7 +65,7 @@ static zend_object_handlers call_ce_handlers; /* Frees and destroys an instance of wrapped_grpc_call */ PHP_GRPC_FREE_WRAPPED_FUNC_START(wrapped_grpc_call) if (p->owned && p->wrapped != NULL) { - grpc_call_destroy(p->wrapped); + grpc_call_unref(p->wrapped); } PHP_GRPC_FREE_WRAPPED_FUNC_END() diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi index cc3bd7a0672..aa3558b8436 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/call.pyx.pxi @@ -106,7 +106,7 @@ cdef class Call: def __dealloc__(self): if self.c_call != NULL: - grpc_call_destroy(self.c_call) + grpc_call_unref(self.c_call) grpc_shutdown() # The object *should* always be valid from Python. Used for debugging. diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi index bbd72424b9b..f100b65c760 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi @@ -328,7 +328,7 @@ cdef extern from "grpc/grpc.h": const char *description, void *reserved) nogil char *grpc_call_get_peer(grpc_call *call) nogil - void grpc_call_destroy(grpc_call *call) nogil + void grpc_call_unref(grpc_call *call) nogil grpc_channel *grpc_insecure_channel_create(const char *target, const grpc_channel_args *args, diff --git a/src/ruby/ext/grpc/rb_call.c b/src/ruby/ext/grpc/rb_call.c index 82d340b2544..e4b2cfed00f 100644 --- a/src/ruby/ext/grpc/rb_call.c +++ b/src/ruby/ext/grpc/rb_call.c @@ -101,7 +101,7 @@ typedef struct grpc_rb_call { static void destroy_call(grpc_rb_call *call) { /* Ensure that we only try to destroy the call once */ if (call->wrapped != NULL) { - grpc_call_destroy(call->wrapped); + grpc_call_unref(call->wrapped); call->wrapped = NULL; grpc_rb_completion_queue_destroy(call->queue); call->queue = NULL; diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.c b/src/ruby/ext/grpc/rb_grpc_imports.generated.c index 294ca2c5a47..907bf908ad4 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.c +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.c @@ -121,7 +121,7 @@ grpc_lame_client_channel_create_type grpc_lame_client_channel_create_import; grpc_channel_destroy_type grpc_channel_destroy_import; grpc_call_cancel_type grpc_call_cancel_import; grpc_call_cancel_with_status_type grpc_call_cancel_with_status_import; -grpc_call_destroy_type grpc_call_destroy_import; +grpc_call_unref_type grpc_call_unref_import; grpc_server_request_call_type grpc_server_request_call_import; grpc_server_register_method_type grpc_server_register_method_import; grpc_server_request_registered_call_type grpc_server_request_registered_call_import; @@ -419,7 +419,7 @@ void grpc_rb_load_imports(HMODULE library) { grpc_channel_destroy_import = (grpc_channel_destroy_type) GetProcAddress(library, "grpc_channel_destroy"); grpc_call_cancel_import = (grpc_call_cancel_type) GetProcAddress(library, "grpc_call_cancel"); grpc_call_cancel_with_status_import = (grpc_call_cancel_with_status_type) GetProcAddress(library, "grpc_call_cancel_with_status"); - grpc_call_destroy_import = (grpc_call_destroy_type) GetProcAddress(library, "grpc_call_destroy"); + grpc_call_unref_import = (grpc_call_unref_type) GetProcAddress(library, "grpc_call_unref"); grpc_server_request_call_import = (grpc_server_request_call_type) GetProcAddress(library, "grpc_server_request_call"); grpc_server_register_method_import = (grpc_server_register_method_type) GetProcAddress(library, "grpc_server_register_method"); grpc_server_request_registered_call_import = (grpc_server_request_registered_call_type) GetProcAddress(library, "grpc_server_request_registered_call"); diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h index 7b40dd2f27f..c5c416940e5 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h @@ -314,9 +314,9 @@ extern grpc_call_cancel_type grpc_call_cancel_import; typedef grpc_call_error(*grpc_call_cancel_with_status_type)(grpc_call *call, grpc_status_code status, const char *description, void *reserved); extern grpc_call_cancel_with_status_type grpc_call_cancel_with_status_import; #define grpc_call_cancel_with_status grpc_call_cancel_with_status_import -typedef void(*grpc_call_destroy_type)(grpc_call *call); -extern grpc_call_destroy_type grpc_call_destroy_import; -#define grpc_call_destroy grpc_call_destroy_import +typedef void(*grpc_call_unref_type)(grpc_call *call); +extern grpc_call_unref_type grpc_call_unref_import; +#define grpc_call_unref grpc_call_unref_import typedef grpc_call_error(*grpc_server_request_call_type)(grpc_server *server, grpc_call **call, grpc_call_details *details, grpc_metadata_array *request_metadata, grpc_completion_queue *cq_bound_to_call, grpc_completion_queue *cq_for_notification, void *tag_new); extern grpc_server_request_call_type grpc_server_request_call_import; #define grpc_server_request_call grpc_server_request_call_import diff --git a/test/core/bad_client/tests/head_of_line_blocking.c b/test/core/bad_client/tests/head_of_line_blocking.c index 64cb79d82f2..b0d788bf228 100644 --- a/test/core/bad_client/tests/head_of_line_blocking.c +++ b/test/core/bad_client/tests/head_of_line_blocking.c @@ -103,7 +103,7 @@ static void verifier(grpc_server *server, grpc_completion_queue *cq, GPR_ASSERT(payload != NULL); grpc_metadata_array_destroy(&request_metadata_recv); - grpc_call_destroy(s); + grpc_call_unref(s); grpc_byte_buffer_destroy(payload); cq_verifier_destroy(cqv); } diff --git a/test/core/bad_client/tests/large_metadata.c b/test/core/bad_client/tests/large_metadata.c index f672776a9fb..d7a3ce9461c 100644 --- a/test/core/bad_client/tests/large_metadata.c +++ b/test/core/bad_client/tests/large_metadata.c @@ -131,7 +131,7 @@ static void server_verifier(grpc_server *server, grpc_completion_queue *cq, grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(s); + grpc_call_unref(s); cq_verifier_destroy(cqv); } @@ -177,7 +177,7 @@ static void server_verifier_sends_too_much_metadata(grpc_server *server, grpc_slice_unref(meta.value); grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(s); + grpc_call_unref(s); cq_verifier_destroy(cqv); } diff --git a/test/core/bad_client/tests/server_registered_method.c b/test/core/bad_client/tests/server_registered_method.c index e174af5931a..c5af0bae767 100644 --- a/test/core/bad_client/tests/server_registered_method.c +++ b/test/core/bad_client/tests/server_registered_method.c @@ -76,7 +76,7 @@ static void verifier_succeeds(grpc_server *server, grpc_completion_queue *cq, GPR_ASSERT(payload != NULL); grpc_metadata_array_destroy(&request_metadata_recv); - grpc_call_destroy(s); + grpc_call_unref(s); grpc_byte_buffer_destroy(payload); cq_verifier_destroy(cqv); } @@ -102,7 +102,7 @@ static void verifier_fails(grpc_server *server, grpc_completion_queue *cq, GPR_ASSERT(payload == NULL); grpc_metadata_array_destroy(&request_metadata_recv); - grpc_call_destroy(s); + grpc_call_unref(s); cq_verifier_destroy(cqv); } diff --git a/test/core/bad_client/tests/simple_request.c b/test/core/bad_client/tests/simple_request.c index 608b849d415..fb342f08815 100644 --- a/test/core/bad_client/tests/simple_request.c +++ b/test/core/bad_client/tests/simple_request.c @@ -122,7 +122,7 @@ static void verifier(grpc_server *server, grpc_completion_queue *cq, grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(s); + grpc_call_unref(s); cq_verifier_destroy(cqv); } diff --git a/test/core/bad_ssl/bad_ssl_test.c b/test/core/bad_ssl/bad_ssl_test.c index bd855857066..a8624c2b99f 100644 --- a/test/core/bad_ssl/bad_ssl_test.c +++ b/test/core/bad_ssl/bad_ssl_test.c @@ -115,7 +115,7 @@ static void run_test(const char *target, size_t nops) { GPR_ASSERT(status != GRPC_STATUS_OK); - grpc_call_destroy(c); + grpc_call_unref(c); grpc_slice_unref(details); grpc_metadata_array_destroy(&initial_metadata_recv); grpc_metadata_array_destroy(&trailing_metadata_recv); diff --git a/test/core/client_channel/lb_policies_test.c b/test/core/client_channel/lb_policies_test.c index 057b90ec84f..751ca365879 100644 --- a/test/core/client_channel/lb_policies_test.c +++ b/test/core/client_channel/lb_policies_test.c @@ -391,7 +391,7 @@ static request_sequences perform_request(servers_fixture *f, "foo.test.google.fr")); GPR_ASSERT(was_cancelled == 1); - grpc_call_destroy(f->server_calls[s_idx]); + grpc_call_unref(f->server_calls[s_idx]); /* ask for the next request on this server */ GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( @@ -417,7 +417,7 @@ static request_sequences perform_request(servers_fixture *f, cq_verifier_destroy(cqv); - grpc_call_destroy(c); + grpc_call_unref(c); for (i = 0; i < f->num_servers; i++) { grpc_call_details_destroy(&rdata->call_details[i]); @@ -613,7 +613,7 @@ static void test_pending_calls(size_t concurrent_calls) { /* destroy the calls after the channel so that they are still around for the * LB's shutdown func to process */ for (i = 0; i < concurrent_calls; i++) { - grpc_call_destroy(calls[i]); + grpc_call_unref(calls[i]); } gpr_free(calls); teardown_servers(f); diff --git a/test/core/end2end/bad_server_response_test.c b/test/core/end2end/bad_server_response_test.c index c37a292af97..c8a206f6f95 100644 --- a/test/core/end2end/bad_server_response_test.c +++ b/test/core/end2end/bad_server_response_test.c @@ -236,7 +236,7 @@ static void cleanup_rpc(grpc_exec_ctx *exec_ctx) { grpc_event ev; grpc_slice_buffer_destroy_internal(exec_ctx, &state.temp_incoming_buffer); grpc_slice_buffer_destroy_internal(exec_ctx, &state.outgoing_buffer); - grpc_call_destroy(state.call); + grpc_call_unref(state.call); grpc_completion_queue_shutdown(state.cq); do { ev = grpc_completion_queue_next(state.cq, n_sec_deadline(1), NULL); diff --git a/test/core/end2end/connection_refused_test.c b/test/core/end2end/connection_refused_test.c index 6ded12ad480..8ace2801953 100644 --- a/test/core/end2end/connection_refused_test.c +++ b/test/core/end2end/connection_refused_test.c @@ -138,7 +138,7 @@ static void run_test(bool wait_for_ready, bool use_service_config) { .type != GRPC_QUEUE_SHUTDOWN) ; grpc_completion_queue_destroy(cq); - grpc_call_destroy(call); + grpc_call_unref(call); grpc_channel_destroy(chan); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.c index 3623bd7be8b..c4c3a0d5b59 100644 --- a/test/core/end2end/dualstack_socket_test.c +++ b/test/core/end2end/dualstack_socket_test.c @@ -242,7 +242,7 @@ void test_connect(const char *server_host, const char *client_host, int port, grpc_slice_str_cmp(call_details.host, "foo.test.google.fr")); GPR_ASSERT(was_cancelled == 1); - grpc_call_destroy(s); + grpc_call_unref(s); } else { /* Check for a failed connection. */ CQ_EXPECT_COMPLETION(cqv, tag(1), 1); @@ -251,7 +251,7 @@ void test_connect(const char *server_host, const char *client_host, int port, GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE); } - grpc_call_destroy(c); + grpc_call_unref(c); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/fixtures/h2_ssl_cert.c b/test/core/end2end/fixtures/h2_ssl_cert.c index f62331eea3d..7b83183b7ff 100644 --- a/test/core/end2end/fixtures/h2_ssl_cert.c +++ b/test/core/end2end/fixtures/h2_ssl_cert.c @@ -340,7 +340,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, CQ_EXPECT_COMPLETION(cqv, tag(1), expected_result == SUCCESS); cq_verify(cqv); - grpc_call_destroy(c); + grpc_call_unref(c); cq_verifier_destroy(cqv); } diff --git a/test/core/end2end/fixtures/proxy.c b/test/core/end2end/fixtures/proxy.c index cee053e8c56..449f98813ee 100644 --- a/test/core/end2end/fixtures/proxy.c +++ b/test/core/end2end/fixtures/proxy.c @@ -148,8 +148,8 @@ void grpc_end2end_proxy_destroy(grpc_end2end_proxy *proxy) { static void unrefpc(proxy_call *pc, const char *reason) { if (gpr_unref(&pc->refs)) { - grpc_call_destroy(pc->c2p); - grpc_call_destroy(pc->p2s); + grpc_call_unref(pc->c2p); + grpc_call_unref(pc->p2s); grpc_metadata_array_destroy(&pc->c2p_initial_metadata); grpc_metadata_array_destroy(&pc->p2s_initial_metadata); grpc_metadata_array_destroy(&pc->p2s_trailing_metadata); diff --git a/test/core/end2end/fuzzers/api_fuzzer.c b/test/core/end2end/fuzzers/api_fuzzer.c index a0acf5bf602..430db2b5ba2 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.c +++ b/test/core/end2end/fuzzers/api_fuzzer.c @@ -661,7 +661,7 @@ static void read_metadata(input_stream *inp, size_t *count, } static call_state *destroy_call(call_state *call) { - grpc_call_destroy(call->call); + grpc_call_unref(call->call); call->call = NULL; return maybe_delete_call_state(call); } diff --git a/test/core/end2end/fuzzers/client_fuzzer.c b/test/core/end2end/fuzzers/client_fuzzer.c index e7e7dbefd03..e686a15b2ac 100644 --- a/test/core/end2end/fuzzers/client_fuzzer.c +++ b/test/core/end2end/fuzzers/client_fuzzer.c @@ -151,7 +151,7 @@ done: ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), NULL); GPR_ASSERT(ev.type == GRPC_QUEUE_SHUTDOWN); } - grpc_call_destroy(call); + grpc_call_unref(call); grpc_completion_queue_destroy(cq); grpc_metadata_array_destroy(&initial_metadata_recv); grpc_metadata_array_destroy(&trailing_metadata_recv); diff --git a/test/core/end2end/fuzzers/server_fuzzer.c b/test/core/end2end/fuzzers/server_fuzzer.c index 186542d4b2d..3bf7917f581 100644 --- a/test/core/end2end/fuzzers/server_fuzzer.c +++ b/test/core/end2end/fuzzers/server_fuzzer.c @@ -109,7 +109,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { } done: - if (call1 != NULL) grpc_call_destroy(call1); + if (call1 != NULL) grpc_call_unref(call1); grpc_call_details_destroy(&call_details1); grpc_metadata_array_destroy(&request_metadata1); grpc_server_shutdown_and_notify(server, cq, tag(0xdead)); diff --git a/test/core/end2end/goaway_server_test.c b/test/core/end2end/goaway_server_test.c index 22d93b321a6..0eafb73ed8c 100644 --- a/test/core/end2end/goaway_server_test.c +++ b/test/core/end2end/goaway_server_test.c @@ -302,10 +302,10 @@ int main(int argc, char **argv) { CQ_EXPECT_COMPLETION(cqv, tag(0xdead2), 1); cq_verify(cqv); - grpc_call_destroy(call1); - grpc_call_destroy(call2); - grpc_call_destroy(server_call1); - grpc_call_destroy(server_call2); + grpc_call_unref(call1); + grpc_call_unref(call2); + grpc_call_unref(server_call1); + grpc_call_unref(server_call2); grpc_server_destroy(server1); grpc_server_destroy(server2); grpc_channel_destroy(chan); diff --git a/test/core/end2end/invalid_call_argument_test.c b/test/core/end2end/invalid_call_argument_test.c index 2a9072570d3..c3030c60609 100644 --- a/test/core/end2end/invalid_call_argument_test.c +++ b/test/core/end2end/invalid_call_argument_test.c @@ -123,7 +123,7 @@ static void prepare_test(int is_client) { } static void cleanup_test() { - grpc_call_destroy(g_state.call); + grpc_call_unref(g_state.call); cq_verifier_destroy(g_state.cqv); grpc_channel_destroy(g_state.chan); grpc_slice_unref(g_state.details); @@ -131,7 +131,7 @@ static void cleanup_test() { grpc_metadata_array_destroy(&g_state.trailing_metadata_recv); if (!g_state.is_client) { - grpc_call_destroy(g_state.server_call); + grpc_call_unref(g_state.server_call); grpc_server_shutdown_and_notify(g_state.server, g_state.cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(g_state.cq, tag(1000), grpc_timeout_seconds_to_deadline(5), diff --git a/test/core/end2end/no_server_test.c b/test/core/end2end/no_server_test.c index 26d26d8f7a7..e93993797ca 100644 --- a/test/core/end2end/no_server_test.c +++ b/test/core/end2end/no_server_test.c @@ -97,7 +97,7 @@ int main(int argc, char **argv) { .type != GRPC_QUEUE_SHUTDOWN) ; grpc_completion_queue_destroy(cq); - grpc_call_destroy(call); + grpc_call_unref(call); grpc_channel_destroy(chan); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/authority_not_supported.c b/test/core/end2end/tests/authority_not_supported.c index 7db2fd6b278..921b3a0154b 100644 --- a/test/core/end2end/tests/authority_not_supported.c +++ b/test/core/end2end/tests/authority_not_supported.c @@ -178,7 +178,7 @@ static void test_with_authority_header(grpc_end2end_test_config config) { grpc_metadata_array_destroy(&initial_metadata_recv); grpc_metadata_array_destroy(&trailing_metadata_recv); - grpc_call_destroy(c); + grpc_call_unref(c); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/bad_hostname.c b/test/core/end2end/tests/bad_hostname.c index f50a5805a23..a8cb987dd7c 100644 --- a/test/core/end2end/tests/bad_hostname.c +++ b/test/core/end2end/tests/bad_hostname.c @@ -159,7 +159,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); + grpc_call_unref(c); cq_verifier_destroy(cqv); } diff --git a/test/core/end2end/tests/binary_metadata.c b/test/core/end2end/tests/binary_metadata.c index 7fb60f4495b..b8e6b9bbc2b 100644 --- a/test/core/end2end/tests/binary_metadata.c +++ b/test/core/end2end/tests/binary_metadata.c @@ -310,8 +310,8 @@ static void test_request_response_with_metadata_and_payload( grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/call_creds.c b/test/core/end2end/tests/call_creds.c index 38cba50e129..6ace0079e81 100644 --- a/test/core/end2end/tests/call_creds.c +++ b/test/core/end2end/tests/call_creds.c @@ -343,8 +343,8 @@ static void request_response_with_payload_and_call_creds( grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); @@ -469,7 +469,7 @@ static void test_request_with_server_rejecting_client_creds( grpc_byte_buffer_destroy(response_payload_recv); grpc_slice_unref(details); - grpc_call_destroy(c); + grpc_call_unref(c); cq_verifier_destroy(cqv); end_test(&f); diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c index 1a92aa48378..395d3a12f4e 100644 --- a/test/core/end2end/tests/cancel_after_accept.c +++ b/test/core/end2end/tests/cancel_after_accept.c @@ -248,8 +248,8 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, grpc_byte_buffer_destroy(response_payload_recv); grpc_slice_unref(details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); if (args != NULL) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; diff --git a/test/core/end2end/tests/cancel_after_client_done.c b/test/core/end2end/tests/cancel_after_client_done.c index 0afeecb037b..f92f5b971e8 100644 --- a/test/core/end2end/tests/cancel_after_client_done.c +++ b/test/core/end2end/tests/cancel_after_client_done.c @@ -225,8 +225,8 @@ static void test_cancel_after_accept_and_writes_closed( grpc_byte_buffer_destroy(response_payload_recv); grpc_slice_unref(details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); end_test(&f); diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c index 8a96ef2f894..61c9a18a6d5 100644 --- a/test/core/end2end/tests/cancel_after_invoke.c +++ b/test/core/end2end/tests/cancel_after_invoke.c @@ -185,7 +185,7 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config, grpc_byte_buffer_destroy(response_payload_recv); grpc_slice_unref(details); - grpc_call_destroy(c); + grpc_call_unref(c); cq_verifier_destroy(cqv); end_test(&f); diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.c index 586aa7ead37..c1abf983505 100644 --- a/test/core/end2end/tests/cancel_before_invoke.c +++ b/test/core/end2end/tests/cancel_before_invoke.c @@ -182,7 +182,7 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config, grpc_byte_buffer_destroy(response_payload_recv); grpc_slice_unref(details); - grpc_call_destroy(c); + grpc_call_unref(c); cq_verifier_destroy(cqv); end_test(&f); diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.c b/test/core/end2end/tests/cancel_in_a_vacuum.c index bc462ddcf56..c78192a8906 100644 --- a/test/core/end2end/tests/cancel_in_a_vacuum.c +++ b/test/core/end2end/tests/cancel_in_a_vacuum.c @@ -114,7 +114,7 @@ static void test_cancel_in_a_vacuum(grpc_end2end_test_config config, GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, NULL)); - grpc_call_destroy(c); + grpc_call_unref(c); cq_verifier_destroy(v_client); end_test(&f); diff --git a/test/core/end2end/tests/cancel_with_status.c b/test/core/end2end/tests/cancel_with_status.c index 7d03fe5580f..3c7522bfe31 100644 --- a/test/core/end2end/tests/cancel_with_status.c +++ b/test/core/end2end/tests/cancel_with_status.c @@ -161,7 +161,7 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_metadata_array_destroy(&initial_metadata_recv); grpc_metadata_array_destroy(&trailing_metadata_recv); - grpc_call_destroy(c); + grpc_call_unref(c); cq_verifier_destroy(cqv); } diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c index 7dd8c112d11..af88ce73111 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.c @@ -257,8 +257,8 @@ static void request_for_disabled_algorithm( grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); @@ -515,8 +515,8 @@ static void request_with_payload_template( grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/default_host.c b/test/core/end2end/tests/default_host.c index bc1829b24b7..ceba1fb9042 100644 --- a/test/core/end2end/tests/default_host.c +++ b/test/core/end2end/tests/default_host.c @@ -210,8 +210,8 @@ static void simple_request_body(grpc_end2end_test_fixture f) { grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); } diff --git a/test/core/end2end/tests/disappearing_server.c b/test/core/end2end/tests/disappearing_server.c index 05440a6f56c..965e1bd20c2 100644 --- a/test/core/end2end/tests/disappearing_server.c +++ b/test/core/end2end/tests/disappearing_server.c @@ -186,8 +186,8 @@ static void do_request_and_shutdown_server(grpc_end2end_test_config config, grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); } static void disappearing_server_test(grpc_end2end_test_config config) { diff --git a/test/core/end2end/tests/empty_batch.c b/test/core/end2end/tests/empty_batch.c index 50bb6b849e1..c4789ef859b 100644 --- a/test/core/end2end/tests/empty_batch.c +++ b/test/core/end2end/tests/empty_batch.c @@ -117,7 +117,7 @@ static void empty_batch_body(grpc_end2end_test_config config, CQ_EXPECT_COMPLETION(cqv, tag(1), 1); cq_verify(cqv); - grpc_call_destroy(c); + grpc_call_unref(c); cq_verifier_destroy(cqv); } diff --git a/test/core/end2end/tests/filter_call_init_fails.c b/test/core/end2end/tests/filter_call_init_fails.c index ebfe3b03dc3..74b832cd02d 100644 --- a/test/core/end2end/tests/filter_call_init_fails.c +++ b/test/core/end2end/tests/filter_call_init_fails.c @@ -188,7 +188,7 @@ static void test_request(grpc_end2end_test_config config) { grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); + grpc_call_unref(c); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/filter_causes_close.c b/test/core/end2end/tests/filter_causes_close.c index e6b02eaeee3..1aae5ea8c9f 100644 --- a/test/core/end2end/tests/filter_causes_close.c +++ b/test/core/end2end/tests/filter_causes_close.c @@ -185,7 +185,7 @@ static void test_request(grpc_end2end_test_config config) { grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); + grpc_call_unref(c); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/filter_latency.c b/test/core/end2end/tests/filter_latency.c index 2428c92a42b..1607c9794f1 100644 --- a/test/core/end2end/tests/filter_latency.c +++ b/test/core/end2end/tests/filter_latency.c @@ -224,8 +224,8 @@ static void test_request(grpc_end2end_test_config config) { grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(s); - grpc_call_destroy(c); + grpc_call_unref(s); + grpc_call_unref(c); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/graceful_server_shutdown.c b/test/core/end2end/tests/graceful_server_shutdown.c index a3ad260cc22..be006f30d72 100644 --- a/test/core/end2end/tests/graceful_server_shutdown.c +++ b/test/core/end2end/tests/graceful_server_shutdown.c @@ -188,7 +188,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( CQ_EXPECT_COMPLETION(cqv, tag(1), 1); cq_verify(cqv); - grpc_call_destroy(s); + grpc_call_unref(s); GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); @@ -202,7 +202,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); + grpc_call_unref(c); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/high_initial_seqno.c b/test/core/end2end/tests/high_initial_seqno.c index cca8532b0e0..08e3fd3d67d 100644 --- a/test/core/end2end/tests/high_initial_seqno.c +++ b/test/core/end2end/tests/high_initial_seqno.c @@ -201,8 +201,8 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); /* TODO(ctiller): this rate limits the test, and it should be removed when retry has been implemented; until then cross-thread chatter diff --git a/test/core/end2end/tests/hpack_size.c b/test/core/end2end/tests/hpack_size.c index 7601722deea..95725b2e7c1 100644 --- a/test/core/end2end/tests/hpack_size.c +++ b/test/core/end2end/tests/hpack_size.c @@ -354,8 +354,8 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); } diff --git a/test/core/end2end/tests/idempotent_request.c b/test/core/end2end/tests/idempotent_request.c index cef2e100be9..f5ed60138e7 100644 --- a/test/core/end2end/tests/idempotent_request.c +++ b/test/core/end2end/tests/idempotent_request.c @@ -215,8 +215,8 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); } diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.c index d799bd8ccf9..f907a3fd1c0 100644 --- a/test/core/end2end/tests/invoke_large_request.c +++ b/test/core/end2end/tests/invoke_large_request.c @@ -256,8 +256,8 @@ static void test_invoke_large_request(grpc_end2end_test_config config, grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/keepalive_timeout.c b/test/core/end2end/tests/keepalive_timeout.c index 44b6e12abc7..f86e4c56a12 100644 --- a/test/core/end2end/tests/keepalive_timeout.c +++ b/test/core/end2end/tests/keepalive_timeout.c @@ -221,8 +221,8 @@ static void test_keepalive_timeout(grpc_end2end_test_config config) { grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/large_metadata.c b/test/core/end2end/tests/large_metadata.c index ac4c0e7f3b4..6f78b3b5c7e 100644 --- a/test/core/end2end/tests/large_metadata.c +++ b/test/core/end2end/tests/large_metadata.c @@ -242,8 +242,8 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/load_reporting_hook.c b/test/core/end2end/tests/load_reporting_hook.c index d1ee26fe502..3eb75de3a9a 100644 --- a/test/core/end2end/tests/load_reporting_hook.c +++ b/test/core/end2end/tests/load_reporting_hook.c @@ -262,8 +262,8 @@ static void request_response_with_payload( grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c index e81a6289443..b7221cb315e 100644 --- a/test/core/end2end/tests/max_concurrent_streams.c +++ b/test/core/end2end/tests/max_concurrent_streams.c @@ -197,8 +197,8 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); } @@ -429,10 +429,10 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { cq_verifier_destroy(cqv); - grpc_call_destroy(c1); - grpc_call_destroy(s1); - grpc_call_destroy(c2); - grpc_call_destroy(s2); + grpc_call_unref(c1); + grpc_call_unref(s1); + grpc_call_unref(c2); + grpc_call_unref(s2); grpc_slice_unref(details1); grpc_slice_unref(details2); @@ -624,10 +624,10 @@ static void test_max_concurrent_streams_with_timeout_on_first( cq_verifier_destroy(cqv); - grpc_call_destroy(c1); - grpc_call_destroy(s1); - grpc_call_destroy(c2); - grpc_call_destroy(s2); + grpc_call_unref(c1); + grpc_call_unref(s1); + grpc_call_unref(c2); + grpc_call_unref(s2); grpc_slice_unref(details1); grpc_slice_unref(details2); @@ -785,7 +785,7 @@ static void test_max_concurrent_streams_with_timeout_on_second( /* second request is finished because of time out, so destroy the second call */ - grpc_call_destroy(c2); + grpc_call_unref(c2); /* now reply the first call */ memset(ops, 0, sizeof(ops)); @@ -817,8 +817,8 @@ static void test_max_concurrent_streams_with_timeout_on_second( cq_verifier_destroy(cqv); - grpc_call_destroy(c1); - grpc_call_destroy(s1); + grpc_call_unref(c1); + grpc_call_unref(s1); grpc_slice_unref(details1); grpc_slice_unref(details2); diff --git a/test/core/end2end/tests/max_message_length.c b/test/core/end2end/tests/max_message_length.c index b15d30f58c4..8fc49352c27 100644 --- a/test/core/end2end/tests/max_message_length.c +++ b/test/core/end2end/tests/max_message_length.c @@ -285,8 +285,8 @@ done: grpc_byte_buffer_destroy(request_payload); grpc_byte_buffer_destroy(recv_payload); - grpc_call_destroy(c); - if (s != NULL) grpc_call_destroy(s); + grpc_call_unref(c); + if (s != NULL) grpc_call_unref(s); cq_verifier_destroy(cqv); @@ -479,8 +479,8 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config, grpc_byte_buffer_destroy(response_payload); grpc_byte_buffer_destroy(recv_payload); - grpc_call_destroy(c); - if (s != NULL) grpc_call_destroy(s); + grpc_call_unref(c); + if (s != NULL) grpc_call_unref(s); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/negative_deadline.c b/test/core/end2end/tests/negative_deadline.c index 0b61efbac97..04b09df7492 100644 --- a/test/core/end2end/tests/negative_deadline.c +++ b/test/core/end2end/tests/negative_deadline.c @@ -158,7 +158,7 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_metadata_array_destroy(&initial_metadata_recv); grpc_metadata_array_destroy(&trailing_metadata_recv); - grpc_call_destroy(c); + grpc_call_unref(c); cq_verifier_destroy(cqv); } diff --git a/test/core/end2end/tests/network_status_change.c b/test/core/end2end/tests/network_status_change.c index d7a4106459d..a5e6240cd26 100644 --- a/test/core/end2end/tests/network_status_change.c +++ b/test/core/end2end/tests/network_status_change.c @@ -227,8 +227,8 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) { grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/no_logging.c b/test/core/end2end/tests/no_logging.c index 56e48a88a87..cb077921d19 100644 --- a/test/core/end2end/tests/no_logging.c +++ b/test/core/end2end/tests/no_logging.c @@ -240,8 +240,8 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); } diff --git a/test/core/end2end/tests/payload.c b/test/core/end2end/tests/payload.c index b04ee5705c6..9f2e0ffa612 100644 --- a/test/core/end2end/tests/payload.c +++ b/test/core/end2end/tests/payload.c @@ -257,8 +257,8 @@ static void request_response_with_payload(grpc_end2end_test_config config, grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.c index 848f76018d1..62b01e60cd3 100644 --- a/test/core/end2end/tests/ping_pong_streaming.c +++ b/test/core/end2end/tests/ping_pong_streaming.c @@ -261,8 +261,8 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, CQ_EXPECT_COMPLETION(cqv, tag(104), 1); cq_verify(cqv); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/registered_call.c b/test/core/end2end/tests/registered_call.c index 9c8ce89c838..cdcba07203d 100644 --- a/test/core/end2end/tests/registered_call.c +++ b/test/core/end2end/tests/registered_call.c @@ -196,8 +196,8 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); } diff --git a/test/core/end2end/tests/request_with_flags.c b/test/core/end2end/tests/request_with_flags.c index 329359e08b8..a636d515a45 100644 --- a/test/core/end2end/tests/request_with_flags.c +++ b/test/core/end2end/tests/request_with_flags.c @@ -175,7 +175,7 @@ static void test_invoke_request_with_flags( grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); + grpc_call_unref(c); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c index f71f92bbb84..3d6e3f43d32 100644 --- a/test/core/end2end/tests/request_with_payload.c +++ b/test/core/end2end/tests/request_with_payload.c @@ -222,8 +222,8 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/resource_quota_server.c b/test/core/end2end/tests/resource_quota_server.c index db26b4480e0..6d4cb73d669 100644 --- a/test/core/end2end/tests/resource_quota_server.c +++ b/test/core/end2end/tests/resource_quota_server.c @@ -265,7 +265,7 @@ void resource_quota_server(grpc_end2end_test_config config) { grpc_metadata_array_destroy(&initial_metadata_recv[call_id]); grpc_metadata_array_destroy(&trailing_metadata_recv[call_id]); - grpc_call_destroy(client_calls[call_id]); + grpc_call_unref(client_calls[call_id]); grpc_slice_unref(details[call_id]); pending_client_calls--; @@ -347,7 +347,7 @@ void resource_quota_server(grpc_end2end_test_config config) { GPR_ASSERT(pending_server_end_calls > 0); pending_server_end_calls--; - grpc_call_destroy(server_calls[call_id]); + grpc_call_unref(server_calls[call_id]); } } diff --git a/test/core/end2end/tests/server_finishes_request.c b/test/core/end2end/tests/server_finishes_request.c index b42d17002e8..9463ed64ada 100644 --- a/test/core/end2end/tests/server_finishes_request.c +++ b/test/core/end2end/tests/server_finishes_request.c @@ -195,8 +195,8 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); } diff --git a/test/core/end2end/tests/shutdown_finishes_calls.c b/test/core/end2end/tests/shutdown_finishes_calls.c index c019682ea66..245acbdce83 100644 --- a/test/core/end2end/tests/shutdown_finishes_calls.c +++ b/test/core/end2end/tests/shutdown_finishes_calls.c @@ -182,8 +182,8 @@ static void test_early_server_shutdown_finishes_inflight_calls( grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/simple_cacheable_request.c b/test/core/end2end/tests/simple_cacheable_request.c index 4eef02e9eed..915920b1b9f 100644 --- a/test/core/end2end/tests/simple_cacheable_request.c +++ b/test/core/end2end/tests/simple_cacheable_request.c @@ -270,8 +270,8 @@ static void test_cacheable_request_response_with_metadata_and_payload( grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c index e3b6aee783e..f4331e43dd1 100644 --- a/test/core/end2end/tests/simple_delayed_request.c +++ b/test/core/end2end/tests/simple_delayed_request.c @@ -191,8 +191,8 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); } diff --git a/test/core/end2end/tests/simple_metadata.c b/test/core/end2end/tests/simple_metadata.c index 7ab5563cfa9..d151ea7040f 100644 --- a/test/core/end2end/tests/simple_metadata.c +++ b/test/core/end2end/tests/simple_metadata.c @@ -262,8 +262,8 @@ static void test_request_response_with_metadata_and_payload( grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index af5d74959e3..5c815938593 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -215,8 +215,8 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); } diff --git a/test/core/end2end/tests/streaming_error_response.c b/test/core/end2end/tests/streaming_error_response.c index 2b9c404b15a..a0ec2f6f911 100644 --- a/test/core/end2end/tests/streaming_error_response.c +++ b/test/core/end2end/tests/streaming_error_response.c @@ -259,8 +259,8 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/trailing_metadata.c b/test/core/end2end/tests/trailing_metadata.c index dbbda505bc4..d7a6adcd3e7 100644 --- a/test/core/end2end/tests/trailing_metadata.c +++ b/test/core/end2end/tests/trailing_metadata.c @@ -272,8 +272,8 @@ static void test_request_response_with_metadata_and_payload( grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/write_buffering.c b/test/core/end2end/tests/write_buffering.c index abf90ca6e06..c7ecd97a81e 100644 --- a/test/core/end2end/tests/write_buffering.c +++ b/test/core/end2end/tests/write_buffering.c @@ -270,8 +270,8 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/write_buffering_at_end.c b/test/core/end2end/tests/write_buffering_at_end.c index 8c02b425bae..55bbab4ea20 100644 --- a/test/core/end2end/tests/write_buffering_at_end.c +++ b/test/core/end2end/tests/write_buffering_at_end.c @@ -261,8 +261,8 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); diff --git a/test/core/fling/client.c b/test/core/fling/client.c index 85bab6d431b..7fa7563b939 100644 --- a/test/core/fling/client.c +++ b/test/core/fling/client.c @@ -99,7 +99,7 @@ static void step_ping_pong_request(void) { (size_t)(op - ops), (void *)1, NULL)); grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); - grpc_call_destroy(call); + grpc_call_unref(call); grpc_byte_buffer_destroy(response_payload_recv); call = NULL; GPR_TIMER_END("ping_pong", 1); @@ -233,7 +233,7 @@ int main(int argc, char **argv) { grpc_profiler_stop(); if (call) { - grpc_call_destroy(call); + grpc_call_unref(call); } grpc_channel_destroy(channel); diff --git a/test/core/fling/server.c b/test/core/fling/server.c index 7ea54b1167e..9488b0b5fcb 100644 --- a/test/core/fling/server.c +++ b/test/core/fling/server.c @@ -294,7 +294,7 @@ int main(int argc, char **argv) { break; case FLING_SERVER_SEND_STATUS_FOR_STREAMING: /* Send status and close completed at server */ - grpc_call_destroy(call); + grpc_call_unref(call); if (!shutdown_started) request_call(); break; case FLING_SERVER_READ_FOR_UNARY: @@ -307,7 +307,7 @@ int main(int argc, char **argv) { /* Finished unary call. */ grpc_byte_buffer_destroy(payload_buffer); payload_buffer = NULL; - grpc_call_destroy(call); + grpc_call_unref(call); if (!shutdown_started) request_call(); break; } diff --git a/test/core/memory_usage/client.c b/test/core/memory_usage/client.c index 51ea51bc12f..78b9db9195c 100644 --- a/test/core/memory_usage/client.c +++ b/test/core/memory_usage/client.c @@ -120,7 +120,7 @@ static void finish_ping_pong_request(int call_idx) { grpc_metadata_array_destroy(&calls[call_idx].initial_metadata_recv); grpc_metadata_array_destroy(&calls[call_idx].trailing_metadata_recv); grpc_slice_unref(calls[call_idx].details); - grpc_call_destroy(calls[call_idx].call); + grpc_call_unref(calls[call_idx].call); calls[call_idx].call = NULL; } @@ -187,7 +187,7 @@ static struct grpc_memory_counters send_snapshot_request(int call_idx, grpc_byte_buffer_destroy(response_payload_recv); grpc_slice_unref(calls[call_idx].details); calls[call_idx].details = grpc_empty_slice(); - grpc_call_destroy(calls[call_idx].call); + grpc_call_unref(calls[call_idx].call); calls[call_idx].call = NULL; return snapshot; diff --git a/test/core/memory_usage/server.c b/test/core/memory_usage/server.c index ab059c25b8b..cba2086a44c 100644 --- a/test/core/memory_usage/server.c +++ b/test/core/memory_usage/server.c @@ -281,7 +281,7 @@ int main(int argc, char **argv) { case FLING_SERVER_WAIT_FOR_DESTROY: break; case FLING_SERVER_SEND_STATUS_FLING_CALL: - grpc_call_destroy(s->call); + grpc_call_unref(s->call); grpc_call_details_destroy(&s->call_details); grpc_metadata_array_destroy(&s->initial_metadata_send); grpc_metadata_array_destroy(&s->request_metadata_recv); @@ -299,7 +299,7 @@ int main(int argc, char **argv) { case FLING_SERVER_SEND_STATUS_SNAPSHOT: grpc_byte_buffer_destroy(payload_buffer); grpc_byte_buffer_destroy(terminal_buffer); - grpc_call_destroy(s->call); + grpc_call_unref(s->call); grpc_call_details_destroy(&s->call_details); grpc_metadata_array_destroy(&s->initial_metadata_send); grpc_metadata_array_destroy(&s->request_metadata_recv); diff --git a/test/core/surface/lame_client_test.c b/test/core/surface/lame_client_test.c index 9deb50bb044..664bcf0ca4b 100644 --- a/test/core/surface/lame_client_test.c +++ b/test/core/surface/lame_client_test.c @@ -156,7 +156,7 @@ int main(int argc, char **argv) { GPR_ASSERT(strcmp(peer, "lampoon:national") == 0); gpr_free(peer); - grpc_call_destroy(call); + grpc_call_unref(call); grpc_channel_destroy(chan); cq_verifier_destroy(cqv); grpc_completion_queue_destroy(cq); diff --git a/test/cpp/grpclb/grpclb_test.cc b/test/cpp/grpclb/grpclb_test.cc index 89ed9249adc..65fa73c417a 100644 --- a/test/cpp/grpclb/grpclb_test.cc +++ b/test/cpp/grpclb/grpclb_test.cc @@ -310,7 +310,7 @@ static void start_lb_server(server_fixture *sf, int *ports, size_t nports, gpr_log(GPR_INFO, "LB Server[%s](%s) after tag 204. All done. LB server out", sf->servers_hostport, sf->balancer_name); - grpc_call_destroy(s); + grpc_call_unref(s); cq_verifier_destroy(cqv); @@ -457,7 +457,7 @@ static void start_backend_server(server_fixture *sf) { gpr_log(GPR_INFO, "Server[%s] DONE. After servicing %d calls", sf->servers_hostport, sf->num_calls_serviced); - grpc_call_destroy(s); + grpc_call_unref(s); cq_verifier_destroy(cqv); grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); @@ -557,7 +557,7 @@ static void perform_request(client_fixture *cf) { peer = grpc_call_get_peer(c); gpr_log(GPR_INFO, "Client DONE WITH SERVER %s ", peer); - grpc_call_destroy(c); + grpc_call_unref(c); cq_verify_empty_timeout(cqv, 1 /* seconds */); cq_verifier_destroy(cqv); diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index 4af2263e823..bcfcc703dab 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -123,7 +123,7 @@ static void BM_CallCreateDestroy(benchmark::State &state) { void *method_hdl = grpc_channel_register_call(fixture.channel(), "/foo/bar", NULL, NULL); while (state.KeepRunning()) { - grpc_call_destroy(grpc_channel_create_registered_call( + grpc_call_unref(grpc_channel_create_registered_call( fixture.channel(), NULL, GRPC_PROPAGATE_DEFAULTS, cq, method_hdl, deadline, NULL)); } @@ -590,7 +590,7 @@ static void BM_IsolatedCall_NoOp(benchmark::State &state) { void *method_hdl = grpc_channel_register_call(fixture.channel(), "/foo/bar", NULL, NULL); while (state.KeepRunning()) { - grpc_call_destroy(grpc_channel_create_registered_call( + grpc_call_unref(grpc_channel_create_registered_call( fixture.channel(), nullptr, GRPC_PROPAGATE_DEFAULTS, fixture.cq(), method_hdl, deadline, NULL)); } @@ -634,7 +634,7 @@ static void BM_IsolatedCall_Unary(benchmark::State &state) { grpc_call_start_batch(call, ops, 6, tag(1), NULL); grpc_completion_queue_next(fixture.cq(), gpr_inf_future(GPR_CLOCK_MONOTONIC), NULL); - grpc_call_destroy(call); + grpc_call_unref(call); } fixture.Finish(state); grpc_metadata_array_destroy(&recv_initial_metadata); @@ -674,7 +674,7 @@ static void BM_IsolatedCall_StreamingSend(benchmark::State &state) { grpc_completion_queue_next(fixture.cq(), gpr_inf_future(GPR_CLOCK_MONOTONIC), NULL); } - grpc_call_destroy(call); + grpc_call_unref(call); fixture.Finish(state); grpc_metadata_array_destroy(&recv_initial_metadata); grpc_metadata_array_destroy(&recv_trailing_metadata); From 66051c618fecc6f9c6b1fa40749c1f267147eb28 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 31 Mar 2017 09:16:35 -0700 Subject: [PATCH 120/461] Async end2end test passes --- include/grpc++/impl/codegen/async_unary_call.h | 13 ++++++++----- include/grpc++/impl/codegen/call.h | 10 ++++++---- include/grpc++/impl/codegen/core_codegen.h | 3 +++ .../grpc++/impl/codegen/core_codegen_interface.h | 3 +++ src/cpp/client/channel_cc.cc | 2 +- src/cpp/common/core_codegen.cc | 3 +++ src/cpp/server/server_cc.cc | 2 +- src/cpp/server/server_context.cc | 5 +++-- 8 files changed, 28 insertions(+), 13 deletions(-) diff --git a/include/grpc++/impl/codegen/async_unary_call.h b/include/grpc++/impl/codegen/async_unary_call.h index dd65cf89d6e..b120b37f1fe 100644 --- a/include/grpc++/impl/codegen/async_unary_call.h +++ b/include/grpc++/impl/codegen/async_unary_call.h @@ -68,10 +68,9 @@ class ClientAsyncResponseReader final ClientContext* context, const W& request) { Call call = channel->CreateCall(method, context, cq); - ClientAsyncResponseReader* reader = static_cast( - grpc_call_arena_alloc(call.call(), sizeof(*reader))); - new (&reader->call_) Call(std::move(call)); - reader->context_ = context; + ClientAsyncResponseReader* reader = + new (grpc_call_arena_alloc(call.call(), sizeof(*reader))) + ClientAsyncResponseReader(call, context); reader->init_buf_.SendInitialMetadata(context->send_initial_metadata_, context->initial_metadata_flags()); @@ -107,11 +106,15 @@ class ClientAsyncResponseReader final } private: - ClientContext* context_; + ClientContext* const context_; Call call_; + ClientAsyncResponseReader(Call call, ClientContext* context) + : context_(context), call_(call) {} + // disable operator new static void* operator new(std::size_t size); + static void* operator new(std::size_t size, void* p) { return p; }; SneakyCallOpSet diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h index 4a52c2cbcfa..56dd7b96850 100644 --- a/include/grpc++/impl/codegen/call.h +++ b/include/grpc++/impl/codegen/call.h @@ -570,7 +570,7 @@ class CallOpSetInterface : public CompletionQueueTag { public: /// Fills in grpc_op, starting from ops[*nops] and moving /// upwards. - virtual void FillOps(grpc_op* ops, size_t* nops) = 0; + virtual void FillOps(grpc_call* call, grpc_op* ops, size_t* nops) = 0; }; /// Primary implementaiton of CallOpSetInterface. @@ -598,10 +598,11 @@ class CallOpSet : public CallOpSetInterface, this->Op4::AddOp(ops, nops); this->Op5::AddOp(ops, nops); this->Op6::AddOp(ops, nops); - grpc_call_ref(call); + g_core_codegen_interface->grpc_call_ref(call); + call_ = call; } - bool FinalizeResult(grpc_call* call, void** tag, bool* status) override { + bool FinalizeResult(void** tag, bool* status) override { this->Op1::FinishOp(status); this->Op2::FinishOp(status); this->Op3::FinishOp(status); @@ -609,7 +610,7 @@ class CallOpSet : public CallOpSetInterface, this->Op5::FinishOp(status); this->Op6::FinishOp(status); *tag = return_tag_; - grpc_call_unref(call); + g_core_codegen_interface->grpc_call_unref(call_); return true; } @@ -617,6 +618,7 @@ class CallOpSet : public CallOpSetInterface, private: void* return_tag_; + grpc_call* call_; }; /// A CallOpSet that does not post completions to the completion queue. diff --git a/include/grpc++/impl/codegen/core_codegen.h b/include/grpc++/impl/codegen/core_codegen.h index 754bf14b259..b579849acaa 100644 --- a/include/grpc++/impl/codegen/core_codegen.h +++ b/include/grpc++/impl/codegen/core_codegen.h @@ -64,6 +64,9 @@ class CoreCodegen : public CoreCodegenInterface { void gpr_cv_signal(gpr_cv* cv) override; void gpr_cv_broadcast(gpr_cv* cv) override; + void grpc_call_ref(grpc_call* call) override; + void grpc_call_unref(grpc_call* call) override; + void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) override; int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader, diff --git a/include/grpc++/impl/codegen/core_codegen_interface.h b/include/grpc++/impl/codegen/core_codegen_interface.h index 45ea0403031..12464591a42 100644 --- a/include/grpc++/impl/codegen/core_codegen_interface.h +++ b/include/grpc++/impl/codegen/core_codegen_interface.h @@ -94,6 +94,9 @@ class CoreCodegenInterface { virtual grpc_byte_buffer* grpc_raw_byte_buffer_create(grpc_slice* slice, size_t nslices) = 0; + virtual void grpc_call_ref(grpc_call* call) = 0; + virtual void grpc_call_unref(grpc_call* call) = 0; + virtual grpc_slice grpc_slice_malloc(size_t length) = 0; virtual void grpc_slice_unref(grpc_slice slice) = 0; virtual grpc_slice grpc_slice_split_tail(grpc_slice* s, size_t split) = 0; diff --git a/src/cpp/client/channel_cc.cc b/src/cpp/client/channel_cc.cc index c985183ae76..fac1ba9d43c 100644 --- a/src/cpp/client/channel_cc.cc +++ b/src/cpp/client/channel_cc.cc @@ -131,7 +131,7 @@ void Channel::PerformOpsOnCall(CallOpSetInterface* ops, Call* call) { static const size_t MAX_OPS = 8; size_t nops = 0; grpc_op cops[MAX_OPS]; - ops->FillOps(cops, &nops); + ops->FillOps(call->call(), cops, &nops); GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call->call(), cops, nops, ops, nullptr)); } diff --git a/src/cpp/common/core_codegen.cc b/src/cpp/common/core_codegen.cc index 36e4c893540..902eee568cb 100644 --- a/src/cpp/common/core_codegen.cc +++ b/src/cpp/common/core_codegen.cc @@ -91,6 +91,9 @@ void CoreCodegen::grpc_byte_buffer_destroy(grpc_byte_buffer* bb) { ::grpc_byte_buffer_destroy(bb); } +void CoreCodegen::grpc_call_ref(grpc_call* call) { ::grpc_call_ref(call); } +void CoreCodegen::grpc_call_unref(grpc_call* call) { ::grpc_call_unref(call); } + int CoreCodegen::grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader, grpc_byte_buffer* buffer) { return ::grpc_byte_buffer_reader_init(reader, buffer); diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index e874892e73c..a611e1a77b2 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -591,7 +591,7 @@ void Server::PerformOpsOnCall(CallOpSetInterface* ops, Call* call) { static const size_t MAX_OPS = 8; size_t nops = 0; grpc_op cops[MAX_OPS]; - ops->FillOps(cops, &nops); + ops->FillOps(call->call(), cops, &nops); auto result = grpc_call_start_batch(call->call(), cops, nops, ops, nullptr); GPR_ASSERT(GRPC_CALL_OK == result); } diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index c0c40fda7be..cc6cf2353ef 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -62,7 +62,7 @@ class ServerContext::CompletionOp final : public CallOpSetInterface { finalized_(false), cancelled_(0) {} - void FillOps(grpc_op* ops, size_t* nops) override; + void FillOps(grpc_call* call, grpc_op* ops, size_t* nops) override; bool FinalizeResult(void** tag, bool* status) override; bool CheckCancelled(CompletionQueue* cq) { @@ -100,7 +100,8 @@ void ServerContext::CompletionOp::Unref() { } } -void ServerContext::CompletionOp::FillOps(grpc_op* ops, size_t* nops) { +void ServerContext::CompletionOp::FillOps(grpc_call* call, grpc_op* ops, + size_t* nops) { ops->op = GRPC_OP_RECV_CLOSE_ON_SERVER; ops->data.recv_close_on_server.cancelled = &cancelled_; ops->flags = 0; From 846242dd5e7bce2a63b3edef96058fe371e6f508 Mon Sep 17 00:00:00 2001 From: Menghan Li Date: Fri, 24 Mar 2017 14:26:55 -0700 Subject: [PATCH 121/461] update go version in Dockerfile to 1.8 --- .../dockerfile/interoptest/grpc_interop_go/Dockerfile.template | 2 +- .../interoptest/grpc_interop_http2/Dockerfile.template | 2 +- .../stress_test/grpc_interop_stress_go/Dockerfile.template | 2 +- tools/dockerfile/interoptest/grpc_interop_go/Dockerfile | 2 +- tools/dockerfile/interoptest/grpc_interop_http2/Dockerfile | 2 +- tools/dockerfile/stress_test/grpc_interop_stress_go/Dockerfile | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/templates/tools/dockerfile/interoptest/grpc_interop_go/Dockerfile.template b/templates/tools/dockerfile/interoptest/grpc_interop_go/Dockerfile.template index 38a5ca725da..bf025d80371 100644 --- a/templates/tools/dockerfile/interoptest/grpc_interop_go/Dockerfile.template +++ b/templates/tools/dockerfile/interoptest/grpc_interop_go/Dockerfile.template @@ -29,7 +29,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - FROM golang:1.5 + FROM golang:latest <%include file="../../go_path.include"/> <%include file="../../python_deps.include"/> diff --git a/templates/tools/dockerfile/interoptest/grpc_interop_http2/Dockerfile.template b/templates/tools/dockerfile/interoptest/grpc_interop_http2/Dockerfile.template index 6204c3e2cb2..0899e007d9e 100644 --- a/templates/tools/dockerfile/interoptest/grpc_interop_http2/Dockerfile.template +++ b/templates/tools/dockerfile/interoptest/grpc_interop_http2/Dockerfile.template @@ -29,7 +29,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - FROM golang:1.5 + FROM golang:latest <%include file="../../go_path.include"/> <%include file="../../python_deps.include"/> diff --git a/templates/tools/dockerfile/stress_test/grpc_interop_stress_go/Dockerfile.template b/templates/tools/dockerfile/stress_test/grpc_interop_stress_go/Dockerfile.template index e02254cd535..ad8ad71b5fa 100644 --- a/templates/tools/dockerfile/stress_test/grpc_interop_stress_go/Dockerfile.template +++ b/templates/tools/dockerfile/stress_test/grpc_interop_stress_go/Dockerfile.template @@ -29,7 +29,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - FROM golang:1.5 + FROM golang:latest <%include file="../../gcp_api_libraries.include"/> <%include file="../../python_deps.include"/> diff --git a/tools/dockerfile/interoptest/grpc_interop_go/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_go/Dockerfile index d3bf071c72e..d7a0b1786b9 100644 --- a/tools/dockerfile/interoptest/grpc_interop_go/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_go/Dockerfile @@ -27,7 +27,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -FROM golang:1.5 +FROM golang:latest # Using login shell removes Go from path, so we add it. RUN ln -s /usr/local/go/bin/go /usr/local/bin diff --git a/tools/dockerfile/interoptest/grpc_interop_http2/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_http2/Dockerfile index 66d9b4f6403..42e9edf98ad 100644 --- a/tools/dockerfile/interoptest/grpc_interop_http2/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_http2/Dockerfile @@ -27,7 +27,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -FROM golang:1.5 +FROM golang:latest # Using login shell removes Go from path, so we add it. RUN ln -s /usr/local/go/bin/go /usr/local/bin diff --git a/tools/dockerfile/stress_test/grpc_interop_stress_go/Dockerfile b/tools/dockerfile/stress_test/grpc_interop_stress_go/Dockerfile index bbf7de7f91d..c099f339aee 100644 --- a/tools/dockerfile/stress_test/grpc_interop_stress_go/Dockerfile +++ b/tools/dockerfile/stress_test/grpc_interop_stress_go/Dockerfile @@ -27,7 +27,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -FROM golang:1.5 +FROM golang:latest # Google Cloud platform API libraries RUN apt-get update && apt-get install -y python-pip && apt-get clean From d35bb9ec62992cb01f44316a7267d39f1918149d Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 31 Mar 2017 12:56:15 -0700 Subject: [PATCH 122/461] Fix sanity --- grpc.def | 1 + src/ruby/ext/grpc/rb_grpc_imports.generated.c | 2 ++ src/ruby/ext/grpc/rb_grpc_imports.generated.h | 3 +++ 3 files changed, 6 insertions(+) diff --git a/grpc.def b/grpc.def index 266ca593ce1..748f8ea1a11 100644 --- a/grpc.def +++ b/grpc.def @@ -83,6 +83,7 @@ EXPORTS grpc_channel_destroy grpc_call_cancel grpc_call_cancel_with_status + grpc_call_ref grpc_call_unref grpc_server_request_call grpc_server_register_method diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.c b/src/ruby/ext/grpc/rb_grpc_imports.generated.c index 907bf908ad4..1d204515cc4 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.c +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.c @@ -121,6 +121,7 @@ grpc_lame_client_channel_create_type grpc_lame_client_channel_create_import; grpc_channel_destroy_type grpc_channel_destroy_import; grpc_call_cancel_type grpc_call_cancel_import; grpc_call_cancel_with_status_type grpc_call_cancel_with_status_import; +grpc_call_ref_type grpc_call_ref_import; grpc_call_unref_type grpc_call_unref_import; grpc_server_request_call_type grpc_server_request_call_import; grpc_server_register_method_type grpc_server_register_method_import; @@ -419,6 +420,7 @@ void grpc_rb_load_imports(HMODULE library) { grpc_channel_destroy_import = (grpc_channel_destroy_type) GetProcAddress(library, "grpc_channel_destroy"); grpc_call_cancel_import = (grpc_call_cancel_type) GetProcAddress(library, "grpc_call_cancel"); grpc_call_cancel_with_status_import = (grpc_call_cancel_with_status_type) GetProcAddress(library, "grpc_call_cancel_with_status"); + grpc_call_ref_import = (grpc_call_ref_type) GetProcAddress(library, "grpc_call_ref"); grpc_call_unref_import = (grpc_call_unref_type) GetProcAddress(library, "grpc_call_unref"); grpc_server_request_call_import = (grpc_server_request_call_type) GetProcAddress(library, "grpc_server_request_call"); grpc_server_register_method_import = (grpc_server_register_method_type) GetProcAddress(library, "grpc_server_register_method"); diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h index c5c416940e5..ac17045be2f 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h @@ -314,6 +314,9 @@ extern grpc_call_cancel_type grpc_call_cancel_import; typedef grpc_call_error(*grpc_call_cancel_with_status_type)(grpc_call *call, grpc_status_code status, const char *description, void *reserved); extern grpc_call_cancel_with_status_type grpc_call_cancel_with_status_import; #define grpc_call_cancel_with_status grpc_call_cancel_with_status_import +typedef void(*grpc_call_ref_type)(grpc_call *call); +extern grpc_call_ref_type grpc_call_ref_import; +#define grpc_call_ref grpc_call_ref_import typedef void(*grpc_call_unref_type)(grpc_call *call); extern grpc_call_unref_type grpc_call_unref_import; #define grpc_call_unref grpc_call_unref_import From ac399579285661ce13cdbc51c2c8bf7509412be2 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 28 Mar 2017 18:42:00 -0700 Subject: [PATCH 123/461] Polished with better thread safety --- .../chttp2/transport/chttp2_transport.c | 431 ++++++++---------- .../transport/chttp2/transport/frame_data.c | 184 +------- .../transport/chttp2/transport/frame_data.h | 4 +- .../ext/transport/chttp2/transport/internal.h | 28 +- .../ext/transport/chttp2/transport/parsing.c | 4 +- src/core/lib/surface/call.c | 17 +- 6 files changed, 248 insertions(+), 420 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 8c197f2b85f..c86fefe2cfb 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -115,6 +115,11 @@ static void incoming_byte_stream_update_flow_control(grpc_exec_ctx *exec_ctx, static void incoming_byte_stream_destroy_locked(grpc_exec_ctx *exec_ctx, void *byte_stream, grpc_error *error_ignored); +static void incoming_byte_stream_publish_error(grpc_exec_ctx *exec_ctx, + grpc_chttp2_incoming_byte_stream *bs, + grpc_error *error); +static void incoming_byte_stream_unref(grpc_exec_ctx *exec_ctx, + grpc_chttp2_incoming_byte_stream *bs); static void benign_reclaimer_locked(grpc_exec_ctx *exec_ctx, void *t, grpc_error *error); @@ -156,13 +161,14 @@ static void finish_keepalive_ping_locked(grpc_exec_ctx *exec_ctx, void *arg, static void keepalive_watchdog_fired_locked(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error); -static grpc_error *deframe_unprocessed_incoming_frames( - grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *p, - grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_slice_buffer *slices, - grpc_slice *slice_out, bool partial_deframe); -static void clean_unprocessed_frames_buffer(grpc_exec_ctx *exec_ctx, - grpc_chttp2_transport *t, - grpc_chttp2_stream *s); +static grpc_error *deframe_unprocessed_incoming_frames(grpc_exec_ctx *exec_ctx, + grpc_chttp2_data_parser *p, + grpc_chttp2_stream *s, + grpc_slice_buffer *slices, + grpc_slice *slice_out, + grpc_byte_stream **stream_out); +static void reset_byte_stream(grpc_exec_ctx *exec_ctx, void *arg, + grpc_error *error); /******************************************************************************* * CONSTRUCTION/DESTRUCTION/REFCOUNTING @@ -596,7 +602,6 @@ static int init_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, /* We reserve one 'active stream' that's dropped when the stream is read-closed. The others are for incoming_byte_streams that are actively reading */ - gpr_ref_init(&s->active_streams, 1); GRPC_CHTTP2_STREAM_REF(s, "chttp2"); grpc_chttp2_incoming_metadata_buffer_init(&s->metadata_buffer[0], arena); @@ -606,9 +611,10 @@ static int init_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, s->deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); grpc_closure_init(&s->complete_fetch_locked, complete_fetch_locked, s, grpc_schedule_on_exec_ctx); - s->incoming_frames = NULL; grpc_slice_buffer_init(&s->unprocessed_incoming_frames_buffer); - gpr_mu_init(&s->buffer_mu); + grpc_slice_buffer_init(&s->frame_storage); + s->pending_byte_stream = false; + grpc_closure_init(&s->reset_byte_stream, reset_byte_stream, s, grpc_combiner_scheduler(t->combiner, false)); GRPC_CHTTP2_REF_TRANSPORT(t, "stream"); @@ -638,11 +644,7 @@ static void destroy_stream_locked(grpc_exec_ctx *exec_ctx, void *sp, grpc_slice_buffer_destroy_internal(exec_ctx, &s->unprocessed_incoming_frames_buffer); - if (s->incoming_frames != NULL) { - grpc_chttp2_incoming_byte_stream *ibs = s->incoming_frames; - s->incoming_frames = NULL; - incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, GRPC_ERROR_NONE); - } + grpc_slice_buffer_destroy_internal(exec_ctx, &s->frame_storage); grpc_chttp2_list_remove_stalled_by_transport(t, s); grpc_chttp2_list_remove_stalled_by_stream(t, s); @@ -661,9 +663,7 @@ static void destroy_stream_locked(grpc_exec_ctx *exec_ctx, void *sp, GPR_ASSERT(s->recv_initial_metadata_ready == NULL); GPR_ASSERT(s->recv_message_ready == NULL); GPR_ASSERT(s->recv_trailing_metadata_finished == NULL); - gpr_mu_lock(&s->buffer_mu); grpc_chttp2_data_parser_destroy(exec_ctx, &s->data_parser); - gpr_mu_unlock(&s->buffer_mu); grpc_chttp2_incoming_metadata_buffer_destroy(exec_ctx, &s->metadata_buffer[0]); grpc_chttp2_incoming_metadata_buffer_destroy(exec_ctx, @@ -671,6 +671,7 @@ static void destroy_stream_locked(grpc_exec_ctx *exec_ctx, void *sp, grpc_slice_buffer_destroy_internal(exec_ctx, &s->flow_controlled_buffer); GRPC_ERROR_UNREF(s->read_closed_error); GRPC_ERROR_UNREF(s->write_closed_error); + GRPC_ERROR_UNREF(s->byte_stream_error); if (s->incoming_window_delta > 0) { GRPC_CHTTP2_FLOW_DEBIT_STREAM_INCOMING_WINDOW_DELTA( @@ -1345,22 +1346,9 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op, GPR_ASSERT(s->recv_message_ready == NULL); s->recv_message_ready = op->recv_message_ready; s->recv_message = op->recv_message; - gpr_mu_lock(&s->buffer_mu); - if (s->id != 0 && (s->incoming_frames == NULL || - s->unprocessed_incoming_frames_buffer.count == 0)) { - gpr_mu_unlock(&s->buffer_mu); + if (s->id != 0 && s->frame_storage.length == 0) { incoming_byte_stream_update_flow_control(exec_ctx, t, s, 5, 0); - } else { - gpr_mu_unlock(&s->buffer_mu); - } - gpr_mu_lock(&s->buffer_mu); - if (s->incoming_frames == NULL && - s->unprocessed_incoming_frames_buffer.count > 0) { - deframe_unprocessed_incoming_frames( - exec_ctx, &s->data_parser, t, s, - &s->unprocessed_incoming_frames_buffer, NULL, true); } - gpr_mu_unlock(&s->buffer_mu); grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); } @@ -1527,18 +1515,9 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_exec_ctx *exec_ctx, if (s->recv_initial_metadata_ready != NULL && s->published_metadata[0] != GRPC_METADATA_NOT_PUBLISHED) { if (s->seen_error) { - if (s->incoming_frames != NULL) { - grpc_chttp2_incoming_byte_stream *ibs = s->incoming_frames; - s->incoming_frames = NULL; - incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, - GRPC_ERROR_NONE); - } - size_t length; - gpr_mu_lock(&s->buffer_mu); - length = s->unprocessed_incoming_frames_buffer.length; - gpr_mu_unlock(&s->buffer_mu); - if (length > 0) { - clean_unprocessed_frames_buffer(exec_ctx, t, s); + grpc_slice_buffer_reset_and_unref(&s->frame_storage); + if (!s->pending_byte_stream) { + grpc_slice_buffer_reset_and_unref(&s->unprocessed_incoming_frames_buffer); } } grpc_chttp2_incoming_metadata_buffer_publish( @@ -1551,32 +1530,38 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_exec_ctx *exec_ctx, void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s) { + grpc_error *error = GRPC_ERROR_NONE; if (s->recv_message_ready != NULL) { + *s->recv_message = NULL; if (s->final_metadata_requested && s->seen_error) { - if (s->incoming_frames != NULL) { - grpc_chttp2_incoming_byte_stream *ibs = s->incoming_frames; - s->incoming_frames = NULL; - incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, - GRPC_ERROR_NONE); + grpc_slice_buffer_reset_and_unref(&s->frame_storage); + if (!s->pending_byte_stream) { + grpc_slice_buffer_reset_and_unref(&s->unprocessed_incoming_frames_buffer); } - size_t length; - gpr_mu_lock(&s->buffer_mu); - length = s->unprocessed_incoming_frames_buffer.length; - gpr_mu_unlock(&s->buffer_mu); - if (length > 0) { - clean_unprocessed_frames_buffer(exec_ctx, t, s); + } + if (!s->pending_byte_stream) { + while (s->unprocessed_incoming_frames_buffer.length > 0 || + s->frame_storage.length > 0) { + if (s->unprocessed_incoming_frames_buffer.length == 0) { + grpc_slice_buffer_swap(&s->unprocessed_incoming_frames_buffer, &s->frame_storage); + } + /* error handling ok? */ + error = deframe_unprocessed_incoming_frames(exec_ctx, &s->data_parser, s, &s->unprocessed_incoming_frames_buffer, NULL, s->recv_message); + if (error != GRPC_ERROR_NONE) { + s->seen_error = true; + grpc_slice_buffer_reset_and_unref(&s->frame_storage); + grpc_slice_buffer_reset_and_unref(&s->unprocessed_incoming_frames_buffer); + break; + } else if (*s->recv_message != NULL) { + break; + } } } - if (s->incoming_frames != NULL) { - *s->recv_message = &s->incoming_frames->base; - s->incoming_frames = NULL; - GPR_ASSERT(*s->recv_message != NULL); - grpc_closure_sched(exec_ctx, s->recv_message_ready, GRPC_ERROR_NONE); - s->recv_message_ready = NULL; + if (error == GRPC_ERROR_NONE && *s->recv_message != NULL) { + null_then_run_closure(exec_ctx, &s->recv_message_ready, GRPC_ERROR_NONE); } else if (s->published_metadata[1] != GRPC_METADATA_NOT_PUBLISHED) { *s->recv_message = NULL; - grpc_closure_sched(exec_ctx, s->recv_message_ready, GRPC_ERROR_NONE); - s->recv_message_ready = NULL; + null_then_run_closure(exec_ctx, &s->recv_message_ready, GRPC_ERROR_NONE); } } } @@ -1588,21 +1573,13 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx *exec_ctx, if (s->recv_trailing_metadata_finished != NULL && s->read_closed && s->write_closed) { if (s->seen_error) { - if (s->incoming_frames != NULL) { - grpc_chttp2_incoming_byte_stream *ibs = s->incoming_frames; - s->incoming_frames = NULL; - incoming_byte_stream_destroy_locked(exec_ctx, &ibs->base, - GRPC_ERROR_NONE); - } - size_t length; - gpr_mu_lock(&s->buffer_mu); - length = s->unprocessed_incoming_frames_buffer.length; - gpr_mu_unlock(&s->buffer_mu); - if (length > 0) { - clean_unprocessed_frames_buffer(exec_ctx, t, s); + grpc_slice_buffer_reset_and_unref(&s->frame_storage); + if (!s->pending_byte_stream) { + grpc_slice_buffer_reset_and_unref(&s->unprocessed_incoming_frames_buffer); } } - if (s->all_incoming_byte_streams_finished && + if (s->read_closed && s->frame_storage.length == 0 && + (!s->pending_byte_stream || s->seen_error) && s->recv_trailing_metadata_finished != NULL) { grpc_chttp2_incoming_metadata_buffer_publish( exec_ctx, &s->metadata_buffer[1], s->recv_trailing_metadata); @@ -1613,34 +1590,6 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx *exec_ctx, } } -static void decrement_active_streams_locked(grpc_exec_ctx *exec_ctx, - grpc_chttp2_transport *t, - grpc_chttp2_stream *s) { - size_t length; - gpr_mu_lock(&s->buffer_mu); - length = s->unprocessed_incoming_frames_buffer.length; - gpr_mu_unlock(&s->buffer_mu); - if ((s->all_incoming_byte_streams_finished = - (gpr_unref(&s->active_streams) && length == 0))) { - grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, t, s); - } -} - -static void clean_unprocessed_frames_buffer(grpc_exec_ctx *exec_ctx, - grpc_chttp2_transport *t, - grpc_chttp2_stream *s) { - gpr_mu_lock(&s->buffer_mu); - grpc_slice_buffer_reset_and_unref_internal( - exec_ctx, &s->unprocessed_incoming_frames_buffer); - gpr_mu_unlock(&s->buffer_mu); - // TODO (mxyan): add get ref count in sync.c? - gpr_atm active_streams = - gpr_atm_no_barrier_fetch_add(&s->active_streams.count, 0); - if ((s->all_incoming_byte_streams_finished = (active_streams == 0))) { - grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, t, s); - } -} - static void remove_stream(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, uint32_t id, grpc_error *error) { grpc_chttp2_stream *s = grpc_chttp2_stream_map_delete(&t->stream_map, id); @@ -1649,24 +1598,18 @@ static void remove_stream(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, t->incoming_stream = NULL; grpc_chttp2_parsing_become_skip_parser(exec_ctx, t); } - gpr_mu_lock(&s->buffer_mu); - if (s->data_parser.parsing_frame != NULL) { - grpc_chttp2_incoming_byte_stream *bs = s->data_parser.parsing_frame; - gpr_mu_lock(&bs->slice_mu); - bs->push_closed = true; - if (bs->on_next != NULL) { - gpr_mu_unlock(&bs->slice_mu); - gpr_mu_unlock(&s->buffer_mu); - grpc_chttp2_incoming_byte_stream_finished( - exec_ctx, s->data_parser.parsing_frame, GRPC_ERROR_REF(error)); + if (s->pending_byte_stream) { + if (s->on_next != NULL) { + grpc_chttp2_incoming_byte_stream *bs = s->data_parser.parsing_frame; + if (error == GRPC_ERROR_NONE) { + error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message"); + } + incoming_byte_stream_publish_error(exec_ctx, bs, error); + incoming_byte_stream_unref(exec_ctx, bs); s->data_parser.parsing_frame = NULL; } else { - bs->error = GRPC_ERROR_REF(error); - gpr_mu_unlock(&bs->slice_mu); - gpr_mu_unlock(&s->buffer_mu); + s->byte_stream_error = GRPC_ERROR_REF(error); } - } else { - gpr_mu_unlock(&s->buffer_mu); } if (grpc_chttp2_stream_map_size(&t->stream_map) == 0) { @@ -1852,7 +1795,6 @@ void grpc_chttp2_mark_stream_closed(grpc_exec_ctx *exec_ctx, s->published_metadata[i] = GPRC_METADATA_PUBLISHED_AT_CLOSE; } } - decrement_active_streams_locked(exec_ctx, t, s); grpc_chttp2_maybe_complete_recv_initial_metadata(exec_ctx, t, s); grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); } @@ -2304,11 +2246,32 @@ static void set_pollset_set(grpc_exec_ctx *exec_ctx, grpc_transport *gt, * BYTE STREAM */ +static void reset_byte_stream(grpc_exec_ctx *exec_ctx, void *arg, + grpc_error *error) { + grpc_chttp2_stream *s = (grpc_chttp2_stream *)arg; + + s->pending_byte_stream = false; + if (error == GRPC_ERROR_NONE) { + grpc_chttp2_maybe_complete_recv_message(exec_ctx, s->t, s); + grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, s->t, s); + } else { + GPR_ASSERT(error != GRPC_ERROR_NONE); + grpc_closure_sched(exec_ctx, s->on_next, GRPC_ERROR_REF(error)); + s->on_next = NULL; + GRPC_ERROR_UNREF(s->byte_stream_error); + grpc_chttp2_cancel_stream(exec_ctx, s->t, s, + GRPC_ERROR_REF(error)); + s->byte_stream_error = error; + } +} + static grpc_error *deframe_unprocessed_incoming_frames( grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *p, - grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_slice_buffer *slices, - grpc_slice *slice_out, bool partial_deframe) { - bool slice_set = false; + grpc_chttp2_stream *s, grpc_slice_buffer *slices, + grpc_slice *slice_out, grpc_byte_stream **stream_out) { + grpc_error *error = GRPC_ERROR_NONE; + grpc_chttp2_transport *t = s->t; + while (slices->count > 0) { uint8_t *beg = NULL; uint8_t *end = NULL; @@ -2332,15 +2295,7 @@ static grpc_error *deframe_unprocessed_incoming_frames( p->state = GRPC_CHTTP2_DATA_ERROR; grpc_slice_unref_internal(exec_ctx, slice); return GRPC_ERROR_REF(p->error); - fh_0: case GRPC_CHTTP2_DATA_FH_0: - if (s->incoming_frames != NULL) { - grpc_slice_buffer_undo_take_first( - &s->unprocessed_incoming_frames_buffer, - grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); - grpc_slice_unref_internal(exec_ctx, slice); - return GRPC_ERROR_NONE; - } p->frame_type = *cur; switch (p->frame_type) { case 0: @@ -2396,6 +2351,8 @@ static grpc_error *deframe_unprocessed_incoming_frames( } /* fallthrough */ case GRPC_CHTTP2_DATA_FH_4: + GPR_ASSERT(stream_out != NULL); + GPR_ASSERT(p->parsing_frame == NULL); p->frame_size |= ((uint32_t)*cur); p->state = GRPC_CHTTP2_DATA_FRAME; ++cur; @@ -2403,71 +2360,69 @@ static grpc_error *deframe_unprocessed_incoming_frames( if (p->is_frame_compressed) { message_flags |= GRPC_WRITE_INTERNAL_COMPRESS; } - GPR_ASSERT(s->incoming_frames == NULL); p->parsing_frame = grpc_chttp2_incoming_byte_stream_create( exec_ctx, t, s, p->frame_size, message_flags); - /* fallthrough */ + *stream_out = &p->parsing_frame->base; + if (p->parsing_frame->remaining_bytes == 0) { + grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, GRPC_ERROR_NONE); + p->parsing_frame = NULL; + p->state = GRPC_CHTTP2_DATA_FH_0; + } else { + s->pending_byte_stream = true; + } + + if (cur != end) { + grpc_slice_buffer_undo_take_first(&s->unprocessed_incoming_frames_buffer, grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + } + grpc_slice_unref(slice); + return GRPC_ERROR_NONE; case GRPC_CHTTP2_DATA_FRAME: { GPR_ASSERT(p->parsing_frame != NULL); - if (partial_deframe && p->frame_size > 0) { - if (cur != end) { - grpc_slice_buffer_undo_take_first( - &s->unprocessed_incoming_frames_buffer, - grpc_slice_sub(slice, (size_t)(cur - beg), - (size_t)(end - beg))); - } - grpc_slice_unref_internal(exec_ctx, slice); - return GRPC_ERROR_NONE; - } + GPR_ASSERT(slice_out != NULL); if (cur == end) { grpc_slice_unref_internal(exec_ctx, slice); continue; } - if (slice_set) { - grpc_slice_buffer_undo_take_first( - &s->unprocessed_incoming_frames_buffer, - grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); - grpc_slice_unref_internal(exec_ctx, slice); - return GRPC_ERROR_NONE; - } uint32_t remaining = (uint32_t)(end - cur); if (remaining == p->frame_size) { - grpc_chttp2_incoming_byte_stream_push( + if (GRPC_ERROR_NONE != (error = grpc_chttp2_incoming_byte_stream_push( exec_ctx, p->parsing_frame, grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg)), - slice_out); - slice_set = true; + slice_out))) { + grpc_slice_unref_internal(exec_ctx, slice); + return error; + } grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, GRPC_ERROR_NONE); p->parsing_frame = NULL; p->state = GRPC_CHTTP2_DATA_FH_0; + grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_NONE); grpc_slice_unref_internal(exec_ctx, slice); - continue; + return GRPC_ERROR_NONE; } else if (remaining < p->frame_size) { - grpc_chttp2_incoming_byte_stream_push( + if (GRPC_ERROR_NONE != (error = grpc_chttp2_incoming_byte_stream_push( exec_ctx, p->parsing_frame, grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg)), - slice_out); - slice_set = true; + slice_out))) { + return error; + } p->frame_size -= remaining; grpc_slice_unref_internal(exec_ctx, slice); - continue; + return GRPC_ERROR_NONE; } else { GPR_ASSERT(remaining > p->frame_size); - if (p->frame_size > 0) { - grpc_chttp2_incoming_byte_stream_push( - exec_ctx, p->parsing_frame, - grpc_slice_sub(slice, (size_t)(cur - beg), - (size_t)(cur + p->frame_size - beg)), - slice_out); + if (GRPC_ERROR_NONE != (grpc_chttp2_incoming_byte_stream_push(exec_ctx, p->parsing_frame, grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(cur + p->frame_size - beg)), slice_out))) { + grpc_slice_unref_internal(exec_ctx, slice); + return error; } - slice_set = true; grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, GRPC_ERROR_NONE); p->parsing_frame = NULL; p->state = GRPC_CHTTP2_DATA_FH_0; cur += p->frame_size; - goto fh_0; + grpc_slice_buffer_undo_take_first(&s->unprocessed_incoming_frames_buffer, grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_NONE); + grpc_slice_unref(slice); return GRPC_ERROR_NONE; } } @@ -2480,7 +2435,6 @@ static grpc_error *deframe_unprocessed_incoming_frames( static void incoming_byte_stream_unref(grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs) { if (gpr_unref(&bs->refs)) { - GRPC_ERROR_UNREF(bs->error); grpc_slice_buffer_destroy_internal(exec_ctx, &bs->slices); gpr_mu_destroy(&bs->slice_mu); gpr_free(bs); @@ -2542,90 +2496,90 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t = bs->transport; grpc_chttp2_stream *s = bs->stream; - if (bs->is_tail) { - gpr_mu_lock(&bs->slice_mu); - size_t cur_length = bs->slices.length; - gpr_mu_unlock(&bs->slice_mu); - incoming_byte_stream_update_flow_control( - exec_ctx, t, s, bs->next_action.max_size_hint, cur_length); - } - gpr_mu_lock(&s->buffer_mu); - gpr_mu_lock(&bs->slice_mu); - if (s->unprocessed_incoming_frames_buffer.length > 0) { + size_t cur_length = s->frame_storage.length; + incoming_byte_stream_update_flow_control( + exec_ctx, t, s, bs->next_action.max_size_hint, cur_length); + + GPR_ASSERT(s->unprocessed_incoming_frames_buffer.length == 0); + if (s->frame_storage.length > 0) { + grpc_slice_buffer_swap(&s->frame_storage, &s->unprocessed_incoming_frames_buffer); grpc_closure_sched(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_NONE); - } else if (bs->error != GRPC_ERROR_NONE) { + } else if (s->byte_stream_error != GRPC_ERROR_NONE) { grpc_closure_sched(exec_ctx, bs->next_action.on_complete, - GRPC_ERROR_REF(bs->error)); - } else if (bs->push_closed) { + GRPC_ERROR_REF(s->byte_stream_error)); + if (s->data_parser.parsing_frame != NULL) { + incoming_byte_stream_unref(exec_ctx, s->data_parser.parsing_frame); + s->data_parser.parsing_frame = NULL; + } + } else if (s->read_closed) { if (bs->remaining_bytes != 0) { - bs->error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message"); + s->byte_stream_error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message"); grpc_closure_sched(exec_ctx, bs->next_action.on_complete, - GRPC_ERROR_REF(bs->error)); + GRPC_ERROR_REF(s->byte_stream_error)); + if (s->data_parser.parsing_frame != NULL) { + incoming_byte_stream_unref(exec_ctx, s->data_parser.parsing_frame); + s->data_parser.parsing_frame = NULL; + } } else { /* Should never reach here. */ GPR_ASSERT(false); - grpc_closure_sched(exec_ctx, bs->next_action.on_complete, - GRPC_ERROR_NONE); } } else { - bs->on_next = bs->next_action.on_complete; + s->on_next = bs->next_action.on_complete; } - gpr_mu_unlock(&bs->slice_mu); - gpr_mu_unlock(&s->buffer_mu); incoming_byte_stream_unref(exec_ctx, bs); } +static int incoming_byte_stream_next(grpc_exec_ctx *exec_ctx, + grpc_byte_stream *byte_stream, + size_t max_size_hint, + grpc_closure *on_complete) { + GPR_TIMER_BEGIN("incoming_byte_stream_next", 0); + grpc_chttp2_incoming_byte_stream *bs = + (grpc_chttp2_incoming_byte_stream *)byte_stream; + grpc_chttp2_stream *s = bs->stream; + if (s->unprocessed_incoming_frames_buffer.length > 0) { + return 1; + } else { + gpr_ref(&bs->refs); + bs->next_action.max_size_hint = max_size_hint; + bs->next_action.on_complete = on_complete; + grpc_closure_sched( + exec_ctx, + grpc_closure_init( + &bs->next_action.closure, incoming_byte_stream_next_locked, bs, + grpc_combiner_scheduler(bs->transport->combiner, false)), + GRPC_ERROR_NONE); + GPR_TIMER_END("incoming_byte_stream_next", 0); + return 0; + } +} + static grpc_error *incoming_byte_stream_pull(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, grpc_slice *slice) { GPR_TIMER_BEGIN("incoming_byte_stream_pull", 0); grpc_chttp2_incoming_byte_stream *bs = - (grpc_chttp2_incoming_byte_stream *)byte_stream; + (grpc_chttp2_incoming_byte_stream *)byte_stream; grpc_chttp2_stream *s = bs->stream; - grpc_chttp2_transport *t = bs->transport; - if (bs->error) { - return bs->error; - } - gpr_mu_lock(&s->buffer_mu); if (s->unprocessed_incoming_frames_buffer.length > 0) { grpc_error *error = deframe_unprocessed_incoming_frames( - exec_ctx, &s->data_parser, t, s, &s->unprocessed_incoming_frames_buffer, - slice, false); + exec_ctx, &s->data_parser, s, &s->unprocessed_incoming_frames_buffer, + slice, NULL); if (error != GRPC_ERROR_NONE) { - gpr_mu_unlock(&s->buffer_mu); return error; } } else { - bs->error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message"); - gpr_mu_unlock(&s->buffer_mu); - return bs->error; + grpc_error *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message"); + grpc_closure_sched(exec_ctx, + &s->reset_byte_stream, GRPC_ERROR_REF(error)); + return error; } - gpr_mu_unlock(&s->buffer_mu); GPR_TIMER_END("incoming_byte_stream_pull", 0); return GRPC_ERROR_NONE; } -static int incoming_byte_stream_next(grpc_exec_ctx *exec_ctx, - grpc_byte_stream *byte_stream, - size_t max_size_hint, - grpc_closure *on_complete) { - GPR_TIMER_BEGIN("incoming_byte_stream_next", 0); - grpc_chttp2_incoming_byte_stream *bs = - (grpc_chttp2_incoming_byte_stream *)byte_stream; - gpr_ref(&bs->refs); - bs->next_action.max_size_hint = max_size_hint; - bs->next_action.on_complete = on_complete; - grpc_closure_sched( - exec_ctx, - grpc_closure_init( - &bs->next_action.closure, incoming_byte_stream_next_locked, bs, - grpc_combiner_scheduler(bs->transport->combiner, false)), - GRPC_ERROR_NONE); - GPR_TIMER_END("incoming_byte_stream_next", 0); - return 0; -} - static void incoming_byte_stream_destroy(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream); @@ -2634,7 +2588,6 @@ static void incoming_byte_stream_destroy_locked(grpc_exec_ctx *exec_ctx, grpc_error *error_ignored) { grpc_chttp2_incoming_byte_stream *bs = byte_stream; GPR_ASSERT(bs->base.destroy == incoming_byte_stream_destroy); - decrement_active_streams_locked(exec_ctx, bs->transport, bs->stream); incoming_byte_stream_unref(exec_ctx, bs); } @@ -2655,34 +2608,44 @@ static void incoming_byte_stream_destroy(grpc_exec_ctx *exec_ctx, static void incoming_byte_stream_publish_error( grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, grpc_error *error) { + grpc_chttp2_stream *s = bs->stream; + GPR_ASSERT(error != GRPC_ERROR_NONE); - grpc_closure_sched(exec_ctx, bs->on_next, GRPC_ERROR_REF(error)); - bs->on_next = NULL; - GRPC_ERROR_UNREF(bs->error); + grpc_closure_sched(exec_ctx, s->on_next, GRPC_ERROR_REF(error)); + s->on_next = NULL; + GRPC_ERROR_UNREF(s->byte_stream_error); grpc_chttp2_cancel_stream(exec_ctx, bs->transport, bs->stream, GRPC_ERROR_REF(error)); - bs->error = error; + s->byte_stream_error = error; } -void grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, +grpc_error *grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, grpc_slice slice, grpc_slice *slice_out) { + grpc_chttp2_stream *s = bs->stream; + if (bs->remaining_bytes < GRPC_SLICE_LENGTH(slice)) { - incoming_byte_stream_publish_error( - exec_ctx, bs, - GRPC_ERROR_CREATE_FROM_STATIC_STRING("Too many bytes in stream")); + grpc_error *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Too many bytes in stream"); + + grpc_closure_sched(exec_ctx, + &s->reset_byte_stream, GRPC_ERROR_REF(error)); + grpc_slice_unref_internal(exec_ctx, slice); + return error; } else { bs->remaining_bytes -= (uint32_t)GRPC_SLICE_LENGTH(slice); if (slice_out != NULL) { *slice_out = slice; } + return GRPC_ERROR_NONE; } } -void grpc_chttp2_incoming_byte_stream_finished( +grpc_error *grpc_chttp2_incoming_byte_stream_finished( grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, grpc_error *error) { + grpc_chttp2_stream *s = bs->stream; + if (error == GRPC_ERROR_NONE) { gpr_mu_lock(&bs->slice_mu); if (bs->remaining_bytes != 0) { @@ -2691,9 +2654,11 @@ void grpc_chttp2_incoming_byte_stream_finished( gpr_mu_unlock(&bs->slice_mu); } if (error != GRPC_ERROR_NONE) { - incoming_byte_stream_publish_error(exec_ctx, bs, error); + grpc_closure_sched(exec_ctx, + &s->reset_byte_stream, GRPC_ERROR_REF(error)); } incoming_byte_stream_unref(exec_ctx, bs); + return error; } grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( @@ -2712,14 +2677,10 @@ grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( incoming_byte_stream->next_message = NULL; incoming_byte_stream->transport = t; incoming_byte_stream->stream = s; - gpr_ref(&incoming_byte_stream->stream->active_streams); grpc_slice_buffer_init(&incoming_byte_stream->slices); - incoming_byte_stream->on_next = NULL; incoming_byte_stream->is_tail = 1; - incoming_byte_stream->error = GRPC_ERROR_NONE; + s->byte_stream_error = GRPC_ERROR_NONE; incoming_byte_stream->push_closed = false; - s->incoming_frames = incoming_byte_stream; - grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); return incoming_byte_stream; } diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c index ecd53e2ce96..ecb941e366c 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -63,7 +63,8 @@ void grpc_chttp2_data_parser_destroy(grpc_exec_ctx *exec_ctx, grpc_error *grpc_chttp2_data_parser_begin_frame(grpc_chttp2_data_parser *parser, uint8_t flags, - uint32_t stream_id) { + uint32_t stream_id, + grpc_chttp2_stream *s) { if (flags & ~GRPC_CHTTP2_DATA_FLAG_END_STREAM) { char *msg; gpr_asprintf(&msg, "unsupported data flags: 0x%02x", flags); @@ -75,9 +76,9 @@ grpc_error *grpc_chttp2_data_parser_begin_frame(grpc_chttp2_data_parser *parser, } if (flags & GRPC_CHTTP2_DATA_FLAG_END_STREAM) { - parser->is_last_frame = 1; + s->received_last_frame = true; } else { - parser->is_last_frame = 0; + s->received_last_frame = false; } return GRPC_ERROR_NONE; @@ -144,172 +145,31 @@ void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer *inbuf, stats->data_bytes += write_bytes; } -static void grpc_chttp2_unprocessed_frames_buffer_push( - grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *p, grpc_chttp2_stream *s, - grpc_slice slice) { - grpc_slice_buffer_add(&s->unprocessed_incoming_frames_buffer, slice); - if (p->parsing_frame) { - grpc_chttp2_incoming_byte_stream *bs = p->parsing_frame; - // Necessary? - gpr_mu_lock(&bs->slice_mu); - if (bs->on_next != NULL) { - grpc_closure_sched(exec_ctx, bs->on_next, GRPC_ERROR_NONE); - bs->on_next = NULL; - } - gpr_mu_unlock(&bs->slice_mu); - } -} - -grpc_error *parse_inner_buffer(grpc_exec_ctx *exec_ctx, - grpc_chttp2_data_parser *p, - grpc_chttp2_transport *t, grpc_chttp2_stream *s, - grpc_slice slice) { - uint8_t *const beg = GRPC_SLICE_START_PTR(slice); - uint8_t *const end = GRPC_SLICE_END_PTR(slice); - uint8_t *cur = beg; - uint32_t message_flags; - char *msg; - - if (cur == end) { - return GRPC_ERROR_NONE; - } - - /* If there is already pending data, or if there is a pending - * incoming_byte_stream that is finished, append the data to unprocessed frame - * buffer. */ - gpr_mu_lock(&s->buffer_mu); - if (s->unprocessed_incoming_frames_buffer.count > 0) { - s->stats.incoming.framing_bytes += GRPC_SLICE_LENGTH(slice); - grpc_slice_ref_internal(slice); - grpc_chttp2_unprocessed_frames_buffer_push(exec_ctx, p, s, slice); - gpr_mu_unlock(&s->buffer_mu); - return GRPC_ERROR_NONE; - } - - switch (p->state) { - case GRPC_CHTTP2_DATA_ERROR: - p->state = GRPC_CHTTP2_DATA_ERROR; - gpr_mu_unlock(&s->buffer_mu); - return GRPC_ERROR_REF(p->error); - fh_0: - case GRPC_CHTTP2_DATA_FH_0: - if (s->incoming_frames != NULL) { - s->stats.incoming.framing_bytes += (size_t)(end - cur); - grpc_chttp2_unprocessed_frames_buffer_push( - exec_ctx, p, s, - grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); - gpr_mu_unlock(&s->buffer_mu); - return GRPC_ERROR_NONE; - } - s->stats.incoming.framing_bytes++; - p->frame_type = *cur; - switch (p->frame_type) { - case 0: - p->is_frame_compressed = 0; /* GPR_FALSE */ - break; - case 1: - p->is_frame_compressed = 1; /* GPR_TRUE */ - break; - default: - gpr_asprintf(&msg, "Bad GRPC frame type 0x%02x", p->frame_type); - p->error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg); - p->error = grpc_error_set_int(p->error, GRPC_ERROR_INT_STREAM_ID, - (intptr_t)s->id); - gpr_free(msg); - msg = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); - p->error = grpc_error_set_str(p->error, GRPC_ERROR_STR_RAW_BYTES, - grpc_slice_from_copied_string(msg)); - gpr_free(msg); - p->error = - grpc_error_set_int(p->error, GRPC_ERROR_INT_OFFSET, cur - beg); - p->state = GRPC_CHTTP2_DATA_ERROR; - gpr_mu_unlock(&s->buffer_mu); - return GRPC_ERROR_REF(p->error); - } - if (++cur == end) { - p->state = GRPC_CHTTP2_DATA_FH_1; - gpr_mu_unlock(&s->buffer_mu); - return GRPC_ERROR_NONE; - } - /* fallthrough */ - case GRPC_CHTTP2_DATA_FH_1: - s->stats.incoming.framing_bytes++; - p->frame_size = ((uint32_t)*cur) << 24; - if (++cur == end) { - p->state = GRPC_CHTTP2_DATA_FH_2; - gpr_mu_unlock(&s->buffer_mu); - return GRPC_ERROR_NONE; - } - /* fallthrough */ - case GRPC_CHTTP2_DATA_FH_2: - s->stats.incoming.framing_bytes++; - p->frame_size |= ((uint32_t)*cur) << 16; - if (++cur == end) { - p->state = GRPC_CHTTP2_DATA_FH_3; - gpr_mu_unlock(&s->buffer_mu); - return GRPC_ERROR_NONE; - } - /* fallthrough */ - case GRPC_CHTTP2_DATA_FH_3: - s->stats.incoming.framing_bytes++; - p->frame_size |= ((uint32_t)*cur) << 8; - if (++cur == end) { - p->state = GRPC_CHTTP2_DATA_FH_4; - gpr_mu_unlock(&s->buffer_mu); - return GRPC_ERROR_NONE; - } - /* fallthrough */ - case GRPC_CHTTP2_DATA_FH_4: - s->stats.incoming.framing_bytes++; - p->frame_size |= ((uint32_t)*cur); - p->state = GRPC_CHTTP2_DATA_FRAME; - ++cur; - message_flags = 0; - if (p->is_frame_compressed) { - message_flags |= GRPC_WRITE_INTERNAL_COMPRESS; - } - GPR_ASSERT(s->incoming_frames == NULL); - p->parsing_frame = grpc_chttp2_incoming_byte_stream_create( - exec_ctx, t, s, p->frame_size, message_flags); - /* fallthrough */ - case GRPC_CHTTP2_DATA_FRAME: - if (p->parsing_frame->remaining_bytes == 0) { - grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, - GRPC_ERROR_NONE); - p->parsing_frame = NULL; - p->state = GRPC_CHTTP2_DATA_FH_0; - if (cur != end) { - goto fh_0; - } - } - if (cur == end) { - gpr_mu_unlock(&s->buffer_mu); - return GRPC_ERROR_NONE; - } - uint32_t remaining = (uint32_t)(end - cur); - s->stats.incoming.data_bytes += remaining; - grpc_chttp2_unprocessed_frames_buffer_push( - exec_ctx, p, s, - grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); - gpr_mu_unlock(&s->buffer_mu); - return GRPC_ERROR_NONE; - } - - GPR_UNREACHABLE_CODE( - return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Should never reach here")); -} - grpc_error *grpc_chttp2_data_parser_parse(grpc_exec_ctx *exec_ctx, void *parser, grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_slice slice, int is_last) { - grpc_chttp2_data_parser *p = parser; - grpc_error *error = parse_inner_buffer(exec_ctx, p, t, s, slice); + /* grpc_error *error = parse_inner_buffer(exec_ctx, p, t, s, slice); */ + s->stats.incoming.framing_bytes += GRPC_SLICE_LENGTH(slice); + if (!s->pending_byte_stream) { + grpc_slice_ref_internal(slice); + grpc_slice_buffer_add(&s->frame_storage, slice); + grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); + } else if (s->on_next) { + GPR_ASSERT(s->frame_storage.length == 0); + grpc_slice_ref_internal(slice); + grpc_slice_buffer_add(&s->unprocessed_incoming_frames_buffer, slice); + grpc_closure_sched(exec_ctx, s->on_next, GRPC_ERROR_NONE); + s->on_next = NULL; + } else { + grpc_slice_ref_internal(slice); + grpc_slice_buffer_add(&s->frame_storage, slice); + } - if (is_last && p->is_last_frame) { + if (is_last && s->received_last_frame) { grpc_chttp2_mark_stream_closed(exec_ctx, t, s, true, false, GRPC_ERROR_NONE); } - return error; + return GRPC_ERROR_NONE; } diff --git a/src/core/ext/transport/chttp2/transport/frame_data.h b/src/core/ext/transport/chttp2/transport/frame_data.h index 264ad146085..e7e459c79fa 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.h +++ b/src/core/ext/transport/chttp2/transport/frame_data.h @@ -63,7 +63,6 @@ typedef struct grpc_chttp2_incoming_frame_queue { typedef struct { grpc_chttp2_stream_state state; - uint8_t is_last_frame; uint8_t frame_type; uint32_t frame_size; grpc_error *error; @@ -87,7 +86,8 @@ void grpc_chttp2_data_parser_destroy(grpc_exec_ctx *exec_ctx, /* start processing a new data frame */ grpc_error *grpc_chttp2_data_parser_begin_frame(grpc_chttp2_data_parser *parser, uint8_t flags, - uint32_t stream_id); + uint32_t stream_id, + grpc_chttp2_stream *s); /* handle a slice of a data frame - is_last indicates the last slice of a frame */ diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 5604ea3e31c..917fc1b71eb 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -187,7 +187,6 @@ struct grpc_chttp2_incoming_byte_stream { grpc_byte_stream base; gpr_refcount refs; struct grpc_chttp2_incoming_byte_stream *next_message; /* unused; should be removed */ - grpc_error *error; /* protected by slice_mu */ bool push_closed; /* protected by slice_mu */ grpc_chttp2_transport *transport; /* immutable */ @@ -196,7 +195,6 @@ struct grpc_chttp2_incoming_byte_stream { gpr_mu slice_mu; grpc_slice_buffer slices; /* unused; should be removed */ - grpc_closure *on_next; /* protected by slice_mu */ uint32_t remaining_bytes; /* guaranteed one thread access */ struct { @@ -462,9 +460,6 @@ struct grpc_chttp2_stream { grpc_transport_stream_stats *collecting_stats; grpc_transport_stream_stats stats; - /** number of streams that are currently being read */ - gpr_refcount active_streams; - /** Is this stream closed for writing. */ bool write_closed; /** Is this stream reading half-closed. */ @@ -488,10 +483,13 @@ struct grpc_chttp2_stream { grpc_chttp2_incoming_metadata_buffer metadata_buffer[2]; - grpc_chttp2_incoming_byte_stream *incoming_frames; /* protected by buffer_mu */ - gpr_mu buffer_mu; /* protects unprocessed_incoming_frames_buffer and - data_parser */ - grpc_slice_buffer unprocessed_incoming_frames_buffer; /* protected by buffer_mu */ + grpc_slice_buffer frame_storage; /* protected by t combiner */ + grpc_slice_buffer unprocessed_incoming_frames_buffer; /* guaranteed one thread access */ + grpc_closure *on_next; /* protected by t combiner */ + bool pending_byte_stream; /* protected by t combiner */ + grpc_closure reset_byte_stream; + grpc_error *byte_stream_error; /* protected by t combiner */ + bool received_last_frame; /* proected by t combiner */ gpr_timespec deadline; @@ -504,7 +502,7 @@ struct grpc_chttp2_stream { * incoming_window = incoming_window_delta + transport.initial_window_size */ int64_t incoming_window_delta; /** parsing state for data frames */ - grpc_chttp2_data_parser data_parser; /* protected by buffer_mu */ + grpc_chttp2_data_parser data_parser; /* guaranteed one thread access */ /** number of bytes received - reset at end of parse thread execution */ int64_t received_bytes; @@ -782,11 +780,11 @@ void grpc_chttp2_ref_transport(grpc_chttp2_transport *t); grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s, uint32_t frame_size, uint32_t flags); -void grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, - grpc_chttp2_incoming_byte_stream *bs, - grpc_slice slice, - grpc_slice *slice_out); -void grpc_chttp2_incoming_byte_stream_finished( +grpc_error *grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, + grpc_chttp2_incoming_byte_stream *bs, + grpc_slice slice, + grpc_slice *slice_out); +grpc_error *grpc_chttp2_incoming_byte_stream_finished( grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, grpc_error *error); void grpc_chttp2_incoming_byte_stream_notify( diff --git a/src/core/ext/transport/chttp2/transport/parsing.c b/src/core/ext/transport/chttp2/transport/parsing.c index f1c6f96db58..2c662b67219 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.c +++ b/src/core/ext/transport/chttp2/transport/parsing.c @@ -458,10 +458,8 @@ static grpc_error *init_data_frame_parser(grpc_exec_ctx *exec_ctx, return init_skip_frame_parser(exec_ctx, t, 0); } if (err == GRPC_ERROR_NONE) { - gpr_mu_lock(&s->buffer_mu); err = grpc_chttp2_data_parser_begin_frame(&s->data_parser, - t->incoming_frame_flags, s->id); - gpr_mu_unlock(&s->buffer_mu); + t->incoming_frame_flags, s->id, s); } error_handler: if (err == GRPC_ERROR_NONE) { diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 963e16046a3..6ea199e84f8 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -1143,6 +1143,7 @@ static void finish_batch_step(grpc_exec_ctx *exec_ctx, batch_control *bctl) { static void continue_receiving_slices(grpc_exec_ctx *exec_ctx, batch_control *bctl) { + grpc_error *error; grpc_call *call = bctl->call; for (;;) { size_t remaining = call->receiving_stream->length - @@ -1156,10 +1157,20 @@ static void continue_receiving_slices(grpc_exec_ctx *exec_ctx, } if (grpc_byte_stream_next(exec_ctx, call->receiving_stream, remaining, &call->receiving_slice_ready)) { - grpc_byte_stream_pull(exec_ctx, call->receiving_stream, + error = grpc_byte_stream_pull(exec_ctx, call->receiving_stream, &call->receiving_slice); - grpc_slice_buffer_add(&(*call->receiving_buffer)->data.raw.slice_buffer, - call->receiving_slice); + if (error == GRPC_ERROR_NONE) { + grpc_slice_buffer_add(&(*call->receiving_buffer)->data.raw.slice_buffer, + call->receiving_slice); + } else { + grpc_byte_stream_destroy(exec_ctx, call->receiving_stream); + call->receiving_stream = NULL; + grpc_byte_buffer_destroy(*call->receiving_buffer); + *call->receiving_buffer = NULL; + call->receiving_message = 0; + finish_batch_step(exec_ctx, bctl); + return; + } } else { return; } From 895653bc020a1862be7393fde31e48eb90df0e64 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Sat, 1 Apr 2017 07:43:08 -0700 Subject: [PATCH 124/461] merge --- test/core/end2end/tests/max_connection_age.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/core/end2end/tests/max_connection_age.c b/test/core/end2end/tests/max_connection_age.c index 1de54e08252..fb2613a0ec1 100644 --- a/test/core/end2end/tests/max_connection_age.c +++ b/test/core/end2end/tests/max_connection_age.c @@ -212,7 +212,7 @@ static void test_max_age_forcibly_close(grpc_end2end_test_config config) { CQ_EXPECT_COMPLETION(cqv, tag(0xdead), true); cq_verify(cqv); - grpc_call_destroy(s); + grpc_call_unref(s); /* The connection should be closed immediately after the max age grace period, the in-progress RPC should fail. */ @@ -228,7 +228,7 @@ static void test_max_age_forcibly_close(grpc_end2end_test_config config) { grpc_metadata_array_destroy(&trailing_metadata_recv); grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); + grpc_call_unref(c); cq_verifier_destroy(cqv); end_test(&f); config.tear_down_data(&f); @@ -350,7 +350,7 @@ static void test_max_age_gracefully_close(grpc_end2end_test_config config) { CQ_EXPECT_COMPLETION(cqv, tag(0xdead), true); cq_verify(cqv); - grpc_call_destroy(s); + grpc_call_unref(s); /* The connection is closed gracefully with goaway, the rpc should still be completed. */ @@ -366,7 +366,7 @@ static void test_max_age_gracefully_close(grpc_end2end_test_config config) { grpc_metadata_array_destroy(&trailing_metadata_recv); grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); + grpc_call_unref(c); cq_verifier_destroy(cqv); end_test(&f); config.tear_down_data(&f); From fa71f6f36923f0c8ceb978fb33e716fa9346a422 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Sat, 1 Apr 2017 17:32:34 -0700 Subject: [PATCH 125/461] Fix ASAN failure --- .../grpc++/impl/codegen/completion_queue.h | 23 +++++++++++++++++++ include/grpc++/impl/codegen/server_context.h | 3 +++ src/cpp/server/server_cc.cc | 9 ++++++-- src/cpp/server/server_context.cc | 4 ++++ 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/include/grpc++/impl/codegen/completion_queue.h b/include/grpc++/impl/codegen/completion_queue.h index 025eea3ef5b..90595de4826 100644 --- a/include/grpc++/impl/codegen/completion_queue.h +++ b/include/grpc++/impl/codegen/completion_queue.h @@ -247,6 +247,12 @@ class CompletionQueue : private GrpcLibraryCodegen { /// Performs a single polling pluck on \a tag. /// \warning Must not be mixed with calls to \a Next. + /// + /// TODO: sreek - This calls tag->FinalizeResult() even if the cq_ is already + /// shutdown. This is most likely a bug and if it is a bug, then change this + /// implementation to simple call the other TryPluck function with a zero + /// timeout. i.e: + /// TryPluck(tag, gpr_time_0(GPR_CLOCK_REALTIME)) void TryPluck(CompletionQueueTag* tag) { auto deadline = g_core_codegen_interface->gpr_time_0(GPR_CLOCK_REALTIME); auto ev = g_core_codegen_interface->grpc_completion_queue_pluck( @@ -258,6 +264,23 @@ class CompletionQueue : private GrpcLibraryCodegen { GPR_CODEGEN_ASSERT(!tag->FinalizeResult(&ignored, &ok)); } + /// Performs a single polling pluck on \a tag. Calls tag->FinalizeResult if + /// the pluck() was successful and returned the tag. + /// + /// This exects tag->FinalizeResult (if called) to return 'false' i.e expects + /// that the tag is internal not something that is returned to the user. + void TryPluck(CompletionQueueTag* tag, gpr_timespec deadline) { + auto ev = g_core_codegen_interface->grpc_completion_queue_pluck( + cq_, tag, deadline, nullptr); + if (ev.type == GRPC_QUEUE_TIMEOUT || ev.type == GRPC_QUEUE_SHUTDOWN) { + return; + } + + bool ok = ev.success != 0; + void* ignored = tag; + GPR_CODEGEN_ASSERT(!tag->FinalizeResult(&ignored, &ok)); + } + grpc_completion_queue* cq_; // owned gpr_atm avalanches_in_flight_; diff --git a/include/grpc++/impl/codegen/server_context.h b/include/grpc++/impl/codegen/server_context.h index bf9a9b6f1a5..f84ede9eb11 100644 --- a/include/grpc++/impl/codegen/server_context.h +++ b/include/grpc++/impl/codegen/server_context.h @@ -41,6 +41,7 @@ #include #include +#include #include #include #include @@ -212,6 +213,8 @@ class ServerContext { class CompletionOp; void BeginCompletionOp(Call* call); + // Return the tag queued by BeginCompletionOp() + CompletionQueueTag* GetCompletionOpTag(); ServerContext(gpr_timespec deadline, grpc_metadata_array* arr); diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index 6adabef7636..6bb88bcd945 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -221,9 +221,14 @@ class Server::SyncRequest final : public CompletionQueueTag { MethodHandler::HandlerParameter(&call_, &ctx_, request_payload_)); global_callbacks->PostSynchronousRequest(&ctx_); request_payload_ = nullptr; - DummyTag ignored_tag; + cq_.Shutdown(); - /* Ensure the cq_ is shutdown (else this will hang indefinitely) */ + + CompletionQueueTag* op_tag = ctx_.GetCompletionOpTag(); + cq_.TryPluck(op_tag, gpr_inf_future(GPR_CLOCK_REALTIME)); + + /* Ensure the cq_ is shutdown */ + DummyTag ignored_tag; GPR_ASSERT(cq_.Pluck(&ignored_tag) == false); } diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 05c05c86953..01e9c004346 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -166,6 +166,10 @@ void ServerContext::BeginCompletionOp(Call* call) { call->PerformOps(completion_op_); } +CompletionQueueTag* ServerContext::GetCompletionOpTag() { + return static_cast(completion_op_); +} + void ServerContext::AddInitialMetadata(const grpc::string& key, const grpc::string& value) { initial_metadata_.insert(std::make_pair(key, value)); From 4426800e6c3b8e1c535918166a1e59fea521bfd7 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Sat, 1 Apr 2017 17:33:50 -0700 Subject: [PATCH 126/461] clang format --- src/cpp/server/server_cc.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index 6bb88bcd945..f121b481c5b 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -227,7 +227,7 @@ class Server::SyncRequest final : public CompletionQueueTag { CompletionQueueTag* op_tag = ctx_.GetCompletionOpTag(); cq_.TryPluck(op_tag, gpr_inf_future(GPR_CLOCK_REALTIME)); - /* Ensure the cq_ is shutdown */ + /* Ensure the cq_ is shutdown */ DummyTag ignored_tag; GPR_ASSERT(cq_.Pluck(&ignored_tag) == false); } From 0ae9959a1c93bedeb6f8ac009cb338eeee08a8ba Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Sat, 1 Apr 2017 21:57:42 -0700 Subject: [PATCH 127/461] Revert "Revert "Add selected fullstack benchmarks to pr suite"" --- tools/jenkins/run_performance.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/jenkins/run_performance.sh b/tools/jenkins/run_performance.sh index dee033a951a..544e31dcbdb 100755 --- a/tools/jenkins/run_performance.sh +++ b/tools/jenkins/run_performance.sh @@ -32,7 +32,7 @@ set -ex # List of benchmarks that provide good signal for analyzing performance changes in pull requests -BENCHMARKS_TO_RUN="bm_closure bm_cq bm_call_create bm_error bm_chttp2_hpack bm_chttp2_transport bm_pollset bm_metadata" +BENCHMARKS_TO_RUN="bm_fullstack_unary_ping_pong bm_fullstack_streaming_ping_pong bm_fullstack_streaming_pump bm_closure bm_cq bm_call_create bm_error bm_chttp2_hpack bm_chttp2_transport bm_pollset bm_metadata" # Enter the gRPC repo root cd $(dirname $0)/../.. From 3f182df7de52374e600264af7d76f1f6f73da6b8 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Sun, 2 Apr 2017 03:44:43 -0700 Subject: [PATCH 128/461] Fix C asan error and check_sources_and_headers.py --- include/grpc++/impl/codegen/completion_queue.h | 1 - include/grpc++/impl/codegen/core_codegen_interface.h | 1 - test/core/end2end/tests/max_connection_age.c | 1 + test/core/end2end/tests/max_connection_idle.c | 1 + 4 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/grpc++/impl/codegen/completion_queue.h b/include/grpc++/impl/codegen/completion_queue.h index 90595de4826..61617f2bdc9 100644 --- a/include/grpc++/impl/codegen/completion_queue.h +++ b/include/grpc++/impl/codegen/completion_queue.h @@ -52,7 +52,6 @@ #include #include #include -#include #include struct grpc_completion_queue; diff --git a/include/grpc++/impl/codegen/core_codegen_interface.h b/include/grpc++/impl/codegen/core_codegen_interface.h index fd4767a80ae..c7e10b64962 100644 --- a/include/grpc++/impl/codegen/core_codegen_interface.h +++ b/include/grpc++/impl/codegen/core_codegen_interface.h @@ -36,7 +36,6 @@ #include #include -#include #include #include #include diff --git a/test/core/end2end/tests/max_connection_age.c b/test/core/end2end/tests/max_connection_age.c index 1de54e08252..28f63232367 100644 --- a/test/core/end2end/tests/max_connection_age.c +++ b/test/core/end2end/tests/max_connection_age.c @@ -88,6 +88,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } static void test_max_age_forcibly_close(grpc_end2end_test_config config) { diff --git a/test/core/end2end/tests/max_connection_idle.c b/test/core/end2end/tests/max_connection_idle.c index 9dc1ee47664..4e5aa15a5af 100644 --- a/test/core/end2end/tests/max_connection_idle.c +++ b/test/core/end2end/tests/max_connection_idle.c @@ -105,6 +105,7 @@ static void test_max_connection_idle(grpc_end2end_test_config config) { grpc_channel_destroy(f.client); grpc_completion_queue_shutdown(f.cq); grpc_completion_queue_destroy(f.cq); + grpc_completion_queue_destroy(f.shutdown_cq); config.tear_down_data(&f); cq_verifier_destroy(cqv); From 7b9cb834ff6dcc9af126c4cc541093b14cf5f691 Mon Sep 17 00:00:00 2001 From: Alena Varkockova Date: Sun, 2 Apr 2017 22:02:09 +0200 Subject: [PATCH 129/461] Print out some cli error message for getservices Currently, when you cann grpc_cli ls on an endpoint that does not have service reflection, the cli just silently ends without printing out any error or message. This PR should fix that. --- test/cpp/util/grpc_tool.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/test/cpp/util/grpc_tool.cc b/test/cpp/util/grpc_tool.cc index 856cd32c3ce..c7acb7c6313 100644 --- a/test/cpp/util/grpc_tool.cc +++ b/test/cpp/util/grpc_tool.cc @@ -321,6 +321,7 @@ bool GrpcTool::ListServices(int argc, const char** argv, std::vector service_list; if (!desc_db.GetServices(&service_list)) { + fprintf(stderr, "Received an error when querying services endpoint.\n"); return false; } From f69317cf03cd69475e65e1e5ca2ef751947f3c12 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Sun, 2 Apr 2017 16:03:43 -0700 Subject: [PATCH 130/461] Increase reps to decrease noise --- tools/profiling/microbenchmarks/bm_diff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index 2337f2b282e..5350b5739f3 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -101,7 +101,7 @@ argp.add_argument('-t', '--track', help='Which metrics to track') argp.add_argument('-b', '--benchmarks', nargs='+', choices=_AVAILABLE_BENCHMARK_TESTS, default=['bm_cq']) argp.add_argument('-d', '--diff_base', type=str) -argp.add_argument('-r', '--repetitions', type=int, default=4) +argp.add_argument('-r', '--repetitions', type=int, default=7) argp.add_argument('-p', '--p_threshold', type=float, default=0.01) args = argp.parse_args() From 69b2d2d40bd06b872bdf0c484a459831ed399dbc Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sun, 2 Apr 2017 18:09:03 -0700 Subject: [PATCH 131/461] Bug fix --- .../transport/chttp2/transport/chttp2_transport.c | 12 ++++++------ src/core/ext/transport/chttp2/transport/frame_data.c | 2 +- src/core/ext/transport/chttp2/transport/internal.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index c86fefe2cfb..2ac87b9b241 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -2364,7 +2364,7 @@ static grpc_error *deframe_unprocessed_incoming_frames( exec_ctx, t, s, p->frame_size, message_flags); *stream_out = &p->parsing_frame->base; if (p->parsing_frame->remaining_bytes == 0) { - grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, GRPC_ERROR_NONE); + grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, GRPC_ERROR_NONE, 1); p->parsing_frame = NULL; p->state = GRPC_CHTTP2_DATA_FH_0; } else { @@ -2393,7 +2393,7 @@ static grpc_error *deframe_unprocessed_incoming_frames( return error; } grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, - GRPC_ERROR_NONE); + GRPC_ERROR_NONE, 1); p->parsing_frame = NULL; p->state = GRPC_CHTTP2_DATA_FH_0; grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_NONE); @@ -2416,7 +2416,7 @@ static grpc_error *deframe_unprocessed_incoming_frames( return error; } grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, - GRPC_ERROR_NONE); + GRPC_ERROR_NONE, 1); p->parsing_frame = NULL; p->state = GRPC_CHTTP2_DATA_FH_0; cur += p->frame_size; @@ -2616,7 +2616,7 @@ static void incoming_byte_stream_publish_error( GRPC_ERROR_UNREF(s->byte_stream_error); grpc_chttp2_cancel_stream(exec_ctx, bs->transport, bs->stream, GRPC_ERROR_REF(error)); - s->byte_stream_error = error; + s->byte_stream_error = GRPC_ERROR_REF(error); } grpc_error *grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, @@ -2643,7 +2643,7 @@ grpc_error *grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, grpc_error *grpc_chttp2_incoming_byte_stream_finished( grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, - grpc_error *error) { + grpc_error *error, int reset_on_error) { grpc_chttp2_stream *s = bs->stream; if (error == GRPC_ERROR_NONE) { @@ -2653,7 +2653,7 @@ grpc_error *grpc_chttp2_incoming_byte_stream_finished( } gpr_mu_unlock(&bs->slice_mu); } - if (error != GRPC_ERROR_NONE) { + if (error != GRPC_ERROR_NONE && reset_on_error) { grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error)); } diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c index ecb941e366c..8b42d05c726 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -56,7 +56,7 @@ void grpc_chttp2_data_parser_destroy(grpc_exec_ctx *exec_ctx, if (parser->parsing_frame != NULL) { grpc_chttp2_incoming_byte_stream_finished( exec_ctx, parser->parsing_frame, - GRPC_ERROR_CREATE_FROM_STATIC_STRING("Parser destroyed")); + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Parser destroyed"), 0); } GRPC_ERROR_UNREF(parser->error); } diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 917fc1b71eb..a43c825b70a 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -786,7 +786,7 @@ grpc_error *grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, grpc_slice *slice_out); grpc_error *grpc_chttp2_incoming_byte_stream_finished( grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, - grpc_error *error); + grpc_error *error, int reset_on_error); void grpc_chttp2_incoming_byte_stream_notify( grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, grpc_error *error); From 0fa217dfb938166c0442dc023db8095264f77e77 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sun, 2 Apr 2017 18:18:51 -0700 Subject: [PATCH 132/461] clang-format --- .../chttp2/transport/chttp2_transport.c | 123 ++++++++++-------- .../ext/transport/chttp2/transport/internal.h | 35 ++--- .../ext/transport/chttp2/transport/parsing.c | 22 ++-- src/core/lib/surface/call.c | 2 +- 4 files changed, 101 insertions(+), 81 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 176382cb10b..d3a4f35ea40 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -115,9 +115,9 @@ static void incoming_byte_stream_update_flow_control(grpc_exec_ctx *exec_ctx, static void incoming_byte_stream_destroy_locked(grpc_exec_ctx *exec_ctx, void *byte_stream, grpc_error *error_ignored); -static void incoming_byte_stream_publish_error(grpc_exec_ctx *exec_ctx, - grpc_chttp2_incoming_byte_stream *bs, - grpc_error *error); +static void incoming_byte_stream_publish_error( + grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, + grpc_error *error); static void incoming_byte_stream_unref(grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs); @@ -161,12 +161,10 @@ static void finish_keepalive_ping_locked(grpc_exec_ctx *exec_ctx, void *arg, static void keepalive_watchdog_fired_locked(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error); -static grpc_error *deframe_unprocessed_incoming_frames(grpc_exec_ctx *exec_ctx, - grpc_chttp2_data_parser *p, - grpc_chttp2_stream *s, - grpc_slice_buffer *slices, - grpc_slice *slice_out, - grpc_byte_stream **stream_out); +static grpc_error *deframe_unprocessed_incoming_frames( + grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *p, grpc_chttp2_stream *s, + grpc_slice_buffer *slices, grpc_slice *slice_out, + grpc_byte_stream **stream_out); static void reset_byte_stream(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error); @@ -615,7 +613,8 @@ static int init_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, grpc_slice_buffer_init(&s->unprocessed_incoming_frames_buffer); grpc_slice_buffer_init(&s->frame_storage); s->pending_byte_stream = false; - grpc_closure_init(&s->reset_byte_stream, reset_byte_stream, s, grpc_combiner_scheduler(t->combiner, false)); + grpc_closure_init(&s->reset_byte_stream, reset_byte_stream, s, + grpc_combiner_scheduler(t->combiner, false)); GRPC_CHTTP2_REF_TRANSPORT(t, "stream"); @@ -1520,7 +1519,8 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_exec_ctx *exec_ctx, if (s->seen_error) { grpc_slice_buffer_reset_and_unref(&s->frame_storage); if (!s->pending_byte_stream) { - grpc_slice_buffer_reset_and_unref(&s->unprocessed_incoming_frames_buffer); + grpc_slice_buffer_reset_and_unref( + &s->unprocessed_incoming_frames_buffer); } } grpc_chttp2_incoming_metadata_buffer_publish( @@ -1539,21 +1539,26 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, if (s->final_metadata_requested && s->seen_error) { grpc_slice_buffer_reset_and_unref(&s->frame_storage); if (!s->pending_byte_stream) { - grpc_slice_buffer_reset_and_unref(&s->unprocessed_incoming_frames_buffer); + grpc_slice_buffer_reset_and_unref( + &s->unprocessed_incoming_frames_buffer); } } if (!s->pending_byte_stream) { while (s->unprocessed_incoming_frames_buffer.length > 0 || s->frame_storage.length > 0) { if (s->unprocessed_incoming_frames_buffer.length == 0) { - grpc_slice_buffer_swap(&s->unprocessed_incoming_frames_buffer, &s->frame_storage); + grpc_slice_buffer_swap(&s->unprocessed_incoming_frames_buffer, + &s->frame_storage); } /* error handling ok? */ - error = deframe_unprocessed_incoming_frames(exec_ctx, &s->data_parser, s, &s->unprocessed_incoming_frames_buffer, NULL, s->recv_message); + error = deframe_unprocessed_incoming_frames( + exec_ctx, &s->data_parser, s, + &s->unprocessed_incoming_frames_buffer, NULL, s->recv_message); if (error != GRPC_ERROR_NONE) { s->seen_error = true; grpc_slice_buffer_reset_and_unref(&s->frame_storage); - grpc_slice_buffer_reset_and_unref(&s->unprocessed_incoming_frames_buffer); + grpc_slice_buffer_reset_and_unref( + &s->unprocessed_incoming_frames_buffer); break; } else if (*s->recv_message != NULL) { break; @@ -1578,7 +1583,8 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx *exec_ctx, if (s->seen_error) { grpc_slice_buffer_reset_and_unref(&s->frame_storage); if (!s->pending_byte_stream) { - grpc_slice_buffer_reset_and_unref(&s->unprocessed_incoming_frames_buffer); + grpc_slice_buffer_reset_and_unref( + &s->unprocessed_incoming_frames_buffer); } } if (s->read_closed && s->frame_storage.length == 0 && @@ -2263,16 +2269,15 @@ static void reset_byte_stream(grpc_exec_ctx *exec_ctx, void *arg, grpc_closure_sched(exec_ctx, s->on_next, GRPC_ERROR_REF(error)); s->on_next = NULL; GRPC_ERROR_UNREF(s->byte_stream_error); - grpc_chttp2_cancel_stream(exec_ctx, s->t, s, - GRPC_ERROR_REF(error)); + grpc_chttp2_cancel_stream(exec_ctx, s->t, s, GRPC_ERROR_REF(error)); s->byte_stream_error = error; } } static grpc_error *deframe_unprocessed_incoming_frames( - grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *p, - grpc_chttp2_stream *s, grpc_slice_buffer *slices, - grpc_slice *slice_out, grpc_byte_stream **stream_out) { + grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *p, grpc_chttp2_stream *s, + grpc_slice_buffer *slices, grpc_slice *slice_out, + grpc_byte_stream **stream_out) { grpc_error *error = GRPC_ERROR_NONE; grpc_chttp2_transport *t = s->t; @@ -2368,7 +2373,8 @@ static grpc_error *deframe_unprocessed_incoming_frames( exec_ctx, t, s, p->frame_size, message_flags); *stream_out = &p->parsing_frame->base; if (p->parsing_frame->remaining_bytes == 0) { - grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, GRPC_ERROR_NONE, 1); + grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, + GRPC_ERROR_NONE, 1); p->parsing_frame = NULL; p->state = GRPC_CHTTP2_DATA_FH_0; } else { @@ -2376,7 +2382,9 @@ static grpc_error *deframe_unprocessed_incoming_frames( } if (cur != end) { - grpc_slice_buffer_undo_take_first(&s->unprocessed_incoming_frames_buffer, grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + grpc_slice_buffer_undo_take_first( + &s->unprocessed_incoming_frames_buffer, + grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); } grpc_slice_unref(slice); return GRPC_ERROR_NONE; @@ -2390,9 +2398,10 @@ static grpc_error *deframe_unprocessed_incoming_frames( uint32_t remaining = (uint32_t)(end - cur); if (remaining == p->frame_size) { if (GRPC_ERROR_NONE != (error = grpc_chttp2_incoming_byte_stream_push( - exec_ctx, p->parsing_frame, - grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg)), - slice_out))) { + exec_ctx, p->parsing_frame, + grpc_slice_sub(slice, (size_t)(cur - beg), + (size_t)(end - beg)), + slice_out))) { grpc_slice_unref_internal(exec_ctx, slice); return error; } @@ -2405,9 +2414,10 @@ static grpc_error *deframe_unprocessed_incoming_frames( return GRPC_ERROR_NONE; } else if (remaining < p->frame_size) { if (GRPC_ERROR_NONE != (error = grpc_chttp2_incoming_byte_stream_push( - exec_ctx, p->parsing_frame, - grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg)), - slice_out))) { + exec_ctx, p->parsing_frame, + grpc_slice_sub(slice, (size_t)(cur - beg), + (size_t)(end - beg)), + slice_out))) { return error; } p->frame_size -= remaining; @@ -2415,7 +2425,12 @@ static grpc_error *deframe_unprocessed_incoming_frames( return GRPC_ERROR_NONE; } else { GPR_ASSERT(remaining > p->frame_size); - if (GRPC_ERROR_NONE != (grpc_chttp2_incoming_byte_stream_push(exec_ctx, p->parsing_frame, grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(cur + p->frame_size - beg)), slice_out))) { + if (GRPC_ERROR_NONE != + (grpc_chttp2_incoming_byte_stream_push( + exec_ctx, p->parsing_frame, + grpc_slice_sub(slice, (size_t)(cur - beg), + (size_t)(cur + p->frame_size - beg)), + slice_out))) { grpc_slice_unref_internal(exec_ctx, slice); return error; } @@ -2424,7 +2439,9 @@ static grpc_error *deframe_unprocessed_incoming_frames( p->parsing_frame = NULL; p->state = GRPC_CHTTP2_DATA_FH_0; cur += p->frame_size; - grpc_slice_buffer_undo_take_first(&s->unprocessed_incoming_frames_buffer, grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + grpc_slice_buffer_undo_take_first( + &s->unprocessed_incoming_frames_buffer, + grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_NONE); grpc_slice_unref(slice); return GRPC_ERROR_NONE; @@ -2506,7 +2523,8 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx *exec_ctx, GPR_ASSERT(s->unprocessed_incoming_frames_buffer.length == 0); if (s->frame_storage.length > 0) { - grpc_slice_buffer_swap(&s->frame_storage, &s->unprocessed_incoming_frames_buffer); + grpc_slice_buffer_swap(&s->frame_storage, + &s->unprocessed_incoming_frames_buffer); grpc_closure_sched(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_NONE); } else if (s->byte_stream_error != GRPC_ERROR_NONE) { grpc_closure_sched(exec_ctx, bs->next_action.on_complete, @@ -2517,7 +2535,8 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx *exec_ctx, } } else if (s->read_closed) { if (bs->remaining_bytes != 0) { - s->byte_stream_error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message"); + s->byte_stream_error = + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message"); grpc_closure_sched(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_REF(s->byte_stream_error)); if (s->data_parser.parsing_frame != NULL) { @@ -2549,11 +2568,11 @@ static int incoming_byte_stream_next(grpc_exec_ctx *exec_ctx, bs->next_action.max_size_hint = max_size_hint; bs->next_action.on_complete = on_complete; grpc_closure_sched( - exec_ctx, - grpc_closure_init( - &bs->next_action.closure, incoming_byte_stream_next_locked, bs, - grpc_combiner_scheduler(bs->transport->combiner, false)), - GRPC_ERROR_NONE); + exec_ctx, + grpc_closure_init( + &bs->next_action.closure, incoming_byte_stream_next_locked, bs, + grpc_combiner_scheduler(bs->transport->combiner, false)), + GRPC_ERROR_NONE); GPR_TIMER_END("incoming_byte_stream_next", 0); return 0; } @@ -2564,20 +2583,20 @@ static grpc_error *incoming_byte_stream_pull(grpc_exec_ctx *exec_ctx, grpc_slice *slice) { GPR_TIMER_BEGIN("incoming_byte_stream_pull", 0); grpc_chttp2_incoming_byte_stream *bs = - (grpc_chttp2_incoming_byte_stream *)byte_stream; + (grpc_chttp2_incoming_byte_stream *)byte_stream; grpc_chttp2_stream *s = bs->stream; if (s->unprocessed_incoming_frames_buffer.length > 0) { grpc_error *error = deframe_unprocessed_incoming_frames( - exec_ctx, &s->data_parser, s, &s->unprocessed_incoming_frames_buffer, - slice, NULL); + exec_ctx, &s->data_parser, s, &s->unprocessed_incoming_frames_buffer, + slice, NULL); if (error != GRPC_ERROR_NONE) { return error; } } else { - grpc_error *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message"); - grpc_closure_sched(exec_ctx, - &s->reset_byte_stream, GRPC_ERROR_REF(error)); + grpc_error *error = + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message"); + grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error)); return error; } GPR_TIMER_END("incoming_byte_stream_pull", 0); @@ -2623,17 +2642,16 @@ static void incoming_byte_stream_publish_error( s->byte_stream_error = GRPC_ERROR_REF(error); } -grpc_error *grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, - grpc_chttp2_incoming_byte_stream *bs, - grpc_slice slice, - grpc_slice *slice_out) { +grpc_error *grpc_chttp2_incoming_byte_stream_push( + grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, + grpc_slice slice, grpc_slice *slice_out) { grpc_chttp2_stream *s = bs->stream; if (bs->remaining_bytes < GRPC_SLICE_LENGTH(slice)) { - grpc_error *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Too many bytes in stream"); + grpc_error *error = + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Too many bytes in stream"); - grpc_closure_sched(exec_ctx, - &s->reset_byte_stream, GRPC_ERROR_REF(error)); + grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error)); grpc_slice_unref_internal(exec_ctx, slice); return error; } else { @@ -2658,8 +2676,7 @@ grpc_error *grpc_chttp2_incoming_byte_stream_finished( gpr_mu_unlock(&bs->slice_mu); } if (error != GRPC_ERROR_NONE && reset_on_error) { - grpc_closure_sched(exec_ctx, - &s->reset_byte_stream, GRPC_ERROR_REF(error)); + grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error)); } incoming_byte_stream_unref(exec_ctx, bs); return error; diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index a43c825b70a..a2deac63151 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -186,22 +186,23 @@ typedef struct grpc_chttp2_write_cb { struct grpc_chttp2_incoming_byte_stream { grpc_byte_stream base; gpr_refcount refs; - struct grpc_chttp2_incoming_byte_stream *next_message; /* unused; should be removed */ - bool push_closed; /* protected by slice_mu */ + struct grpc_chttp2_incoming_byte_stream + *next_message; /* unused; should be removed */ + bool push_closed; /* protected by slice_mu */ grpc_chttp2_transport *transport; /* immutable */ grpc_chttp2_stream *stream; /* immutable */ bool is_tail; /* immutable */ gpr_mu slice_mu; - grpc_slice_buffer slices; /* unused; should be removed */ - uint32_t remaining_bytes; /* guaranteed one thread access */ + grpc_slice_buffer slices; /* unused; should be removed */ + uint32_t remaining_bytes; /* guaranteed one thread access */ struct { grpc_closure closure; size_t max_size_hint; grpc_closure *on_complete; - } next_action; /* guaranteed one thread access */ + } next_action; /* guaranteed one thread access */ grpc_closure destroy_action; grpc_closure finished_action; }; @@ -431,8 +432,8 @@ struct grpc_chttp2_stream { uint32_t id; /** window available for us to send to peer, over or under the initial window - * size of the transport... ie: - * outgoing_window = outgoing_window_delta + transport.initial_window_size */ + * size of the transport... ie: + * outgoing_window = outgoing_window_delta + transport.initial_window_size */ int64_t outgoing_window_delta; /** things the upper layers would like to send */ grpc_metadata_batch *send_initial_metadata; @@ -484,12 +485,13 @@ struct grpc_chttp2_stream { grpc_chttp2_incoming_metadata_buffer metadata_buffer[2]; grpc_slice_buffer frame_storage; /* protected by t combiner */ - grpc_slice_buffer unprocessed_incoming_frames_buffer; /* guaranteed one thread access */ - grpc_closure *on_next; /* protected by t combiner */ - bool pending_byte_stream; /* protected by t combiner */ + grpc_slice_buffer + unprocessed_incoming_frames_buffer; /* guaranteed one thread access */ + grpc_closure *on_next; /* protected by t combiner */ + bool pending_byte_stream; /* protected by t combiner */ grpc_closure reset_byte_stream; grpc_error *byte_stream_error; /* protected by t combiner */ - bool received_last_frame; /* proected by t combiner */ + bool received_last_frame; /* proected by t combiner */ gpr_timespec deadline; @@ -502,7 +504,7 @@ struct grpc_chttp2_stream { * incoming_window = incoming_window_delta + transport.initial_window_size */ int64_t incoming_window_delta; /** parsing state for data frames */ - grpc_chttp2_data_parser data_parser; /* guaranteed one thread access */ + grpc_chttp2_data_parser data_parser; /* guaranteed one thread access */ /** number of bytes received - reset at end of parse thread execution */ int64_t received_bytes; @@ -617,7 +619,7 @@ extern int grpc_flowctl_trace; if (!(grpc_http_trace)) \ ; \ else \ - stmt + stmt typedef enum { GRPC_CHTTP2_FLOWCTL_MOVE, @@ -780,10 +782,9 @@ void grpc_chttp2_ref_transport(grpc_chttp2_transport *t); grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s, uint32_t frame_size, uint32_t flags); -grpc_error *grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, - grpc_chttp2_incoming_byte_stream *bs, - grpc_slice slice, - grpc_slice *slice_out); +grpc_error *grpc_chttp2_incoming_byte_stream_push( + grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, + grpc_slice slice, grpc_slice *slice_out); grpc_error *grpc_chttp2_incoming_byte_stream_finished( grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, grpc_error *error, int reset_on_error); diff --git a/src/core/ext/transport/chttp2/transport/parsing.c b/src/core/ext/transport/chttp2/transport/parsing.c index 2c662b67219..bf1cf58cb25 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.c +++ b/src/core/ext/transport/chttp2/transport/parsing.c @@ -230,10 +230,11 @@ grpc_error *grpc_chttp2_perform_read(grpc_exec_ctx *exec_ctx, case GRPC_DTS_FRAME: GPR_ASSERT(cur < end); if ((uint32_t)(end - cur) == t->incoming_frame_size) { - err = parse_frame_slice( - exec_ctx, t, grpc_slice_sub_no_ref(slice, (size_t)(cur - beg), - (size_t)(end - beg)), - 1); + err = + parse_frame_slice(exec_ctx, t, + grpc_slice_sub_no_ref(slice, (size_t)(cur - beg), + (size_t)(end - beg)), + 1); if (err != GRPC_ERROR_NONE) { return err; } @@ -254,10 +255,11 @@ grpc_error *grpc_chttp2_perform_read(grpc_exec_ctx *exec_ctx, t->incoming_stream = NULL; goto dts_fh_0; /* loop */ } else { - err = parse_frame_slice( - exec_ctx, t, grpc_slice_sub_no_ref(slice, (size_t)(cur - beg), - (size_t)(end - beg)), - 0); + err = + parse_frame_slice(exec_ctx, t, + grpc_slice_sub_no_ref(slice, (size_t)(cur - beg), + (size_t)(end - beg)), + 0); if (err != GRPC_ERROR_NONE) { return err; } @@ -458,8 +460,8 @@ static grpc_error *init_data_frame_parser(grpc_exec_ctx *exec_ctx, return init_skip_frame_parser(exec_ctx, t, 0); } if (err == GRPC_ERROR_NONE) { - err = grpc_chttp2_data_parser_begin_frame(&s->data_parser, - t->incoming_frame_flags, s->id, s); + err = grpc_chttp2_data_parser_begin_frame( + &s->data_parser, t->incoming_frame_flags, s->id, s); } error_handler: if (err == GRPC_ERROR_NONE) { diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 6ea199e84f8..c7b0b7ead34 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -1158,7 +1158,7 @@ static void continue_receiving_slices(grpc_exec_ctx *exec_ctx, if (grpc_byte_stream_next(exec_ctx, call->receiving_stream, remaining, &call->receiving_slice_ready)) { error = grpc_byte_stream_pull(exec_ctx, call->receiving_stream, - &call->receiving_slice); + &call->receiving_slice); if (error == GRPC_ERROR_NONE) { grpc_slice_buffer_add(&(*call->receiving_buffer)->data.raw.slice_buffer, call->receiving_slice); From 691eefbe0ff634fe49aacf06efccdd7e84864dfc Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 3 Apr 2017 08:06:32 -0700 Subject: [PATCH 133/461] Parallel bm_diff --- tools/profiling/microbenchmarks/bm_diff.py | 33 +++++++++++----------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index 5350b5739f3..1602e83fcab 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.7 +args.benchmarks#!/usr/bin/env python2.7 # Copyright 2017, Google Inc. # All rights reserved. # @@ -41,6 +41,7 @@ import pipes import os sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '..', '..', 'run_tests', 'python_utils')) import comment_on_pr +import jobset def changed_ratio(n, o): if float(o) <= .0001: o = 0 @@ -101,8 +102,9 @@ argp.add_argument('-t', '--track', help='Which metrics to track') argp.add_argument('-b', '--benchmarks', nargs='+', choices=_AVAILABLE_BENCHMARK_TESTS, default=['bm_cq']) argp.add_argument('-d', '--diff_base', type=str) -argp.add_argument('-r', '--repetitions', type=int, default=7) +argp.add_argument('-r', '--repetitions', type=int, default=30) argp.add_argument('-p', '--p_threshold', type=float, default=0.01) +argp.add_argument('-j', '--jobs', type=int, default=multiprocessing.cpu_count()) args = argp.parse_args() assert args.diff_base @@ -117,7 +119,7 @@ def avg(lst): def make_cmd(cfg): return ['make'] + args.benchmarks + [ - 'CONFIG=%s' % cfg, '-j', '%d' % multiprocessing.cpu_count()] + 'CONFIG=%s' % cfg, '-j', '%d' % args.jobs] def build(): subprocess.check_call(['git', 'submodule', 'update']) @@ -135,27 +137,24 @@ def collect1(bm, cfg, ver): '--benchmark_out_format=json', '--benchmark_repetitions=%d' % (args.repetitions) ] - print cmd - subprocess.check_call(cmd) + return jobset.JobSpec(cmd, shortname='%s %s %s' % (bm, cfg, ver), + verbose_success=True) build() -for bm in args.benchmarks: - collect1(bm, 'opt', 'new') - collect1(bm, 'counters', 'new') +jobset.run(itertools.chain( + (collect1(bm, 'opt', 'new') for bm in args.benchmarks), + (collect1(bm, 'counters', 'new') for bm in args.benchmarks), +), maxjobs=args.jobs) where_am_i = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip() subprocess.check_call(['git', 'checkout', args.diff_base]) try: build() - comparables = [] - for bm in args.benchmarks: - try: - collect1(bm, 'opt', 'old') - collect1(bm, 'counters', 'old') - comparables.append(bm) - except subprocess.CalledProcessError, e: - pass + jobset.run(itertools.chain( + (collect1(bm, 'opt', 'new') for bm in args.benchmarks), + (collect1(bm, 'counters', 'new') for bm in args.benchmarks), + ), maxjobs=args.jobs) finally: subprocess.check_call(['git', 'checkout', where_am_i]) subprocess.check_call(['git', 'submodule', 'update']) @@ -201,7 +200,7 @@ class Benchmark: benchmarks = collections.defaultdict(Benchmark) -for bm in comparables: +for bm in args.benchmarks: with open('%s.counters.new.json' % bm) as f: js_new_ctr = json.loads(f.read()) with open('%s.opt.new.json' % bm) as f: From cc89f7801bd1c6822e1805525073a69cf070320c Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 3 Apr 2017 08:08:25 -0700 Subject: [PATCH 134/461] Fix typo --- tools/profiling/microbenchmarks/bm_diff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index 1602e83fcab..82fbe084977 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -1,4 +1,4 @@ -args.benchmarks#!/usr/bin/env python2.7 +#!/usr/bin/env python2.7 # Copyright 2017, Google Inc. # All rights reserved. # From 2fbbcd1fd49203347b668bc2b896d8cbaab158fd Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 3 Apr 2017 08:29:08 -0700 Subject: [PATCH 135/461] Missing import --- tools/profiling/microbenchmarks/bm_diff.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index 82fbe084977..84712e7e0dc 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -42,6 +42,7 @@ import os sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '..', '..', 'run_tests', 'python_utils')) import comment_on_pr import jobset +import itertools def changed_ratio(n, o): if float(o) <= .0001: o = 0 From 494e72d6b4ad057bcbcf67d808fc0639c2a8724b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 3 Apr 2017 08:43:22 -0700 Subject: [PATCH 136/461] Add a minimal stack test --- CMakeLists.txt | 32 +++++++++++++ Makefile | 36 +++++++++++++++ build.yaml | 10 +++++ .../channel/minimal_stack_is_minimal_test.c | 45 +++++++++++++++++++ .../generated/sources_and_headers.json | 17 +++++++ tools/run_tests/generated/tests.json | 22 +++++++++ vsprojects/buildtests_c.sln | 27 +++++++++++ 7 files changed, 189 insertions(+) create mode 100644 test/core/channel/minimal_stack_is_minimal_test.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 332f8a541ce..872b782b44f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -472,6 +472,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_dependencies(buildtests_c memory_profile_test) endif() add_dependencies(buildtests_c message_compress_test) +add_dependencies(buildtests_c minimal_stack_is_minimal_test) add_dependencies(buildtests_c mlog_test) add_dependencies(buildtests_c multiple_server_queues_test) add_dependencies(buildtests_c murmur_hash_test) @@ -7376,6 +7377,37 @@ target_link_libraries(message_compress_test endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) +add_executable(minimal_stack_is_minimal_test + test/core/channel/minimal_stack_is_minimal_test.c +) + + +target_include_directories(minimal_stack_is_minimal_test + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${BORINGSSL_ROOT_DIR}/include + PRIVATE ${PROTOBUF_ROOT_DIR}/src + PRIVATE ${BENCHMARK_ROOT_DIR}/include + PRIVATE ${ZLIB_ROOT_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CARES_BUILD_INCLUDE_DIR} + PRIVATE ${CARES_INCLUDE_DIR} + PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include +) + +target_link_libraries(minimal_stack_is_minimal_test + ${_gRPC_ALLTARGETS_LIBRARIES} + grpc_test_util + grpc + gpr_test_util + gpr +) + +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + add_executable(mlog_test test/core/census/mlog_test.c ) diff --git a/Makefile b/Makefile index 8bad909fe94..e8987c85e0d 100644 --- a/Makefile +++ b/Makefile @@ -1050,6 +1050,7 @@ memory_profile_client: $(BINDIR)/$(CONFIG)/memory_profile_client memory_profile_server: $(BINDIR)/$(CONFIG)/memory_profile_server memory_profile_test: $(BINDIR)/$(CONFIG)/memory_profile_test message_compress_test: $(BINDIR)/$(CONFIG)/message_compress_test +minimal_stack_is_minimal_test: $(BINDIR)/$(CONFIG)/minimal_stack_is_minimal_test mlog_test: $(BINDIR)/$(CONFIG)/mlog_test multiple_server_queues_test: $(BINDIR)/$(CONFIG)/multiple_server_queues_test murmur_hash_test: $(BINDIR)/$(CONFIG)/murmur_hash_test @@ -1421,6 +1422,7 @@ buildtests_c: privatelibs_c \ $(BINDIR)/$(CONFIG)/memory_profile_server \ $(BINDIR)/$(CONFIG)/memory_profile_test \ $(BINDIR)/$(CONFIG)/message_compress_test \ + $(BINDIR)/$(CONFIG)/minimal_stack_is_minimal_test \ $(BINDIR)/$(CONFIG)/mlog_test \ $(BINDIR)/$(CONFIG)/multiple_server_queues_test \ $(BINDIR)/$(CONFIG)/murmur_hash_test \ @@ -1871,6 +1873,8 @@ test_c: buildtests_c $(Q) $(BINDIR)/$(CONFIG)/memory_profile_test || ( echo test memory_profile_test failed ; exit 1 ) $(E) "[RUN] Testing message_compress_test" $(Q) $(BINDIR)/$(CONFIG)/message_compress_test || ( echo test message_compress_test failed ; exit 1 ) + $(E) "[RUN] Testing minimal_stack_is_minimal_test" + $(Q) $(BINDIR)/$(CONFIG)/minimal_stack_is_minimal_test || ( echo test minimal_stack_is_minimal_test failed ; exit 1 ) $(E) "[RUN] Testing multiple_server_queues_test" $(Q) $(BINDIR)/$(CONFIG)/multiple_server_queues_test || ( echo test multiple_server_queues_test failed ; exit 1 ) $(E) "[RUN] Testing murmur_hash_test" @@ -11493,6 +11497,38 @@ endif endif +MINIMAL_STACK_IS_MINIMAL_TEST_SRC = \ + test/core/channel/minimal_stack_is_minimal_test.c \ + +MINIMAL_STACK_IS_MINIMAL_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(MINIMAL_STACK_IS_MINIMAL_TEST_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/minimal_stack_is_minimal_test: openssl_dep_error + +else + + + +$(BINDIR)/$(CONFIG)/minimal_stack_is_minimal_test: $(MINIMAL_STACK_IS_MINIMAL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LD) $(LDFLAGS) $(MINIMAL_STACK_IS_MINIMAL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/minimal_stack_is_minimal_test + +endif + +$(OBJDIR)/$(CONFIG)/test/core/channel/minimal_stack_is_minimal_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + +deps_minimal_stack_is_minimal_test: $(MINIMAL_STACK_IS_MINIMAL_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(MINIMAL_STACK_IS_MINIMAL_TEST_OBJS:.o=.dep) +endif +endif + + MLOG_TEST_SRC = \ test/core/census/mlog_test.c \ diff --git a/build.yaml b/build.yaml index de72276f564..f14f4c2ec0e 100644 --- a/build.yaml +++ b/build.yaml @@ -2500,6 +2500,16 @@ targets: - grpc - gpr_test_util - gpr +- name: minimal_stack_is_minimal_test + build: test + language: c + src: + - test/core/channel/minimal_stack_is_minimal_test.c + deps: + - grpc_test_util + - grpc + - gpr_test_util + - gpr - name: mlog_test flaky: true build: test diff --git a/test/core/channel/minimal_stack_is_minimal_test.c b/test/core/channel/minimal_stack_is_minimal_test.c new file mode 100644 index 00000000000..1c12c9ebdef --- /dev/null +++ b/test/core/channel/minimal_stack_is_minimal_test.c @@ -0,0 +1,45 @@ +/* + * + * Copyright 2017, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "src/core/lib/surface/channel_stack_type.h" + +int main(int argc, char **argv) { + grpc_test_init(argc, argv); + grpc_init(); + check_stack(GRPC_CLIENT_CHANNEL, "client_channel", NULL); + check_stack(GRPC_CLIENT_DIRECT_CHANNEL, "connected_channel", NULL); + check_stack(GRPC_CLIENT_SUBCHANNEL, "connected_channel", NULL); + check_stack(GRPC_SERVER_CHANNEL, "server", "connected_channel", NULL); + grpc_shutdown(); + return 0; +} diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 5d2c3840cda..254df5568d7 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -1589,6 +1589,23 @@ "third_party": false, "type": "target" }, + { + "deps": [ + "gpr", + "gpr_test_util", + "grpc", + "grpc_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c", + "name": "minimal_stack_is_minimal_test", + "src": [ + "test/core/channel/minimal_stack_is_minimal_test.c" + ], + "third_party": false, + "type": "target" + }, { "deps": [ "gpr", diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index f2228a9e92e..ddcac57a6d2 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -1675,6 +1675,28 @@ "windows" ] }, + { + "args": [], + "ci_platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "gtest": false, + "language": "c", + "name": "minimal_stack_is_minimal_test", + "platforms": [ + "linux", + "mac", + "posix", + "windows" + ] + }, { "args": [], "ci_platforms": [ diff --git a/vsprojects/buildtests_c.sln b/vsprojects/buildtests_c.sln index c8fcacf75b1..1e8336c54ef 100644 --- a/vsprojects/buildtests_c.sln +++ b/vsprojects/buildtests_c.sln @@ -1242,6 +1242,17 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "message_compress_test", "vc {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minimal_stack_is_minimal_test", "vcxproj\test\minimal_stack_is_minimal_test\minimal_stack_is_minimal_test.vcxproj", "{68A54124-DFA3-4FF3-081F-70356222C977}" + ProjectSection(myProperties) = preProject + lib = "False" + EndProjectSection + ProjectSection(ProjectDependencies) = postProject + {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} = {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} + {29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9} + {EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037} + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + EndProjectSection +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mlog_test", "vcxproj\test\mlog_test\mlog_test.vcxproj", "{9345E329-80F3-DED4-FDC3-BF63FCEA2C03}" ProjectSection(myProperties) = preProject lib = "False" @@ -3513,6 +3524,22 @@ Global {07170557-CCB0-D23C-8018-C2909D115DF9}.Release-DLL|Win32.Build.0 = Release|Win32 {07170557-CCB0-D23C-8018-C2909D115DF9}.Release-DLL|x64.ActiveCfg = Release|x64 {07170557-CCB0-D23C-8018-C2909D115DF9}.Release-DLL|x64.Build.0 = Release|x64 + {68A54124-DFA3-4FF3-081F-70356222C977}.Debug|Win32.ActiveCfg = Debug|Win32 + {68A54124-DFA3-4FF3-081F-70356222C977}.Debug|x64.ActiveCfg = Debug|x64 + {68A54124-DFA3-4FF3-081F-70356222C977}.Release|Win32.ActiveCfg = Release|Win32 + {68A54124-DFA3-4FF3-081F-70356222C977}.Release|x64.ActiveCfg = Release|x64 + {68A54124-DFA3-4FF3-081F-70356222C977}.Debug|Win32.Build.0 = Debug|Win32 + {68A54124-DFA3-4FF3-081F-70356222C977}.Debug|x64.Build.0 = Debug|x64 + {68A54124-DFA3-4FF3-081F-70356222C977}.Release|Win32.Build.0 = Release|Win32 + {68A54124-DFA3-4FF3-081F-70356222C977}.Release|x64.Build.0 = Release|x64 + {68A54124-DFA3-4FF3-081F-70356222C977}.Debug-DLL|Win32.ActiveCfg = Debug|Win32 + {68A54124-DFA3-4FF3-081F-70356222C977}.Debug-DLL|Win32.Build.0 = Debug|Win32 + {68A54124-DFA3-4FF3-081F-70356222C977}.Debug-DLL|x64.ActiveCfg = Debug|x64 + {68A54124-DFA3-4FF3-081F-70356222C977}.Debug-DLL|x64.Build.0 = Debug|x64 + {68A54124-DFA3-4FF3-081F-70356222C977}.Release-DLL|Win32.ActiveCfg = Release|Win32 + {68A54124-DFA3-4FF3-081F-70356222C977}.Release-DLL|Win32.Build.0 = Release|Win32 + {68A54124-DFA3-4FF3-081F-70356222C977}.Release-DLL|x64.ActiveCfg = Release|x64 + {68A54124-DFA3-4FF3-081F-70356222C977}.Release-DLL|x64.Build.0 = Release|x64 {9345E329-80F3-DED4-FDC3-BF63FCEA2C03}.Debug|Win32.ActiveCfg = Debug|Win32 {9345E329-80F3-DED4-FDC3-BF63FCEA2C03}.Debug|x64.ActiveCfg = Debug|x64 {9345E329-80F3-DED4-FDC3-BF63FCEA2C03}.Release|Win32.ActiveCfg = Release|Win32 From 988ef83446a5b2b3a8517d1648394f97796dda4f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 3 Apr 2017 09:44:35 -0700 Subject: [PATCH 137/461] Minimal stack test --- src/core/lib/channel/channel_stack_builder.c | 11 ++ src/core/lib/channel/channel_stack_builder.h | 4 + .../channel/minimal_stack_is_minimal_test.c | 103 +++++++++++++++++- 3 files changed, 114 insertions(+), 4 deletions(-) diff --git a/src/core/lib/channel/channel_stack_builder.c b/src/core/lib/channel/channel_stack_builder.c index b515b7321a7..88c02edb70e 100644 --- a/src/core/lib/channel/channel_stack_builder.c +++ b/src/core/lib/channel/channel_stack_builder.c @@ -113,6 +113,17 @@ grpc_channel_stack_builder_create_iterator_at_last( return create_iterator_at_filter_node(builder, &builder->end); } +bool grpc_channel_stack_builder_iterator_is_end( + grpc_channel_stack_builder_iterator *iterator) { + return iterator->node == &iterator->builder->end; +} + +const char *grpc_channel_stack_builder_iterator_filter_name( + grpc_channel_stack_builder_iterator *iterator) { + if (iterator->node->filter == NULL) return NULL; + return iterator->node->filter->name; +} + bool grpc_channel_stack_builder_move_next( grpc_channel_stack_builder_iterator *iterator) { if (iterator->node == &iterator->builder->end) return false; diff --git a/src/core/lib/channel/channel_stack_builder.h b/src/core/lib/channel/channel_stack_builder.h index 8adf38e27bf..c78111b00d0 100644 --- a/src/core/lib/channel/channel_stack_builder.h +++ b/src/core/lib/channel/channel_stack_builder.h @@ -98,6 +98,10 @@ bool grpc_channel_stack_builder_iterator_is_first( bool grpc_channel_stack_builder_iterator_is_end( grpc_channel_stack_builder_iterator *iterator); +/// What is the name of the filter at this iterator position? +const char *grpc_channel_stack_builder_iterator_filter_name( + grpc_channel_stack_builder_iterator *iterator); + /// Move an iterator to the next item bool grpc_channel_stack_builder_move_next( grpc_channel_stack_builder_iterator *iterator); diff --git a/test/core/channel/minimal_stack_is_minimal_test.c b/test/core/channel/minimal_stack_is_minimal_test.c index 1c12c9ebdef..622ca0ee038 100644 --- a/test/core/channel/minimal_stack_is_minimal_test.c +++ b/test/core/channel/minimal_stack_is_minimal_test.c @@ -31,15 +31,110 @@ * */ +#include +#include +#include +#include + +#include "src/core/lib/channel/channel_stack_builder.h" +#include "src/core/lib/support/string.h" +#include "src/core/lib/surface/channel_init.h" #include "src/core/lib/surface/channel_stack_type.h" +#include "src/core/lib/transport/transport_impl.h" +#include "test/core/util/test_config.h" + +static int check_stack(const char *transport_name, grpc_channel_args *init_args, + grpc_channel_stack_type channel_stack_type, ...) { + // create dummy channel stack + grpc_channel_stack_builder *builder = grpc_channel_stack_builder_create(); + grpc_transport_vtable fake_transport_vtable = {.name = transport_name}; + grpc_transport fake_transport = {.vtable = &fake_transport_vtable}; + grpc_arg arg = {.type = GRPC_ARG_INTEGER, + .key = GRPC_ARG_MINIMAL_STACK, + .value.integer = 1}; + grpc_channel_stack_builder_set_target(builder, "foo.test.google.fr"); + grpc_channel_args *channel_args = + grpc_channel_args_copy_and_add(init_args, &arg, 1); + if (transport_name != NULL) { + grpc_channel_stack_builder_set_transport(builder, &fake_transport); + } + { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_channel_stack_builder_set_channel_arguments(&exec_ctx, builder, + channel_args); + GPR_ASSERT( + grpc_channel_init_create_stack(&exec_ctx, builder, channel_stack_type)); + grpc_exec_ctx_finish(&exec_ctx); + } + + // build up our expectation list + gpr_strvec v; + gpr_strvec_init(&v); + va_list args; + va_start(args, channel_stack_type); + for (;;) { + char *a = va_arg(args, char *); + if (a == NULL) break; + if (v.count != 0) gpr_strvec_add(&v, gpr_strdup(", ")); + gpr_strvec_add(&v, gpr_strdup(a)); + } + va_end(args); + char *expect = gpr_strvec_flatten(&v, NULL); + gpr_strvec_destroy(&v); + + // build up our "got" list + gpr_strvec_init(&v); + grpc_channel_stack_builder_iterator *it = + grpc_channel_stack_builder_create_iterator_at_first(builder); + while (grpc_channel_stack_builder_move_next(it)) { + const char *name = grpc_channel_stack_builder_iterator_filter_name(it); + if (name == NULL) continue; + if (v.count != 0) gpr_strvec_add(&v, gpr_strdup(", ")); + gpr_strvec_add(&v, gpr_strdup(name)); + } + char *got = gpr_strvec_flatten(&v, NULL); + gpr_strvec_destroy(&v); + + // figure out result, log if there's an error + int result = 0; + if (0 != strcmp(got, expect)) { + gpr_log(GPR_ERROR, + "FAILED transport=%s; stack_type=%d: expected '%s'; got '%s'", + transport_name, channel_stack_type, expect, got); + result = 1; + } + + gpr_free(got); + gpr_free(expect); + + { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_channel_stack_builder_destroy(&exec_ctx, builder); + grpc_exec_ctx_finish(&exec_ctx); + } + + return result; +} int main(int argc, char **argv) { grpc_test_init(argc, argv); grpc_init(); - check_stack(GRPC_CLIENT_CHANNEL, "client_channel", NULL); - check_stack(GRPC_CLIENT_DIRECT_CHANNEL, "connected_channel", NULL); - check_stack(GRPC_CLIENT_SUBCHANNEL, "connected_channel", NULL); - check_stack(GRPC_SERVER_CHANNEL, "server", "connected_channel", NULL); + int errors = 0; + errors += check_stack("unknown", NULL, GRPC_CLIENT_DIRECT_CHANNEL, + "connected", NULL); + errors += + check_stack("unknown", NULL, GRPC_CLIENT_SUBCHANNEL, "connected", NULL); + errors += check_stack("unknown", NULL, GRPC_SERVER_CHANNEL, "server", + "connected", NULL); + errors += check_stack("chttp2", NULL, GRPC_CLIENT_DIRECT_CHANNEL, + "http-client", "connected", NULL); + errors += + check_stack("chttp2", NULL, GRPC_CLIENT_SUBCHANNEL, "connected", NULL); + errors += check_stack("chttp2", NULL, GRPC_SERVER_CHANNEL, "server", + "http-server", "connected", NULL); + errors += + check_stack(NULL, NULL, GRPC_CLIENT_CHANNEL, "client-channel", NULL); + GPR_ASSERT(errors == 0); grpc_shutdown(); return 0; } From 4f89b0b13958fac3d0caea76829bda9b36fb76fa Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 3 Apr 2017 10:00:17 -0700 Subject: [PATCH 138/461] Refine test to what we really expect --- src/core/lib/surface/channel_init.c | 21 +---- src/core/lib/surface/channel_stack_type.c | 18 ++++ src/core/lib/surface/channel_stack_type.h | 2 + .../channel/minimal_stack_is_minimal_test.c | 94 +++++++++++++++---- 4 files changed, 98 insertions(+), 37 deletions(-) diff --git a/src/core/lib/surface/channel_init.c b/src/core/lib/surface/channel_init.c index 7acb444d9b1..20f57530049 100644 --- a/src/core/lib/surface/channel_init.c +++ b/src/core/lib/surface/channel_init.c @@ -104,30 +104,13 @@ void grpc_channel_init_shutdown(void) { } } -static const char *name_for_type(grpc_channel_stack_type type) { - switch (type) { - case GRPC_CLIENT_CHANNEL: - return "CLIENT_CHANNEL"; - case GRPC_CLIENT_SUBCHANNEL: - return "CLIENT_SUBCHANNEL"; - case GRPC_SERVER_CHANNEL: - return "SERVER_CHANNEL"; - case GRPC_CLIENT_LAME_CHANNEL: - return "CLIENT_LAME_CHANNEL"; - case GRPC_CLIENT_DIRECT_CHANNEL: - return "CLIENT_DIRECT_CHANNEL"; - case GRPC_NUM_CHANNEL_STACK_TYPES: - break; - } - GPR_UNREACHABLE_CODE(return "UNKNOWN"); -} - bool grpc_channel_init_create_stack(grpc_exec_ctx *exec_ctx, grpc_channel_stack_builder *builder, grpc_channel_stack_type type) { GPR_ASSERT(g_finalized); - grpc_channel_stack_builder_set_name(builder, name_for_type(type)); + grpc_channel_stack_builder_set_name(builder, + grpc_channel_stack_type_string(type)); for (size_t i = 0; i < g_slots[type].num_slots; i++) { const stage_slot *slot = &g_slots[type].slots[i]; diff --git a/src/core/lib/surface/channel_stack_type.c b/src/core/lib/surface/channel_stack_type.c index c35d603ca3a..ed3b53fb36e 100644 --- a/src/core/lib/surface/channel_stack_type.c +++ b/src/core/lib/surface/channel_stack_type.c @@ -52,3 +52,21 @@ bool grpc_channel_stack_type_is_client(grpc_channel_stack_type type) { } GPR_UNREACHABLE_CODE(return true;); } + +const char *grpc_channel_stack_type_string(grpc_channel_stack_type type) { + switch (type) { + case GRPC_CLIENT_CHANNEL: + return "CLIENT_CHANNEL"; + case GRPC_CLIENT_SUBCHANNEL: + return "CLIENT_SUBCHANNEL"; + case GRPC_SERVER_CHANNEL: + return "SERVER_CHANNEL"; + case GRPC_CLIENT_LAME_CHANNEL: + return "CLIENT_LAME_CHANNEL"; + case GRPC_CLIENT_DIRECT_CHANNEL: + return "CLIENT_DIRECT_CHANNEL"; + case GRPC_NUM_CHANNEL_STACK_TYPES: + break; + } + GPR_UNREACHABLE_CODE(return "UNKNOWN"); +} diff --git a/src/core/lib/surface/channel_stack_type.h b/src/core/lib/surface/channel_stack_type.h index 4eea4f1b016..ccf4e53d277 100644 --- a/src/core/lib/surface/channel_stack_type.h +++ b/src/core/lib/surface/channel_stack_type.h @@ -55,4 +55,6 @@ typedef enum { bool grpc_channel_stack_type_is_client(grpc_channel_stack_type type); +const char *grpc_channel_stack_type_string(grpc_channel_stack_type type); + #endif /* GRPC_CORE_LIB_SURFACE_CHANNEL_STACK_TYPE_H */ diff --git a/test/core/channel/minimal_stack_is_minimal_test.c b/test/core/channel/minimal_stack_is_minimal_test.c index 622ca0ee038..de8f78fb1a6 100644 --- a/test/core/channel/minimal_stack_is_minimal_test.c +++ b/test/core/channel/minimal_stack_is_minimal_test.c @@ -43,18 +43,15 @@ #include "src/core/lib/transport/transport_impl.h" #include "test/core/util/test_config.h" -static int check_stack(const char *transport_name, grpc_channel_args *init_args, +static int check_stack(const char *file, int line, const char *transport_name, + grpc_channel_args *init_args, grpc_channel_stack_type channel_stack_type, ...) { // create dummy channel stack grpc_channel_stack_builder *builder = grpc_channel_stack_builder_create(); grpc_transport_vtable fake_transport_vtable = {.name = transport_name}; grpc_transport fake_transport = {.vtable = &fake_transport_vtable}; - grpc_arg arg = {.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_MINIMAL_STACK, - .value.integer = 1}; grpc_channel_stack_builder_set_target(builder, "foo.test.google.fr"); - grpc_channel_args *channel_args = - grpc_channel_args_copy_and_add(init_args, &arg, 1); + grpc_channel_args *channel_args = grpc_channel_args_copy(init_args); if (transport_name != NULL) { grpc_channel_stack_builder_set_transport(builder, &fake_transport); } @@ -98,10 +95,41 @@ static int check_stack(const char *transport_name, grpc_channel_args *init_args, // figure out result, log if there's an error int result = 0; if (0 != strcmp(got, expect)) { - gpr_log(GPR_ERROR, - "FAILED transport=%s; stack_type=%d: expected '%s'; got '%s'", - transport_name, channel_stack_type, expect, got); + gpr_strvec_init(&v); + gpr_strvec_add(&v, gpr_strdup("{")); + for (size_t i = 0; i < channel_args->num_args; i++) { + if (i > 0) gpr_strvec_add(&v, gpr_strdup(", ")); + gpr_strvec_add(&v, gpr_strdup(channel_args->args[i].key)); + gpr_strvec_add(&v, gpr_strdup("=")); + switch (channel_args->args[i].type) { + case GRPC_ARG_INTEGER: { + char *tmp; + gpr_asprintf(&tmp, "%d", channel_args->args[i].value.integer); + gpr_strvec_add(&v, tmp); + break; + } + case GRPC_ARG_STRING: + gpr_strvec_add(&v, gpr_strdup(channel_args->args[i].value.string)); + break; + case GRPC_ARG_POINTER: { + char *tmp; + gpr_asprintf(&tmp, "%p", channel_args->args[i].value.pointer.p); + gpr_strvec_add(&v, tmp); + break; + } + } + } + gpr_strvec_add(&v, gpr_strdup("}")); + char *args_str = gpr_strvec_flatten(&v, NULL); + gpr_strvec_destroy(&v); + + gpr_log(file, line, GPR_LOG_SEVERITY_ERROR, + "FAILED transport=%s; stack_type=%s; %s: expected '%s'; got '%s'", + transport_name, grpc_channel_stack_type_string(channel_stack_type), + args_str, expect, got); result = 1; + + gpr_free(args_str); } gpr_free(got); @@ -110,30 +138,60 @@ static int check_stack(const char *transport_name, grpc_channel_args *init_args, { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_channel_stack_builder_destroy(&exec_ctx, builder); + grpc_channel_args_destroy(&exec_ctx, channel_args); grpc_exec_ctx_finish(&exec_ctx); } return result; } +#define CHECK_STACK(...) check_stack(__FILE__, __LINE__, __VA_ARGS__) + int main(int argc, char **argv) { grpc_test_init(argc, argv); grpc_init(); int errors = 0; - errors += check_stack("unknown", NULL, GRPC_CLIENT_DIRECT_CHANNEL, + + // tests with a minimal stack + grpc_arg minimal_stack_arg = {.type = GRPC_ARG_INTEGER, + .key = GRPC_ARG_MINIMAL_STACK, + .value.integer = 1}; + grpc_channel_args minimal_stack_args = {.num_args = 1, + .args = &minimal_stack_arg}; + errors += CHECK_STACK("unknown", &minimal_stack_args, + GRPC_CLIENT_DIRECT_CHANNEL, "connected", NULL); + errors += CHECK_STACK("unknown", &minimal_stack_args, GRPC_CLIENT_SUBCHANNEL, "connected", NULL); + errors += CHECK_STACK("unknown", &minimal_stack_args, GRPC_SERVER_CHANNEL, + "server", "connected", NULL); errors += - check_stack("unknown", NULL, GRPC_CLIENT_SUBCHANNEL, "connected", NULL); - errors += check_stack("unknown", NULL, GRPC_SERVER_CHANNEL, "server", + CHECK_STACK("chttp2", &minimal_stack_args, GRPC_CLIENT_DIRECT_CHANNEL, + "http-client", "connected", NULL); + errors += CHECK_STACK("chttp2", &minimal_stack_args, GRPC_CLIENT_SUBCHANNEL, "connected", NULL); - errors += check_stack("chttp2", NULL, GRPC_CLIENT_DIRECT_CHANNEL, - "http-client", "connected", NULL); + errors += CHECK_STACK("chttp2", &minimal_stack_args, GRPC_SERVER_CHANNEL, + "server", "http-server", "connected", NULL); + errors += CHECK_STACK(NULL, &minimal_stack_args, GRPC_CLIENT_CHANNEL, + "client-channel", NULL); + + // tests with a default stack + errors += CHECK_STACK("unknown", NULL, GRPC_CLIENT_DIRECT_CHANNEL, "compress", + "deadline", "connected", NULL); + errors += + CHECK_STACK("unknown", NULL, GRPC_CLIENT_SUBCHANNEL, "connected", NULL); + errors += CHECK_STACK("unknown", NULL, GRPC_SERVER_CHANNEL, "server", + "compress", "deadline", "connected", NULL); errors += - check_stack("chttp2", NULL, GRPC_CLIENT_SUBCHANNEL, "connected", NULL); - errors += check_stack("chttp2", NULL, GRPC_SERVER_CHANNEL, "server", - "http-server", "connected", NULL); + CHECK_STACK("chttp2", NULL, GRPC_CLIENT_DIRECT_CHANNEL, "http-client", + "compress", "deadline", "connected", NULL); + errors += CHECK_STACK("chttp2", NULL, GRPC_CLIENT_SUBCHANNEL, "http-client", + "connected", NULL); errors += - check_stack(NULL, NULL, GRPC_CLIENT_CHANNEL, "client-channel", NULL); + CHECK_STACK("chttp2", NULL, GRPC_SERVER_CHANNEL, "server", "http-server", + "compress", "deadline", "connected", NULL); + errors += CHECK_STACK(NULL, NULL, GRPC_CLIENT_CHANNEL, "compress", + "client-channel", NULL); + GPR_ASSERT(errors == 0); grpc_shutdown(); return 0; From 942324235cc03dd3437df8c282796f5711bfa131 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 3 Apr 2017 10:44:03 -0700 Subject: [PATCH 139/461] s/new/old --- tools/profiling/microbenchmarks/bm_diff.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index 84712e7e0dc..aa4caca43d7 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -153,8 +153,8 @@ subprocess.check_call(['git', 'checkout', args.diff_base]) try: build() jobset.run(itertools.chain( - (collect1(bm, 'opt', 'new') for bm in args.benchmarks), - (collect1(bm, 'counters', 'new') for bm in args.benchmarks), + (collect1(bm, 'opt', 'old') for bm in args.benchmarks), + (collect1(bm, 'counters', 'old') for bm in args.benchmarks), ), maxjobs=args.jobs) finally: subprocess.check_call(['git', 'checkout', where_am_i]) From 0be726b34dafa05a46f5071d9786692d23e7a503 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 3 Apr 2017 20:04:34 +0200 Subject: [PATCH 140/461] bump version to 1.2.2 --- BUILD | 2 +- CMakeLists.txt | 2 +- Makefile | 4 ++-- build.yaml | 2 +- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.json | 2 +- package.xml | 4 ++-- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Auth/project.json | 4 ++-- src/csharp/Grpc.Core.Testing/project.json | 4 ++-- src/csharp/Grpc.Core/VersionInfo.cs | 4 ++-- src/csharp/Grpc.Core/project.json | 2 +- src/csharp/Grpc.HealthCheck/project.json | 4 ++-- src/csharp/Grpc.Reflection/project.json | 4 ++-- src/csharp/build_packages_dotnetcli.bat | 2 +- src/csharp/build_packages_dotnetcli.sh | 4 ++-- src/node/health_check/package.json | 4 ++-- src/node/tools/package.json | 2 +- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/private/version.h | 2 +- src/php/composer.json | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- 33 files changed, 42 insertions(+), 42 deletions(-) diff --git a/BUILD b/BUILD index 0c6daee4bb8..0e8b058cb5f 100644 --- a/BUILD +++ b/BUILD @@ -41,7 +41,7 @@ g_stands_for = "green" core_version = "3.0.0-dev" -version = "1.2.1" +version = "1.2.2" grpc_cc_library( name = "gpr", diff --git a/CMakeLists.txt b/CMakeLists.txt index f9ca86266bd..4496d37bd6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,7 @@ cmake_minimum_required(VERSION 2.8) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.2.1") +set(PACKAGE_VERSION "1.2.2") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index 5655ae36858..00a99ab964f 100644 --- a/Makefile +++ b/Makefile @@ -412,8 +412,8 @@ Q = @ endif CORE_VERSION = 3.0.0-dev -CPP_VERSION = 1.2.1 -CSHARP_VERSION = 1.2.1 +CPP_VERSION = 1.2.2 +CSHARP_VERSION = 1.2.2 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/build.yaml b/build.yaml index 1c3a23bf6b7..8df00f2c4bd 100644 --- a/build.yaml +++ b/build.yaml @@ -14,7 +14,7 @@ settings: '#10': See the expand_version.py for all the quirks here core_version: 3.0.0-dev g_stands_for: green - version: 1.2.1 + version: 1.2.2 filegroups: - name: census public_headers: diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 585713c0e61..51e8fdfa02e 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -37,7 +37,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.2.1' + version = '1.2.2' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'http://www.grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index cc9817a02a9..86c51819227 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -36,7 +36,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.2.1' + version = '1.2.2' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'http://www.grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index e631ee5104a..ba365ceaa04 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -36,7 +36,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.2.1' + version = '1.2.2' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'http://www.grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index ea78d5f91ea..b51c4df5dae 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -35,7 +35,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.2.1' + version = '1.2.2' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'http://www.grpc.io' diff --git a/package.json b/package.json index 31846bf2e79..b4503d00dba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grpc", - "version": "1.2.1", + "version": "1.2.2", "author": "Google Inc.", "description": "gRPC Library for Node", "homepage": "http://www.grpc.io/", diff --git a/package.xml b/package.xml index 24a0bf01a8b..6ff9a9c9cc4 100644 --- a/package.xml +++ b/package.xml @@ -13,8 +13,8 @@ 2017-03-01 - 1.2.1 - 1.2.1 + 1.2.2 + 1.2.2 beta diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index 5cac8cdf781..6405fbcbd7d 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -37,5 +37,5 @@ #include namespace grpc { -grpc::string Version() { return "1.2.1"; } +grpc::string Version() { return "1.2.2"; } } diff --git a/src/csharp/Grpc.Auth/project.json b/src/csharp/Grpc.Auth/project.json index 66b3fa93d6a..31022e65bdf 100644 --- a/src/csharp/Grpc.Auth/project.json +++ b/src/csharp/Grpc.Auth/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.1", + "version": "1.2.2", "title": "gRPC C# Auth", "authors": [ "Google Inc." ], "copyright": "Copyright 2015, Google Inc.", @@ -21,7 +21,7 @@ } }, "dependencies": { - "Grpc.Core": "1.2.1", + "Grpc.Core": "1.2.2", "Google.Apis.Auth": "1.21.0" }, "frameworks": { diff --git a/src/csharp/Grpc.Core.Testing/project.json b/src/csharp/Grpc.Core.Testing/project.json index c4e015f4186..22d728fc159 100644 --- a/src/csharp/Grpc.Core.Testing/project.json +++ b/src/csharp/Grpc.Core.Testing/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.1", + "version": "1.2.2", "title": "gRPC C# Core Testing", "authors": [ "Google Inc." ], "copyright": "Copyright 2017, Google Inc.", @@ -21,7 +21,7 @@ } }, "dependencies": { - "Grpc.Core": "1.2.1" + "Grpc.Core": "1.2.2" }, "frameworks": { "net45": { diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs index 42881c9f065..d46f863e173 100644 --- a/src/csharp/Grpc.Core/VersionInfo.cs +++ b/src/csharp/Grpc.Core/VersionInfo.cs @@ -48,11 +48,11 @@ namespace Grpc.Core /// /// Current AssemblyFileVersion of gRPC C# assemblies /// - public const string CurrentAssemblyFileVersion = "1.2.1.0"; + public const string CurrentAssemblyFileVersion = "1.2.2.0"; /// /// Current version of gRPC C# /// - public const string CurrentVersion = "1.2.1"; + public const string CurrentVersion = "1.2.2"; } } diff --git a/src/csharp/Grpc.Core/project.json b/src/csharp/Grpc.Core/project.json index f9f617772a8..0d56b55fe30 100644 --- a/src/csharp/Grpc.Core/project.json +++ b/src/csharp/Grpc.Core/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.1", + "version": "1.2.2", "title": "gRPC C# Core", "authors": [ "Google Inc." ], "copyright": "Copyright 2015, Google Inc.", diff --git a/src/csharp/Grpc.HealthCheck/project.json b/src/csharp/Grpc.HealthCheck/project.json index 0a564fde5af..259d973ff62 100644 --- a/src/csharp/Grpc.HealthCheck/project.json +++ b/src/csharp/Grpc.HealthCheck/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.1", + "version": "1.2.2", "title": "gRPC C# Healthchecking", "authors": [ "Google Inc." ], "copyright": "Copyright 2015, Google Inc.", @@ -21,7 +21,7 @@ } }, "dependencies": { - "Grpc.Core": "1.2.1", + "Grpc.Core": "1.2.2", "Google.Protobuf": "3.2.0" }, "frameworks": { diff --git a/src/csharp/Grpc.Reflection/project.json b/src/csharp/Grpc.Reflection/project.json index ac948d45f04..b40945cad40 100644 --- a/src/csharp/Grpc.Reflection/project.json +++ b/src/csharp/Grpc.Reflection/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.1", + "version": "1.2.2", "title": "gRPC C# Reflection", "authors": [ "Google Inc." ], "copyright": "Copyright 2016, Google Inc.", @@ -21,7 +21,7 @@ } }, "dependencies": { - "Grpc.Core": "1.2.1", + "Grpc.Core": "1.2.2", "Google.Protobuf": "3.2.0" }, "frameworks": { diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat index da6556dc27e..51c87246bf0 100755 --- a/src/csharp/build_packages_dotnetcli.bat +++ b/src/csharp/build_packages_dotnetcli.bat @@ -28,7 +28,7 @@ @rem OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @rem Current package versions -set VERSION=1.2.1 +set VERSION=1.2.2 set PROTOBUF_VERSION=3.0.0 @rem Adjust the location of nuget.exe diff --git a/src/csharp/build_packages_dotnetcli.sh b/src/csharp/build_packages_dotnetcli.sh index c0d58d667a9..7e7a029fcfd 100755 --- a/src/csharp/build_packages_dotnetcli.sh +++ b/src/csharp/build_packages_dotnetcli.sh @@ -66,7 +66,7 @@ dotnet pack --configuration Release Grpc.Auth/project.json --output ../../artifa dotnet pack --configuration Release Grpc.HealthCheck/project.json --output ../../artifacts dotnet pack --configuration Release Grpc.Reflection/project.json --output ../../artifacts -nuget pack Grpc.nuspec -Version "1.2.1" -OutputDirectory ../../artifacts -nuget pack Grpc.Tools.nuspec -Version "1.2.1" -OutputDirectory ../../artifacts +nuget pack Grpc.nuspec -Version "1.2.2" -OutputDirectory ../../artifacts +nuget pack Grpc.Tools.nuspec -Version "1.2.2" -OutputDirectory ../../artifacts (cd ../../artifacts && zip csharp_nugets_dotnetcli.zip *.nupkg) diff --git a/src/node/health_check/package.json b/src/node/health_check/package.json index 177b27b9112..61bb83f229a 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.2.1", + "version": "1.2.2", "author": "Google Inc.", "description": "Health check service for use with gRPC", "repository": { @@ -15,7 +15,7 @@ } ], "dependencies": { - "grpc": "^1.2.1", + "grpc": "^1.2.2", "lodash": "^3.9.3", "google-protobuf": "^3.0.0" }, diff --git a/src/node/tools/package.json b/src/node/tools/package.json index 5867db6bb9b..460f2fc857a 100644 --- a/src/node/tools/package.json +++ b/src/node/tools/package.json @@ -1,6 +1,6 @@ { "name": "grpc-tools", - "version": "1.2.1", + "version": "1.2.2", "author": "Google Inc.", "description": "Tools for developing with gRPC on Node.js", "homepage": "http://www.grpc.io/", diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index 226e36fd866..ca5ad7b2f56 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.2.1' + v = '1.2.2' 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 60866a078af..d04f73d3188 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -38,4 +38,4 @@ // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.2.1" +#define GRPC_OBJC_VERSION_STRING @"1.2.2" diff --git a/src/php/composer.json b/src/php/composer.json index ee7616b45df..fa4e3e5990f 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": "BSD-3-Clause", - "version": "1.2.1", + "version": "1.2.2", "require": { "php": ">=5.5.0", "google/protobuf": "^v3.1.0" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index 330c20dd8f3..caf940273e2 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION='1.2.1' +VERSION='1.2.2' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index c06086d5b8c..7b7d95daacf 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION='1.2.1' +VERSION='1.2.2' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index f774e403f50..dffabad634f 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION='1.2.1' +VERSION='1.2.2' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index 9a1a472afcc..d31ddd3c221 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION='1.2.1' +VERSION='1.2.2' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index 3ee48ae328f..cc25ca10a0e 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -29,5 +29,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.2.1' + VERSION = '1.2.2' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index d037014852f..7c7eada243d 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -29,6 +29,6 @@ module GRPC module Tools - VERSION = '1.2.1' + VERSION = '1.2.2' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index e125d189220..a28f2448d4d 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION='1.2.1' +VERSION='1.2.2' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 4d427640503..70c7f6d5ae8 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.2.1 +PROJECT_NUMBER = 1.2.2 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 8e5730a0d32..34d6a59be20 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.2.1 +PROJECT_NUMBER = 1.2.2 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a From ec9698f8364934808c0272008735ec16e1cf4e12 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 3 Apr 2017 11:27:16 -0700 Subject: [PATCH 141/461] Fix asan and use internal version of grpc_slice_buffer_reset_and_unref --- .../chttp2/transport/chttp2_transport.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index d3a4f35ea40..63bb622c292 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1517,9 +1517,9 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_exec_ctx *exec_ctx, if (s->recv_initial_metadata_ready != NULL && s->published_metadata[0] != GRPC_METADATA_NOT_PUBLISHED) { if (s->seen_error) { - grpc_slice_buffer_reset_and_unref(&s->frame_storage); + grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->frame_storage); if (!s->pending_byte_stream) { - grpc_slice_buffer_reset_and_unref( + grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->unprocessed_incoming_frames_buffer); } } @@ -1537,9 +1537,9 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, if (s->recv_message_ready != NULL) { *s->recv_message = NULL; if (s->final_metadata_requested && s->seen_error) { - grpc_slice_buffer_reset_and_unref(&s->frame_storage); + grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->frame_storage); if (!s->pending_byte_stream) { - grpc_slice_buffer_reset_and_unref( + grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->unprocessed_incoming_frames_buffer); } } @@ -1556,8 +1556,8 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, &s->unprocessed_incoming_frames_buffer, NULL, s->recv_message); if (error != GRPC_ERROR_NONE) { s->seen_error = true; - grpc_slice_buffer_reset_and_unref(&s->frame_storage); - grpc_slice_buffer_reset_and_unref( + grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->frame_storage); + grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->unprocessed_incoming_frames_buffer); break; } else if (*s->recv_message != NULL) { @@ -1581,9 +1581,9 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx *exec_ctx, if (s->recv_trailing_metadata_finished != NULL && s->read_closed && s->write_closed) { if (s->seen_error) { - grpc_slice_buffer_reset_and_unref(&s->frame_storage); + grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->frame_storage); if (!s->pending_byte_stream) { - grpc_slice_buffer_reset_and_unref( + grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->unprocessed_incoming_frames_buffer); } } @@ -2678,6 +2678,7 @@ grpc_error *grpc_chttp2_incoming_byte_stream_finished( if (error != GRPC_ERROR_NONE && reset_on_error) { grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error)); } + GRPC_ERROR_UNREF(error); incoming_byte_stream_unref(exec_ctx, bs); return error; } From f5684b4e13bb8281a2246b3219a9e53cfa8d6bfb Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 3 Apr 2017 11:29:41 -0700 Subject: [PATCH 142/461] clang-format --- .../chttp2/transport/chttp2_transport.c | 43 +++++++++---------- .../ext/transport/chttp2/transport/internal.h | 2 +- .../ext/transport/chttp2/transport/parsing.c | 18 ++++---- 3 files changed, 29 insertions(+), 34 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 63bb622c292..301140311ab 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -515,11 +515,10 @@ static void destroy_transport_locked(grpc_exec_ctx *exec_ctx, void *tp, static void destroy_transport(grpc_exec_ctx *exec_ctx, grpc_transport *gt) { grpc_chttp2_transport *t = (grpc_chttp2_transport *)gt; - grpc_closure_sched( - exec_ctx, - grpc_closure_create(destroy_transport_locked, t, - grpc_combiner_scheduler(t->combiner, false)), - GRPC_ERROR_NONE); + grpc_closure_sched(exec_ctx, grpc_closure_create( + destroy_transport_locked, t, + grpc_combiner_scheduler(t->combiner, false)), + GRPC_ERROR_NONE); } static void close_transport_locked(grpc_exec_ctx *exec_ctx, @@ -697,9 +696,8 @@ static void destroy_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, s->destroy_stream_arg = then_schedule_closure; grpc_closure_sched( - exec_ctx, - grpc_closure_init(&s->destroy_stream, destroy_stream_locked, s, - grpc_combiner_scheduler(t->combiner, false)), + exec_ctx, grpc_closure_init(&s->destroy_stream, destroy_stream_locked, s, + grpc_combiner_scheduler(t->combiner, false)), GRPC_ERROR_NONE); GPR_TIMER_END("destroy_stream", 0); } @@ -1500,10 +1498,9 @@ static void perform_transport_op(grpc_exec_ctx *exec_ctx, grpc_transport *gt, op->transport_private.args[0] = gt; GRPC_CHTTP2_REF_TRANSPORT(t, "transport_op"); grpc_closure_sched( - exec_ctx, - grpc_closure_init(&op->transport_private.closure, - perform_transport_op_locked, op, - grpc_combiner_scheduler(t->combiner, false)), + exec_ctx, grpc_closure_init(&op->transport_private.closure, + perform_transport_op_locked, op, + grpc_combiner_scheduler(t->combiner, false)), GRPC_ERROR_NONE); } @@ -1519,8 +1516,8 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_exec_ctx *exec_ctx, if (s->seen_error) { grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->frame_storage); if (!s->pending_byte_stream) { - grpc_slice_buffer_reset_and_unref_internal(exec_ctx, - &s->unprocessed_incoming_frames_buffer); + grpc_slice_buffer_reset_and_unref_internal( + exec_ctx, &s->unprocessed_incoming_frames_buffer); } } grpc_chttp2_incoming_metadata_buffer_publish( @@ -1539,8 +1536,8 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, if (s->final_metadata_requested && s->seen_error) { grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->frame_storage); if (!s->pending_byte_stream) { - grpc_slice_buffer_reset_and_unref_internal(exec_ctx, - &s->unprocessed_incoming_frames_buffer); + grpc_slice_buffer_reset_and_unref_internal( + exec_ctx, &s->unprocessed_incoming_frames_buffer); } } if (!s->pending_byte_stream) { @@ -1556,9 +1553,10 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, &s->unprocessed_incoming_frames_buffer, NULL, s->recv_message); if (error != GRPC_ERROR_NONE) { s->seen_error = true; - grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->frame_storage); grpc_slice_buffer_reset_and_unref_internal(exec_ctx, - &s->unprocessed_incoming_frames_buffer); + &s->frame_storage); + grpc_slice_buffer_reset_and_unref_internal( + exec_ctx, &s->unprocessed_incoming_frames_buffer); break; } else if (*s->recv_message != NULL) { break; @@ -1583,8 +1581,8 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx *exec_ctx, if (s->seen_error) { grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->frame_storage); if (!s->pending_byte_stream) { - grpc_slice_buffer_reset_and_unref_internal(exec_ctx, - &s->unprocessed_incoming_frames_buffer); + grpc_slice_buffer_reset_and_unref_internal( + exec_ctx, &s->unprocessed_incoming_frames_buffer); } } if (s->read_closed && s->frame_storage.length == 0 && @@ -2207,9 +2205,8 @@ static void keepalive_watchdog_fired_locked(grpc_exec_ctx *exec_ctx, void *arg, if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) { if (error == GRPC_ERROR_NONE) { t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DYING; - close_transport_locked( - exec_ctx, t, - GRPC_ERROR_CREATE_FROM_STATIC_STRING("keepalive watchdog timeout")); + close_transport_locked(exec_ctx, t, GRPC_ERROR_CREATE_FROM_STATIC_STRING( + "keepalive watchdog timeout")); } } else { /** The watchdog timer should have been cancelled by diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index a2deac63151..b4938dc2812 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -619,7 +619,7 @@ extern int grpc_flowctl_trace; if (!(grpc_http_trace)) \ ; \ else \ - stmt + stmt typedef enum { GRPC_CHTTP2_FLOWCTL_MOVE, diff --git a/src/core/ext/transport/chttp2/transport/parsing.c b/src/core/ext/transport/chttp2/transport/parsing.c index bf1cf58cb25..638b137316f 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.c +++ b/src/core/ext/transport/chttp2/transport/parsing.c @@ -230,11 +230,10 @@ grpc_error *grpc_chttp2_perform_read(grpc_exec_ctx *exec_ctx, case GRPC_DTS_FRAME: GPR_ASSERT(cur < end); if ((uint32_t)(end - cur) == t->incoming_frame_size) { - err = - parse_frame_slice(exec_ctx, t, - grpc_slice_sub_no_ref(slice, (size_t)(cur - beg), - (size_t)(end - beg)), - 1); + err = parse_frame_slice( + exec_ctx, t, grpc_slice_sub_no_ref(slice, (size_t)(cur - beg), + (size_t)(end - beg)), + 1); if (err != GRPC_ERROR_NONE) { return err; } @@ -255,11 +254,10 @@ grpc_error *grpc_chttp2_perform_read(grpc_exec_ctx *exec_ctx, t->incoming_stream = NULL; goto dts_fh_0; /* loop */ } else { - err = - parse_frame_slice(exec_ctx, t, - grpc_slice_sub_no_ref(slice, (size_t)(cur - beg), - (size_t)(end - beg)), - 0); + err = parse_frame_slice( + exec_ctx, t, grpc_slice_sub_no_ref(slice, (size_t)(cur - beg), + (size_t)(end - beg)), + 0); if (err != GRPC_ERROR_NONE) { return err; } From 9b3648a28e636398788737ce83982a4cb061031b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 3 Apr 2017 12:25:19 -0700 Subject: [PATCH 143/461] Optionalize message_size_filter --- BUILD | 4 +- CMakeLists.txt | 9 +- Makefile | 9 +- binding.gyp | 2 +- build.yaml | 12 +- config.m4 | 3 +- gRPC-Core.podspec | 8 +- grpc.gemspec | 4 +- package.xml | 4 +- src/core/ext/filters/max_age/max_age_filter.c | 2 +- .../message_size}/message_size_filter.c | 102 +++++++-- .../message_size}/message_size_filter.h | 0 src/core/lib/surface/init.c | 10 - .../plugin_registry/grpc_plugin_registry.c | 4 + .../grpc_unsecure_plugin_registry.c | 4 + src/python/grpcio/grpc_core_dependencies.py | 2 +- test/cpp/microbenchmarks/bm_call_create.cc | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 - tools/doxygen/Doxyfile.core.internal | 4 +- .../generated/sources_and_headers.json | 23 +- vsprojects/vcxproj/grpc++/grpc++.vcxproj | 3 - .../vcxproj/grpc++/grpc++.vcxproj.filters | 6 - .../grpc++_unsecure/grpc++_unsecure.vcxproj | 3 - .../grpc++_unsecure.vcxproj.filters | 6 - vsprojects/vcxproj/grpc/grpc.vcxproj | 6 +- vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 15 +- .../grpc_test_util/grpc_test_util.vcxproj | 3 - .../grpc_test_util.vcxproj.filters | 6 - .../grpc_unsecure/grpc_unsecure.vcxproj | 6 +- .../grpc_unsecure.vcxproj.filters | 15 +- .../minimal_stack_is_minimal_test.vcxproj | 199 ++++++++++++++++++ ...imal_stack_is_minimal_test.vcxproj.filters | 21 ++ 32 files changed, 387 insertions(+), 112 deletions(-) rename src/core/{lib/channel => ext/filters/message_size}/message_size_filter.c (77%) rename src/core/{lib/channel => ext/filters/message_size}/message_size_filter.h (100%) create mode 100644 vsprojects/vcxproj/test/minimal_stack_is_minimal_test/minimal_stack_is_minimal_test.vcxproj create mode 100644 vsprojects/vcxproj/test/minimal_stack_is_minimal_test/minimal_stack_is_minimal_test.vcxproj.filters diff --git a/BUILD b/BUILD index 77ea8333088..9d183c8e2b2 100644 --- a/BUILD +++ b/BUILD @@ -437,7 +437,7 @@ grpc_cc_library( "src/core/lib/channel/http_client_filter.c", "src/core/lib/channel/http_server_filter.c", "src/core/ext/filters/max_age/max_age_filter.c", - "src/core/lib/channel/message_size_filter.c", + "src/core/ext/filters/message_size/message_size_filter.c", "src/core/lib/compression/compression.c", "src/core/lib/compression/message_compress.c", "src/core/lib/debug/trace.c", @@ -565,7 +565,7 @@ grpc_cc_library( "src/core/lib/channel/http_client_filter.h", "src/core/lib/channel/http_server_filter.h", "src/core/ext/filters/max_age/max_age_filter.h", - "src/core/lib/channel/message_size_filter.h", + "src/core/ext/filters/message_size/message_size_filter.h", "src/core/lib/compression/algorithm_metadata.h", "src/core/lib/compression/message_compress.h", "src/core/lib/debug/trace.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index 872b782b44f..441be29c0b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -919,7 +919,6 @@ add_library(grpc src/core/lib/channel/handshaker_registry.c src/core/lib/channel/http_client_filter.c src/core/lib/channel/http_server_filter.c - src/core/lib/channel/message_size_filter.c src/core/lib/compression/compression.c src/core/lib/compression/message_compress.c src/core/lib/debug/trace.c @@ -1139,6 +1138,7 @@ add_library(grpc src/core/ext/census/trace_context.c src/core/ext/census/tracing.c src/core/ext/filters/max_age/max_age_filter.c + src/core/ext/filters/message_size/message_size_filter.c src/core/plugin_registry/grpc_plugin_registry.c ) @@ -1241,7 +1241,6 @@ add_library(grpc_cronet src/core/lib/channel/handshaker_registry.c src/core/lib/channel/http_client_filter.c src/core/lib/channel/http_server_filter.c - src/core/lib/channel/message_size_filter.c src/core/lib/compression/compression.c src/core/lib/compression/message_compress.c src/core/lib/debug/trace.c @@ -1549,7 +1548,6 @@ add_library(grpc_test_util src/core/lib/channel/handshaker_registry.c src/core/lib/channel/http_client_filter.c src/core/lib/channel/http_server_filter.c - src/core/lib/channel/message_size_filter.c src/core/lib/compression/compression.c src/core/lib/compression/message_compress.c src/core/lib/debug/trace.c @@ -1809,7 +1807,6 @@ add_library(grpc_unsecure src/core/lib/channel/handshaker_registry.c src/core/lib/channel/http_client_filter.c src/core/lib/channel/http_server_filter.c - src/core/lib/channel/message_size_filter.c src/core/lib/compression/compression.c src/core/lib/compression/message_compress.c src/core/lib/debug/trace.c @@ -2000,6 +1997,7 @@ add_library(grpc_unsecure src/core/ext/census/trace_context.c src/core/ext/census/tracing.c src/core/ext/filters/max_age/max_age_filter.c + src/core/ext/filters/message_size/message_size_filter.c src/core/plugin_registry/grpc_unsecure_plugin_registry.c ) @@ -2225,7 +2223,6 @@ add_library(grpc++ src/core/lib/channel/handshaker_registry.c src/core/lib/channel/http_client_filter.c src/core/lib/channel/http_server_filter.c - src/core/lib/channel/message_size_filter.c src/core/lib/compression/compression.c src/core/lib/compression/message_compress.c src/core/lib/debug/trace.c @@ -2555,7 +2552,6 @@ add_library(grpc++_cronet src/core/lib/channel/handshaker_registry.c src/core/lib/channel/http_client_filter.c src/core/lib/channel/http_server_filter.c - src/core/lib/channel/message_size_filter.c src/core/lib/compression/compression.c src/core/lib/compression/message_compress.c src/core/lib/debug/trace.c @@ -3253,7 +3249,6 @@ add_library(grpc++_unsecure src/core/lib/channel/handshaker_registry.c src/core/lib/channel/http_client_filter.c src/core/lib/channel/http_server_filter.c - src/core/lib/channel/message_size_filter.c src/core/lib/compression/compression.c src/core/lib/compression/message_compress.c src/core/lib/debug/trace.c diff --git a/Makefile b/Makefile index e8987c85e0d..c0d0a63a836 100644 --- a/Makefile +++ b/Makefile @@ -2824,7 +2824,6 @@ LIBGRPC_SRC = \ src/core/lib/channel/handshaker_registry.c \ src/core/lib/channel/http_client_filter.c \ src/core/lib/channel/http_server_filter.c \ - src/core/lib/channel/message_size_filter.c \ src/core/lib/compression/compression.c \ src/core/lib/compression/message_compress.c \ src/core/lib/debug/trace.c \ @@ -3044,6 +3043,7 @@ LIBGRPC_SRC = \ src/core/ext/census/trace_context.c \ src/core/ext/census/tracing.c \ src/core/ext/filters/max_age/max_age_filter.c \ + src/core/ext/filters/message_size/message_size_filter.c \ src/core/plugin_registry/grpc_plugin_registry.c \ PUBLIC_HEADERS_C += \ @@ -3144,7 +3144,6 @@ LIBGRPC_CRONET_SRC = \ src/core/lib/channel/handshaker_registry.c \ src/core/lib/channel/http_client_filter.c \ src/core/lib/channel/http_server_filter.c \ - src/core/lib/channel/message_size_filter.c \ src/core/lib/compression/compression.c \ src/core/lib/compression/message_compress.c \ src/core/lib/debug/trace.c \ @@ -3451,7 +3450,6 @@ LIBGRPC_TEST_UTIL_SRC = \ src/core/lib/channel/handshaker_registry.c \ src/core/lib/channel/http_client_filter.c \ src/core/lib/channel/http_server_filter.c \ - src/core/lib/channel/message_size_filter.c \ src/core/lib/compression/compression.c \ src/core/lib/compression/message_compress.c \ src/core/lib/debug/trace.c \ @@ -3683,7 +3681,6 @@ LIBGRPC_UNSECURE_SRC = \ src/core/lib/channel/handshaker_registry.c \ src/core/lib/channel/http_client_filter.c \ src/core/lib/channel/http_server_filter.c \ - src/core/lib/channel/message_size_filter.c \ src/core/lib/compression/compression.c \ src/core/lib/compression/message_compress.c \ src/core/lib/debug/trace.c \ @@ -3874,6 +3871,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/census/trace_context.c \ src/core/ext/census/tracing.c \ src/core/ext/filters/max_age/max_age_filter.c \ + src/core/ext/filters/message_size/message_size_filter.c \ src/core/plugin_registry/grpc_unsecure_plugin_registry.c \ PUBLIC_HEADERS_C += \ @@ -4076,7 +4074,6 @@ LIBGRPC++_SRC = \ src/core/lib/channel/handshaker_registry.c \ src/core/lib/channel/http_client_filter.c \ src/core/lib/channel/http_server_filter.c \ - src/core/lib/channel/message_size_filter.c \ src/core/lib/compression/compression.c \ src/core/lib/compression/message_compress.c \ src/core/lib/debug/trace.c \ @@ -4414,7 +4411,6 @@ LIBGRPC++_CRONET_SRC = \ src/core/lib/channel/handshaker_registry.c \ src/core/lib/channel/http_client_filter.c \ src/core/lib/channel/http_server_filter.c \ - src/core/lib/channel/message_size_filter.c \ src/core/lib/compression/compression.c \ src/core/lib/compression/message_compress.c \ src/core/lib/debug/trace.c \ @@ -5104,7 +5100,6 @@ LIBGRPC++_UNSECURE_SRC = \ src/core/lib/channel/handshaker_registry.c \ src/core/lib/channel/http_client_filter.c \ src/core/lib/channel/http_server_filter.c \ - src/core/lib/channel/message_size_filter.c \ src/core/lib/compression/compression.c \ src/core/lib/compression/message_compress.c \ src/core/lib/debug/trace.c \ diff --git a/binding.gyp b/binding.gyp index f3c7252d96d..01bd1ee43f3 100644 --- a/binding.gyp +++ b/binding.gyp @@ -626,7 +626,6 @@ 'src/core/lib/channel/handshaker_registry.c', 'src/core/lib/channel/http_client_filter.c', 'src/core/lib/channel/http_server_filter.c', - 'src/core/lib/channel/message_size_filter.c', 'src/core/lib/compression/compression.c', 'src/core/lib/compression/message_compress.c', 'src/core/lib/debug/trace.c', @@ -846,6 +845,7 @@ 'src/core/ext/census/trace_context.c', 'src/core/ext/census/tracing.c', 'src/core/ext/filters/max_age/max_age_filter.c', + 'src/core/ext/filters/message_size/message_size_filter.c', 'src/core/plugin_registry/grpc_plugin_registry.c', ], "conditions": [ diff --git a/build.yaml b/build.yaml index f14f4c2ec0e..6c87210e65f 100644 --- a/build.yaml +++ b/build.yaml @@ -185,7 +185,6 @@ filegroups: - src/core/lib/channel/handshaker_registry.h - src/core/lib/channel/http_client_filter.h - src/core/lib/channel/http_server_filter.h - - src/core/lib/channel/message_size_filter.h - src/core/lib/compression/algorithm_metadata.h - src/core/lib/compression/message_compress.h - src/core/lib/debug/trace.h @@ -295,7 +294,6 @@ filegroups: - src/core/lib/channel/handshaker_registry.c - src/core/lib/channel/http_client_filter.c - src/core/lib/channel/http_server_filter.c - - src/core/lib/channel/message_size_filter.c - src/core/lib/compression/compression.c - src/core/lib/compression/message_compress.c - src/core/lib/debug/trace.c @@ -533,6 +531,14 @@ filegroups: plugin: grpc_max_age_filter uses: - grpc_base +- name: grpc_message_size_filter + headers: + - src/core/ext/filters/message_size/message_size_filter.h + src: + - src/core/ext/filters/message_size/message_size_filter.c + plugin: grpc_message_size_filter + uses: + - grpc_base - name: grpc_resolver_dns_ares headers: - src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h @@ -997,6 +1003,7 @@ libs: - grpc_secure - census - grpc_max_age_filter + - grpc_message_size_filter generate_plugin_registry: true secure: true vs_packages: @@ -1094,6 +1101,7 @@ libs: - grpc_lb_policy_round_robin - census - grpc_max_age_filter + - grpc_message_size_filter generate_plugin_registry: true secure: false vs_project_guid: '{46CEDFFF-9692-456A-AA24-38B5D6BCF4C5}' diff --git a/config.m4 b/config.m4 index 28467810313..d830fa17bf0 100644 --- a/config.m4 +++ b/config.m4 @@ -94,7 +94,6 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/channel/handshaker_registry.c \ src/core/lib/channel/http_client_filter.c \ src/core/lib/channel/http_server_filter.c \ - src/core/lib/channel/message_size_filter.c \ src/core/lib/compression/compression.c \ src/core/lib/compression/message_compress.c \ src/core/lib/debug/trace.c \ @@ -314,6 +313,7 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/census/trace_context.c \ src/core/ext/census/tracing.c \ src/core/ext/filters/max_age/max_age_filter.c \ + src/core/ext/filters/message_size/message_size_filter.c \ src/core/plugin_registry/grpc_plugin_registry.c \ src/boringssl/err_data.c \ third_party/boringssl/crypto/aes/aes.c \ @@ -639,6 +639,7 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/resolver/sockaddr) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/load_reporting) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/max_age) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/message_size) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/alpn) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/client) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/client/insecure) diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 83c19afc243..8f39374693c 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -267,7 +267,6 @@ Pod::Spec.new do |s| 'src/core/lib/channel/handshaker_registry.h', 'src/core/lib/channel/http_client_filter.h', 'src/core/lib/channel/http_server_filter.h', - 'src/core/lib/channel/message_size_filter.h', 'src/core/lib/compression/algorithm_metadata.h', 'src/core/lib/compression/message_compress.h', 'src/core/lib/debug/trace.h', @@ -457,6 +456,7 @@ Pod::Spec.new do |s| 'src/core/ext/census/trace_string.h', 'src/core/ext/census/tracing.h', 'src/core/ext/filters/max_age/max_age_filter.h', + 'src/core/ext/filters/message_size/message_size_filter.h', 'src/core/lib/surface/init.c', 'src/core/lib/channel/channel_args.c', 'src/core/lib/channel/channel_stack.c', @@ -469,7 +469,6 @@ Pod::Spec.new do |s| 'src/core/lib/channel/handshaker_registry.c', 'src/core/lib/channel/http_client_filter.c', 'src/core/lib/channel/http_server_filter.c', - 'src/core/lib/channel/message_size_filter.c', 'src/core/lib/compression/compression.c', 'src/core/lib/compression/message_compress.c', 'src/core/lib/debug/trace.c', @@ -689,6 +688,7 @@ Pod::Spec.new do |s| 'src/core/ext/census/trace_context.c', 'src/core/ext/census/tracing.c', 'src/core/ext/filters/max_age/max_age_filter.c', + 'src/core/ext/filters/message_size/message_size_filter.c', 'src/core/plugin_registry/grpc_plugin_registry.c' ss.private_header_files = 'src/core/lib/profiling/timers.h', @@ -717,7 +717,6 @@ Pod::Spec.new do |s| 'src/core/lib/channel/handshaker_registry.h', 'src/core/lib/channel/http_client_filter.h', 'src/core/lib/channel/http_server_filter.h', - 'src/core/lib/channel/message_size_filter.h', 'src/core/lib/compression/algorithm_metadata.h', 'src/core/lib/compression/message_compress.h', 'src/core/lib/debug/trace.h', @@ -906,7 +905,8 @@ Pod::Spec.new do |s| 'src/core/ext/census/trace_status.h', 'src/core/ext/census/trace_string.h', 'src/core/ext/census/tracing.h', - 'src/core/ext/filters/max_age/max_age_filter.h' + 'src/core/ext/filters/max_age/max_age_filter.h', + 'src/core/ext/filters/message_size/message_size_filter.h' end s.subspec 'Cronet-Interface' do |ss| diff --git a/grpc.gemspec b/grpc.gemspec index a3a5870761a..60fc0a208a7 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -183,7 +183,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/channel/handshaker_registry.h ) s.files += %w( src/core/lib/channel/http_client_filter.h ) s.files += %w( src/core/lib/channel/http_server_filter.h ) - s.files += %w( src/core/lib/channel/message_size_filter.h ) s.files += %w( src/core/lib/compression/algorithm_metadata.h ) s.files += %w( src/core/lib/compression/message_compress.h ) s.files += %w( src/core/lib/debug/trace.h ) @@ -373,6 +372,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/census/trace_string.h ) s.files += %w( src/core/ext/census/tracing.h ) s.files += %w( src/core/ext/filters/max_age/max_age_filter.h ) + s.files += %w( src/core/ext/filters/message_size/message_size_filter.h ) s.files += %w( src/core/lib/surface/init.c ) s.files += %w( src/core/lib/channel/channel_args.c ) s.files += %w( src/core/lib/channel/channel_stack.c ) @@ -385,7 +385,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/channel/handshaker_registry.c ) s.files += %w( src/core/lib/channel/http_client_filter.c ) s.files += %w( src/core/lib/channel/http_server_filter.c ) - s.files += %w( src/core/lib/channel/message_size_filter.c ) s.files += %w( src/core/lib/compression/compression.c ) s.files += %w( src/core/lib/compression/message_compress.c ) s.files += %w( src/core/lib/debug/trace.c ) @@ -605,6 +604,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/census/trace_context.c ) s.files += %w( src/core/ext/census/tracing.c ) s.files += %w( src/core/ext/filters/max_age/max_age_filter.c ) + s.files += %w( src/core/ext/filters/message_size/message_size_filter.c ) s.files += %w( src/core/plugin_registry/grpc_plugin_registry.c ) s.files += %w( third_party/boringssl/crypto/aes/internal.h ) s.files += %w( third_party/boringssl/crypto/asn1/asn1_locl.h ) diff --git a/package.xml b/package.xml index 6957ecca731..f2cf6463e5f 100644 --- a/package.xml +++ b/package.xml @@ -192,7 +192,6 @@ - @@ -382,6 +381,7 @@ + @@ -394,7 +394,6 @@ - @@ -614,6 +613,7 @@ + diff --git a/src/core/ext/filters/max_age/max_age_filter.c b/src/core/ext/filters/max_age/max_age_filter.c index b03cb0ba0a9..3111a91a844 100644 --- a/src/core/ext/filters/max_age/max_age_filter.c +++ b/src/core/ext/filters/max_age/max_age_filter.c @@ -31,7 +31,7 @@ * */ -#include "src/core/lib/channel/message_size_filter.h" +#include "src/core/ext/filters/max_age/max_age_filter.h" #include #include diff --git a/src/core/lib/channel/message_size_filter.c b/src/core/ext/filters/message_size/message_size_filter.c similarity index 77% rename from src/core/lib/channel/message_size_filter.c rename to src/core/ext/filters/message_size/message_size_filter.c index 63136650a57..833639ba6f8 100644 --- a/src/core/lib/channel/message_size_filter.c +++ b/src/core/ext/filters/message_size/message_size_filter.c @@ -29,7 +29,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -#include "src/core/lib/channel/message_size_filter.h" +#include "src/core/ext/filters/message_size/message_size_filter.h" #include #include @@ -40,7 +40,9 @@ #include #include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/channel/channel_stack_builder.h" #include "src/core/lib/support/string.h" +#include "src/core/lib/surface/channel_init.h" #include "src/core/lib/transport/service_config.h" typedef struct message_size_limits { @@ -203,30 +205,55 @@ static void destroy_call_elem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem, const grpc_call_final_info* final_info, grpc_closure* ignored) {} -// Constructor for channel_data. -static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx, - grpc_channel_element* elem, - grpc_channel_element_args* args) { - GPR_ASSERT(!args->is_last); - channel_data* chand = elem->channel_data; - chand->max_send_size = GRPC_DEFAULT_MAX_SEND_MESSAGE_LENGTH; - chand->max_recv_size = GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH; - for (size_t i = 0; i < args->channel_args->num_args; ++i) { - if (strcmp(args->channel_args->args[i].key, - GRPC_ARG_MAX_SEND_MESSAGE_LENGTH) == 0) { +static int default_size(const grpc_channel_args* args, + int without_minimal_stack) { + if (grpc_channel_args_want_minimal_stack(args)) { + return INT_MAX; + } + return without_minimal_stack; +} + +typedef struct { + int max_recv_size; + int max_send_size; +} channel_limits; + +channel_limits get_channel_limits(const grpc_channel_args* channel_args) { + channel_limits lim; + lim.max_send_size = + default_size(channel_args, GRPC_DEFAULT_MAX_SEND_MESSAGE_LENGTH); + lim.max_recv_size = + default_size(channel_args, GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH); + for (size_t i = 0; i < channel_args->num_args; ++i) { + if (strcmp(channel_args->args[i].key, GRPC_ARG_MAX_SEND_MESSAGE_LENGTH) == + 0) { const grpc_integer_options options = { - GRPC_DEFAULT_MAX_SEND_MESSAGE_LENGTH, 0, INT_MAX}; - chand->max_send_size = - grpc_channel_arg_get_integer(&args->channel_args->args[i], options); + default_size(channel_args, GRPC_DEFAULT_MAX_SEND_MESSAGE_LENGTH), 0, + INT_MAX}; + lim.max_send_size = + grpc_channel_arg_get_integer(&channel_args->args[i], options); } - if (strcmp(args->channel_args->args[i].key, + if (strcmp(channel_args->args[i].key, GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH) == 0) { const grpc_integer_options options = { - GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH, 0, INT_MAX}; - chand->max_recv_size = - grpc_channel_arg_get_integer(&args->channel_args->args[i], options); + default_size(channel_args, GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH), 0, + INT_MAX}; + lim.max_recv_size = + grpc_channel_arg_get_integer(&channel_args->args[i], options); } } + return lim; +} + +// Constructor for channel_data. +static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx, + grpc_channel_element* elem, + grpc_channel_element_args* args) { + GPR_ASSERT(!args->is_last); + channel_data* chand = elem->channel_data; + channel_limits lim = get_channel_limits(args->channel_args); + chand->max_send_size = lim.max_send_size; + chand->max_recv_size = lim.max_recv_size; // Get method config table from channel args. const grpc_arg* channel_arg = grpc_channel_args_find(args->channel_args, GRPC_ARG_SERVICE_CONFIG); @@ -265,3 +292,40 @@ const grpc_channel_filter grpc_message_size_filter = { grpc_call_next_get_peer, grpc_channel_next_get_info, "message_size"}; + +static bool maybe_add_message_size_filter(grpc_exec_ctx* exec_ctx, + grpc_channel_stack_builder* builder, + void* arg) { + const grpc_channel_args* channel_args = + grpc_channel_stack_builder_get_channel_arguments(builder); + bool enable = false; + channel_limits lim = get_channel_limits(channel_args); + if (lim.max_send_size != INT_MAX || lim.max_recv_size != INT_MAX) { + enable = true; + } + const grpc_arg* a = + grpc_channel_args_find(channel_args, GRPC_ARG_SERVICE_CONFIG); + if (a != NULL) { + enable = true; + } + if (enable) { + return grpc_channel_stack_builder_prepend_filter( + builder, &grpc_message_size_filter, NULL, NULL); + } else { + return true; + } +} + +void grpc_message_size_filter_init(void) { + grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, + GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, + maybe_add_message_size_filter, NULL); + grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL, + GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, + maybe_add_message_size_filter, NULL); + grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, + GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, + maybe_add_message_size_filter, NULL); +} + +void grpc_message_size_filter_shutdown(void) {} diff --git a/src/core/lib/channel/message_size_filter.h b/src/core/ext/filters/message_size/message_size_filter.h similarity index 100% rename from src/core/lib/channel/message_size_filter.h rename to src/core/ext/filters/message_size/message_size_filter.h diff --git a/src/core/lib/surface/init.c b/src/core/lib/surface/init.c index 91bd014a0e5..f9b1675465c 100644 --- a/src/core/lib/surface/init.c +++ b/src/core/lib/surface/init.c @@ -47,7 +47,6 @@ #include "src/core/lib/channel/handshaker_registry.h" #include "src/core/lib/channel/http_client_filter.h" #include "src/core/lib/channel/http_server_filter.h" -#include "src/core/lib/channel/message_size_filter.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/http/parser.h" #include "src/core/lib/iomgr/combiner.h" @@ -113,15 +112,6 @@ static void register_builtin_channel_init() { grpc_channel_init_register_stage( GRPC_SERVER_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, prepend_filter, (void *)&grpc_server_deadline_filter); - grpc_channel_init_register_stage( - GRPC_CLIENT_SUBCHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, - prepend_filter, (void *)&grpc_message_size_filter); - grpc_channel_init_register_stage( - GRPC_CLIENT_DIRECT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, - prepend_filter, (void *)&grpc_message_size_filter); - grpc_channel_init_register_stage( - GRPC_SERVER_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, prepend_filter, - (void *)&grpc_message_size_filter); grpc_channel_init_register_stage( GRPC_CLIENT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, prepend_filter, (void *)&grpc_compress_filter); diff --git a/src/core/plugin_registry/grpc_plugin_registry.c b/src/core/plugin_registry/grpc_plugin_registry.c index 803a26b7534..3588954631f 100644 --- a/src/core/plugin_registry/grpc_plugin_registry.c +++ b/src/core/plugin_registry/grpc_plugin_registry.c @@ -55,6 +55,8 @@ extern void census_grpc_plugin_init(void); extern void census_grpc_plugin_shutdown(void); extern void grpc_max_age_filter_init(void); extern void grpc_max_age_filter_shutdown(void); +extern void grpc_message_size_filter_init(void); +extern void grpc_message_size_filter_shutdown(void); void grpc_register_built_in_plugins(void) { grpc_register_plugin(grpc_chttp2_plugin_init, @@ -79,4 +81,6 @@ void grpc_register_built_in_plugins(void) { census_grpc_plugin_shutdown); grpc_register_plugin(grpc_max_age_filter_init, grpc_max_age_filter_shutdown); + grpc_register_plugin(grpc_message_size_filter_init, + grpc_message_size_filter_shutdown); } diff --git a/src/core/plugin_registry/grpc_unsecure_plugin_registry.c b/src/core/plugin_registry/grpc_unsecure_plugin_registry.c index e65fc2425d9..2f0a0d8c96e 100644 --- a/src/core/plugin_registry/grpc_unsecure_plugin_registry.c +++ b/src/core/plugin_registry/grpc_unsecure_plugin_registry.c @@ -55,6 +55,8 @@ extern void census_grpc_plugin_init(void); extern void census_grpc_plugin_shutdown(void); extern void grpc_max_age_filter_init(void); extern void grpc_max_age_filter_shutdown(void); +extern void grpc_message_size_filter_init(void); +extern void grpc_message_size_filter_shutdown(void); void grpc_register_built_in_plugins(void) { grpc_register_plugin(grpc_chttp2_plugin_init, @@ -79,4 +81,6 @@ void grpc_register_built_in_plugins(void) { census_grpc_plugin_shutdown); grpc_register_plugin(grpc_max_age_filter_init, grpc_max_age_filter_shutdown); + grpc_register_plugin(grpc_message_size_filter_init, + grpc_message_size_filter_shutdown); } diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 3bcbe667e2c..41c309dd3db 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -88,7 +88,6 @@ CORE_SOURCE_FILES = [ 'src/core/lib/channel/handshaker_registry.c', 'src/core/lib/channel/http_client_filter.c', 'src/core/lib/channel/http_server_filter.c', - 'src/core/lib/channel/message_size_filter.c', 'src/core/lib/compression/compression.c', 'src/core/lib/compression/message_compress.c', 'src/core/lib/debug/trace.c', @@ -308,6 +307,7 @@ CORE_SOURCE_FILES = [ 'src/core/ext/census/trace_context.c', 'src/core/ext/census/tracing.c', 'src/core/ext/filters/max_age/max_age_filter.c', + 'src/core/ext/filters/message_size/message_size_filter.c', 'src/core/plugin_registry/grpc_plugin_registry.c', 'src/boringssl/err_data.c', 'third_party/boringssl/crypto/aes/aes.c', diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index 0c2b170dc20..be18f12d158 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -53,7 +53,7 @@ extern "C" { #include "src/core/lib/channel/deadline_filter.h" #include "src/core/lib/channel/http_client_filter.h" #include "src/core/lib/channel/http_server_filter.h" -#include "src/core/lib/channel/message_size_filter.h" +#include "src/core/ext/filters/message_size/message_size_filter.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/transport/transport_impl.h" } diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 209d5445dbc..0334434f24d 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -923,8 +923,6 @@ src/core/lib/channel/http_client_filter.c \ src/core/lib/channel/http_client_filter.h \ src/core/lib/channel/http_server_filter.c \ src/core/lib/channel/http_server_filter.h \ -src/core/lib/channel/message_size_filter.c \ -src/core/lib/channel/message_size_filter.h \ src/core/lib/compression/algorithm_metadata.h \ src/core/lib/compression/compression.c \ src/core/lib/compression/message_compress.c \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 6903a0e5d5a..284cab8e54e 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -960,6 +960,8 @@ src/core/ext/filters/load_reporting/load_reporting_filter.c \ src/core/ext/filters/load_reporting/load_reporting_filter.h \ src/core/ext/filters/max_age/max_age_filter.c \ src/core/ext/filters/max_age/max_age_filter.h \ +src/core/ext/filters/message_size/message_size_filter.c \ +src/core/ext/filters/message_size/message_size_filter.h \ src/core/ext/transport/README.md \ src/core/ext/transport/chttp2/README.md \ src/core/ext/transport/chttp2/alpn/alpn.c \ @@ -1042,8 +1044,6 @@ src/core/lib/channel/http_client_filter.c \ src/core/lib/channel/http_client_filter.h \ src/core/lib/channel/http_server_filter.c \ src/core/lib/channel/http_server_filter.h \ -src/core/lib/channel/message_size_filter.c \ -src/core/lib/channel/message_size_filter.h \ src/core/lib/compression/algorithm_metadata.h \ src/core/lib/compression/compression.c \ src/core/lib/compression/message_compress.c \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 254df5568d7..e8168ce10b8 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -5594,6 +5594,7 @@ "grpc_lb_policy_round_robin", "grpc_load_reporting", "grpc_max_age_filter", + "grpc_message_size_filter", "grpc_resolver_dns_ares", "grpc_resolver_dns_native", "grpc_resolver_sockaddr", @@ -5697,6 +5698,7 @@ "grpc_lb_policy_round_robin", "grpc_load_reporting", "grpc_max_age_filter", + "grpc_message_size_filter", "grpc_resolver_dns_ares", "grpc_resolver_dns_native", "grpc_resolver_sockaddr", @@ -7533,7 +7535,6 @@ "src/core/lib/channel/handshaker_registry.h", "src/core/lib/channel/http_client_filter.h", "src/core/lib/channel/http_server_filter.h", - "src/core/lib/channel/message_size_filter.h", "src/core/lib/compression/algorithm_metadata.h", "src/core/lib/compression/message_compress.h", "src/core/lib/debug/trace.h", @@ -7669,8 +7670,6 @@ "src/core/lib/channel/http_client_filter.h", "src/core/lib/channel/http_server_filter.c", "src/core/lib/channel/http_server_filter.h", - "src/core/lib/channel/message_size_filter.c", - "src/core/lib/channel/message_size_filter.h", "src/core/lib/compression/algorithm_metadata.h", "src/core/lib/compression/compression.c", "src/core/lib/compression/message_compress.c", @@ -8115,6 +8114,24 @@ "third_party": false, "type": "filegroup" }, + { + "deps": [ + "gpr", + "grpc_base" + ], + "headers": [ + "src/core/ext/filters/message_size/message_size_filter.h" + ], + "is_filegroup": true, + "language": "c", + "name": "grpc_message_size_filter", + "src": [ + "src/core/ext/filters/message_size/message_size_filter.c", + "src/core/ext/filters/message_size/message_size_filter.h" + ], + "third_party": false, + "type": "filegroup" + }, { "deps": [ "gpr", diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj b/vsprojects/vcxproj/grpc++/grpc++.vcxproj index caa22a019db..8ec84928bf3 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj @@ -389,7 +389,6 @@ - @@ -597,8 +596,6 @@ - - diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters index 6fc1c969309..a32fdbb8f60 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters @@ -157,9 +157,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\compression @@ -899,9 +896,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\compression diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj index 674818182e8..0f8fe4a6230 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -383,7 +383,6 @@ - @@ -581,8 +580,6 @@ - - diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index 2b9a5b13c1a..d29b3ba6fe5 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -142,9 +142,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\compression @@ -866,9 +863,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\compression diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index 948af2f29ee..2a4d0b13a34 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -312,7 +312,6 @@ - @@ -502,6 +501,7 @@ + @@ -528,8 +528,6 @@ - - @@ -968,6 +966,8 @@ + + diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index d43b0e3f83e..800cea6d1da 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -37,9 +37,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\compression @@ -697,6 +694,9 @@ src\core\ext\filters\max_age + + src\core\ext\filters\message_size + src\core\plugin_registry @@ -833,9 +833,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\compression @@ -1403,6 +1400,9 @@ src\core\ext\filters\max_age + + src\core\ext\filters\message_size + @@ -1484,6 +1484,9 @@ {5369e83c-4625-fc14-cc40-9db5da3a7af4} + + {5ca3f38c-539f-3c4f-b68c-38b31ba339ba} + {e3abfd0a-064e-0f2f-c8e8-7c5a7e98142a} diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj index c675cda122f..0e9c2923841 100644 --- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj +++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj @@ -207,7 +207,6 @@ - @@ -369,8 +368,6 @@ - - diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters index c6bd2d6c9f1..94168a26288 100644 --- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters @@ -94,9 +94,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\compression @@ -611,9 +608,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\compression diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index 8799359bb76..11ee7b9563c 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -302,7 +302,6 @@ - @@ -468,6 +467,7 @@ + @@ -496,8 +496,6 @@ - - @@ -878,6 +876,8 @@ + + diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index cf2def4ff65..a4a46549ae9 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -40,9 +40,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\compression @@ -613,6 +610,9 @@ src\core\ext\filters\max_age + + src\core\ext\filters\message_size + src\core\plugin_registry @@ -746,9 +746,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\compression @@ -1244,6 +1241,9 @@ src\core\ext\filters\max_age + + src\core\ext\filters\message_size + @@ -1325,6 +1325,9 @@ {d3bc80c1-5f2d-e842-42ac-43d8a6ada8de} + + {8cbe7444-caac-49dc-be89-d4c4d1c7966a} + {967c89fe-c97c-27e2-aac0-9ba5854cb5fa} diff --git a/vsprojects/vcxproj/test/minimal_stack_is_minimal_test/minimal_stack_is_minimal_test.vcxproj b/vsprojects/vcxproj/test/minimal_stack_is_minimal_test/minimal_stack_is_minimal_test.vcxproj new file mode 100644 index 00000000000..0473fa95457 --- /dev/null +++ b/vsprojects/vcxproj/test/minimal_stack_is_minimal_test/minimal_stack_is_minimal_test.vcxproj @@ -0,0 +1,199 @@ + + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {68A54124-DFA3-4FF3-081F-70356222C977} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + minimal_stack_is_minimal_test + static + Debug + static + Debug + + + minimal_stack_is_minimal_test + static + Release + static + Release + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Console + true + false + true + true + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Console + true + false + true + true + + + + + + + + + + {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} + + + {29D16885-7228-4C31-81ED-5F9187C7F2A9} + + + {EAB0A629-17A9-44DB-B5FF-E91A721FE037} + + + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + diff --git a/vsprojects/vcxproj/test/minimal_stack_is_minimal_test/minimal_stack_is_minimal_test.vcxproj.filters b/vsprojects/vcxproj/test/minimal_stack_is_minimal_test/minimal_stack_is_minimal_test.vcxproj.filters new file mode 100644 index 00000000000..7eb2ba551f5 --- /dev/null +++ b/vsprojects/vcxproj/test/minimal_stack_is_minimal_test/minimal_stack_is_minimal_test.vcxproj.filters @@ -0,0 +1,21 @@ + + + + + test\core\channel + + + + + + {52e0de0c-9f7d-1497-1339-b0ed30ed41f8} + + + {2cd01454-1131-89cc-68a2-10365fa32bb0} + + + {f473b99d-5602-d2df-2d85-99648d00ba4f} + + + + From b0f15ff23b3f6db30345967837781773bb50c7c0 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 3 Apr 2017 13:01:22 -0700 Subject: [PATCH 144/461] fix merge --- src/core/lib/surface/init.c | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/src/core/lib/surface/init.c b/src/core/lib/surface/init.c index 15396b16632..f9b1675465c 100644 --- a/src/core/lib/surface/init.c +++ b/src/core/lib/surface/init.c @@ -105,22 +105,6 @@ static bool maybe_add_http_filter(grpc_exec_ctx *exec_ctx, return true; } -typedef struct { - const grpc_channel_filter *filter; - const char *controlling_channel_arg; - bool default_on; -} maybe_prepend_filter_args; - -static const maybe_prepend_filter_args message_size_args = { - &grpc_message_size_filter, NULL, true}; - -static bool maybe_prepend_filter(grpc_exec_ctx *exec_ctx, - grpc_channel_stack_builder *builder, - void *arg) { - return grpc_channel_stack_builder_prepend_filter( - builder, (const grpc_channel_filter *)arg, NULL, NULL); -} - static void register_builtin_channel_init() { grpc_channel_init_register_stage( GRPC_CLIENT_DIRECT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, @@ -129,18 +113,6 @@ static void register_builtin_channel_init() { GRPC_SERVER_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, prepend_filter, (void *)&grpc_server_deadline_filter); grpc_channel_init_register_stage( -<<<<<<< HEAD -======= - GRPC_CLIENT_SUBCHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, - maybe_prepend_filter, (void *)&message_size_args); - grpc_channel_init_register_stage( - GRPC_CLIENT_DIRECT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, - prepend_filter, (void *)&grpc_message_size_filter); - grpc_channel_init_register_stage( - GRPC_SERVER_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, prepend_filter, - (void *)&grpc_message_size_filter); - grpc_channel_init_register_stage( ->>>>>>> 6b97e5344f4dddcdad1e0525b733162c0025b770 GRPC_CLIENT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, prepend_filter, (void *)&grpc_compress_filter); grpc_channel_init_register_stage( From af76743e33891f269ff2404ba8a631a97f6b50c0 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 3 Apr 2017 13:54:31 -0700 Subject: [PATCH 145/461] Optionalize compress, gather all the http2 filter bits together in ext/ --- BUILD | 27 +++- CMakeLists.txt | 37 +++--- Makefile | 37 +++--- binding.gyp | 7 +- build.yaml | 19 ++- config.m4 | 11 +- gRPC-Core.podspec | 19 +-- grpc.gemspec | 13 +- include/grpc/impl/codegen/grpc_types.h | 3 + package.xml | 13 +- .../filters/http/client}/http_client_filter.c | 2 +- .../filters/http/client}/http_client_filter.h | 0 .../filters/http/compress}/compress_filter.c | 2 +- .../filters/http/compress}/compress_filter.h | 0 .../ext/filters/http/http_filters_plugin.c | 106 ++++++++++++++++ .../filters/http/server}/http_server_filter.c | 2 +- .../filters/http/server}/http_server_filter.h | 0 .../transport/chttp2/server/chttp2_server.c | 2 +- .../lib/security/credentials/credentials.c | 2 +- .../credentials/ssl/ssl_credentials.c | 2 +- src/core/lib/surface/init.c | 33 ----- .../grpc_cronet_plugin_registry.c | 4 + .../plugin_registry/grpc_plugin_registry.c | 4 + .../grpc_unsecure_plugin_registry.c | 4 + src/python/grpcio/grpc_core_dependencies.py | 7 +- test/core/bad_client/bad_client.c | 2 +- .../channel/minimal_stack_is_minimal_test.c | 116 ++++++++++-------- test/core/end2end/fixtures/h2_census.c | 2 +- test/core/end2end/fixtures/h2_compress.c | 2 +- test/core/end2end/fixtures/h2_full+pipe.c | 2 +- test/core/end2end/fixtures/h2_full+trace.c | 2 +- test/core/end2end/fixtures/h2_full.c | 2 +- test/core/end2end/fixtures/h2_http_proxy.c | 2 +- .../core/end2end/fixtures/h2_load_reporting.c | 2 +- test/core/end2end/fixtures/h2_proxy.c | 2 +- .../core/end2end/fixtures/h2_sockpair+trace.c | 6 +- test/core/end2end/fixtures/h2_sockpair.c | 6 +- .../core/end2end/fixtures/h2_sockpair_1byte.c | 6 +- test/core/end2end/fixtures/h2_uds.c | 2 +- test/cpp/microbenchmarks/bm_call_create.cc | 6 +- tools/doxygen/Doxyfile.c++.internal | 6 - tools/doxygen/Doxyfile.core.internal | 13 +- .../generated/sources_and_headers.json | 33 +++-- vsprojects/vcxproj/grpc++/grpc++.vcxproj | 9 -- .../vcxproj/grpc++/grpc++.vcxproj.filters | 18 --- .../grpc++_unsecure/grpc++_unsecure.vcxproj | 9 -- .../grpc++_unsecure.vcxproj.filters | 18 --- vsprojects/vcxproj/grpc/grpc.vcxproj | 20 +-- vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 51 +++++--- .../grpc_test_util/grpc_test_util.vcxproj | 9 -- .../grpc_test_util.vcxproj.filters | 18 --- .../grpc_unsecure/grpc_unsecure.vcxproj | 20 +-- .../grpc_unsecure.vcxproj.filters | 51 +++++--- 53 files changed, 436 insertions(+), 355 deletions(-) rename src/core/{lib/channel => ext/filters/http/client}/http_client_filter.c (99%) rename src/core/{lib/channel => ext/filters/http/client}/http_client_filter.h (100%) rename src/core/{lib/channel => ext/filters/http/compress}/compress_filter.c (99%) rename src/core/{lib/channel => ext/filters/http/compress}/compress_filter.h (100%) create mode 100644 src/core/ext/filters/http/http_filters_plugin.c rename src/core/{lib/channel => ext/filters/http/server}/http_server_filter.c (99%) rename src/core/{lib/channel => ext/filters/http/server}/http_server_filter.h (100%) diff --git a/BUILD b/BUILD index 98c194c7781..59b97028736 100644 --- a/BUILD +++ b/BUILD @@ -91,6 +91,7 @@ grpc_cc_library( "grpc_base", "grpc_transport_chttp2_client_secure", "grpc_transport_cronet_client_secure", + "grpc_http_filters", ], ) @@ -432,14 +433,11 @@ grpc_cc_library( "src/core/lib/channel/channel_args.c", "src/core/lib/channel/channel_stack.c", "src/core/lib/channel/channel_stack_builder.c", - "src/core/lib/channel/compress_filter.c", "src/core/lib/channel/connected_channel.c", "src/core/lib/channel/deadline_filter.c", "src/core/lib/channel/handshaker.c", "src/core/lib/channel/handshaker_factory.c", "src/core/lib/channel/handshaker_registry.c", - "src/core/lib/channel/http_client_filter.c", - "src/core/lib/channel/http_server_filter.c", "src/core/lib/compression/compression.c", "src/core/lib/compression/message_compress.c", "src/core/lib/debug/trace.c", @@ -557,15 +555,12 @@ grpc_cc_library( "src/core/lib/channel/channel_args.h", "src/core/lib/channel/channel_stack.h", "src/core/lib/channel/channel_stack_builder.h", - "src/core/lib/channel/compress_filter.h", "src/core/lib/channel/connected_channel.h", "src/core/lib/channel/context.h", "src/core/lib/channel/deadline_filter.h", "src/core/lib/channel/handshaker.h", "src/core/lib/channel/handshaker_factory.h", "src/core/lib/channel/handshaker_registry.h", - "src/core/lib/channel/http_client_filter.h", - "src/core/lib/channel/http_server_filter.h", "src/core/lib/compression/algorithm_metadata.h", "src/core/lib/compression/message_compress.h", "src/core/lib/debug/trace.h", @@ -764,6 +759,25 @@ grpc_cc_library( ], ) +grpc_cc_library( + name = "grpc_http_filters", + hdrs = [ + "src/core/ext/filters/http/compress/compress_filter.h", + "src/core/ext/filters/http/client/http_client_filter.h", + "src/core/ext/filters/http/server/http_server_filter.h", + ], + srcs = [ + "src/core/ext/filters/http/compress/compress_filter.c", + "src/core/ext/filters/http/client/http_client_filter.c", + "src/core/ext/filters/http/server/http_server_filter.c", + "src/core/ext/filters/http/http_filters_plugin.c" + ], + language = "c", + deps = [ + "grpc_base", + ], +) + grpc_cc_library( name = "grpc_codegen", language = "c", @@ -1024,6 +1038,7 @@ grpc_cc_library( deps = [ "grpc_base", "grpc_transport_chttp2_alpn", + "grpc_http_filters", ], ) diff --git a/CMakeLists.txt b/CMakeLists.txt index 441be29c0b0..7e51b530365 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -911,14 +911,11 @@ add_library(grpc src/core/lib/channel/channel_args.c src/core/lib/channel/channel_stack.c src/core/lib/channel/channel_stack_builder.c - src/core/lib/channel/compress_filter.c src/core/lib/channel/connected_channel.c src/core/lib/channel/deadline_filter.c src/core/lib/channel/handshaker.c src/core/lib/channel/handshaker_factory.c src/core/lib/channel/handshaker_registry.c - src/core/lib/channel/http_client_filter.c - src/core/lib/channel/http_server_filter.c src/core/lib/compression/compression.c src/core/lib/compression/message_compress.c src/core/lib/debug/trace.c @@ -1053,6 +1050,10 @@ add_library(grpc src/core/ext/transport/chttp2/transport/varint.c src/core/ext/transport/chttp2/transport/writing.c src/core/ext/transport/chttp2/alpn/alpn.c + src/core/ext/filters/http/client/http_client_filter.c + src/core/ext/filters/http/compress/compress_filter.c + src/core/ext/filters/http/http_filters_plugin.c + src/core/ext/filters/http/server/http_server_filter.c src/core/lib/http/httpcli_security_connector.c src/core/lib/security/context/security_context.c src/core/lib/security/credentials/composite/composite_credentials.c @@ -1233,14 +1234,11 @@ add_library(grpc_cronet src/core/lib/channel/channel_args.c src/core/lib/channel/channel_stack.c src/core/lib/channel/channel_stack_builder.c - src/core/lib/channel/compress_filter.c src/core/lib/channel/connected_channel.c src/core/lib/channel/deadline_filter.c src/core/lib/channel/handshaker.c src/core/lib/channel/handshaker_factory.c src/core/lib/channel/handshaker_registry.c - src/core/lib/channel/http_client_filter.c - src/core/lib/channel/http_server_filter.c src/core/lib/compression/compression.c src/core/lib/compression/message_compress.c src/core/lib/debug/trace.c @@ -1378,6 +1376,10 @@ add_library(grpc_cronet src/core/ext/transport/chttp2/transport/varint.c src/core/ext/transport/chttp2/transport/writing.c src/core/ext/transport/chttp2/alpn/alpn.c + src/core/ext/filters/http/client/http_client_filter.c + src/core/ext/filters/http/compress/compress_filter.c + src/core/ext/filters/http/http_filters_plugin.c + src/core/ext/filters/http/server/http_server_filter.c src/core/ext/filters/client_channel/channel_connectivity.c src/core/ext/filters/client_channel/client_channel.c src/core/ext/filters/client_channel/client_channel_factory.c @@ -1540,14 +1542,11 @@ add_library(grpc_test_util src/core/lib/channel/channel_args.c src/core/lib/channel/channel_stack.c src/core/lib/channel/channel_stack_builder.c - src/core/lib/channel/compress_filter.c src/core/lib/channel/connected_channel.c src/core/lib/channel/deadline_filter.c src/core/lib/channel/handshaker.c src/core/lib/channel/handshaker_factory.c src/core/lib/channel/handshaker_registry.c - src/core/lib/channel/http_client_filter.c - src/core/lib/channel/http_server_filter.c src/core/lib/compression/compression.c src/core/lib/compression/message_compress.c src/core/lib/debug/trace.c @@ -1799,14 +1798,11 @@ add_library(grpc_unsecure src/core/lib/channel/channel_args.c src/core/lib/channel/channel_stack.c src/core/lib/channel/channel_stack_builder.c - src/core/lib/channel/compress_filter.c src/core/lib/channel/connected_channel.c src/core/lib/channel/deadline_filter.c src/core/lib/channel/handshaker.c src/core/lib/channel/handshaker_factory.c src/core/lib/channel/handshaker_registry.c - src/core/lib/channel/http_client_filter.c - src/core/lib/channel/http_server_filter.c src/core/lib/compression/compression.c src/core/lib/compression/message_compress.c src/core/lib/debug/trace.c @@ -1942,6 +1938,10 @@ add_library(grpc_unsecure src/core/ext/transport/chttp2/transport/varint.c src/core/ext/transport/chttp2/transport/writing.c src/core/ext/transport/chttp2/alpn/alpn.c + src/core/ext/filters/http/client/http_client_filter.c + src/core/ext/filters/http/compress/compress_filter.c + src/core/ext/filters/http/http_filters_plugin.c + src/core/ext/filters/http/server/http_server_filter.c src/core/ext/transport/chttp2/server/chttp2_server.c src/core/ext/transport/chttp2/client/insecure/channel_create.c src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c @@ -2215,14 +2215,11 @@ add_library(grpc++ src/core/lib/channel/channel_args.c src/core/lib/channel/channel_stack.c src/core/lib/channel/channel_stack_builder.c - src/core/lib/channel/compress_filter.c src/core/lib/channel/connected_channel.c src/core/lib/channel/deadline_filter.c src/core/lib/channel/handshaker.c src/core/lib/channel/handshaker_factory.c src/core/lib/channel/handshaker_registry.c - src/core/lib/channel/http_client_filter.c - src/core/lib/channel/http_server_filter.c src/core/lib/compression/compression.c src/core/lib/compression/message_compress.c src/core/lib/debug/trace.c @@ -2544,14 +2541,11 @@ add_library(grpc++_cronet src/core/lib/channel/channel_args.c src/core/lib/channel/channel_stack.c src/core/lib/channel/channel_stack_builder.c - src/core/lib/channel/compress_filter.c src/core/lib/channel/connected_channel.c src/core/lib/channel/deadline_filter.c src/core/lib/channel/handshaker.c src/core/lib/channel/handshaker_factory.c src/core/lib/channel/handshaker_registry.c - src/core/lib/channel/http_client_filter.c - src/core/lib/channel/http_server_filter.c src/core/lib/compression/compression.c src/core/lib/compression/message_compress.c src/core/lib/debug/trace.c @@ -2692,6 +2686,10 @@ add_library(grpc++_cronet src/core/ext/transport/chttp2/transport/varint.c src/core/ext/transport/chttp2/transport/writing.c src/core/ext/transport/chttp2/alpn/alpn.c + src/core/ext/filters/http/client/http_client_filter.c + src/core/ext/filters/http/compress/compress_filter.c + src/core/ext/filters/http/http_filters_plugin.c + src/core/ext/filters/http/server/http_server_filter.c src/core/ext/filters/client_channel/channel_connectivity.c src/core/ext/filters/client_channel/client_channel.c src/core/ext/filters/client_channel/client_channel_factory.c @@ -3241,14 +3239,11 @@ add_library(grpc++_unsecure src/core/lib/channel/channel_args.c src/core/lib/channel/channel_stack.c src/core/lib/channel/channel_stack_builder.c - src/core/lib/channel/compress_filter.c src/core/lib/channel/connected_channel.c src/core/lib/channel/deadline_filter.c src/core/lib/channel/handshaker.c src/core/lib/channel/handshaker_factory.c src/core/lib/channel/handshaker_registry.c - src/core/lib/channel/http_client_filter.c - src/core/lib/channel/http_server_filter.c src/core/lib/compression/compression.c src/core/lib/compression/message_compress.c src/core/lib/debug/trace.c diff --git a/Makefile b/Makefile index c0d0a63a836..4e5e21d5665 100644 --- a/Makefile +++ b/Makefile @@ -2816,14 +2816,11 @@ LIBGRPC_SRC = \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ - src/core/lib/channel/compress_filter.c \ src/core/lib/channel/connected_channel.c \ src/core/lib/channel/deadline_filter.c \ src/core/lib/channel/handshaker.c \ src/core/lib/channel/handshaker_factory.c \ src/core/lib/channel/handshaker_registry.c \ - src/core/lib/channel/http_client_filter.c \ - src/core/lib/channel/http_server_filter.c \ src/core/lib/compression/compression.c \ src/core/lib/compression/message_compress.c \ src/core/lib/debug/trace.c \ @@ -2958,6 +2955,10 @@ LIBGRPC_SRC = \ src/core/ext/transport/chttp2/transport/varint.c \ src/core/ext/transport/chttp2/transport/writing.c \ src/core/ext/transport/chttp2/alpn/alpn.c \ + src/core/ext/filters/http/client/http_client_filter.c \ + src/core/ext/filters/http/compress/compress_filter.c \ + src/core/ext/filters/http/http_filters_plugin.c \ + src/core/ext/filters/http/server/http_server_filter.c \ src/core/lib/http/httpcli_security_connector.c \ src/core/lib/security/context/security_context.c \ src/core/lib/security/credentials/composite/composite_credentials.c \ @@ -3136,14 +3137,11 @@ LIBGRPC_CRONET_SRC = \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ - src/core/lib/channel/compress_filter.c \ src/core/lib/channel/connected_channel.c \ src/core/lib/channel/deadline_filter.c \ src/core/lib/channel/handshaker.c \ src/core/lib/channel/handshaker_factory.c \ src/core/lib/channel/handshaker_registry.c \ - src/core/lib/channel/http_client_filter.c \ - src/core/lib/channel/http_server_filter.c \ src/core/lib/compression/compression.c \ src/core/lib/compression/message_compress.c \ src/core/lib/debug/trace.c \ @@ -3281,6 +3279,10 @@ LIBGRPC_CRONET_SRC = \ src/core/ext/transport/chttp2/transport/varint.c \ src/core/ext/transport/chttp2/transport/writing.c \ src/core/ext/transport/chttp2/alpn/alpn.c \ + src/core/ext/filters/http/client/http_client_filter.c \ + src/core/ext/filters/http/compress/compress_filter.c \ + src/core/ext/filters/http/http_filters_plugin.c \ + src/core/ext/filters/http/server/http_server_filter.c \ src/core/ext/filters/client_channel/channel_connectivity.c \ src/core/ext/filters/client_channel/client_channel.c \ src/core/ext/filters/client_channel/client_channel_factory.c \ @@ -3442,14 +3444,11 @@ LIBGRPC_TEST_UTIL_SRC = \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ - src/core/lib/channel/compress_filter.c \ src/core/lib/channel/connected_channel.c \ src/core/lib/channel/deadline_filter.c \ src/core/lib/channel/handshaker.c \ src/core/lib/channel/handshaker_factory.c \ src/core/lib/channel/handshaker_registry.c \ - src/core/lib/channel/http_client_filter.c \ - src/core/lib/channel/http_server_filter.c \ src/core/lib/compression/compression.c \ src/core/lib/compression/message_compress.c \ src/core/lib/debug/trace.c \ @@ -3673,14 +3672,11 @@ LIBGRPC_UNSECURE_SRC = \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ - src/core/lib/channel/compress_filter.c \ src/core/lib/channel/connected_channel.c \ src/core/lib/channel/deadline_filter.c \ src/core/lib/channel/handshaker.c \ src/core/lib/channel/handshaker_factory.c \ src/core/lib/channel/handshaker_registry.c \ - src/core/lib/channel/http_client_filter.c \ - src/core/lib/channel/http_server_filter.c \ src/core/lib/compression/compression.c \ src/core/lib/compression/message_compress.c \ src/core/lib/debug/trace.c \ @@ -3816,6 +3812,10 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/transport/chttp2/transport/varint.c \ src/core/ext/transport/chttp2/transport/writing.c \ src/core/ext/transport/chttp2/alpn/alpn.c \ + src/core/ext/filters/http/client/http_client_filter.c \ + src/core/ext/filters/http/compress/compress_filter.c \ + src/core/ext/filters/http/http_filters_plugin.c \ + src/core/ext/filters/http/server/http_server_filter.c \ src/core/ext/transport/chttp2/server/chttp2_server.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.c \ src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c \ @@ -4066,14 +4066,11 @@ LIBGRPC++_SRC = \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ - src/core/lib/channel/compress_filter.c \ src/core/lib/channel/connected_channel.c \ src/core/lib/channel/deadline_filter.c \ src/core/lib/channel/handshaker.c \ src/core/lib/channel/handshaker_factory.c \ src/core/lib/channel/handshaker_registry.c \ - src/core/lib/channel/http_client_filter.c \ - src/core/lib/channel/http_server_filter.c \ src/core/lib/compression/compression.c \ src/core/lib/compression/message_compress.c \ src/core/lib/debug/trace.c \ @@ -4403,14 +4400,11 @@ LIBGRPC++_CRONET_SRC = \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ - src/core/lib/channel/compress_filter.c \ src/core/lib/channel/connected_channel.c \ src/core/lib/channel/deadline_filter.c \ src/core/lib/channel/handshaker.c \ src/core/lib/channel/handshaker_factory.c \ src/core/lib/channel/handshaker_registry.c \ - src/core/lib/channel/http_client_filter.c \ - src/core/lib/channel/http_server_filter.c \ src/core/lib/compression/compression.c \ src/core/lib/compression/message_compress.c \ src/core/lib/debug/trace.c \ @@ -4551,6 +4545,10 @@ LIBGRPC++_CRONET_SRC = \ src/core/ext/transport/chttp2/transport/varint.c \ src/core/ext/transport/chttp2/transport/writing.c \ src/core/ext/transport/chttp2/alpn/alpn.c \ + src/core/ext/filters/http/client/http_client_filter.c \ + src/core/ext/filters/http/compress/compress_filter.c \ + src/core/ext/filters/http/http_filters_plugin.c \ + src/core/ext/filters/http/server/http_server_filter.c \ src/core/ext/filters/client_channel/channel_connectivity.c \ src/core/ext/filters/client_channel/client_channel.c \ src/core/ext/filters/client_channel/client_channel_factory.c \ @@ -5092,14 +5090,11 @@ LIBGRPC++_UNSECURE_SRC = \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ - src/core/lib/channel/compress_filter.c \ src/core/lib/channel/connected_channel.c \ src/core/lib/channel/deadline_filter.c \ src/core/lib/channel/handshaker.c \ src/core/lib/channel/handshaker_factory.c \ src/core/lib/channel/handshaker_registry.c \ - src/core/lib/channel/http_client_filter.c \ - src/core/lib/channel/http_server_filter.c \ src/core/lib/compression/compression.c \ src/core/lib/compression/message_compress.c \ src/core/lib/debug/trace.c \ diff --git a/binding.gyp b/binding.gyp index 01bd1ee43f3..ccfbeedc639 100644 --- a/binding.gyp +++ b/binding.gyp @@ -618,14 +618,11 @@ 'src/core/lib/channel/channel_args.c', 'src/core/lib/channel/channel_stack.c', 'src/core/lib/channel/channel_stack_builder.c', - 'src/core/lib/channel/compress_filter.c', 'src/core/lib/channel/connected_channel.c', 'src/core/lib/channel/deadline_filter.c', 'src/core/lib/channel/handshaker.c', 'src/core/lib/channel/handshaker_factory.c', 'src/core/lib/channel/handshaker_registry.c', - 'src/core/lib/channel/http_client_filter.c', - 'src/core/lib/channel/http_server_filter.c', 'src/core/lib/compression/compression.c', 'src/core/lib/compression/message_compress.c', 'src/core/lib/debug/trace.c', @@ -760,6 +757,10 @@ 'src/core/ext/transport/chttp2/transport/varint.c', 'src/core/ext/transport/chttp2/transport/writing.c', 'src/core/ext/transport/chttp2/alpn/alpn.c', + 'src/core/ext/filters/http/client/http_client_filter.c', + 'src/core/ext/filters/http/compress/compress_filter.c', + 'src/core/ext/filters/http/http_filters_plugin.c', + 'src/core/ext/filters/http/server/http_server_filter.c', 'src/core/lib/http/httpcli_security_connector.c', 'src/core/lib/security/context/security_context.c', 'src/core/lib/security/credentials/composite/composite_credentials.c', diff --git a/build.yaml b/build.yaml index 6c87210e65f..6a8abdc8b25 100644 --- a/build.yaml +++ b/build.yaml @@ -176,15 +176,12 @@ filegroups: - src/core/lib/channel/channel_args.h - src/core/lib/channel/channel_stack.h - src/core/lib/channel/channel_stack_builder.h - - src/core/lib/channel/compress_filter.h - src/core/lib/channel/connected_channel.h - src/core/lib/channel/context.h - src/core/lib/channel/deadline_filter.h - src/core/lib/channel/handshaker.h - src/core/lib/channel/handshaker_factory.h - src/core/lib/channel/handshaker_registry.h - - src/core/lib/channel/http_client_filter.h - - src/core/lib/channel/http_server_filter.h - src/core/lib/compression/algorithm_metadata.h - src/core/lib/compression/message_compress.h - src/core/lib/debug/trace.h @@ -286,14 +283,11 @@ filegroups: - src/core/lib/channel/channel_args.c - src/core/lib/channel/channel_stack.c - src/core/lib/channel/channel_stack_builder.c - - src/core/lib/channel/compress_filter.c - src/core/lib/channel/connected_channel.c - src/core/lib/channel/deadline_filter.c - src/core/lib/channel/handshaker.c - src/core/lib/channel/handshaker_factory.c - src/core/lib/channel/handshaker_registry.c - - src/core/lib/channel/http_client_filter.c - - src/core/lib/channel/http_server_filter.c - src/core/lib/compression/compression.c - src/core/lib/compression/message_compress.c - src/core/lib/debug/trace.c @@ -466,6 +460,17 @@ filegroups: - include/grpc/impl/codegen/status.h uses: - gpr_codegen +- name: grpc_http_filters + headers: + - src/core/ext/filters/http/client/http_client_filter.h + - src/core/ext/filters/http/compress/compress_filter.h + - src/core/ext/filters/http/server/http_server_filter.h + src: + - src/core/ext/filters/http/client/http_client_filter.c + - src/core/ext/filters/http/compress/compress_filter.c + - src/core/ext/filters/http/http_filters_plugin.c + - src/core/ext/filters/http/server/http_server_filter.c + plugin: grpc_http_filters - name: grpc_lb_policy_grpclb headers: - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h @@ -700,6 +705,7 @@ filegroups: uses: - grpc_base - grpc_transport_chttp2_alpn + - grpc_http_filters - name: grpc_transport_chttp2_alpn headers: - src/core/ext/transport/chttp2/alpn/alpn.h @@ -773,6 +779,7 @@ filegroups: filegroups: - grpc_base - grpc_transport_chttp2 + - grpc_http_filters - name: nanopb headers: - third_party/nanopb/pb.h diff --git a/config.m4 b/config.m4 index d830fa17bf0..77ffaa4db45 100644 --- a/config.m4 +++ b/config.m4 @@ -86,14 +86,11 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ - src/core/lib/channel/compress_filter.c \ src/core/lib/channel/connected_channel.c \ src/core/lib/channel/deadline_filter.c \ src/core/lib/channel/handshaker.c \ src/core/lib/channel/handshaker_factory.c \ src/core/lib/channel/handshaker_registry.c \ - src/core/lib/channel/http_client_filter.c \ - src/core/lib/channel/http_server_filter.c \ src/core/lib/compression/compression.c \ src/core/lib/compression/message_compress.c \ src/core/lib/debug/trace.c \ @@ -228,6 +225,10 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/transport/chttp2/transport/varint.c \ src/core/ext/transport/chttp2/transport/writing.c \ src/core/ext/transport/chttp2/alpn/alpn.c \ + src/core/ext/filters/http/client/http_client_filter.c \ + src/core/ext/filters/http/compress/compress_filter.c \ + src/core/ext/filters/http/http_filters_plugin.c \ + src/core/ext/filters/http/server/http_server_filter.c \ src/core/lib/http/httpcli_security_connector.c \ src/core/lib/security/context/security_context.c \ src/core/lib/security/credentials/composite/composite_credentials.c \ @@ -637,6 +638,10 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/resolver/dns/c_ares) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/resolver/dns/native) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/resolver/sockaddr) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/http) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/http/client) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/http/compress) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/http/server) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/load_reporting) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/max_age) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/message_size) diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 8f39374693c..b0b8686a813 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -258,15 +258,12 @@ Pod::Spec.new do |s| 'src/core/lib/channel/channel_args.h', 'src/core/lib/channel/channel_stack.h', 'src/core/lib/channel/channel_stack_builder.h', - 'src/core/lib/channel/compress_filter.h', 'src/core/lib/channel/connected_channel.h', 'src/core/lib/channel/context.h', 'src/core/lib/channel/deadline_filter.h', 'src/core/lib/channel/handshaker.h', 'src/core/lib/channel/handshaker_factory.h', 'src/core/lib/channel/handshaker_registry.h', - 'src/core/lib/channel/http_client_filter.h', - 'src/core/lib/channel/http_server_filter.h', 'src/core/lib/compression/algorithm_metadata.h', 'src/core/lib/compression/message_compress.h', 'src/core/lib/debug/trace.h', @@ -383,6 +380,9 @@ Pod::Spec.new do |s| 'src/core/ext/transport/chttp2/transport/stream_map.h', 'src/core/ext/transport/chttp2/transport/varint.h', 'src/core/ext/transport/chttp2/alpn/alpn.h', + 'src/core/ext/filters/http/client/http_client_filter.h', + 'src/core/ext/filters/http/compress/compress_filter.h', + 'src/core/ext/filters/http/server/http_server_filter.h', 'src/core/lib/security/context/security_context.h', 'src/core/lib/security/credentials/composite/composite_credentials.h', 'src/core/lib/security/credentials/credentials.h', @@ -461,14 +461,11 @@ Pod::Spec.new do |s| 'src/core/lib/channel/channel_args.c', 'src/core/lib/channel/channel_stack.c', 'src/core/lib/channel/channel_stack_builder.c', - 'src/core/lib/channel/compress_filter.c', 'src/core/lib/channel/connected_channel.c', 'src/core/lib/channel/deadline_filter.c', 'src/core/lib/channel/handshaker.c', 'src/core/lib/channel/handshaker_factory.c', 'src/core/lib/channel/handshaker_registry.c', - 'src/core/lib/channel/http_client_filter.c', - 'src/core/lib/channel/http_server_filter.c', 'src/core/lib/compression/compression.c', 'src/core/lib/compression/message_compress.c', 'src/core/lib/debug/trace.c', @@ -603,6 +600,10 @@ Pod::Spec.new do |s| 'src/core/ext/transport/chttp2/transport/varint.c', 'src/core/ext/transport/chttp2/transport/writing.c', 'src/core/ext/transport/chttp2/alpn/alpn.c', + 'src/core/ext/filters/http/client/http_client_filter.c', + 'src/core/ext/filters/http/compress/compress_filter.c', + 'src/core/ext/filters/http/http_filters_plugin.c', + 'src/core/ext/filters/http/server/http_server_filter.c', 'src/core/lib/http/httpcli_security_connector.c', 'src/core/lib/security/context/security_context.c', 'src/core/lib/security/credentials/composite/composite_credentials.c', @@ -708,15 +709,12 @@ Pod::Spec.new do |s| 'src/core/lib/channel/channel_args.h', 'src/core/lib/channel/channel_stack.h', 'src/core/lib/channel/channel_stack_builder.h', - 'src/core/lib/channel/compress_filter.h', 'src/core/lib/channel/connected_channel.h', 'src/core/lib/channel/context.h', 'src/core/lib/channel/deadline_filter.h', 'src/core/lib/channel/handshaker.h', 'src/core/lib/channel/handshaker_factory.h', 'src/core/lib/channel/handshaker_registry.h', - 'src/core/lib/channel/http_client_filter.h', - 'src/core/lib/channel/http_server_filter.h', 'src/core/lib/compression/algorithm_metadata.h', 'src/core/lib/compression/message_compress.h', 'src/core/lib/debug/trace.h', @@ -833,6 +831,9 @@ Pod::Spec.new do |s| 'src/core/ext/transport/chttp2/transport/stream_map.h', 'src/core/ext/transport/chttp2/transport/varint.h', 'src/core/ext/transport/chttp2/alpn/alpn.h', + 'src/core/ext/filters/http/client/http_client_filter.h', + 'src/core/ext/filters/http/compress/compress_filter.h', + 'src/core/ext/filters/http/server/http_server_filter.h', 'src/core/lib/security/context/security_context.h', 'src/core/lib/security/credentials/composite/composite_credentials.h', 'src/core/lib/security/credentials/credentials.h', diff --git a/grpc.gemspec b/grpc.gemspec index 60fc0a208a7..2ba0ec953b4 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -174,15 +174,12 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/channel/channel_args.h ) s.files += %w( src/core/lib/channel/channel_stack.h ) s.files += %w( src/core/lib/channel/channel_stack_builder.h ) - s.files += %w( src/core/lib/channel/compress_filter.h ) s.files += %w( src/core/lib/channel/connected_channel.h ) s.files += %w( src/core/lib/channel/context.h ) s.files += %w( src/core/lib/channel/deadline_filter.h ) s.files += %w( src/core/lib/channel/handshaker.h ) s.files += %w( src/core/lib/channel/handshaker_factory.h ) s.files += %w( src/core/lib/channel/handshaker_registry.h ) - s.files += %w( src/core/lib/channel/http_client_filter.h ) - s.files += %w( src/core/lib/channel/http_server_filter.h ) s.files += %w( src/core/lib/compression/algorithm_metadata.h ) s.files += %w( src/core/lib/compression/message_compress.h ) s.files += %w( src/core/lib/debug/trace.h ) @@ -299,6 +296,9 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/transport/chttp2/transport/stream_map.h ) s.files += %w( src/core/ext/transport/chttp2/transport/varint.h ) s.files += %w( src/core/ext/transport/chttp2/alpn/alpn.h ) + s.files += %w( src/core/ext/filters/http/client/http_client_filter.h ) + s.files += %w( src/core/ext/filters/http/compress/compress_filter.h ) + s.files += %w( src/core/ext/filters/http/server/http_server_filter.h ) s.files += %w( src/core/lib/security/context/security_context.h ) s.files += %w( src/core/lib/security/credentials/composite/composite_credentials.h ) s.files += %w( src/core/lib/security/credentials/credentials.h ) @@ -377,14 +377,11 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/channel/channel_args.c ) s.files += %w( src/core/lib/channel/channel_stack.c ) s.files += %w( src/core/lib/channel/channel_stack_builder.c ) - s.files += %w( src/core/lib/channel/compress_filter.c ) s.files += %w( src/core/lib/channel/connected_channel.c ) s.files += %w( src/core/lib/channel/deadline_filter.c ) s.files += %w( src/core/lib/channel/handshaker.c ) s.files += %w( src/core/lib/channel/handshaker_factory.c ) s.files += %w( src/core/lib/channel/handshaker_registry.c ) - s.files += %w( src/core/lib/channel/http_client_filter.c ) - s.files += %w( src/core/lib/channel/http_server_filter.c ) s.files += %w( src/core/lib/compression/compression.c ) s.files += %w( src/core/lib/compression/message_compress.c ) s.files += %w( src/core/lib/debug/trace.c ) @@ -519,6 +516,10 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/transport/chttp2/transport/varint.c ) s.files += %w( src/core/ext/transport/chttp2/transport/writing.c ) s.files += %w( src/core/ext/transport/chttp2/alpn/alpn.c ) + s.files += %w( src/core/ext/filters/http/client/http_client_filter.c ) + s.files += %w( src/core/ext/filters/http/compress/compress_filter.c ) + s.files += %w( src/core/ext/filters/http/http_filters_plugin.c ) + s.files += %w( src/core/ext/filters/http/server/http_server_filter.c ) s.files += %w( src/core/lib/http/httpcli_security_connector.c ) s.files += %w( src/core/lib/security/context/security_context.c ) s.files += %w( src/core/lib/security/credentials/composite/composite_credentials.c ) diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index 5beac83a3bc..83bdd80f2c5 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -175,6 +175,9 @@ typedef struct { /** Grace period after the chennel reaches its max age. Int valued, milliseconds. INT_MAX means unlimited. */ #define GRPC_ARG_MAX_CONNECTION_AGE_GRACE_MS "grpc.max_connection_age_grace_ms" +/** Enable/disable support for per-message compression. Defaults to 1, unless + GRPC_ARG_MINIMAL_STACK is enabled, in which case it defaults to 0. */ +#define GRPC_ARG_ENABLE_PER_MESSAGE_COMPRESSION "grpc.per_message_compression" /** Initial sequence number for http2 transports. Int valued. */ #define GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER \ "grpc.http2.initial_sequence_number" diff --git a/package.xml b/package.xml index f2cf6463e5f..7faa5320822 100644 --- a/package.xml +++ b/package.xml @@ -183,15 +183,12 @@ - - - @@ -308,6 +305,9 @@ + + + @@ -386,14 +386,11 @@ - - - @@ -528,6 +525,10 @@ + + + + diff --git a/src/core/lib/channel/http_client_filter.c b/src/core/ext/filters/http/client/http_client_filter.c similarity index 99% rename from src/core/lib/channel/http_client_filter.c rename to src/core/ext/filters/http/client/http_client_filter.c index 17af2013d97..c97bdb31ddb 100644 --- a/src/core/lib/channel/http_client_filter.c +++ b/src/core/ext/filters/http/client/http_client_filter.c @@ -30,7 +30,7 @@ * */ -#include "src/core/lib/channel/http_client_filter.h" +#include "src/core/ext/filters/http/client/http_client_filter.h" #include #include #include diff --git a/src/core/lib/channel/http_client_filter.h b/src/core/ext/filters/http/client/http_client_filter.h similarity index 100% rename from src/core/lib/channel/http_client_filter.h rename to src/core/ext/filters/http/client/http_client_filter.h diff --git a/src/core/lib/channel/compress_filter.c b/src/core/ext/filters/http/compress/compress_filter.c similarity index 99% rename from src/core/lib/channel/compress_filter.c rename to src/core/ext/filters/http/compress/compress_filter.c index 02dc479f3a2..64cc42d165a 100644 --- a/src/core/lib/channel/compress_filter.c +++ b/src/core/ext/filters/http/compress/compress_filter.c @@ -39,8 +39,8 @@ #include #include +#include "src/core/ext/filters/http/compress/compress_filter.h" #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/compress_filter.h" #include "src/core/lib/compression/algorithm_metadata.h" #include "src/core/lib/compression/message_compress.h" #include "src/core/lib/profiling/timers.h" diff --git a/src/core/lib/channel/compress_filter.h b/src/core/ext/filters/http/compress/compress_filter.h similarity index 100% rename from src/core/lib/channel/compress_filter.h rename to src/core/ext/filters/http/compress/compress_filter.h diff --git a/src/core/ext/filters/http/http_filters_plugin.c b/src/core/ext/filters/http/http_filters_plugin.c new file mode 100644 index 00000000000..a6e35bc181a --- /dev/null +++ b/src/core/ext/filters/http/http_filters_plugin.c @@ -0,0 +1,106 @@ +/* + * + * Copyright 2017, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include "src/core/ext/filters/http/client/http_client_filter.h" +#include "src/core/ext/filters/http/compress/compress_filter.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" +#include "src/core/lib/channel/channel_stack_builder.h" +#include "src/core/lib/surface/channel_init.h" +#include "src/core/lib/transport/transport_impl.h" + +typedef struct { + const grpc_channel_filter *filter; + const char *control_channel_arg; +} optional_filter; + +static optional_filter compress_filter = { + &grpc_compress_filter, GRPC_ARG_ENABLE_PER_MESSAGE_COMPRESSION}; + +static bool is_building_http_like_transport( + grpc_channel_stack_builder *builder) { + grpc_transport *t = grpc_channel_stack_builder_get_transport(builder); + return t && strstr(t->vtable->name, "http"); +} + +static bool maybe_add_optional_filter(grpc_exec_ctx *exec_ctx, + grpc_channel_stack_builder *builder, + void *arg) { + if (!is_building_http_like_transport(builder)) return true; + optional_filter *filtarg = arg; + const grpc_channel_args *channel_args = + grpc_channel_stack_builder_get_channel_arguments(builder); + bool enable = !grpc_channel_args_want_minimal_stack(channel_args); + const grpc_arg *ctlarg = + grpc_channel_args_find(channel_args, filtarg->control_channel_arg); + if (ctlarg != NULL) { + enable = !(ctlarg->type == GRPC_ARG_INTEGER && ctlarg->value.integer == 0); + } + return enable ? grpc_channel_stack_builder_prepend_filter( + builder, filtarg->filter, NULL, NULL) + : true; +} + +static bool maybe_add_required_filter(grpc_exec_ctx *exec_ctx, + grpc_channel_stack_builder *builder, + void *arg) { + return is_building_http_like_transport(builder) + ? grpc_channel_stack_builder_prepend_filter( + builder, (const grpc_channel_filter *)arg, NULL, NULL) + : true; +} + +void grpc_http_filters_init(void) { + grpc_register_tracer("compression", &grpc_compression_trace); + grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, + GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, + maybe_add_optional_filter, &compress_filter); + grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL, + GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, + maybe_add_optional_filter, &compress_filter); + grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, + GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, + maybe_add_optional_filter, &compress_filter); + grpc_channel_init_register_stage( + GRPC_CLIENT_SUBCHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, + maybe_add_required_filter, (void *)&grpc_http_client_filter); + grpc_channel_init_register_stage( + GRPC_CLIENT_DIRECT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, + maybe_add_required_filter, (void *)&grpc_http_client_filter); + grpc_channel_init_register_stage( + GRPC_SERVER_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, + maybe_add_required_filter, (void *)&grpc_http_server_filter); +} + +void grpc_http_filters_shutdown(void) {} diff --git a/src/core/lib/channel/http_server_filter.c b/src/core/ext/filters/http/server/http_server_filter.c similarity index 99% rename from src/core/lib/channel/http_server_filter.c rename to src/core/ext/filters/http/server/http_server_filter.c index df0f95010ba..03787d25c2c 100644 --- a/src/core/lib/channel/http_server_filter.c +++ b/src/core/ext/filters/http/server/http_server_filter.c @@ -31,7 +31,7 @@ * */ -#include "src/core/lib/channel/http_server_filter.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include #include diff --git a/src/core/lib/channel/http_server_filter.h b/src/core/ext/filters/http/server/http_server_filter.h similarity index 100% rename from src/core/lib/channel/http_server_filter.h rename to src/core/ext/filters/http/server/http_server_filter.h diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.c b/src/core/ext/transport/chttp2/server/chttp2_server.c index 6433968ca59..ede8eed9274 100644 --- a/src/core/ext/transport/chttp2/server/chttp2_server.c +++ b/src/core/ext/transport/chttp2/server/chttp2_server.c @@ -47,7 +47,7 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/handshaker.h" #include "src/core/lib/channel/handshaker_registry.h" -#include "src/core/lib/channel/http_server_filter.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/resolve_address.h" #include "src/core/lib/iomgr/tcp_server.h" diff --git a/src/core/lib/security/credentials/credentials.c b/src/core/lib/security/credentials/credentials.c index 52b80141d11..18d4604c4a9 100644 --- a/src/core/lib/security/credentials/credentials.c +++ b/src/core/lib/security/credentials/credentials.c @@ -37,7 +37,7 @@ #include #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/http_client_filter.h" +#include "src/core/ext/filters/http/client/http_client_filter.h" #include "src/core/lib/http/httpcli.h" #include "src/core/lib/http/parser.h" #include "src/core/lib/iomgr/executor.h" diff --git a/src/core/lib/security/credentials/ssl/ssl_credentials.c b/src/core/lib/security/credentials/ssl/ssl_credentials.c index 4b17ac80983..35dda88ec6a 100644 --- a/src/core/lib/security/credentials/ssl/ssl_credentials.c +++ b/src/core/lib/security/credentials/ssl/ssl_credentials.c @@ -36,7 +36,7 @@ #include #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/channel/http_client_filter.h" +#include "src/core/ext/filters/http/client/http_client_filter.h" #include "src/core/lib/surface/api_trace.h" #include diff --git a/src/core/lib/surface/init.c b/src/core/lib/surface/init.c index f9b1675465c..bba259c0994 100644 --- a/src/core/lib/surface/init.c +++ b/src/core/lib/surface/init.c @@ -41,12 +41,9 @@ #include #include #include "src/core/lib/channel/channel_stack.h" -#include "src/core/lib/channel/compress_filter.h" #include "src/core/lib/channel/connected_channel.h" #include "src/core/lib/channel/deadline_filter.h" #include "src/core/lib/channel/handshaker_registry.h" -#include "src/core/lib/channel/http_client_filter.h" -#include "src/core/lib/channel/http_server_filter.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/http/parser.h" #include "src/core/lib/iomgr/combiner.h" @@ -94,17 +91,6 @@ static bool prepend_filter(grpc_exec_ctx *exec_ctx, builder, (const grpc_channel_filter *)arg, NULL, NULL); } -static bool maybe_add_http_filter(grpc_exec_ctx *exec_ctx, - grpc_channel_stack_builder *builder, - void *arg) { - grpc_transport *t = grpc_channel_stack_builder_get_transport(builder); - if (t && strstr(t->vtable->name, "http")) { - return grpc_channel_stack_builder_prepend_filter( - builder, (const grpc_channel_filter *)arg, NULL, NULL); - } - return true; -} - static void register_builtin_channel_init() { grpc_channel_init_register_stage( GRPC_CLIENT_DIRECT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, @@ -112,30 +98,12 @@ static void register_builtin_channel_init() { grpc_channel_init_register_stage( GRPC_SERVER_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, prepend_filter, (void *)&grpc_server_deadline_filter); - grpc_channel_init_register_stage( - GRPC_CLIENT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, prepend_filter, - (void *)&grpc_compress_filter); - grpc_channel_init_register_stage( - GRPC_CLIENT_DIRECT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, - prepend_filter, (void *)&grpc_compress_filter); - grpc_channel_init_register_stage( - GRPC_SERVER_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, prepend_filter, - (void *)&grpc_compress_filter); - grpc_channel_init_register_stage( - GRPC_CLIENT_SUBCHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, - maybe_add_http_filter, (void *)&grpc_http_client_filter); grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, grpc_add_connected_filter, NULL); - grpc_channel_init_register_stage( - GRPC_CLIENT_DIRECT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, - maybe_add_http_filter, (void *)&grpc_http_client_filter); grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, grpc_add_connected_filter, NULL); - grpc_channel_init_register_stage( - GRPC_SERVER_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, - maybe_add_http_filter, (void *)&grpc_http_server_filter); grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, grpc_add_connected_filter, NULL); @@ -179,7 +147,6 @@ void grpc_init(void) { grpc_register_tracer("channel_stack_builder", &grpc_trace_channel_stack_builder); grpc_register_tracer("http1", &grpc_http1_trace); - grpc_register_tracer("compression", &grpc_compression_trace); grpc_register_tracer("queue_pluck", &grpc_cq_pluck_trace); grpc_register_tracer("combiner", &grpc_combiner_trace); grpc_register_tracer("server_channel", &grpc_server_channel_trace); diff --git a/src/core/plugin_registry/grpc_cronet_plugin_registry.c b/src/core/plugin_registry/grpc_cronet_plugin_registry.c index c97f47b397a..6cc3a25c550 100644 --- a/src/core/plugin_registry/grpc_cronet_plugin_registry.c +++ b/src/core/plugin_registry/grpc_cronet_plugin_registry.c @@ -33,6 +33,8 @@ #include +extern void grpc_http_filters_init(void); +extern void grpc_http_filters_shutdown(void); extern void grpc_chttp2_plugin_init(void); extern void grpc_chttp2_plugin_shutdown(void); extern void grpc_client_channel_init(void); @@ -41,6 +43,8 @@ extern void grpc_load_reporting_plugin_init(void); extern void grpc_load_reporting_plugin_shutdown(void); void grpc_register_built_in_plugins(void) { + grpc_register_plugin(grpc_http_filters_init, + grpc_http_filters_shutdown); grpc_register_plugin(grpc_chttp2_plugin_init, grpc_chttp2_plugin_shutdown); grpc_register_plugin(grpc_client_channel_init, diff --git a/src/core/plugin_registry/grpc_plugin_registry.c b/src/core/plugin_registry/grpc_plugin_registry.c index 3588954631f..40a882d50cb 100644 --- a/src/core/plugin_registry/grpc_plugin_registry.c +++ b/src/core/plugin_registry/grpc_plugin_registry.c @@ -33,6 +33,8 @@ #include +extern void grpc_http_filters_init(void); +extern void grpc_http_filters_shutdown(void); extern void grpc_chttp2_plugin_init(void); extern void grpc_chttp2_plugin_shutdown(void); extern void grpc_client_channel_init(void); @@ -59,6 +61,8 @@ extern void grpc_message_size_filter_init(void); extern void grpc_message_size_filter_shutdown(void); void grpc_register_built_in_plugins(void) { + grpc_register_plugin(grpc_http_filters_init, + grpc_http_filters_shutdown); grpc_register_plugin(grpc_chttp2_plugin_init, grpc_chttp2_plugin_shutdown); grpc_register_plugin(grpc_client_channel_init, diff --git a/src/core/plugin_registry/grpc_unsecure_plugin_registry.c b/src/core/plugin_registry/grpc_unsecure_plugin_registry.c index 2f0a0d8c96e..ded2aa6a840 100644 --- a/src/core/plugin_registry/grpc_unsecure_plugin_registry.c +++ b/src/core/plugin_registry/grpc_unsecure_plugin_registry.c @@ -33,6 +33,8 @@ #include +extern void grpc_http_filters_init(void); +extern void grpc_http_filters_shutdown(void); extern void grpc_chttp2_plugin_init(void); extern void grpc_chttp2_plugin_shutdown(void); extern void grpc_client_channel_init(void); @@ -59,6 +61,8 @@ extern void grpc_message_size_filter_init(void); extern void grpc_message_size_filter_shutdown(void); void grpc_register_built_in_plugins(void) { + grpc_register_plugin(grpc_http_filters_init, + grpc_http_filters_shutdown); grpc_register_plugin(grpc_chttp2_plugin_init, grpc_chttp2_plugin_shutdown); grpc_register_plugin(grpc_client_channel_init, diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 41c309dd3db..f99e777532e 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -80,14 +80,11 @@ CORE_SOURCE_FILES = [ 'src/core/lib/channel/channel_args.c', 'src/core/lib/channel/channel_stack.c', 'src/core/lib/channel/channel_stack_builder.c', - 'src/core/lib/channel/compress_filter.c', 'src/core/lib/channel/connected_channel.c', 'src/core/lib/channel/deadline_filter.c', 'src/core/lib/channel/handshaker.c', 'src/core/lib/channel/handshaker_factory.c', 'src/core/lib/channel/handshaker_registry.c', - 'src/core/lib/channel/http_client_filter.c', - 'src/core/lib/channel/http_server_filter.c', 'src/core/lib/compression/compression.c', 'src/core/lib/compression/message_compress.c', 'src/core/lib/debug/trace.c', @@ -222,6 +219,10 @@ CORE_SOURCE_FILES = [ 'src/core/ext/transport/chttp2/transport/varint.c', 'src/core/ext/transport/chttp2/transport/writing.c', 'src/core/ext/transport/chttp2/alpn/alpn.c', + 'src/core/ext/filters/http/client/http_client_filter.c', + 'src/core/ext/filters/http/compress/compress_filter.c', + 'src/core/ext/filters/http/http_filters_plugin.c', + 'src/core/ext/filters/http/server/http_server_filter.c', 'src/core/lib/http/httpcli_security_connector.c', 'src/core/lib/security/context/security_context.c', 'src/core/lib/security/credentials/composite/composite_credentials.c', diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.c index 4870dc1a536..3f22351e6da 100644 --- a/test/core/bad_client/bad_client.c +++ b/test/core/bad_client/bad_client.c @@ -42,7 +42,7 @@ #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/channel_stack.h" -#include "src/core/lib/channel/http_server_filter.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/support/murmur_hash.h" diff --git a/test/core/channel/minimal_stack_is_minimal_test.c b/test/core/channel/minimal_stack_is_minimal_test.c index de8f78fb1a6..f7bdc1b8435 100644 --- a/test/core/channel/minimal_stack_is_minimal_test.c +++ b/test/core/channel/minimal_stack_is_minimal_test.c @@ -43,6 +43,62 @@ #include "src/core/lib/transport/transport_impl.h" #include "test/core/util/test_config.h" +static int check_stack(const char *file, int line, const char *transport_name, + grpc_channel_args *init_args, + grpc_channel_stack_type channel_stack_type, ...); + +#define CHECK_STACK(...) check_stack(__FILE__, __LINE__, __VA_ARGS__) + +int main(int argc, char **argv) { + grpc_test_init(argc, argv); + grpc_init(); + int errors = 0; + + // tests with a minimal stack + grpc_arg minimal_stack_arg = {.type = GRPC_ARG_INTEGER, + .key = GRPC_ARG_MINIMAL_STACK, + .value.integer = 1}; + grpc_channel_args minimal_stack_args = {.num_args = 1, + .args = &minimal_stack_arg}; + errors += CHECK_STACK("unknown", &minimal_stack_args, + GRPC_CLIENT_DIRECT_CHANNEL, "connected", NULL); + errors += CHECK_STACK("unknown", &minimal_stack_args, GRPC_CLIENT_SUBCHANNEL, + "connected", NULL); + errors += CHECK_STACK("unknown", &minimal_stack_args, GRPC_SERVER_CHANNEL, + "server", "connected", NULL); + errors += + CHECK_STACK("chttp2", &minimal_stack_args, GRPC_CLIENT_DIRECT_CHANNEL, + "http-client", "connected", NULL); + errors += CHECK_STACK("chttp2", &minimal_stack_args, GRPC_CLIENT_SUBCHANNEL, + "http-client", "connected", NULL); + errors += CHECK_STACK("chttp2", &minimal_stack_args, GRPC_SERVER_CHANNEL, + "server", "http-server", "connected", NULL); + errors += CHECK_STACK(NULL, &minimal_stack_args, GRPC_CLIENT_CHANNEL, + "client-channel", NULL); + + // tests with a default stack + errors += CHECK_STACK("unknown", NULL, GRPC_CLIENT_DIRECT_CHANNEL, "deadline", + "message_size", "connected", NULL); + errors += CHECK_STACK("unknown", NULL, GRPC_CLIENT_SUBCHANNEL, "message_size", + "connected", NULL); + errors += CHECK_STACK("unknown", NULL, GRPC_SERVER_CHANNEL, "server", + "deadline", "message_size", "connected", NULL); + errors += + CHECK_STACK("chttp2", NULL, GRPC_CLIENT_DIRECT_CHANNEL, "deadline", + "message_size", "http-client", "compress", "connected", NULL); + errors += CHECK_STACK("chttp2", NULL, GRPC_CLIENT_SUBCHANNEL, "message_size", + "http-client", "compress", "connected", NULL); + errors += + CHECK_STACK("chttp2", NULL, GRPC_SERVER_CHANNEL, "server", "deadline", + "message_size", "http-server", "compress", "connected", NULL); + errors += + CHECK_STACK(NULL, NULL, GRPC_CLIENT_CHANNEL, "client-channel", NULL); + + GPR_ASSERT(errors == 0); + grpc_shutdown(); + return 0; +} + static int check_stack(const char *file, int line, const char *transport_name, grpc_channel_args *init_args, grpc_channel_stack_type channel_stack_type, ...) { @@ -124,9 +180,13 @@ static int check_stack(const char *file, int line, const char *transport_name, gpr_strvec_destroy(&v); gpr_log(file, line, GPR_LOG_SEVERITY_ERROR, - "FAILED transport=%s; stack_type=%s; %s: expected '%s'; got '%s'", + "**************************************************"); + gpr_log(file, line, GPR_LOG_SEVERITY_ERROR, + "FAILED transport=%s; stack_type=%s; channel_args=%s:", transport_name, grpc_channel_stack_type_string(channel_stack_type), - args_str, expect, got); + args_str); + gpr_log(file, line, GPR_LOG_SEVERITY_ERROR, "EXPECTED: %s", expect); + gpr_log(file, line, GPR_LOG_SEVERITY_ERROR, "GOT: %s", got); result = 1; gpr_free(args_str); @@ -144,55 +204,3 @@ static int check_stack(const char *file, int line, const char *transport_name, return result; } - -#define CHECK_STACK(...) check_stack(__FILE__, __LINE__, __VA_ARGS__) - -int main(int argc, char **argv) { - grpc_test_init(argc, argv); - grpc_init(); - int errors = 0; - - // tests with a minimal stack - grpc_arg minimal_stack_arg = {.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_MINIMAL_STACK, - .value.integer = 1}; - grpc_channel_args minimal_stack_args = {.num_args = 1, - .args = &minimal_stack_arg}; - errors += CHECK_STACK("unknown", &minimal_stack_args, - GRPC_CLIENT_DIRECT_CHANNEL, "connected", NULL); - errors += CHECK_STACK("unknown", &minimal_stack_args, GRPC_CLIENT_SUBCHANNEL, - "connected", NULL); - errors += CHECK_STACK("unknown", &minimal_stack_args, GRPC_SERVER_CHANNEL, - "server", "connected", NULL); - errors += - CHECK_STACK("chttp2", &minimal_stack_args, GRPC_CLIENT_DIRECT_CHANNEL, - "http-client", "connected", NULL); - errors += CHECK_STACK("chttp2", &minimal_stack_args, GRPC_CLIENT_SUBCHANNEL, - "connected", NULL); - errors += CHECK_STACK("chttp2", &minimal_stack_args, GRPC_SERVER_CHANNEL, - "server", "http-server", "connected", NULL); - errors += CHECK_STACK(NULL, &minimal_stack_args, GRPC_CLIENT_CHANNEL, - "client-channel", NULL); - - // tests with a default stack - errors += CHECK_STACK("unknown", NULL, GRPC_CLIENT_DIRECT_CHANNEL, "compress", - "deadline", "connected", NULL); - errors += - CHECK_STACK("unknown", NULL, GRPC_CLIENT_SUBCHANNEL, "connected", NULL); - errors += CHECK_STACK("unknown", NULL, GRPC_SERVER_CHANNEL, "server", - "compress", "deadline", "connected", NULL); - errors += - CHECK_STACK("chttp2", NULL, GRPC_CLIENT_DIRECT_CHANNEL, "http-client", - "compress", "deadline", "connected", NULL); - errors += CHECK_STACK("chttp2", NULL, GRPC_CLIENT_SUBCHANNEL, "http-client", - "connected", NULL); - errors += - CHECK_STACK("chttp2", NULL, GRPC_SERVER_CHANNEL, "server", "http-server", - "compress", "deadline", "connected", NULL); - errors += CHECK_STACK(NULL, NULL, GRPC_CLIENT_CHANNEL, "compress", - "client-channel", NULL); - - GPR_ASSERT(errors == 0); - grpc_shutdown(); - return 0; -} diff --git a/test/core/end2end/fixtures/h2_census.c b/test/core/end2end/fixtures/h2_census.c index 97b27b2496a..8db0acf47f5 100644 --- a/test/core/end2end/fixtures/h2_census.c +++ b/test/core/end2end/fixtures/h2_census.c @@ -45,7 +45,7 @@ #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/connected_channel.h" -#include "src/core/lib/channel/http_server_filter.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/server.h" #include "test/core/util/port.h" diff --git a/test/core/end2end/fixtures/h2_compress.c b/test/core/end2end/fixtures/h2_compress.c index 8aec94d6019..aa2b3bf069e 100644 --- a/test/core/end2end/fixtures/h2_compress.c +++ b/test/core/end2end/fixtures/h2_compress.c @@ -45,7 +45,7 @@ #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/connected_channel.h" -#include "src/core/lib/channel/http_server_filter.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/server.h" #include "test/core/util/port.h" diff --git a/test/core/end2end/fixtures/h2_full+pipe.c b/test/core/end2end/fixtures/h2_full+pipe.c index 0191e59fc83..9280aa13d4b 100644 --- a/test/core/end2end/fixtures/h2_full+pipe.c +++ b/test/core/end2end/fixtures/h2_full+pipe.c @@ -49,7 +49,7 @@ #include "src/core/ext/filters/client_channel/client_channel.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/connected_channel.h" -#include "src/core/lib/channel/http_server_filter.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/iomgr/wakeup_fd_posix.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/server.h" diff --git a/test/core/end2end/fixtures/h2_full+trace.c b/test/core/end2end/fixtures/h2_full+trace.c index 9dbb27fc4b8..f32521cb58d 100644 --- a/test/core/end2end/fixtures/h2_full+trace.c +++ b/test/core/end2end/fixtures/h2_full+trace.c @@ -49,7 +49,7 @@ #include "src/core/ext/filters/client_channel/client_channel.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/connected_channel.h" -#include "src/core/lib/channel/http_server_filter.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/support/env.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/server.h" diff --git a/test/core/end2end/fixtures/h2_full.c b/test/core/end2end/fixtures/h2_full.c index 49c62b34298..28474507b9b 100644 --- a/test/core/end2end/fixtures/h2_full.c +++ b/test/core/end2end/fixtures/h2_full.c @@ -44,7 +44,7 @@ #include "src/core/ext/filters/client_channel/client_channel.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/connected_channel.h" -#include "src/core/lib/channel/http_server_filter.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/server.h" #include "test/core/util/port.h" diff --git a/test/core/end2end/fixtures/h2_http_proxy.c b/test/core/end2end/fixtures/h2_http_proxy.c index 62c435557d7..fb4f56e88d3 100644 --- a/test/core/end2end/fixtures/h2_http_proxy.c +++ b/test/core/end2end/fixtures/h2_http_proxy.c @@ -45,7 +45,7 @@ #include "src/core/ext/filters/client_channel/client_channel.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/connected_channel.h" -#include "src/core/lib/channel/http_server_filter.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/support/env.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/server.h" diff --git a/test/core/end2end/fixtures/h2_load_reporting.c b/test/core/end2end/fixtures/h2_load_reporting.c index 79f26ed2bc6..4cf3b445d5c 100644 --- a/test/core/end2end/fixtures/h2_load_reporting.c +++ b/test/core/end2end/fixtures/h2_load_reporting.c @@ -46,7 +46,7 @@ #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/connected_channel.h" -#include "src/core/lib/channel/http_server_filter.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/server.h" #include "test/core/util/port.h" diff --git a/test/core/end2end/fixtures/h2_proxy.c b/test/core/end2end/fixtures/h2_proxy.c index a10738fa0b4..d8658eca640 100644 --- a/test/core/end2end/fixtures/h2_proxy.c +++ b/test/core/end2end/fixtures/h2_proxy.c @@ -44,7 +44,7 @@ #include "src/core/ext/filters/client_channel/client_channel.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/connected_channel.h" -#include "src/core/lib/channel/http_server_filter.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/server.h" #include "test/core/end2end/fixtures/proxy.h" diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.c b/test/core/end2end/fixtures/h2_sockpair+trace.c index 5ace922f058..b3a158650ee 100644 --- a/test/core/end2end/fixtures/h2_sockpair+trace.c +++ b/test/core/end2end/fixtures/h2_sockpair+trace.c @@ -47,10 +47,10 @@ #include #include "src/core/ext/filters/client_channel/client_channel.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" -#include "src/core/lib/channel/compress_filter.h" +#include "src/core/ext/filters/http/compress/compress_filter.h" #include "src/core/lib/channel/connected_channel.h" -#include "src/core/lib/channel/http_client_filter.h" -#include "src/core/lib/channel/http_server_filter.h" +#include "src/core/ext/filters/http/client/http_client_filter.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/support/env.h" diff --git a/test/core/end2end/fixtures/h2_sockpair.c b/test/core/end2end/fixtures/h2_sockpair.c index 3079a42dceb..3fe1b8fc367 100644 --- a/test/core/end2end/fixtures/h2_sockpair.c +++ b/test/core/end2end/fixtures/h2_sockpair.c @@ -42,10 +42,10 @@ #include #include "src/core/ext/filters/client_channel/client_channel.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" -#include "src/core/lib/channel/compress_filter.h" +#include "src/core/ext/filters/http/compress/compress_filter.h" #include "src/core/lib/channel/connected_channel.h" -#include "src/core/lib/channel/http_client_filter.h" -#include "src/core/lib/channel/http_server_filter.h" +#include "src/core/ext/filters/http/client/http_client_filter.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/surface/channel.h" diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.c b/test/core/end2end/fixtures/h2_sockpair_1byte.c index 70410d75f4c..149902673dd 100644 --- a/test/core/end2end/fixtures/h2_sockpair_1byte.c +++ b/test/core/end2end/fixtures/h2_sockpair_1byte.c @@ -42,10 +42,10 @@ #include #include "src/core/ext/filters/client_channel/client_channel.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" -#include "src/core/lib/channel/compress_filter.h" +#include "src/core/ext/filters/http/compress/compress_filter.h" #include "src/core/lib/channel/connected_channel.h" -#include "src/core/lib/channel/http_client_filter.h" -#include "src/core/lib/channel/http_server_filter.h" +#include "src/core/ext/filters/http/client/http_client_filter.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/surface/channel.h" diff --git a/test/core/end2end/fixtures/h2_uds.c b/test/core/end2end/fixtures/h2_uds.c index 7bde69d82a4..c0a4d694183 100644 --- a/test/core/end2end/fixtures/h2_uds.c +++ b/test/core/end2end/fixtures/h2_uds.c @@ -47,7 +47,7 @@ #include "src/core/ext/filters/client_channel/client_channel.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/connected_channel.h" -#include "src/core/lib/channel/http_server_filter.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/support/string.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/server.h" diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index be18f12d158..3fcd5bc6ab7 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -48,11 +48,11 @@ extern "C" { #include "src/core/ext/filters/client_channel/client_channel.h" #include "src/core/ext/filters/load_reporting/load_reporting_filter.h" #include "src/core/lib/channel/channel_stack.h" -#include "src/core/lib/channel/compress_filter.h" +#include "src/core/ext/filters/http/compress/compress_filter.h" #include "src/core/lib/channel/connected_channel.h" #include "src/core/lib/channel/deadline_filter.h" -#include "src/core/lib/channel/http_client_filter.h" -#include "src/core/lib/channel/http_server_filter.h" +#include "src/core/ext/filters/http/client/http_client_filter.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/ext/filters/message_size/message_size_filter.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/transport/transport_impl.h" diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 0334434f24d..add3cb1857b 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -906,8 +906,6 @@ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack.h \ src/core/lib/channel/channel_stack_builder.c \ src/core/lib/channel/channel_stack_builder.h \ -src/core/lib/channel/compress_filter.c \ -src/core/lib/channel/compress_filter.h \ src/core/lib/channel/connected_channel.c \ src/core/lib/channel/connected_channel.h \ src/core/lib/channel/context.h \ @@ -919,10 +917,6 @@ src/core/lib/channel/handshaker_factory.c \ src/core/lib/channel/handshaker_factory.h \ src/core/lib/channel/handshaker_registry.c \ src/core/lib/channel/handshaker_registry.h \ -src/core/lib/channel/http_client_filter.c \ -src/core/lib/channel/http_client_filter.h \ -src/core/lib/channel/http_server_filter.c \ -src/core/lib/channel/http_server_filter.h \ src/core/lib/compression/algorithm_metadata.h \ src/core/lib/compression/compression.c \ src/core/lib/compression/message_compress.c \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 284cab8e54e..8db6e146a32 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -954,6 +954,13 @@ src/core/ext/filters/client_channel/subchannel_index.c \ src/core/ext/filters/client_channel/subchannel_index.h \ src/core/ext/filters/client_channel/uri_parser.c \ src/core/ext/filters/client_channel/uri_parser.h \ +src/core/ext/filters/http/client/http_client_filter.c \ +src/core/ext/filters/http/client/http_client_filter.h \ +src/core/ext/filters/http/compress/compress_filter.c \ +src/core/ext/filters/http/compress/compress_filter.h \ +src/core/ext/filters/http/http_filters_plugin.c \ +src/core/ext/filters/http/server/http_server_filter.c \ +src/core/ext/filters/http/server/http_server_filter.h \ src/core/ext/filters/load_reporting/load_reporting.c \ src/core/ext/filters/load_reporting/load_reporting.h \ src/core/ext/filters/load_reporting/load_reporting_filter.c \ @@ -1027,8 +1034,6 @@ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack.h \ src/core/lib/channel/channel_stack_builder.c \ src/core/lib/channel/channel_stack_builder.h \ -src/core/lib/channel/compress_filter.c \ -src/core/lib/channel/compress_filter.h \ src/core/lib/channel/connected_channel.c \ src/core/lib/channel/connected_channel.h \ src/core/lib/channel/context.h \ @@ -1040,10 +1045,6 @@ src/core/lib/channel/handshaker_factory.c \ src/core/lib/channel/handshaker_factory.h \ src/core/lib/channel/handshaker_registry.c \ src/core/lib/channel/handshaker_registry.h \ -src/core/lib/channel/http_client_filter.c \ -src/core/lib/channel/http_client_filter.h \ -src/core/lib/channel/http_server_filter.c \ -src/core/lib/channel/http_server_filter.h \ src/core/lib/compression/algorithm_metadata.h \ src/core/lib/compression/compression.c \ src/core/lib/compression/message_compress.c \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index e8168ce10b8..03cf01be0f5 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -7526,15 +7526,12 @@ "src/core/lib/channel/channel_args.h", "src/core/lib/channel/channel_stack.h", "src/core/lib/channel/channel_stack_builder.h", - "src/core/lib/channel/compress_filter.h", "src/core/lib/channel/connected_channel.h", "src/core/lib/channel/context.h", "src/core/lib/channel/deadline_filter.h", "src/core/lib/channel/handshaker.h", "src/core/lib/channel/handshaker_factory.h", "src/core/lib/channel/handshaker_registry.h", - "src/core/lib/channel/http_client_filter.h", - "src/core/lib/channel/http_server_filter.h", "src/core/lib/compression/algorithm_metadata.h", "src/core/lib/compression/message_compress.h", "src/core/lib/debug/trace.h", @@ -7653,8 +7650,6 @@ "src/core/lib/channel/channel_stack.h", "src/core/lib/channel/channel_stack_builder.c", "src/core/lib/channel/channel_stack_builder.h", - "src/core/lib/channel/compress_filter.c", - "src/core/lib/channel/compress_filter.h", "src/core/lib/channel/connected_channel.c", "src/core/lib/channel/connected_channel.h", "src/core/lib/channel/context.h", @@ -7666,10 +7661,6 @@ "src/core/lib/channel/handshaker_factory.h", "src/core/lib/channel/handshaker_registry.c", "src/core/lib/channel/handshaker_registry.h", - "src/core/lib/channel/http_client_filter.c", - "src/core/lib/channel/http_client_filter.h", - "src/core/lib/channel/http_server_filter.c", - "src/core/lib/channel/http_server_filter.h", "src/core/lib/compression/algorithm_metadata.h", "src/core/lib/compression/compression.c", "src/core/lib/compression/message_compress.c", @@ -7984,6 +7975,28 @@ "third_party": false, "type": "filegroup" }, + { + "deps": [], + "headers": [ + "src/core/ext/filters/http/client/http_client_filter.h", + "src/core/ext/filters/http/compress/compress_filter.h", + "src/core/ext/filters/http/server/http_server_filter.h" + ], + "is_filegroup": true, + "language": "c", + "name": "grpc_http_filters", + "src": [ + "src/core/ext/filters/http/client/http_client_filter.c", + "src/core/ext/filters/http/client/http_client_filter.h", + "src/core/ext/filters/http/compress/compress_filter.c", + "src/core/ext/filters/http/compress/compress_filter.h", + "src/core/ext/filters/http/http_filters_plugin.c", + "src/core/ext/filters/http/server/http_server_filter.c", + "src/core/ext/filters/http/server/http_server_filter.h" + ], + "third_party": false, + "type": "filegroup" + }, { "deps": [ "gpr", @@ -8332,6 +8345,7 @@ "deps": [ "gpr", "grpc_base", + "grpc_http_filters", "grpc_transport_chttp2_alpn" ], "headers": [ @@ -8533,6 +8547,7 @@ { "deps": [ "grpc_base", + "grpc_http_filters", "grpc_transport_chttp2" ], "headers": [ diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj b/vsprojects/vcxproj/grpc++/grpc++.vcxproj index 8ec84928bf3..c37cb77d5bf 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj @@ -380,15 +380,12 @@ - - - @@ -580,8 +577,6 @@ - - @@ -592,10 +587,6 @@ - - - - diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters index a32fdbb8f60..8f7e5769989 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters @@ -133,9 +133,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\channel @@ -151,12 +148,6 @@ src\core\lib\channel - - src\core\lib\channel - - - src\core\lib\channel - src\core\lib\compression @@ -869,9 +860,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\channel @@ -890,12 +878,6 @@ src\core\lib\channel - - src\core\lib\channel - - - src\core\lib\channel - src\core\lib\compression diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj index 0f8fe4a6230..973c0163058 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -374,15 +374,12 @@ - - - @@ -564,8 +561,6 @@ - - @@ -576,10 +571,6 @@ - - - - diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index d29b3ba6fe5..6da1a2bcbae 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -118,9 +118,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\channel @@ -136,12 +133,6 @@ src\core\lib\channel - - src\core\lib\channel - - - src\core\lib\channel - src\core\lib\compression @@ -836,9 +827,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\channel @@ -857,12 +845,6 @@ src\core\lib\channel - - src\core\lib\channel - - - src\core\lib\channel - src\core\lib\compression diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index 2a4d0b13a34..47d28e06ca2 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -303,15 +303,12 @@ - - - @@ -428,6 +425,9 @@ + + + @@ -512,8 +512,6 @@ - - @@ -524,10 +522,6 @@ - - - - @@ -796,6 +790,14 @@ + + + + + + + + diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index 800cea6d1da..f67b7ab3f88 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -13,9 +13,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\channel @@ -31,12 +28,6 @@ src\core\lib\channel - - src\core\lib\channel - - - src\core\lib\channel - src\core\lib\compression @@ -439,6 +430,18 @@ src\core\ext\transport\chttp2\alpn + + src\core\ext\filters\http\client + + + src\core\ext\filters\http\compress + + + src\core\ext\filters\http + + + src\core\ext\filters\http\server + src\core\lib\http @@ -806,9 +809,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\channel @@ -827,12 +827,6 @@ src\core\lib\channel - - src\core\lib\channel - - - src\core\lib\channel - src\core\lib\compression @@ -1181,6 +1175,15 @@ src\core\ext\transport\chttp2\alpn + + src\core\ext\filters\http\client + + + src\core\ext\filters\http\compress + + + src\core\ext\filters\http\server + src\core\lib\security\context @@ -1478,6 +1481,18 @@ {bd317dd5-323e-5b27-4c05-d85786be36ab} + + {2e3ab9f3-39ca-db39-cb3e-2196cbc68098} + + + {e4f7616b-2b49-7df9-8ca3-eb7848d4609d} + + + {8f3d6045-e672-b61f-437e-052557970f41} + + + {a40e82ca-0c04-35b8-898d-7ad5f323d110} + {12559ba7-9445-92ae-0c5a-2d79570d4c9b} diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj index 0e9c2923841..382e5af7e32 100644 --- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj +++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj @@ -198,15 +198,12 @@ - - - @@ -352,8 +349,6 @@ - - @@ -364,10 +359,6 @@ - - - - diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters index 94168a26288..db22acc6855 100644 --- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters @@ -70,9 +70,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\channel @@ -88,12 +85,6 @@ src\core\lib\channel - - src\core\lib\channel - - - src\core\lib\channel - src\core\lib\compression @@ -581,9 +572,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\channel @@ -602,12 +590,6 @@ src\core\lib\channel - - src\core\lib\channel - - - src\core\lib\channel - src\core\lib\compression diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index 11ee7b9563c..336902647ac 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -293,15 +293,12 @@ - - - @@ -418,6 +415,9 @@ + + + @@ -480,8 +480,6 @@ - - @@ -492,10 +490,6 @@ - - - - @@ -766,6 +760,14 @@ + + + + + + + + diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index a4a46549ae9..53a47482324 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -16,9 +16,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\channel @@ -34,12 +31,6 @@ src\core\lib\channel - - src\core\lib\channel - - - src\core\lib\channel - src\core\lib\compression @@ -445,6 +436,18 @@ src\core\ext\transport\chttp2\alpn + + src\core\ext\filters\http\client + + + src\core\ext\filters\http\compress + + + src\core\ext\filters\http + + + src\core\ext\filters\http\server + src\core\ext\transport\chttp2\server @@ -719,9 +722,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\channel @@ -740,12 +740,6 @@ src\core\lib\channel - - src\core\lib\channel - - - src\core\lib\channel - src\core\lib\compression @@ -1094,6 +1088,15 @@ src\core\ext\transport\chttp2\alpn + + src\core\ext\filters\http\client + + + src\core\ext\filters\http\compress + + + src\core\ext\filters\http\server + src\core\ext\transport\chttp2\server @@ -1319,6 +1322,18 @@ {99210f5e-b2a0-ecd1-024f-fc152db68a11} + + {33287f7d-739b-d30d-a9f3-b338103456b0} + + + {95cd5972-7339-6f09-2332-e6769b3cba3f} + + + {b257d9a5-2100-4b83-9a03-d28707827b1e} + + + {2c1e7897-6f69-f8b9-0b90-5c3fae59a48f} + {0aef07b4-39d2-f862-15ac-65b4bf00dabb} From 3be7dd0e793799b6a3e22e245230789dc80aa853 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 3 Apr 2017 14:30:03 -0700 Subject: [PATCH 146/461] Optionalize deadline checking --- BUILD | 20 +++++++++-- CMakeLists.txt | 14 ++++---- Makefile | 14 ++++---- binding.gyp | 2 +- build.yaml | 15 ++++++-- config.m4 | 3 +- gRPC-Core.podspec | 6 ++-- grpc.gemspec | 4 +-- include/grpc/impl/codegen/grpc_types.h | 3 ++ package.xml | 4 +-- .../filters/client_channel/client_channel.c | 26 ++++++++++---- .../filters/deadline}/deadline_filter.c | 35 ++++++++++++++++++- .../filters/deadline}/deadline_filter.h | 3 ++ src/core/lib/surface/init.c | 7 ---- .../grpc_cronet_plugin_registry.c | 4 +++ .../plugin_registry/grpc_plugin_registry.c | 4 +++ .../grpc_unsecure_plugin_registry.c | 4 +++ src/python/grpcio/grpc_core_dependencies.py | 2 +- .../channel/minimal_stack_is_minimal_test.c | 15 ++++---- test/cpp/microbenchmarks/bm_call_create.cc | 2 +- tools/doxygen/Doxyfile.c++.internal | 4 +-- tools/doxygen/Doxyfile.core.internal | 4 +-- .../generated/sources_and_headers.json | 29 ++++++++++++--- vsprojects/vcxproj/grpc++/grpc++.vcxproj | 6 ++-- .../vcxproj/grpc++/grpc++.vcxproj.filters | 21 +++++++---- .../grpc++_unsecure/grpc++_unsecure.vcxproj | 6 ++-- .../grpc++_unsecure.vcxproj.filters | 21 +++++++---- vsprojects/vcxproj/grpc/grpc.vcxproj | 6 ++-- vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 15 ++++---- .../grpc_test_util/grpc_test_util.vcxproj | 6 ++-- .../grpc_test_util.vcxproj.filters | 21 +++++++---- .../grpc_unsecure/grpc_unsecure.vcxproj | 6 ++-- .../grpc_unsecure.vcxproj.filters | 15 ++++---- 33 files changed, 244 insertions(+), 103 deletions(-) rename src/core/{lib/channel => ext/filters/deadline}/deadline_filter.c (90%) rename src/core/{lib/channel => ext/filters/deadline}/deadline_filter.h (97%) diff --git a/BUILD b/BUILD index 59b97028736..a7c757c7289 100644 --- a/BUILD +++ b/BUILD @@ -77,6 +77,7 @@ grpc_cc_library( "grpc_transport_chttp2_server_secure", "grpc_max_age_filter", "grpc_message_size_filter", + "grpc_deadline_filter", ], ) @@ -117,6 +118,7 @@ grpc_cc_library( "grpc_transport_chttp2_server_insecure", "grpc_max_age_filter", "grpc_message_size_filter", + "grpc_deadline_filter", ], ) @@ -434,7 +436,7 @@ grpc_cc_library( "src/core/lib/channel/channel_stack.c", "src/core/lib/channel/channel_stack_builder.c", "src/core/lib/channel/connected_channel.c", - "src/core/lib/channel/deadline_filter.c", + "src/core/ext/filters/deadline/deadline_filter.c", "src/core/lib/channel/handshaker.c", "src/core/lib/channel/handshaker_factory.c", "src/core/lib/channel/handshaker_registry.c", @@ -557,7 +559,7 @@ grpc_cc_library( "src/core/lib/channel/channel_stack_builder.h", "src/core/lib/channel/connected_channel.h", "src/core/lib/channel/context.h", - "src/core/lib/channel/deadline_filter.h", + "src/core/ext/filters/deadline/deadline_filter.h", "src/core/lib/channel/handshaker.h", "src/core/lib/channel/handshaker_factory.h", "src/core/lib/channel/handshaker_registry.h", @@ -745,6 +747,20 @@ grpc_cc_library( ], ) +grpc_cc_library( + name = "grpc_deadline_filter", + srcs = [ + "src/core/ext/filters/deadline/deadline_filter.c", + ], + hdrs = [ + "src/core/ext/filters/deadline/deadline_filter.h", + ], + language = "c", + deps = [ + "grpc_base", + ], +) + grpc_cc_library( name = "grpc_message_size_filter", srcs = [ diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e51b530365..50eb04a143e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -908,11 +908,11 @@ endif (gRPC_BUILD_TESTS) add_library(grpc src/core/lib/surface/init.c + src/core/ext/filters/deadline/deadline_filter.c src/core/lib/channel/channel_args.c src/core/lib/channel/channel_stack.c src/core/lib/channel/channel_stack_builder.c src/core/lib/channel/connected_channel.c - src/core/lib/channel/deadline_filter.c src/core/lib/channel/handshaker.c src/core/lib/channel/handshaker_factory.c src/core/lib/channel/handshaker_registry.c @@ -1231,11 +1231,11 @@ endif() add_library(grpc_cronet src/core/lib/surface/init.c + src/core/ext/filters/deadline/deadline_filter.c src/core/lib/channel/channel_args.c src/core/lib/channel/channel_stack.c src/core/lib/channel/channel_stack_builder.c src/core/lib/channel/connected_channel.c - src/core/lib/channel/deadline_filter.c src/core/lib/channel/handshaker.c src/core/lib/channel/handshaker_factory.c src/core/lib/channel/handshaker_registry.c @@ -1539,11 +1539,11 @@ add_library(grpc_test_util test/core/util/port_server_client.c test/core/util/slice_splitter.c test/core/util/trickle_endpoint.c + src/core/ext/filters/deadline/deadline_filter.c src/core/lib/channel/channel_args.c src/core/lib/channel/channel_stack.c src/core/lib/channel/channel_stack_builder.c src/core/lib/channel/connected_channel.c - src/core/lib/channel/deadline_filter.c src/core/lib/channel/handshaker.c src/core/lib/channel/handshaker_factory.c src/core/lib/channel/handshaker_registry.c @@ -1795,11 +1795,11 @@ endif (gRPC_BUILD_TESTS) add_library(grpc_unsecure src/core/lib/surface/init.c src/core/lib/surface/init_unsecure.c + src/core/ext/filters/deadline/deadline_filter.c src/core/lib/channel/channel_args.c src/core/lib/channel/channel_stack.c src/core/lib/channel/channel_stack_builder.c src/core/lib/channel/connected_channel.c - src/core/lib/channel/deadline_filter.c src/core/lib/channel/handshaker.c src/core/lib/channel/handshaker_factory.c src/core/lib/channel/handshaker_registry.c @@ -2212,11 +2212,11 @@ add_library(grpc++ src/cpp/util/status.cc src/cpp/util/string_ref.cc src/cpp/util/time_cc.cc + src/core/ext/filters/deadline/deadline_filter.c src/core/lib/channel/channel_args.c src/core/lib/channel/channel_stack.c src/core/lib/channel/channel_stack_builder.c src/core/lib/channel/connected_channel.c - src/core/lib/channel/deadline_filter.c src/core/lib/channel/handshaker.c src/core/lib/channel/handshaker_factory.c src/core/lib/channel/handshaker_registry.c @@ -2538,11 +2538,11 @@ add_library(grpc++_cronet src/cpp/util/status.cc src/cpp/util/string_ref.cc src/cpp/util/time_cc.cc + src/core/ext/filters/deadline/deadline_filter.c src/core/lib/channel/channel_args.c src/core/lib/channel/channel_stack.c src/core/lib/channel/channel_stack_builder.c src/core/lib/channel/connected_channel.c - src/core/lib/channel/deadline_filter.c src/core/lib/channel/handshaker.c src/core/lib/channel/handshaker_factory.c src/core/lib/channel/handshaker_registry.c @@ -3236,11 +3236,11 @@ add_library(grpc++_unsecure src/cpp/util/status.cc src/cpp/util/string_ref.cc src/cpp/util/time_cc.cc + src/core/ext/filters/deadline/deadline_filter.c src/core/lib/channel/channel_args.c src/core/lib/channel/channel_stack.c src/core/lib/channel/channel_stack_builder.c src/core/lib/channel/connected_channel.c - src/core/lib/channel/deadline_filter.c src/core/lib/channel/handshaker.c src/core/lib/channel/handshaker_factory.c src/core/lib/channel/handshaker_registry.c diff --git a/Makefile b/Makefile index 4e5e21d5665..d9f5d773da1 100644 --- a/Makefile +++ b/Makefile @@ -2813,11 +2813,11 @@ endif LIBGRPC_SRC = \ src/core/lib/surface/init.c \ + src/core/ext/filters/deadline/deadline_filter.c \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ src/core/lib/channel/connected_channel.c \ - src/core/lib/channel/deadline_filter.c \ src/core/lib/channel/handshaker.c \ src/core/lib/channel/handshaker_factory.c \ src/core/lib/channel/handshaker_registry.c \ @@ -3134,11 +3134,11 @@ endif LIBGRPC_CRONET_SRC = \ src/core/lib/surface/init.c \ + src/core/ext/filters/deadline/deadline_filter.c \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ src/core/lib/channel/connected_channel.c \ - src/core/lib/channel/deadline_filter.c \ src/core/lib/channel/handshaker.c \ src/core/lib/channel/handshaker_factory.c \ src/core/lib/channel/handshaker_registry.c \ @@ -3441,11 +3441,11 @@ LIBGRPC_TEST_UTIL_SRC = \ test/core/util/port_server_client.c \ test/core/util/slice_splitter.c \ test/core/util/trickle_endpoint.c \ + src/core/ext/filters/deadline/deadline_filter.c \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ src/core/lib/channel/connected_channel.c \ - src/core/lib/channel/deadline_filter.c \ src/core/lib/channel/handshaker.c \ src/core/lib/channel/handshaker_factory.c \ src/core/lib/channel/handshaker_registry.c \ @@ -3669,11 +3669,11 @@ endif LIBGRPC_UNSECURE_SRC = \ src/core/lib/surface/init.c \ src/core/lib/surface/init_unsecure.c \ + src/core/ext/filters/deadline/deadline_filter.c \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ src/core/lib/channel/connected_channel.c \ - src/core/lib/channel/deadline_filter.c \ src/core/lib/channel/handshaker.c \ src/core/lib/channel/handshaker_factory.c \ src/core/lib/channel/handshaker_registry.c \ @@ -4063,11 +4063,11 @@ LIBGRPC++_SRC = \ src/cpp/util/status.cc \ src/cpp/util/string_ref.cc \ src/cpp/util/time_cc.cc \ + src/core/ext/filters/deadline/deadline_filter.c \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ src/core/lib/channel/connected_channel.c \ - src/core/lib/channel/deadline_filter.c \ src/core/lib/channel/handshaker.c \ src/core/lib/channel/handshaker_factory.c \ src/core/lib/channel/handshaker_registry.c \ @@ -4397,11 +4397,11 @@ LIBGRPC++_CRONET_SRC = \ src/cpp/util/status.cc \ src/cpp/util/string_ref.cc \ src/cpp/util/time_cc.cc \ + src/core/ext/filters/deadline/deadline_filter.c \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ src/core/lib/channel/connected_channel.c \ - src/core/lib/channel/deadline_filter.c \ src/core/lib/channel/handshaker.c \ src/core/lib/channel/handshaker_factory.c \ src/core/lib/channel/handshaker_registry.c \ @@ -5087,11 +5087,11 @@ LIBGRPC++_UNSECURE_SRC = \ src/cpp/util/status.cc \ src/cpp/util/string_ref.cc \ src/cpp/util/time_cc.cc \ + src/core/ext/filters/deadline/deadline_filter.c \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ src/core/lib/channel/connected_channel.c \ - src/core/lib/channel/deadline_filter.c \ src/core/lib/channel/handshaker.c \ src/core/lib/channel/handshaker_factory.c \ src/core/lib/channel/handshaker_registry.c \ diff --git a/binding.gyp b/binding.gyp index ccfbeedc639..8cd5bd50f50 100644 --- a/binding.gyp +++ b/binding.gyp @@ -615,11 +615,11 @@ ], 'sources': [ 'src/core/lib/surface/init.c', + 'src/core/ext/filters/deadline/deadline_filter.c', 'src/core/lib/channel/channel_args.c', 'src/core/lib/channel/channel_stack.c', 'src/core/lib/channel/channel_stack_builder.c', 'src/core/lib/channel/connected_channel.c', - 'src/core/lib/channel/deadline_filter.c', 'src/core/lib/channel/handshaker.c', 'src/core/lib/channel/handshaker_factory.c', 'src/core/lib/channel/handshaker_registry.c', diff --git a/build.yaml b/build.yaml index 6a8abdc8b25..2414180ffe1 100644 --- a/build.yaml +++ b/build.yaml @@ -173,12 +173,12 @@ filegroups: - include/grpc/slice_buffer.h - include/grpc/status.h headers: + - src/core/ext/filters/deadline/deadline_filter.h - src/core/lib/channel/channel_args.h - src/core/lib/channel/channel_stack.h - src/core/lib/channel/channel_stack_builder.h - src/core/lib/channel/connected_channel.h - src/core/lib/channel/context.h - - src/core/lib/channel/deadline_filter.h - src/core/lib/channel/handshaker.h - src/core/lib/channel/handshaker_factory.h - src/core/lib/channel/handshaker_registry.h @@ -280,11 +280,11 @@ filegroups: - src/core/lib/transport/transport.h - src/core/lib/transport/transport_impl.h src: + - src/core/ext/filters/deadline/deadline_filter.c - src/core/lib/channel/channel_args.c - src/core/lib/channel/channel_stack.c - src/core/lib/channel/channel_stack_builder.c - src/core/lib/channel/connected_channel.c - - src/core/lib/channel/deadline_filter.c - src/core/lib/channel/handshaker.c - src/core/lib/channel/handshaker_factory.c - src/core/lib/channel/handshaker_registry.c @@ -448,6 +448,7 @@ filegroups: plugin: grpc_client_channel uses: - grpc_base + - grpc_deadline_filter - name: grpc_codegen public_headers: - include/grpc/impl/codegen/byte_buffer_reader.h @@ -460,6 +461,14 @@ filegroups: - include/grpc/impl/codegen/status.h uses: - gpr_codegen +- name: grpc_deadline_filter + headers: + - src/core/ext/filters/deadline/deadline_filter.h + src: + - src/core/ext/filters/deadline/deadline_filter.c + plugin: grpc_deadline_filter + uses: + - grpc_base - name: grpc_http_filters headers: - src/core/ext/filters/http/client/http_client_filter.h @@ -1011,6 +1020,7 @@ libs: - census - grpc_max_age_filter - grpc_message_size_filter + - grpc_deadline_filter generate_plugin_registry: true secure: true vs_packages: @@ -1109,6 +1119,7 @@ libs: - census - grpc_max_age_filter - grpc_message_size_filter + - grpc_deadline_filter generate_plugin_registry: true secure: false vs_project_guid: '{46CEDFFF-9692-456A-AA24-38B5D6BCF4C5}' diff --git a/config.m4 b/config.m4 index 77ffaa4db45..85593afd3c5 100644 --- a/config.m4 +++ b/config.m4 @@ -83,11 +83,11 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/support/tmpfile_windows.c \ src/core/lib/support/wrap_memcpy.c \ src/core/lib/surface/init.c \ + src/core/ext/filters/deadline/deadline_filter.c \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ src/core/lib/channel/connected_channel.c \ - src/core/lib/channel/deadline_filter.c \ src/core/lib/channel/handshaker.c \ src/core/lib/channel/handshaker_factory.c \ src/core/lib/channel/handshaker_registry.c \ @@ -638,6 +638,7 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/resolver/dns/c_ares) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/resolver/dns/native) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/resolver/sockaddr) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/deadline) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/http) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/http/client) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/http/compress) diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index b0b8686a813..9cd92835ac5 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -255,12 +255,12 @@ Pod::Spec.new do |s| 'src/core/lib/support/tmpfile_posix.c', 'src/core/lib/support/tmpfile_windows.c', 'src/core/lib/support/wrap_memcpy.c', + 'src/core/ext/filters/deadline/deadline_filter.h', 'src/core/lib/channel/channel_args.h', 'src/core/lib/channel/channel_stack.h', 'src/core/lib/channel/channel_stack_builder.h', 'src/core/lib/channel/connected_channel.h', 'src/core/lib/channel/context.h', - 'src/core/lib/channel/deadline_filter.h', 'src/core/lib/channel/handshaker.h', 'src/core/lib/channel/handshaker_factory.h', 'src/core/lib/channel/handshaker_registry.h', @@ -458,11 +458,11 @@ Pod::Spec.new do |s| 'src/core/ext/filters/max_age/max_age_filter.h', 'src/core/ext/filters/message_size/message_size_filter.h', 'src/core/lib/surface/init.c', + 'src/core/ext/filters/deadline/deadline_filter.c', 'src/core/lib/channel/channel_args.c', 'src/core/lib/channel/channel_stack.c', 'src/core/lib/channel/channel_stack_builder.c', 'src/core/lib/channel/connected_channel.c', - 'src/core/lib/channel/deadline_filter.c', 'src/core/lib/channel/handshaker.c', 'src/core/lib/channel/handshaker_factory.c', 'src/core/lib/channel/handshaker_registry.c', @@ -706,12 +706,12 @@ Pod::Spec.new do |s| 'src/core/lib/support/thd_internal.h', 'src/core/lib/support/time_precise.h', 'src/core/lib/support/tmpfile.h', + 'src/core/ext/filters/deadline/deadline_filter.h', 'src/core/lib/channel/channel_args.h', 'src/core/lib/channel/channel_stack.h', 'src/core/lib/channel/channel_stack_builder.h', 'src/core/lib/channel/connected_channel.h', 'src/core/lib/channel/context.h', - 'src/core/lib/channel/deadline_filter.h', 'src/core/lib/channel/handshaker.h', 'src/core/lib/channel/handshaker_factory.h', 'src/core/lib/channel/handshaker_registry.h', diff --git a/grpc.gemspec b/grpc.gemspec index 2ba0ec953b4..0e4a3d6fecd 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -171,12 +171,12 @@ Gem::Specification.new do |s| s.files += %w( include/grpc/impl/codegen/sync_windows.h ) s.files += %w( include/grpc/grpc_security.h ) s.files += %w( include/grpc/census.h ) + s.files += %w( src/core/ext/filters/deadline/deadline_filter.h ) s.files += %w( src/core/lib/channel/channel_args.h ) s.files += %w( src/core/lib/channel/channel_stack.h ) s.files += %w( src/core/lib/channel/channel_stack_builder.h ) s.files += %w( src/core/lib/channel/connected_channel.h ) s.files += %w( src/core/lib/channel/context.h ) - s.files += %w( src/core/lib/channel/deadline_filter.h ) s.files += %w( src/core/lib/channel/handshaker.h ) s.files += %w( src/core/lib/channel/handshaker_factory.h ) s.files += %w( src/core/lib/channel/handshaker_registry.h ) @@ -374,11 +374,11 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/max_age/max_age_filter.h ) s.files += %w( src/core/ext/filters/message_size/message_size_filter.h ) s.files += %w( src/core/lib/surface/init.c ) + s.files += %w( src/core/ext/filters/deadline/deadline_filter.c ) s.files += %w( src/core/lib/channel/channel_args.c ) s.files += %w( src/core/lib/channel/channel_stack.c ) s.files += %w( src/core/lib/channel/channel_stack_builder.c ) s.files += %w( src/core/lib/channel/connected_channel.c ) - s.files += %w( src/core/lib/channel/deadline_filter.c ) s.files += %w( src/core/lib/channel/handshaker.c ) s.files += %w( src/core/lib/channel/handshaker_factory.c ) s.files += %w( src/core/lib/channel/handshaker_registry.c ) diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index 83bdd80f2c5..30fe8d216b0 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -178,6 +178,9 @@ typedef struct { /** Enable/disable support for per-message compression. Defaults to 1, unless GRPC_ARG_MINIMAL_STACK is enabled, in which case it defaults to 0. */ #define GRPC_ARG_ENABLE_PER_MESSAGE_COMPRESSION "grpc.per_message_compression" +/** Enable/disable support for deadline checking. Defaults to 1, unless + GRPC_ARG_MINIMAL_STACK is enabled, in which case it defaults to 0 */ +#define GRPC_ARG_ENABLE_DEADLINE_CHECKS "grpc.enable_deadline_checking" /** Initial sequence number for http2 transports. Int valued. */ #define GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER \ "grpc.http2.initial_sequence_number" diff --git a/package.xml b/package.xml index 7faa5320822..8cda68a2666 100644 --- a/package.xml +++ b/package.xml @@ -180,12 +180,12 @@ + - @@ -383,11 +383,11 @@ + - diff --git a/src/core/ext/filters/client_channel/client_channel.c b/src/core/ext/filters/client_channel/client_channel.c index d2892724898..4b6c5328202 100644 --- a/src/core/ext/filters/client_channel/client_channel.c +++ b/src/core/ext/filters/client_channel/client_channel.c @@ -49,9 +49,9 @@ #include "src/core/ext/filters/client_channel/resolver_registry.h" #include "src/core/ext/filters/client_channel/retry_throttle.h" #include "src/core/ext/filters/client_channel/subchannel.h" +#include "src/core/ext/filters/deadline/deadline_filter.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/connected_channel.h" -#include "src/core/lib/channel/deadline_filter.h" #include "src/core/lib/iomgr/combiner.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/iomgr/polling_entity.h" @@ -183,6 +183,8 @@ typedef struct client_channel_channel_data { grpc_resolver *resolver; /** have we started resolving this channel */ bool started_resolving; + /** is deadline checking enabled? */ + bool deadline_checking_enabled; /** client channel factory */ grpc_client_channel_factory *client_channel_factory; @@ -676,6 +678,8 @@ static grpc_error *cc_init_channel_elem(grpc_exec_ctx *exec_ctx, if (chand->resolver == NULL) { return GRPC_ERROR_CREATE_FROM_STATIC_STRING("resolver creation failed"); } + chand->deadline_checking_enabled = + grpc_deadline_checking_enabled(args->channel_args); return GRPC_ERROR_NONE; } @@ -863,12 +867,14 @@ static void apply_final_configuration_locked(grpc_exec_ctx *exec_ctx, /* apply service-config level configuration to the call (now that we're * certain it exists) */ call_data *calld = elem->call_data; + channel_data *chand = elem->channel_data; gpr_timespec per_method_deadline; if (set_call_method_params_from_service_config_locked(exec_ctx, elem, &per_method_deadline)) { // If the deadline from the service config is shorter than the one // from the client API, reset the deadline timer. - if (gpr_time_cmp(per_method_deadline, calld->deadline) < 0) { + if (chand->deadline_checking_enabled && + gpr_time_cmp(per_method_deadline, calld->deadline) < 0) { calld->deadline = per_method_deadline; grpc_deadline_state_reset(exec_ctx, elem, calld->deadline); } @@ -1222,7 +1228,9 @@ static void cc_start_transport_stream_op(grpc_exec_ctx *exec_ctx, call_data *calld = elem->call_data; channel_data *chand = elem->channel_data; GRPC_CALL_LOG_OP(GPR_INFO, elem, op); - grpc_deadline_state_client_start_transport_stream_op(exec_ctx, elem, op); + if (chand->deadline_checking_enabled) { + grpc_deadline_state_client_start_transport_stream_op(exec_ctx, elem, op); + } /* try to (atomically) get the call */ grpc_subchannel_call *call = GET_CALL(calld); GPR_TIMER_BEGIN("cc_start_transport_stream_op", 0); @@ -1256,14 +1264,17 @@ static grpc_error *cc_init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, const grpc_call_element_args *args) { call_data *calld = elem->call_data; + channel_data *chand = elem->channel_data; // Initialize data members. - grpc_deadline_state_init(exec_ctx, elem, args->call_stack); calld->path = grpc_slice_ref_internal(args->path); calld->call_start_time = args->start_time; calld->deadline = gpr_convert_clock_type(args->deadline, GPR_CLOCK_MONOTONIC); calld->owning_call = args->call_stack; calld->arena = args->arena; - grpc_deadline_state_start(exec_ctx, elem, calld->deadline); + if (chand->deadline_checking_enabled) { + grpc_deadline_state_init(exec_ctx, elem, args->call_stack); + grpc_deadline_state_start(exec_ctx, elem, calld->deadline); + } return GRPC_ERROR_NONE; } @@ -1273,7 +1284,10 @@ static void cc_destroy_call_elem(grpc_exec_ctx *exec_ctx, const grpc_call_final_info *final_info, grpc_closure *then_schedule_closure) { call_data *calld = elem->call_data; - grpc_deadline_state_destroy(exec_ctx, elem); + channel_data *chand = elem->channel_data; + if (chand->deadline_checking_enabled) { + grpc_deadline_state_destroy(exec_ctx, elem); + } grpc_slice_unref_internal(exec_ctx, calld->path); if (calld->method_params != NULL) { method_parameters_unref(calld->method_params); diff --git a/src/core/lib/channel/deadline_filter.c b/src/core/ext/filters/deadline/deadline_filter.c similarity index 90% rename from src/core/lib/channel/deadline_filter.c rename to src/core/ext/filters/deadline/deadline_filter.c index ca701ed4575..18f7145cebf 100644 --- a/src/core/lib/channel/deadline_filter.c +++ b/src/core/ext/filters/deadline/deadline_filter.c @@ -29,7 +29,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -#include "src/core/lib/channel/deadline_filter.h" +#include "src/core/ext/filters/deadline/deadline_filter.h" #include #include @@ -39,9 +39,11 @@ #include #include +#include "src/core/lib/channel/channel_stack_builder.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/timer.h" #include "src/core/lib/slice/slice_internal.h" +#include "src/core/lib/surface/channel_init.h" // // grpc_deadline_state @@ -342,3 +344,34 @@ const grpc_channel_filter grpc_server_deadline_filter = { grpc_channel_next_get_info, "deadline", }; + +bool grpc_deadline_checking_enabled(const grpc_channel_args* channel_args) { + bool enable = !grpc_channel_args_want_minimal_stack(channel_args); + const grpc_arg* a = + grpc_channel_args_find(channel_args, GRPC_ARG_ENABLE_DEADLINE_CHECKS); + if (a != NULL && a->type == GRPC_ARG_INTEGER && a->value.integer != 0) { + enable = true; + } + return enable; +} + +static bool maybe_add_deadline_filter(grpc_exec_ctx* exec_ctx, + grpc_channel_stack_builder* builder, + void* arg) { + return grpc_deadline_checking_enabled( + grpc_channel_stack_builder_get_channel_arguments(builder)) + ? grpc_channel_stack_builder_prepend_filter(builder, arg, NULL, + NULL) + : true; +} + +void grpc_deadline_filter_init(void) { + grpc_channel_init_register_stage( + GRPC_CLIENT_DIRECT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, + maybe_add_deadline_filter, (void*)&grpc_client_deadline_filter); + grpc_channel_init_register_stage( + GRPC_SERVER_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, + maybe_add_deadline_filter, (void*)&grpc_server_deadline_filter); +} + +void grpc_deadline_filter_shutdown(void) {} diff --git a/src/core/lib/channel/deadline_filter.h b/src/core/ext/filters/deadline/deadline_filter.h similarity index 97% rename from src/core/lib/channel/deadline_filter.h rename to src/core/ext/filters/deadline/deadline_filter.h index 72cd5cb9296..e1e3f5280b2 100644 --- a/src/core/lib/channel/deadline_filter.h +++ b/src/core/ext/filters/deadline/deadline_filter.h @@ -93,6 +93,9 @@ void grpc_deadline_state_client_start_transport_stream_op( grpc_exec_ctx* exec_ctx, grpc_call_element* elem, grpc_transport_stream_op* op); +// Should deadline checking be performed (according to channel args) +bool grpc_deadline_checking_enabled(const grpc_channel_args* args); + // Deadline filters for direct client channels and server channels. // Note: Deadlines for non-direct client channels are handled by the // client_channel filter. diff --git a/src/core/lib/surface/init.c b/src/core/lib/surface/init.c index bba259c0994..4b381b19546 100644 --- a/src/core/lib/surface/init.c +++ b/src/core/lib/surface/init.c @@ -42,7 +42,6 @@ #include #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/channel/connected_channel.h" -#include "src/core/lib/channel/deadline_filter.h" #include "src/core/lib/channel/handshaker_registry.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/http/parser.h" @@ -92,12 +91,6 @@ static bool prepend_filter(grpc_exec_ctx *exec_ctx, } static void register_builtin_channel_init() { - grpc_channel_init_register_stage( - GRPC_CLIENT_DIRECT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, - prepend_filter, (void *)&grpc_client_deadline_filter); - grpc_channel_init_register_stage( - GRPC_SERVER_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, prepend_filter, - (void *)&grpc_server_deadline_filter); grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, grpc_add_connected_filter, NULL); diff --git a/src/core/plugin_registry/grpc_cronet_plugin_registry.c b/src/core/plugin_registry/grpc_cronet_plugin_registry.c index 6cc3a25c550..907e5a0f394 100644 --- a/src/core/plugin_registry/grpc_cronet_plugin_registry.c +++ b/src/core/plugin_registry/grpc_cronet_plugin_registry.c @@ -37,6 +37,8 @@ extern void grpc_http_filters_init(void); extern void grpc_http_filters_shutdown(void); extern void grpc_chttp2_plugin_init(void); extern void grpc_chttp2_plugin_shutdown(void); +extern void grpc_deadline_filter_init(void); +extern void grpc_deadline_filter_shutdown(void); extern void grpc_client_channel_init(void); extern void grpc_client_channel_shutdown(void); extern void grpc_load_reporting_plugin_init(void); @@ -47,6 +49,8 @@ void grpc_register_built_in_plugins(void) { grpc_http_filters_shutdown); grpc_register_plugin(grpc_chttp2_plugin_init, grpc_chttp2_plugin_shutdown); + grpc_register_plugin(grpc_deadline_filter_init, + grpc_deadline_filter_shutdown); grpc_register_plugin(grpc_client_channel_init, grpc_client_channel_shutdown); grpc_register_plugin(grpc_load_reporting_plugin_init, diff --git a/src/core/plugin_registry/grpc_plugin_registry.c b/src/core/plugin_registry/grpc_plugin_registry.c index 40a882d50cb..25bda7a2622 100644 --- a/src/core/plugin_registry/grpc_plugin_registry.c +++ b/src/core/plugin_registry/grpc_plugin_registry.c @@ -37,6 +37,8 @@ extern void grpc_http_filters_init(void); extern void grpc_http_filters_shutdown(void); extern void grpc_chttp2_plugin_init(void); extern void grpc_chttp2_plugin_shutdown(void); +extern void grpc_deadline_filter_init(void); +extern void grpc_deadline_filter_shutdown(void); extern void grpc_client_channel_init(void); extern void grpc_client_channel_shutdown(void); extern void grpc_lb_policy_grpclb_init(void); @@ -65,6 +67,8 @@ void grpc_register_built_in_plugins(void) { grpc_http_filters_shutdown); grpc_register_plugin(grpc_chttp2_plugin_init, grpc_chttp2_plugin_shutdown); + grpc_register_plugin(grpc_deadline_filter_init, + grpc_deadline_filter_shutdown); grpc_register_plugin(grpc_client_channel_init, grpc_client_channel_shutdown); grpc_register_plugin(grpc_lb_policy_grpclb_init, diff --git a/src/core/plugin_registry/grpc_unsecure_plugin_registry.c b/src/core/plugin_registry/grpc_unsecure_plugin_registry.c index ded2aa6a840..05d4771bce3 100644 --- a/src/core/plugin_registry/grpc_unsecure_plugin_registry.c +++ b/src/core/plugin_registry/grpc_unsecure_plugin_registry.c @@ -37,6 +37,8 @@ extern void grpc_http_filters_init(void); extern void grpc_http_filters_shutdown(void); extern void grpc_chttp2_plugin_init(void); extern void grpc_chttp2_plugin_shutdown(void); +extern void grpc_deadline_filter_init(void); +extern void grpc_deadline_filter_shutdown(void); extern void grpc_client_channel_init(void); extern void grpc_client_channel_shutdown(void); extern void grpc_resolver_dns_ares_init(void); @@ -65,6 +67,8 @@ void grpc_register_built_in_plugins(void) { grpc_http_filters_shutdown); grpc_register_plugin(grpc_chttp2_plugin_init, grpc_chttp2_plugin_shutdown); + grpc_register_plugin(grpc_deadline_filter_init, + grpc_deadline_filter_shutdown); grpc_register_plugin(grpc_client_channel_init, grpc_client_channel_shutdown); grpc_register_plugin(grpc_resolver_dns_ares_init, diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index f99e777532e..c858dc9e1f5 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -77,11 +77,11 @@ CORE_SOURCE_FILES = [ 'src/core/lib/support/tmpfile_windows.c', 'src/core/lib/support/wrap_memcpy.c', 'src/core/lib/surface/init.c', + 'src/core/ext/filters/deadline/deadline_filter.c', 'src/core/lib/channel/channel_args.c', 'src/core/lib/channel/channel_stack.c', 'src/core/lib/channel/channel_stack_builder.c', 'src/core/lib/channel/connected_channel.c', - 'src/core/lib/channel/deadline_filter.c', 'src/core/lib/channel/handshaker.c', 'src/core/lib/channel/handshaker_factory.c', 'src/core/lib/channel/handshaker_registry.c', diff --git a/test/core/channel/minimal_stack_is_minimal_test.c b/test/core/channel/minimal_stack_is_minimal_test.c index f7bdc1b8435..b76e812a61f 100644 --- a/test/core/channel/minimal_stack_is_minimal_test.c +++ b/test/core/channel/minimal_stack_is_minimal_test.c @@ -77,20 +77,20 @@ int main(int argc, char **argv) { "client-channel", NULL); // tests with a default stack - errors += CHECK_STACK("unknown", NULL, GRPC_CLIENT_DIRECT_CHANNEL, "deadline", - "message_size", "connected", NULL); + errors += CHECK_STACK("unknown", NULL, GRPC_CLIENT_DIRECT_CHANNEL, + "message_size", "deadline", "connected", NULL); errors += CHECK_STACK("unknown", NULL, GRPC_CLIENT_SUBCHANNEL, "message_size", "connected", NULL); errors += CHECK_STACK("unknown", NULL, GRPC_SERVER_CHANNEL, "server", - "deadline", "message_size", "connected", NULL); + "message_size", "deadline", "connected", NULL); errors += - CHECK_STACK("chttp2", NULL, GRPC_CLIENT_DIRECT_CHANNEL, "deadline", - "message_size", "http-client", "compress", "connected", NULL); + CHECK_STACK("chttp2", NULL, GRPC_CLIENT_DIRECT_CHANNEL, "message_size", + "deadline", "http-client", "compress", "connected", NULL); errors += CHECK_STACK("chttp2", NULL, GRPC_CLIENT_SUBCHANNEL, "message_size", "http-client", "compress", "connected", NULL); errors += - CHECK_STACK("chttp2", NULL, GRPC_SERVER_CHANNEL, "server", "deadline", - "message_size", "http-server", "compress", "connected", NULL); + CHECK_STACK("chttp2", NULL, GRPC_SERVER_CHANNEL, "server", "message_size", + "deadline", "http-server", "compress", "connected", NULL); errors += CHECK_STACK(NULL, NULL, GRPC_CLIENT_CHANNEL, "client-channel", NULL); @@ -147,6 +147,7 @@ static int check_stack(const char *file, int line, const char *transport_name, } char *got = gpr_strvec_flatten(&v, NULL); gpr_strvec_destroy(&v); + grpc_channel_stack_builder_iterator_destroy(it); // figure out result, log if there's an error int result = 0; diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index 3fcd5bc6ab7..694765e013b 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -50,7 +50,7 @@ extern "C" { #include "src/core/lib/channel/channel_stack.h" #include "src/core/ext/filters/http/compress/compress_filter.h" #include "src/core/lib/channel/connected_channel.h" -#include "src/core/lib/channel/deadline_filter.h" +#include "src/core/ext/filters/deadline/deadline_filter.h" #include "src/core/ext/filters/http/client/http_client_filter.h" #include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/ext/filters/message_size/message_size_filter.h" diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index add3cb1857b..759c7071d03 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -900,6 +900,8 @@ include/grpc/load_reporting.h \ include/grpc/slice.h \ include/grpc/slice_buffer.h \ include/grpc/status.h \ +src/core/ext/filters/deadline/deadline_filter.c \ +src/core/ext/filters/deadline/deadline_filter.h \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_args.h \ src/core/lib/channel/channel_stack.c \ @@ -909,8 +911,6 @@ src/core/lib/channel/channel_stack_builder.h \ src/core/lib/channel/connected_channel.c \ src/core/lib/channel/connected_channel.h \ src/core/lib/channel/context.h \ -src/core/lib/channel/deadline_filter.c \ -src/core/lib/channel/deadline_filter.h \ src/core/lib/channel/handshaker.c \ src/core/lib/channel/handshaker.h \ src/core/lib/channel/handshaker_factory.c \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 8db6e146a32..8bc5896e88c 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -954,6 +954,8 @@ src/core/ext/filters/client_channel/subchannel_index.c \ src/core/ext/filters/client_channel/subchannel_index.h \ src/core/ext/filters/client_channel/uri_parser.c \ src/core/ext/filters/client_channel/uri_parser.h \ +src/core/ext/filters/deadline/deadline_filter.c \ +src/core/ext/filters/deadline/deadline_filter.h \ src/core/ext/filters/http/client/http_client_filter.c \ src/core/ext/filters/http/client/http_client_filter.h \ src/core/ext/filters/http/compress/compress_filter.c \ @@ -1037,8 +1039,6 @@ src/core/lib/channel/channel_stack_builder.h \ src/core/lib/channel/connected_channel.c \ src/core/lib/channel/connected_channel.h \ src/core/lib/channel/context.h \ -src/core/lib/channel/deadline_filter.c \ -src/core/lib/channel/deadline_filter.h \ src/core/lib/channel/handshaker.c \ src/core/lib/channel/handshaker.h \ src/core/lib/channel/handshaker_factory.c \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 03cf01be0f5..894a8953de0 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -5589,6 +5589,7 @@ "census", "gpr", "grpc_base", + "grpc_deadline_filter", "grpc_lb_policy_grpclb_secure", "grpc_lb_policy_pick_first", "grpc_lb_policy_round_robin", @@ -5693,6 +5694,7 @@ "census", "gpr", "grpc_base", + "grpc_deadline_filter", "grpc_lb_policy_grpclb", "grpc_lb_policy_pick_first", "grpc_lb_policy_round_robin", @@ -7523,12 +7525,12 @@ "include/grpc/slice.h", "include/grpc/slice_buffer.h", "include/grpc/status.h", + "src/core/ext/filters/deadline/deadline_filter.h", "src/core/lib/channel/channel_args.h", "src/core/lib/channel/channel_stack.h", "src/core/lib/channel/channel_stack_builder.h", "src/core/lib/channel/connected_channel.h", "src/core/lib/channel/context.h", - "src/core/lib/channel/deadline_filter.h", "src/core/lib/channel/handshaker.h", "src/core/lib/channel/handshaker_factory.h", "src/core/lib/channel/handshaker_registry.h", @@ -7644,6 +7646,8 @@ "include/grpc/slice.h", "include/grpc/slice_buffer.h", "include/grpc/status.h", + "src/core/ext/filters/deadline/deadline_filter.c", + "src/core/ext/filters/deadline/deadline_filter.h", "src/core/lib/channel/channel_args.c", "src/core/lib/channel/channel_args.h", "src/core/lib/channel/channel_stack.c", @@ -7653,8 +7657,6 @@ "src/core/lib/channel/connected_channel.c", "src/core/lib/channel/connected_channel.h", "src/core/lib/channel/context.h", - "src/core/lib/channel/deadline_filter.c", - "src/core/lib/channel/deadline_filter.h", "src/core/lib/channel/handshaker.c", "src/core/lib/channel/handshaker.h", "src/core/lib/channel/handshaker_factory.c", @@ -7877,7 +7879,8 @@ { "deps": [ "gpr", - "grpc_base" + "grpc_base", + "grpc_deadline_filter" ], "headers": [ "src/core/ext/filters/client_channel/client_channel.h", @@ -7975,6 +7978,24 @@ "third_party": false, "type": "filegroup" }, + { + "deps": [ + "gpr", + "grpc_base" + ], + "headers": [ + "src/core/ext/filters/deadline/deadline_filter.h" + ], + "is_filegroup": true, + "language": "c", + "name": "grpc_deadline_filter", + "src": [ + "src/core/ext/filters/deadline/deadline_filter.c", + "src/core/ext/filters/deadline/deadline_filter.h" + ], + "third_party": false, + "type": "filegroup" + }, { "deps": [], "headers": [ diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj b/vsprojects/vcxproj/grpc++/grpc++.vcxproj index c37cb77d5bf..7ffd0202e0f 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj @@ -377,12 +377,12 @@ + - @@ -571,6 +571,8 @@ + + @@ -579,8 +581,6 @@ - - diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters index 8f7e5769989..5390d96a134 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters @@ -124,6 +124,9 @@ src\cpp\util + + src\core\ext\filters\deadline + src\core\lib\channel @@ -136,9 +139,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\channel @@ -851,6 +851,9 @@ src\cpp\thread_manager + + src\core\ext\filters\deadline + src\core\lib\channel @@ -866,9 +869,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\channel @@ -1226,6 +1226,15 @@ {d02f1155-7e7e-3736-3c69-dc9146dc523d} + + {96d09c4a-59f9-3486-6c2f-cbf695b285d8} + + + {ec936f3c-c278-59b3-1fcf-d17ab77c8546} + + + {136a9e7f-2e8b-7cff-c961-5149529ca0f5} + {80567a8f-622f-a3ce-c12d-aebb63984b07} diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj index 973c0163058..c954241d312 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -371,12 +371,12 @@ + - @@ -555,6 +555,8 @@ + + @@ -563,8 +565,6 @@ - - diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index 6da1a2bcbae..9b2463fdee1 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -109,6 +109,9 @@ src\cpp\util + + src\core\ext\filters\deadline + src\core\lib\channel @@ -121,9 +124,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\channel @@ -818,6 +818,9 @@ src\cpp\thread_manager + + src\core\ext\filters\deadline + src\core\lib\channel @@ -833,9 +836,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\channel @@ -1193,6 +1193,15 @@ {595f2ea0-aafb-87e5-c938-db3ff0b0c69a} + + {52eca76b-9502-3d96-9064-6415226a860f} + + + {d2564ab1-6815-d425-3f8a-31693cc2ac81} + + + {0cc70f19-99bb-5e9e-99d9-b103398c0e76} + {cf8fd5d8-ff54-331d-2d20-36d6cae0e14b} diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index 47d28e06ca2..093ac413bb7 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -300,12 +300,12 @@ + - @@ -506,6 +506,8 @@ + + @@ -514,8 +516,6 @@ - - diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index f67b7ab3f88..14a30993c86 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -4,6 +4,9 @@ src\core\lib\surface + + src\core\ext\filters\deadline + src\core\lib\channel @@ -16,9 +19,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\channel @@ -800,6 +800,9 @@ + + src\core\ext\filters\deadline + src\core\lib\channel @@ -815,9 +818,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\channel @@ -1481,6 +1481,9 @@ {bd317dd5-323e-5b27-4c05-d85786be36ab} + + {c8dcda4e-dbaa-1ae8-67a9-0dd26046f652} + {2e3ab9f3-39ca-db39-cb3e-2196cbc68098} diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj index 382e5af7e32..f549452cc99 100644 --- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj +++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj @@ -195,12 +195,12 @@ + - @@ -343,6 +343,8 @@ + + @@ -351,8 +353,6 @@ - - diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters index db22acc6855..11dfb8baa57 100644 --- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters @@ -61,6 +61,9 @@ test\core\util + + src\core\ext\filters\deadline + src\core\lib\channel @@ -73,9 +76,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\channel @@ -563,6 +563,9 @@ test\core\util + + src\core\ext\filters\deadline + src\core\lib\channel @@ -578,9 +581,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\channel @@ -902,6 +902,15 @@ {f7bfac91-5eb2-dea7-4601-6c63edbbf997} + + {5db70e06-741d-708c-bf0a-b59f8ca1f8bd} + + + {f0f88514-c2d8-c4c9-c3bd-591682207751} + + + {2c9ab189-bb7e-355d-9f37-385472e86b9f} + {f4e8c61e-1ca6-0fdd-7b5e-b7f9a30c9a21} diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index 336902647ac..cfad8b85b9d 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -290,12 +290,12 @@ + - @@ -474,6 +474,8 @@ + + @@ -482,8 +484,6 @@ - - diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index 53a47482324..153fb856eeb 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -7,6 +7,9 @@ src\core\lib\surface + + src\core\ext\filters\deadline + src\core\lib\channel @@ -19,9 +22,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\channel @@ -713,6 +713,9 @@ + + src\core\ext\filters\deadline + src\core\lib\channel @@ -728,9 +731,6 @@ src\core\lib\channel - - src\core\lib\channel - src\core\lib\channel @@ -1322,6 +1322,9 @@ {99210f5e-b2a0-ecd1-024f-fc152db68a11} + + {ac374be1-7a3f-14a8-69fe-badac2d9f9ec} + {33287f7d-739b-d30d-a9f3-b338103456b0} From f795feb3c8b73bc0a79ad64abf72fa33a1ebdb83 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 3 Apr 2017 14:37:09 -0700 Subject: [PATCH 147/461] Document this test --- .../channel/minimal_stack_is_minimal_test.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/core/channel/minimal_stack_is_minimal_test.c b/test/core/channel/minimal_stack_is_minimal_test.c index b76e812a61f..bac94cbd645 100644 --- a/test/core/channel/minimal_stack_is_minimal_test.c +++ b/test/core/channel/minimal_stack_is_minimal_test.c @@ -31,6 +31,19 @@ * */ +/******************************************************************************* + * This test verifies that various stack configurations result in the set of + * filters that we expect. + * + * This is akin to a golden-file test, and suffers the same disadvantages and + * advantages: it reflects that the code as written has not been modified - and + * valid code modifications WILL break this test and it will need updating. + * + * The intent therefore is to allow code reviewers to more easily catch changes + * that perturb the generated list of channel filters in different + * configurations and assess whether such a change is correct and desirable. + */ + #include #include #include @@ -43,10 +56,18 @@ #include "src/core/lib/transport/transport_impl.h" #include "test/core/util/test_config.h" +// use CHECK_STACK instead static int check_stack(const char *file, int line, const char *transport_name, grpc_channel_args *init_args, grpc_channel_stack_type channel_stack_type, ...); +// arguments: const char *transport_name - the name of the transport type to +// simulate +// grpc_channel_args *init_args - channel args to pass down +// grpc_channel_stack_type channel_stack_type - the archetype of +// channel stack to create +// variadic arguments - the (in-order) expected list of channel +// filters to instantiate, terminated with NULL #define CHECK_STACK(...) check_stack(__FILE__, __LINE__, __VA_ARGS__) int main(int argc, char **argv) { @@ -99,6 +120,10 @@ int main(int argc, char **argv) { return 0; } +/******************************************************************************* + * End of tests definitions, start of test infrastructure + */ + static int check_stack(const char *file, int line, const char *transport_name, grpc_channel_args *init_args, grpc_channel_stack_type channel_stack_type, ...) { From e3593d912bc851e8ee7be89a7fb2c484dbc7e902 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 3 Apr 2017 14:51:02 -0700 Subject: [PATCH 148/461] Fix sanity --- src/core/ext/filters/deadline/deadline_filter.h | 6 +++--- src/core/ext/filters/http/client/http_client_filter.h | 6 +++--- src/core/ext/filters/http/compress/compress_filter.h | 6 +++--- src/core/ext/filters/http/server/http_server_filter.h | 6 +++--- src/core/ext/filters/message_size/message_size_filter.h | 6 +++--- src/core/ext/transport/chttp2/server/chttp2_server.c | 2 +- src/core/lib/security/credentials/credentials.c | 2 +- src/core/lib/security/credentials/ssl/ssl_credentials.c | 2 +- test/core/bad_client/bad_client.c | 2 +- test/core/end2end/fixtures/h2_census.c | 2 +- test/core/end2end/fixtures/h2_compress.c | 2 +- test/core/end2end/fixtures/h2_full+pipe.c | 2 +- test/core/end2end/fixtures/h2_full+trace.c | 2 +- test/core/end2end/fixtures/h2_full.c | 2 +- test/core/end2end/fixtures/h2_http_proxy.c | 2 +- test/core/end2end/fixtures/h2_load_reporting.c | 2 +- test/core/end2end/fixtures/h2_proxy.c | 2 +- test/core/end2end/fixtures/h2_sockpair+trace.c | 6 +++--- test/core/end2end/fixtures/h2_sockpair.c | 6 +++--- test/core/end2end/fixtures/h2_sockpair_1byte.c | 6 +++--- test/core/end2end/fixtures/h2_uds.c | 2 +- test/cpp/microbenchmarks/bm_call_create.cc | 8 ++++---- 22 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/core/ext/filters/deadline/deadline_filter.h b/src/core/ext/filters/deadline/deadline_filter.h index e1e3f5280b2..060d2f12a8c 100644 --- a/src/core/ext/filters/deadline/deadline_filter.h +++ b/src/core/ext/filters/deadline/deadline_filter.h @@ -29,8 +29,8 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -#ifndef GRPC_CORE_LIB_CHANNEL_DEADLINE_FILTER_H -#define GRPC_CORE_LIB_CHANNEL_DEADLINE_FILTER_H +#ifndef GRPC_CORE_EXT_FILTERS_DEADLINE_DEADLINE_FILTER_H +#define GRPC_CORE_EXT_FILTERS_DEADLINE_DEADLINE_FILTER_H #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/iomgr/timer.h" @@ -102,4 +102,4 @@ bool grpc_deadline_checking_enabled(const grpc_channel_args* args); extern const grpc_channel_filter grpc_client_deadline_filter; extern const grpc_channel_filter grpc_server_deadline_filter; -#endif /* GRPC_CORE_LIB_CHANNEL_DEADLINE_FILTER_H */ +#endif /* GRPC_CORE_EXT_FILTERS_DEADLINE_DEADLINE_FILTER_H */ diff --git a/src/core/ext/filters/http/client/http_client_filter.h b/src/core/ext/filters/http/client/http_client_filter.h index 9e6e106e9cb..109702f6670 100644 --- a/src/core/ext/filters/http/client/http_client_filter.h +++ b/src/core/ext/filters/http/client/http_client_filter.h @@ -30,8 +30,8 @@ * */ -#ifndef GRPC_CORE_LIB_CHANNEL_HTTP_CLIENT_FILTER_H -#define GRPC_CORE_LIB_CHANNEL_HTTP_CLIENT_FILTER_H +#ifndef GRPC_CORE_EXT_FILTERS_HTTP_CLIENT_HTTP_CLIENT_FILTER_H +#define GRPC_CORE_EXT_FILTERS_HTTP_CLIENT_HTTP_CLIENT_FILTER_H #include "src/core/lib/channel/channel_stack.h" @@ -44,4 +44,4 @@ extern const grpc_channel_filter grpc_http_client_filter; /* Channel arg to determine maximum size of payload eligable for GET request */ #define GRPC_ARG_MAX_PAYLOAD_SIZE_FOR_GET "grpc.max_payload_size_for_get" -#endif /* GRPC_CORE_LIB_CHANNEL_HTTP_CLIENT_FILTER_H */ +#endif /* GRPC_CORE_EXT_FILTERS_HTTP_CLIENT_HTTP_CLIENT_FILTER_H */ diff --git a/src/core/ext/filters/http/compress/compress_filter.h b/src/core/ext/filters/http/compress/compress_filter.h index e4a2a829d59..68d2b8766ab 100644 --- a/src/core/ext/filters/http/compress/compress_filter.h +++ b/src/core/ext/filters/http/compress/compress_filter.h @@ -31,8 +31,8 @@ * */ -#ifndef GRPC_CORE_LIB_CHANNEL_COMPRESS_FILTER_H -#define GRPC_CORE_LIB_CHANNEL_COMPRESS_FILTER_H +#ifndef GRPC_CORE_EXT_FILTERS_HTTP_COMPRESS_COMPRESS_FILTER_H +#define GRPC_CORE_EXT_FILTERS_HTTP_COMPRESS_COMPRESS_FILTER_H #include @@ -64,4 +64,4 @@ extern int grpc_compression_trace; extern const grpc_channel_filter grpc_compress_filter; -#endif /* GRPC_CORE_LIB_CHANNEL_COMPRESS_FILTER_H */ +#endif /* GRPC_CORE_EXT_FILTERS_HTTP_COMPRESS_COMPRESS_FILTER_H */ diff --git a/src/core/ext/filters/http/server/http_server_filter.h b/src/core/ext/filters/http/server/http_server_filter.h index 77ba2d263d1..8a2b2196ae1 100644 --- a/src/core/ext/filters/http/server/http_server_filter.h +++ b/src/core/ext/filters/http/server/http_server_filter.h @@ -31,12 +31,12 @@ * */ -#ifndef GRPC_CORE_LIB_CHANNEL_HTTP_SERVER_FILTER_H -#define GRPC_CORE_LIB_CHANNEL_HTTP_SERVER_FILTER_H +#ifndef GRPC_CORE_EXT_FILTERS_HTTP_SERVER_HTTP_SERVER_FILTER_H +#define GRPC_CORE_EXT_FILTERS_HTTP_SERVER_HTTP_SERVER_FILTER_H #include "src/core/lib/channel/channel_stack.h" /* Processes metadata on the client side for HTTP2 transports */ extern const grpc_channel_filter grpc_http_server_filter; -#endif /* GRPC_CORE_LIB_CHANNEL_HTTP_SERVER_FILTER_H */ +#endif /* GRPC_CORE_EXT_FILTERS_HTTP_SERVER_HTTP_SERVER_FILTER_H */ diff --git a/src/core/ext/filters/message_size/message_size_filter.h b/src/core/ext/filters/message_size/message_size_filter.h index a88ff7f81a1..83980e738cb 100644 --- a/src/core/ext/filters/message_size/message_size_filter.h +++ b/src/core/ext/filters/message_size/message_size_filter.h @@ -29,11 +29,11 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -#ifndef GRPC_CORE_LIB_CHANNEL_MESSAGE_SIZE_FILTER_H -#define GRPC_CORE_LIB_CHANNEL_MESSAGE_SIZE_FILTER_H +#ifndef GRPC_CORE_EXT_FILTERS_MESSAGE_SIZE_MESSAGE_SIZE_FILTER_H +#define GRPC_CORE_EXT_FILTERS_MESSAGE_SIZE_MESSAGE_SIZE_FILTER_H #include "src/core/lib/channel/channel_stack.h" extern const grpc_channel_filter grpc_message_size_filter; -#endif /* GRPC_CORE_LIB_CHANNEL_MESSAGE_SIZE_FILTER_H */ +#endif /* GRPC_CORE_EXT_FILTERS_MESSAGE_SIZE_MESSAGE_SIZE_FILTER_H */ diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.c b/src/core/ext/transport/chttp2/server/chttp2_server.c index ede8eed9274..b463506a98f 100644 --- a/src/core/ext/transport/chttp2/server/chttp2_server.c +++ b/src/core/ext/transport/chttp2/server/chttp2_server.c @@ -43,11 +43,11 @@ #include #include +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/handshaker.h" #include "src/core/lib/channel/handshaker_registry.h" -#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/resolve_address.h" #include "src/core/lib/iomgr/tcp_server.h" diff --git a/src/core/lib/security/credentials/credentials.c b/src/core/lib/security/credentials/credentials.c index 18d4604c4a9..700aae1bc5f 100644 --- a/src/core/lib/security/credentials/credentials.c +++ b/src/core/lib/security/credentials/credentials.c @@ -36,8 +36,8 @@ #include #include -#include "src/core/lib/channel/channel_args.h" #include "src/core/ext/filters/http/client/http_client_filter.h" +#include "src/core/lib/channel/channel_args.h" #include "src/core/lib/http/httpcli.h" #include "src/core/lib/http/parser.h" #include "src/core/lib/iomgr/executor.h" diff --git a/src/core/lib/security/credentials/ssl/ssl_credentials.c b/src/core/lib/security/credentials/ssl/ssl_credentials.c index 35dda88ec6a..9dccbb1e5db 100644 --- a/src/core/lib/security/credentials/ssl/ssl_credentials.c +++ b/src/core/lib/security/credentials/ssl/ssl_credentials.c @@ -35,8 +35,8 @@ #include -#include "src/core/lib/channel/channel_args.h" #include "src/core/ext/filters/http/client/http_client_filter.h" +#include "src/core/lib/channel/channel_args.h" #include "src/core/lib/surface/api_trace.h" #include diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.c index 3f22351e6da..c7e55a13576 100644 --- a/test/core/bad_client/bad_client.c +++ b/test/core/bad_client/bad_client.c @@ -40,9 +40,9 @@ #include #include +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/channel_stack.h" -#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/support/murmur_hash.h" diff --git a/test/core/end2end/fixtures/h2_census.c b/test/core/end2end/fixtures/h2_census.c index 8db0acf47f5..7f906fa72b5 100644 --- a/test/core/end2end/fixtures/h2_census.c +++ b/test/core/end2end/fixtures/h2_census.c @@ -42,10 +42,10 @@ #include #include #include "src/core/ext/filters/client_channel/client_channel.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/connected_channel.h" -#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/server.h" #include "test/core/util/port.h" diff --git a/test/core/end2end/fixtures/h2_compress.c b/test/core/end2end/fixtures/h2_compress.c index aa2b3bf069e..ba8092e96e3 100644 --- a/test/core/end2end/fixtures/h2_compress.c +++ b/test/core/end2end/fixtures/h2_compress.c @@ -42,10 +42,10 @@ #include #include #include "src/core/ext/filters/client_channel/client_channel.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/connected_channel.h" -#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/server.h" #include "test/core/util/port.h" diff --git a/test/core/end2end/fixtures/h2_full+pipe.c b/test/core/end2end/fixtures/h2_full+pipe.c index 9280aa13d4b..8d7a1f0cfe0 100644 --- a/test/core/end2end/fixtures/h2_full+pipe.c +++ b/test/core/end2end/fixtures/h2_full+pipe.c @@ -47,9 +47,9 @@ #include #include #include "src/core/ext/filters/client_channel/client_channel.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/connected_channel.h" -#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/iomgr/wakeup_fd_posix.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/server.h" diff --git a/test/core/end2end/fixtures/h2_full+trace.c b/test/core/end2end/fixtures/h2_full+trace.c index f32521cb58d..477bfdd5bb9 100644 --- a/test/core/end2end/fixtures/h2_full+trace.c +++ b/test/core/end2end/fixtures/h2_full+trace.c @@ -47,9 +47,9 @@ #include #include #include "src/core/ext/filters/client_channel/client_channel.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/connected_channel.h" -#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/support/env.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/server.h" diff --git a/test/core/end2end/fixtures/h2_full.c b/test/core/end2end/fixtures/h2_full.c index 28474507b9b..ccb1e2ac027 100644 --- a/test/core/end2end/fixtures/h2_full.c +++ b/test/core/end2end/fixtures/h2_full.c @@ -42,9 +42,9 @@ #include #include #include "src/core/ext/filters/client_channel/client_channel.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/connected_channel.h" -#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/server.h" #include "test/core/util/port.h" diff --git a/test/core/end2end/fixtures/h2_http_proxy.c b/test/core/end2end/fixtures/h2_http_proxy.c index fb4f56e88d3..850b3e720b6 100644 --- a/test/core/end2end/fixtures/h2_http_proxy.c +++ b/test/core/end2end/fixtures/h2_http_proxy.c @@ -43,9 +43,9 @@ #include #include #include "src/core/ext/filters/client_channel/client_channel.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/connected_channel.h" -#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/support/env.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/server.h" diff --git a/test/core/end2end/fixtures/h2_load_reporting.c b/test/core/end2end/fixtures/h2_load_reporting.c index 4cf3b445d5c..70d6f9e605e 100644 --- a/test/core/end2end/fixtures/h2_load_reporting.c +++ b/test/core/end2end/fixtures/h2_load_reporting.c @@ -42,11 +42,11 @@ #include #include #include "src/core/ext/filters/client_channel/client_channel.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/ext/filters/load_reporting/load_reporting.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/connected_channel.h" -#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/server.h" #include "test/core/util/port.h" diff --git a/test/core/end2end/fixtures/h2_proxy.c b/test/core/end2end/fixtures/h2_proxy.c index d8658eca640..f0b9f77653a 100644 --- a/test/core/end2end/fixtures/h2_proxy.c +++ b/test/core/end2end/fixtures/h2_proxy.c @@ -42,9 +42,9 @@ #include #include #include "src/core/ext/filters/client_channel/client_channel.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/connected_channel.h" -#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/server.h" #include "test/core/end2end/fixtures/proxy.h" diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.c b/test/core/end2end/fixtures/h2_sockpair+trace.c index b3a158650ee..5fc0e4ea735 100644 --- a/test/core/end2end/fixtures/h2_sockpair+trace.c +++ b/test/core/end2end/fixtures/h2_sockpair+trace.c @@ -46,11 +46,11 @@ #include #include #include "src/core/ext/filters/client_channel/client_channel.h" -#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" -#include "src/core/ext/filters/http/compress/compress_filter.h" -#include "src/core/lib/channel/connected_channel.h" #include "src/core/ext/filters/http/client/http_client_filter.h" +#include "src/core/ext/filters/http/compress/compress_filter.h" #include "src/core/ext/filters/http/server/http_server_filter.h" +#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" +#include "src/core/lib/channel/connected_channel.h" #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/support/env.h" diff --git a/test/core/end2end/fixtures/h2_sockpair.c b/test/core/end2end/fixtures/h2_sockpair.c index 3fe1b8fc367..24ed048e7d4 100644 --- a/test/core/end2end/fixtures/h2_sockpair.c +++ b/test/core/end2end/fixtures/h2_sockpair.c @@ -41,11 +41,11 @@ #include #include #include "src/core/ext/filters/client_channel/client_channel.h" -#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" -#include "src/core/ext/filters/http/compress/compress_filter.h" -#include "src/core/lib/channel/connected_channel.h" #include "src/core/ext/filters/http/client/http_client_filter.h" +#include "src/core/ext/filters/http/compress/compress_filter.h" #include "src/core/ext/filters/http/server/http_server_filter.h" +#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" +#include "src/core/lib/channel/connected_channel.h" #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/surface/channel.h" diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.c b/test/core/end2end/fixtures/h2_sockpair_1byte.c index 149902673dd..fee30946c43 100644 --- a/test/core/end2end/fixtures/h2_sockpair_1byte.c +++ b/test/core/end2end/fixtures/h2_sockpair_1byte.c @@ -41,11 +41,11 @@ #include #include #include "src/core/ext/filters/client_channel/client_channel.h" -#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" -#include "src/core/ext/filters/http/compress/compress_filter.h" -#include "src/core/lib/channel/connected_channel.h" #include "src/core/ext/filters/http/client/http_client_filter.h" +#include "src/core/ext/filters/http/compress/compress_filter.h" #include "src/core/ext/filters/http/server/http_server_filter.h" +#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" +#include "src/core/lib/channel/connected_channel.h" #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/surface/channel.h" diff --git a/test/core/end2end/fixtures/h2_uds.c b/test/core/end2end/fixtures/h2_uds.c index c0a4d694183..316bfb8541c 100644 --- a/test/core/end2end/fixtures/h2_uds.c +++ b/test/core/end2end/fixtures/h2_uds.c @@ -45,9 +45,9 @@ #include #include #include "src/core/ext/filters/client_channel/client_channel.h" +#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/connected_channel.h" -#include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/support/string.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/server.h" diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index 694765e013b..4417e0e829c 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -46,14 +46,14 @@ extern "C" { #include "src/core/ext/filters/client_channel/client_channel.h" -#include "src/core/ext/filters/load_reporting/load_reporting_filter.h" -#include "src/core/lib/channel/channel_stack.h" -#include "src/core/ext/filters/http/compress/compress_filter.h" -#include "src/core/lib/channel/connected_channel.h" #include "src/core/ext/filters/deadline/deadline_filter.h" #include "src/core/ext/filters/http/client/http_client_filter.h" +#include "src/core/ext/filters/http/compress/compress_filter.h" #include "src/core/ext/filters/http/server/http_server_filter.h" +#include "src/core/ext/filters/load_reporting/load_reporting_filter.h" #include "src/core/ext/filters/message_size/message_size_filter.h" +#include "src/core/lib/channel/channel_stack.h" +#include "src/core/lib/channel/connected_channel.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/transport/transport_impl.h" } From 7e313858636917ceba4b37c673b8676afed75544 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 3 Apr 2017 15:14:08 -0700 Subject: [PATCH 149/461] Remove timeout --- tools/profiling/microbenchmarks/bm_diff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index aa4caca43d7..f6a944babc8 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -139,7 +139,7 @@ def collect1(bm, cfg, ver): '--benchmark_repetitions=%d' % (args.repetitions) ] return jobset.JobSpec(cmd, shortname='%s %s %s' % (bm, cfg, ver), - verbose_success=True) + verbose_success=True, timeout_seconds=None) build() jobset.run(itertools.chain( From 753b0544fdbea8618f2a98fe86eab5419f51c0ce Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 3 Apr 2017 15:31:53 -0700 Subject: [PATCH 150/461] Properly unref some slices in Node glue code --- src/node/ext/call.cc | 17 +++++++++++++---- src/node/ext/node_grpc.cc | 12 +++++++++--- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/node/ext/call.cc b/src/node/ext/call.cc index 244546d3d78..5c311158542 100644 --- a/src/node/ext/call.cc +++ b/src/node/ext/call.cc @@ -574,6 +574,14 @@ void Call::CompleteBatch(bool is_final_op) { } NAN_METHOD(Call::New) { + /* Arguments: + * 0: Channel to make the call on + * 1: Method + * 2: Deadline + * 3: host + * 4: parent Call + * 5: propagation flags + */ if (info.IsConstructCall()) { Call *call; if (info[0]->IsExternal()) { @@ -618,25 +626,26 @@ NAN_METHOD(Call::New) { double deadline = Nan::To(info[2]).FromJust(); grpc_channel *wrapped_channel = channel->GetWrappedChannel(); grpc_call *wrapped_call; + grpc_slice method = CreateSliceFromString( + Nan::To(info[1]).ToLocalChecked()); if (info[3]->IsString()) { grpc_slice *host = new grpc_slice; *host = CreateSliceFromString( Nan::To(info[3]).ToLocalChecked()); wrapped_call = grpc_channel_create_call( wrapped_channel, parent_call, propagate_flags, - GetCompletionQueue(), CreateSliceFromString( - Nan::To(info[1]).ToLocalChecked()), + GetCompletionQueue(), method, host, MillisecondsToTimespec(deadline), NULL); delete host; } else if (info[3]->IsUndefined() || info[3]->IsNull()) { wrapped_call = grpc_channel_create_call( wrapped_channel, parent_call, propagate_flags, - GetCompletionQueue(), CreateSliceFromString( - Nan::To(info[1]).ToLocalChecked()), + GetCompletionQueue(), method, NULL, MillisecondsToTimespec(deadline), NULL); } else { return Nan::ThrowTypeError("Call's fourth argument must be a string"); } + grpc_slice_unref(method); call = new Call(wrapped_call); Nan::Set(info.This(), Nan::New("channel_").ToLocalChecked(), channel_object); diff --git a/src/node/ext/node_grpc.cc b/src/node/ext/node_grpc.cc index 95e273f8ac9..122e5e63ee9 100644 --- a/src/node/ext/node_grpc.cc +++ b/src/node/ext/node_grpc.cc @@ -286,8 +286,10 @@ NAN_METHOD(MetadataKeyIsLegal) { "headerKeyIsLegal's argument must be a string"); } Local key = Nan::To(info[0]).ToLocalChecked(); + grpc_slice slice = CreateSliceFromString(key); info.GetReturnValue().Set(static_cast( - grpc_header_key_is_legal(CreateSliceFromString(key)))); + grpc_header_key_is_legal(slice))); + grpc_slice_unref(slice); } NAN_METHOD(MetadataNonbinValueIsLegal) { @@ -296,8 +298,10 @@ NAN_METHOD(MetadataNonbinValueIsLegal) { "metadataNonbinValueIsLegal's argument must be a string"); } Local value = Nan::To(info[0]).ToLocalChecked(); + grpc_slice slice = CreateSliceFromString(value); info.GetReturnValue().Set(static_cast( - grpc_header_nonbin_value_is_legal(CreateSliceFromString(value)))); + grpc_header_nonbin_value_is_legal(slice))); + grpc_slice_unref(slice); } NAN_METHOD(MetadataKeyIsBinary) { @@ -306,8 +310,10 @@ NAN_METHOD(MetadataKeyIsBinary) { "metadataKeyIsLegal's argument must be a string"); } Local key = Nan::To(info[0]).ToLocalChecked(); + grpc_slice slice = CreateSliceFromString(key); info.GetReturnValue().Set(static_cast( - grpc_is_binary_header(CreateSliceFromString(key)))); + grpc_is_binary_header(slice))); + grpc_slice_unref(slice); } static grpc_ssl_roots_override_result get_ssl_roots_override( From bf289563f6849feb4900c265584c1f5b3434c129 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 3 Apr 2017 15:36:16 -0700 Subject: [PATCH 151/461] Start gen script for new settings handling --- tools/codegen/core/gen_settings_ids.py | 81 ++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100755 tools/codegen/core/gen_settings_ids.py diff --git a/tools/codegen/core/gen_settings_ids.py b/tools/codegen/core/gen_settings_ids.py new file mode 100755 index 00000000000..fa3aad1f1f2 --- /dev/null +++ b/tools/codegen/core/gen_settings_ids.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python2.7 + +# Copyright 2015, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import perfection + +_SETTINGS = { + 'HEADER_TABLE_SIZE': 1, + 'ENABLE_PUSH': 2, + 'MAX_CONCURRENT_STREAMS': 3, + 'INITIAL_WINDOW_SIZE': 4, + 'MAX_FRAME_SIZE': 5, + 'MAX_HEADER_LIST_SIZE': 6, + 'GRPC_ALLOW_TRUE_BINARY_METADATA': 0xfe03, +} + +p = perfection.hash_parameters(sorted(_SETTINGS.values())) +print p + +def hash(i): + i += p.offset + x = i % p.t + y = i / p.t + return x + p.r[y] + +print 'typedef enum {' +for name in sorted(_SETTINGS.keys()): + index = _SETTINGS[name] + print ' GRPC_CHTTP2_SETTING_%s = %d, /* wire id %d */' % ( + name, hash(index), index) +print '} grpc_chttp2_setting_id;' + +print 'const uint16_t grpc_setting_id_to_wire_id[] = {%s};' % ','.join( + '%d' % s for s in p.slots) + +print """ +bool grpc_wire_id_to_setting_id(uint32_t wire_id, grpc_chttp2_setting_id *out) { + static const uint32_t r[] = {%(r)s}; + uint32_t i = wire_id %(offset_sign)s %(offset)d; + uint32_t x = i %% %(t)d; + uint32_t y = i / %(t)d; + uint32_t h = x; + if (y < GPR_ARRAY_SIZE(r)) { + uint32_t delta = (uint32_t)r[y]; + h += delta; + } + *out = (grpc_chttp2_setting_id)i; + return i < GPR_ARRAY_SIZE(grpc_setting_id_to_wire_id) && grpc_setting_id_to_wire_id[i] == wire_id; +}""" % { + 'r': ','.join('%d' % (r if r is not None else 0) for r in p.r), + 't': p.t, + 'offset': abs(p.offset), + 'offset_sign': '+' if p.offset > 0 else '-' + } From a5ea8f2150825e14aa9da1758fd02cff37035ebb Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 3 Apr 2017 16:03:58 -0700 Subject: [PATCH 152/461] Fix serializer error handling, update ProtoBuf.js dependency --- package.json | 2 +- src/node/src/protobuf_js_6_common.js | 2 +- templates/package.json.template | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 440db2ffc8f..7f242326d7e 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "lodash": "^4.15.0", "nan": "^2.0.0", "node-pre-gyp": "^0.6.0", - "protobufjs": "^6.0.0", + "protobufjs": "^6.7.0", "cares": "^1.1.5" }, "devDependencies": { diff --git a/src/node/src/protobuf_js_6_common.js b/src/node/src/protobuf_js_6_common.js index baa62cce866..7e523731d3b 100644 --- a/src/node/src/protobuf_js_6_common.js +++ b/src/node/src/protobuf_js_6_common.js @@ -80,7 +80,7 @@ exports.serializeCls = function serializeCls(cls) { var message = cls.fromObject(arg); var errMsg = cls.verify(message); if (errMsg) { - throw errMsg; + throw Error(errMsg); } return cls.encode(message).finish(); }; diff --git a/templates/package.json.template b/templates/package.json.template index 11fb0fb9206..b69fd28d2ab 100644 --- a/templates/package.json.template +++ b/templates/package.json.template @@ -36,7 +36,7 @@ "lodash": "^4.15.0", "nan": "^2.0.0", "node-pre-gyp": "^0.6.0", - "protobufjs": "^6.0.0", + "protobufjs": "^6.7.0", "cares": "^1.1.5" }, "devDependencies": { From c8f62bcb038b10d03e7cfa49cda7b197aed8fe54 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 3 Apr 2017 16:25:45 -0700 Subject: [PATCH 153/461] Add new setting for true-binary mode --- CMakeLists.txt | 4 + Makefile | 4 + binding.gyp | 1 + build.yaml | 2 + config.m4 | 1 + gRPC-Core.podspec | 3 + grpc.gemspec | 2 + package.xml | 2 + .../chttp2/transport/frame_settings.c | 38 ++--- .../chttp2/transport/frame_settings.h | 30 +--- .../chttp2/transport/http2_settings.c | 85 ++++++++++++ .../chttp2/transport/http2_settings.h | 74 ++++++++++ src/python/grpcio/grpc_core_dependencies.py | 1 + tools/codegen/core/gen_settings_ids.py | 130 +++++++++++++++--- tools/doxygen/Doxyfile.core.internal | 2 + .../generated/sources_and_headers.json | 3 + vsprojects/vcxproj/grpc/grpc.vcxproj | 3 + vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 6 + .../grpc_unsecure/grpc_unsecure.vcxproj | 3 + .../grpc_unsecure.vcxproj.filters | 6 + 20 files changed, 326 insertions(+), 74 deletions(-) create mode 100644 src/core/ext/transport/chttp2/transport/http2_settings.c create mode 100644 src/core/ext/transport/chttp2/transport/http2_settings.h diff --git a/CMakeLists.txt b/CMakeLists.txt index e3b2558ad29..ca44f02c67c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1046,6 +1046,7 @@ add_library(grpc src/core/ext/transport/chttp2/transport/hpack_encoder.c src/core/ext/transport/chttp2/transport/hpack_parser.c src/core/ext/transport/chttp2/transport/hpack_table.c + src/core/ext/transport/chttp2/transport/http2_settings.c src/core/ext/transport/chttp2/transport/huffsyms.c src/core/ext/transport/chttp2/transport/incoming_metadata.c src/core/ext/transport/chttp2/transport/parsing.c @@ -1371,6 +1372,7 @@ add_library(grpc_cronet src/core/ext/transport/chttp2/transport/hpack_encoder.c src/core/ext/transport/chttp2/transport/hpack_parser.c src/core/ext/transport/chttp2/transport/hpack_table.c + src/core/ext/transport/chttp2/transport/http2_settings.c src/core/ext/transport/chttp2/transport/huffsyms.c src/core/ext/transport/chttp2/transport/incoming_metadata.c src/core/ext/transport/chttp2/transport/parsing.c @@ -1939,6 +1941,7 @@ add_library(grpc_unsecure src/core/ext/transport/chttp2/transport/hpack_encoder.c src/core/ext/transport/chttp2/transport/hpack_parser.c src/core/ext/transport/chttp2/transport/hpack_table.c + src/core/ext/transport/chttp2/transport/http2_settings.c src/core/ext/transport/chttp2/transport/huffsyms.c src/core/ext/transport/chttp2/transport/incoming_metadata.c src/core/ext/transport/chttp2/transport/parsing.c @@ -2691,6 +2694,7 @@ add_library(grpc++_cronet src/core/ext/transport/chttp2/transport/hpack_encoder.c src/core/ext/transport/chttp2/transport/hpack_parser.c src/core/ext/transport/chttp2/transport/hpack_table.c + src/core/ext/transport/chttp2/transport/http2_settings.c src/core/ext/transport/chttp2/transport/huffsyms.c src/core/ext/transport/chttp2/transport/incoming_metadata.c src/core/ext/transport/chttp2/transport/parsing.c diff --git a/Makefile b/Makefile index 7499dbbf50d..61f5ffae672 100644 --- a/Makefile +++ b/Makefile @@ -2948,6 +2948,7 @@ LIBGRPC_SRC = \ src/core/ext/transport/chttp2/transport/hpack_encoder.c \ src/core/ext/transport/chttp2/transport/hpack_parser.c \ src/core/ext/transport/chttp2/transport/hpack_table.c \ + src/core/ext/transport/chttp2/transport/http2_settings.c \ src/core/ext/transport/chttp2/transport/huffsyms.c \ src/core/ext/transport/chttp2/transport/incoming_metadata.c \ src/core/ext/transport/chttp2/transport/parsing.c \ @@ -3271,6 +3272,7 @@ LIBGRPC_CRONET_SRC = \ src/core/ext/transport/chttp2/transport/hpack_encoder.c \ src/core/ext/transport/chttp2/transport/hpack_parser.c \ src/core/ext/transport/chttp2/transport/hpack_table.c \ + src/core/ext/transport/chttp2/transport/http2_settings.c \ src/core/ext/transport/chttp2/transport/huffsyms.c \ src/core/ext/transport/chttp2/transport/incoming_metadata.c \ src/core/ext/transport/chttp2/transport/parsing.c \ @@ -3810,6 +3812,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/transport/chttp2/transport/hpack_encoder.c \ src/core/ext/transport/chttp2/transport/hpack_parser.c \ src/core/ext/transport/chttp2/transport/hpack_table.c \ + src/core/ext/transport/chttp2/transport/http2_settings.c \ src/core/ext/transport/chttp2/transport/huffsyms.c \ src/core/ext/transport/chttp2/transport/incoming_metadata.c \ src/core/ext/transport/chttp2/transport/parsing.c \ @@ -4547,6 +4550,7 @@ LIBGRPC++_CRONET_SRC = \ src/core/ext/transport/chttp2/transport/hpack_encoder.c \ src/core/ext/transport/chttp2/transport/hpack_parser.c \ src/core/ext/transport/chttp2/transport/hpack_table.c \ + src/core/ext/transport/chttp2/transport/http2_settings.c \ src/core/ext/transport/chttp2/transport/huffsyms.c \ src/core/ext/transport/chttp2/transport/incoming_metadata.c \ src/core/ext/transport/chttp2/transport/parsing.c \ diff --git a/binding.gyp b/binding.gyp index cd2de83bcb4..01a2c49f194 100644 --- a/binding.gyp +++ b/binding.gyp @@ -754,6 +754,7 @@ 'src/core/ext/transport/chttp2/transport/hpack_encoder.c', 'src/core/ext/transport/chttp2/transport/hpack_parser.c', 'src/core/ext/transport/chttp2/transport/hpack_table.c', + 'src/core/ext/transport/chttp2/transport/http2_settings.c', 'src/core/ext/transport/chttp2/transport/huffsyms.c', 'src/core/ext/transport/chttp2/transport/incoming_metadata.c', 'src/core/ext/transport/chttp2/transport/parsing.c', diff --git a/build.yaml b/build.yaml index 8aff16854ce..49a8b34657e 100644 --- a/build.yaml +++ b/build.yaml @@ -658,6 +658,7 @@ filegroups: - src/core/ext/transport/chttp2/transport/hpack_encoder.h - src/core/ext/transport/chttp2/transport/hpack_parser.h - src/core/ext/transport/chttp2/transport/hpack_table.h + - src/core/ext/transport/chttp2/transport/http2_settings.h - src/core/ext/transport/chttp2/transport/huffsyms.h - src/core/ext/transport/chttp2/transport/incoming_metadata.h - src/core/ext/transport/chttp2/transport/internal.h @@ -677,6 +678,7 @@ filegroups: - src/core/ext/transport/chttp2/transport/hpack_encoder.c - src/core/ext/transport/chttp2/transport/hpack_parser.c - src/core/ext/transport/chttp2/transport/hpack_table.c + - src/core/ext/transport/chttp2/transport/http2_settings.c - src/core/ext/transport/chttp2/transport/huffsyms.c - src/core/ext/transport/chttp2/transport/incoming_metadata.c - src/core/ext/transport/chttp2/transport/parsing.c diff --git a/config.m4 b/config.m4 index 6e6a65a3ded..f980bebda01 100644 --- a/config.m4 +++ b/config.m4 @@ -222,6 +222,7 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/transport/chttp2/transport/hpack_encoder.c \ src/core/ext/transport/chttp2/transport/hpack_parser.c \ src/core/ext/transport/chttp2/transport/hpack_table.c \ + src/core/ext/transport/chttp2/transport/http2_settings.c \ src/core/ext/transport/chttp2/transport/huffsyms.c \ src/core/ext/transport/chttp2/transport/incoming_metadata.c \ src/core/ext/transport/chttp2/transport/parsing.c \ diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index d750a5b9841..42e56abff57 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -379,6 +379,7 @@ Pod::Spec.new do |s| 'src/core/ext/transport/chttp2/transport/hpack_encoder.h', 'src/core/ext/transport/chttp2/transport/hpack_parser.h', 'src/core/ext/transport/chttp2/transport/hpack_table.h', + 'src/core/ext/transport/chttp2/transport/http2_settings.h', 'src/core/ext/transport/chttp2/transport/huffsyms.h', 'src/core/ext/transport/chttp2/transport/incoming_metadata.h', 'src/core/ext/transport/chttp2/transport/internal.h', @@ -597,6 +598,7 @@ Pod::Spec.new do |s| 'src/core/ext/transport/chttp2/transport/hpack_encoder.c', 'src/core/ext/transport/chttp2/transport/hpack_parser.c', 'src/core/ext/transport/chttp2/transport/hpack_table.c', + 'src/core/ext/transport/chttp2/transport/http2_settings.c', 'src/core/ext/transport/chttp2/transport/huffsyms.c', 'src/core/ext/transport/chttp2/transport/incoming_metadata.c', 'src/core/ext/transport/chttp2/transport/parsing.c', @@ -829,6 +831,7 @@ Pod::Spec.new do |s| 'src/core/ext/transport/chttp2/transport/hpack_encoder.h', 'src/core/ext/transport/chttp2/transport/hpack_parser.h', 'src/core/ext/transport/chttp2/transport/hpack_table.h', + 'src/core/ext/transport/chttp2/transport/http2_settings.h', 'src/core/ext/transport/chttp2/transport/huffsyms.h', 'src/core/ext/transport/chttp2/transport/incoming_metadata.h', 'src/core/ext/transport/chttp2/transport/internal.h', diff --git a/grpc.gemspec b/grpc.gemspec index 42d4298c9b6..7b8761cb956 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -295,6 +295,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/transport/chttp2/transport/hpack_encoder.h ) s.files += %w( src/core/ext/transport/chttp2/transport/hpack_parser.h ) s.files += %w( src/core/ext/transport/chttp2/transport/hpack_table.h ) + s.files += %w( src/core/ext/transport/chttp2/transport/http2_settings.h ) s.files += %w( src/core/ext/transport/chttp2/transport/huffsyms.h ) s.files += %w( src/core/ext/transport/chttp2/transport/incoming_metadata.h ) s.files += %w( src/core/ext/transport/chttp2/transport/internal.h ) @@ -513,6 +514,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/transport/chttp2/transport/hpack_encoder.c ) s.files += %w( src/core/ext/transport/chttp2/transport/hpack_parser.c ) s.files += %w( src/core/ext/transport/chttp2/transport/hpack_table.c ) + s.files += %w( src/core/ext/transport/chttp2/transport/http2_settings.c ) s.files += %w( src/core/ext/transport/chttp2/transport/huffsyms.c ) s.files += %w( src/core/ext/transport/chttp2/transport/incoming_metadata.c ) s.files += %w( src/core/ext/transport/chttp2/transport/parsing.c ) diff --git a/package.xml b/package.xml index 382393cbe59..26be06621f2 100644 --- a/package.xml +++ b/package.xml @@ -304,6 +304,7 @@ + @@ -522,6 +523,7 @@ + diff --git a/src/core/ext/transport/chttp2/transport/frame_settings.c b/src/core/ext/transport/chttp2/transport/frame_settings.c index 16881c0707a..5719bf19b2f 100644 --- a/src/core/ext/transport/chttp2/transport/frame_settings.c +++ b/src/core/ext/transport/chttp2/transport/frame_settings.c @@ -48,27 +48,6 @@ #define MAX_MAX_HEADER_LIST_SIZE (1024 * 1024 * 1024) -/* HTTP/2 mandated initial connection settings */ -const grpc_chttp2_setting_parameters - grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS] = { - {NULL, 0, 0, 0, GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE, - GRPC_HTTP2_PROTOCOL_ERROR}, - {"HEADER_TABLE_SIZE", 4096, 0, 0xffffffff, - GRPC_CHTTP2_CLAMP_INVALID_VALUE, GRPC_HTTP2_PROTOCOL_ERROR}, - {"ENABLE_PUSH", 1, 0, 1, GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE, - GRPC_HTTP2_PROTOCOL_ERROR}, - {"MAX_CONCURRENT_STREAMS", 0xffffffffu, 0, 0xffffffffu, - GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE, GRPC_HTTP2_PROTOCOL_ERROR}, - {"INITIAL_WINDOW_SIZE", 65535, 0, 0x7fffffffu, - GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE, - GRPC_HTTP2_FLOW_CONTROL_ERROR}, - {"MAX_FRAME_SIZE", 16384, 16384, 16777215, - GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE, GRPC_HTTP2_PROTOCOL_ERROR}, - {"MAX_HEADER_LIST_SIZE", MAX_MAX_HEADER_LIST_SIZE, 0, - MAX_MAX_HEADER_LIST_SIZE, GRPC_CHTTP2_CLAMP_INVALID_VALUE, - GRPC_HTTP2_PROTOCOL_ERROR}, -}; - static uint8_t *fill_header(uint8_t *out, uint32_t length, uint8_t flags) { *out++ = (uint8_t)(length >> 16); *out++ = (uint8_t)(length >> 8); @@ -99,8 +78,8 @@ grpc_slice grpc_chttp2_settings_create(uint32_t *old, const uint32_t *new, for (i = 0; i < count; i++) { if (new[i] != old[i] || (force_mask & (1u << i)) != 0) { GPR_ASSERT(i); - *p++ = (uint8_t)(i >> 8); - *p++ = (uint8_t)(i); + *p++ = (uint8_t)(grpc_setting_id_to_wire_id[i] >> 8); + *p++ = (uint8_t)(grpc_setting_id_to_wire_id[i]); *p++ = (uint8_t)(new[i] >> 24); *p++ = (uint8_t)(new[i] >> 16); *p++ = (uint8_t)(new[i] >> 8); @@ -154,6 +133,7 @@ grpc_error *grpc_chttp2_settings_parser_parse(grpc_exec_ctx *exec_ctx, void *p, const uint8_t *cur = GRPC_SLICE_START_PTR(slice); const uint8_t *end = GRPC_SLICE_END_PTR(slice); char *msg; + grpc_chttp2_setting_id id; if (parser->is_ack) { return GRPC_ERROR_NONE; @@ -216,9 +196,9 @@ grpc_error *grpc_chttp2_settings_parser_parse(grpc_exec_ctx *exec_ctx, void *p, parser->value |= *cur; cur++; - if (parser->id > 0 && parser->id < GRPC_CHTTP2_NUM_SETTINGS) { + if (grpc_wire_id_to_setting_id(parser->id, &id)) { const grpc_chttp2_setting_parameters *sp = - &grpc_chttp2_settings_parameters[parser->id]; + &grpc_chttp2_settings_parameters[id]; if (parser->value < sp->min_value || parser->value > sp->max_value) { switch (sp->invalid_value_behavior) { case GRPC_CHTTP2_CLAMP_INVALID_VALUE: @@ -237,16 +217,16 @@ grpc_error *grpc_chttp2_settings_parser_parse(grpc_exec_ctx *exec_ctx, void *p, return err; } } - if (parser->id == GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE && - parser->incoming_settings[parser->id] != parser->value) { + if (id == GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE && + parser->incoming_settings[id] != parser->value) { t->initial_window_update += - (int64_t)parser->value - parser->incoming_settings[parser->id]; + (int64_t)parser->value - parser->incoming_settings[id]; if (grpc_http_trace) { gpr_log(GPR_DEBUG, "adding %d for initial_window change", (int)t->initial_window_update); } } - parser->incoming_settings[parser->id] = parser->value; + parser->incoming_settings[id] = parser->value; if (grpc_http_trace) { gpr_log(GPR_DEBUG, "CHTTP2:%s:%s: got setting %d = %d", t->is_client ? "CLI" : "SVR", t->peer_string, parser->id, diff --git a/src/core/ext/transport/chttp2/transport/frame_settings.h b/src/core/ext/transport/chttp2/transport/frame_settings.h index 44137798c06..2a85d0dba76 100644 --- a/src/core/ext/transport/chttp2/transport/frame_settings.h +++ b/src/core/ext/transport/chttp2/transport/frame_settings.h @@ -37,6 +37,7 @@ #include #include #include "src/core/ext/transport/chttp2/transport/frame.h" +#include "src/core/ext/transport/chttp2/transport/http2_settings.h" #include "src/core/lib/iomgr/exec_ctx.h" typedef enum { @@ -48,17 +49,6 @@ typedef enum { GRPC_CHTTP2_SPS_VAL3 } grpc_chttp2_settings_parse_state; -/* The things HTTP/2 defines as connection level settings */ -typedef enum { - GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE = 1, - GRPC_CHTTP2_SETTINGS_ENABLE_PUSH = 2, - GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS = 3, - GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE = 4, - GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE = 5, - GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE = 6, - GRPC_CHTTP2_NUM_SETTINGS -} grpc_chttp2_setting_id; - typedef struct { grpc_chttp2_settings_parse_state state; uint32_t *target_settings; @@ -68,24 +58,6 @@ typedef struct { uint32_t incoming_settings[GRPC_CHTTP2_NUM_SETTINGS]; } grpc_chttp2_settings_parser; -typedef enum { - GRPC_CHTTP2_CLAMP_INVALID_VALUE, - GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE -} grpc_chttp2_invalid_value_behavior; - -typedef struct { - const char *name; - uint32_t default_value; - uint32_t min_value; - uint32_t max_value; - grpc_chttp2_invalid_value_behavior invalid_value_behavior; - uint32_t error_value; -} grpc_chttp2_setting_parameters; - -/* HTTP/2 mandated connection setting parameters */ -extern const grpc_chttp2_setting_parameters - grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS]; - /* Create a settings frame by diffing old & new, and updating old to be new */ grpc_slice grpc_chttp2_settings_create(uint32_t *old, const uint32_t *newval, uint32_t force_mask, size_t count); diff --git a/src/core/ext/transport/chttp2/transport/http2_settings.c b/src/core/ext/transport/chttp2/transport/http2_settings.c new file mode 100644 index 00000000000..eea6305c8ee --- /dev/null +++ b/src/core/ext/transport/chttp2/transport/http2_settings.c @@ -0,0 +1,85 @@ +/* + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Automatically generated by tools/codegen/core/gen_settings_ids.py + */ + +#include "src/core/ext/transport/chttp2/transport/http2_settings.h" + +#include +#include "src/core/lib/transport/http2_errors.h" + +const uint16_t grpc_setting_id_to_wire_id[] = {1, 2, 3, 4, 5, 6, 65027}; + +bool grpc_wire_id_to_setting_id(uint32_t wire_id, grpc_chttp2_setting_id *out) { + static const uint32_t r[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0}; + uint32_t i = wire_id - 1; + uint32_t x = i % 256; + uint32_t y = i / 256; + uint32_t h = x; + if (y < GPR_ARRAY_SIZE(r)) { + uint32_t delta = (uint32_t)r[y]; + h += delta; + } + *out = (grpc_chttp2_setting_id)i; + return i < GPR_ARRAY_SIZE(grpc_setting_id_to_wire_id) && + grpc_setting_id_to_wire_id[i] == wire_id; +} +const grpc_chttp2_setting_parameters + grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS] = { + {"HEADER_TABLE_SIZE", 4096u, 0u, 4294967295u, + GRPC_CHTTP2_CLAMP_INVALID_VALUE, GRPC_HTTP2_PROTOCOL_ERROR}, + {"ENABLE_PUSH", 1u, 0u, 1u, GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE, + GRPC_HTTP2_PROTOCOL_ERROR}, + {"MAX_CONCURRENT_STREAMS", 4294967295u, 0u, 4294967295u, + GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE, GRPC_HTTP2_PROTOCOL_ERROR}, + {"INITIAL_WINDOW_SIZE", 65535u, 0u, 2147483647u, + GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE, + GRPC_HTTP2_FLOW_CONTROL_ERROR}, + {"MAX_FRAME_SIZE", 16384u, 16384u, 16777215u, + GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE, GRPC_HTTP2_PROTOCOL_ERROR}, + {"MAX_HEADER_LIST_SIZE", 16777216u, 0u, 16777216u, + GRPC_CHTTP2_CLAMP_INVALID_VALUE, GRPC_HTTP2_PROTOCOL_ERROR}, + {"GRPC_ALLOW_TRUE_BINARY_METADATA", 0u, 0u, 1u, + GRPC_CHTTP2_CLAMP_INVALID_VALUE, GRPC_HTTP2_PROTOCOL_ERROR}, +}; diff --git a/src/core/ext/transport/chttp2/transport/http2_settings.h b/src/core/ext/transport/chttp2/transport/http2_settings.h new file mode 100644 index 00000000000..393c14f7f1b --- /dev/null +++ b/src/core/ext/transport/chttp2/transport/http2_settings.h @@ -0,0 +1,74 @@ +/* + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Automatically generated by tools/codegen/core/gen_settings_ids.py + */ + +#ifndef SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H +#define SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H + +#include +#include + +typedef enum { + GRPC_CHTTP2_SETTINGS_ENABLE_PUSH = 1, /* wire id 2 */ + GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA = 6, /* wire id 65027 */ + GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE = 0, /* wire id 1 */ + GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE = 3, /* wire id 4 */ + GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS = 2, /* wire id 3 */ + GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE = 4, /* wire id 5 */ + GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE = 5, /* wire id 6 */ +} grpc_chttp2_setting_id; + +#define GRPC_CHTTP2_NUM_SETTINGS 7 +extern const uint16_t grpc_setting_id_to_wire_id[]; + +bool grpc_wire_id_to_setting_id(uint32_t wire_id, grpc_chttp2_setting_id *out); + +typedef enum { + GRPC_CHTTP2_CLAMP_INVALID_VALUE, + GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE +} grpc_chttp2_invalid_value_behavior; + +typedef struct { + const char *name; + uint32_t default_value; + uint32_t min_value; + uint32_t max_value; + grpc_chttp2_invalid_value_behavior invalid_value_behavior; + uint32_t error_value; +} grpc_chttp2_setting_parameters; + +extern const grpc_chttp2_setting_parameters + grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS]; + +#endif /* SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H */ diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index ed8793b019f..522791e17a0 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -216,6 +216,7 @@ CORE_SOURCE_FILES = [ 'src/core/ext/transport/chttp2/transport/hpack_encoder.c', 'src/core/ext/transport/chttp2/transport/hpack_parser.c', 'src/core/ext/transport/chttp2/transport/hpack_table.c', + 'src/core/ext/transport/chttp2/transport/http2_settings.c', 'src/core/ext/transport/chttp2/transport/huffsyms.c', 'src/core/ext/transport/chttp2/transport/incoming_metadata.c', 'src/core/ext/transport/chttp2/transport/parsing.c', diff --git a/tools/codegen/core/gen_settings_ids.py b/tools/codegen/core/gen_settings_ids.py index fa3aad1f1f2..c807f70c2ac 100755 --- a/tools/codegen/core/gen_settings_ids.py +++ b/tools/codegen/core/gen_settings_ids.py @@ -29,19 +29,71 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +import collections import perfection +import sys + +_MAX_HEADER_LIST_SIZE = 16 * 1024 * 1024 + +Setting = collections.namedtuple('Setting', 'id default min max on_error') +OnError = collections.namedtuple('OnError', 'behavior code') +clamp_invalid_value = OnError('CLAMP_INVALID_VALUE', 'PROTOCOL_ERROR') +disconnect_on_invalid_value = lambda e: OnError('DISCONNECT_ON_INVALID_VALUE', e) +DecoratedSetting = collections.namedtuple('DecoratedSetting', 'enum name setting') _SETTINGS = { - 'HEADER_TABLE_SIZE': 1, - 'ENABLE_PUSH': 2, - 'MAX_CONCURRENT_STREAMS': 3, - 'INITIAL_WINDOW_SIZE': 4, - 'MAX_FRAME_SIZE': 5, - 'MAX_HEADER_LIST_SIZE': 6, - 'GRPC_ALLOW_TRUE_BINARY_METADATA': 0xfe03, + 'HEADER_TABLE_SIZE': Setting(1, 4096, 0, 0xffffffff, clamp_invalid_value), + 'ENABLE_PUSH': Setting(2, 1, 0, 1, disconnect_on_invalid_value('PROTOCOL_ERROR')), + 'MAX_CONCURRENT_STREAMS': Setting(3, 0xffffffff, 0, 0xffffffff, disconnect_on_invalid_value('PROTOCOL_ERROR')), + 'INITIAL_WINDOW_SIZE': Setting(4, 65535, 0, 0x7fffffff, disconnect_on_invalid_value('FLOW_CONTROL_ERROR')), + 'MAX_FRAME_SIZE': Setting(5, 16384, 16384, 16777215, disconnect_on_invalid_value('PROTOCOL_ERROR')), + 'MAX_HEADER_LIST_SIZE': Setting(6, _MAX_HEADER_LIST_SIZE, 0, _MAX_HEADER_LIST_SIZE, clamp_invalid_value), + 'GRPC_ALLOW_TRUE_BINARY_METADATA': Setting(0xfe03, 0, 0, 1, clamp_invalid_value), } -p = perfection.hash_parameters(sorted(_SETTINGS.values())) +H = open('src/core/ext/transport/chttp2/transport/http2_settings.h', 'w') +C = open('src/core/ext/transport/chttp2/transport/http2_settings.c', 'w') + +# utility: print a big comment block into a set of files +def put_banner(files, banner): + for f in files: + print >>f, '/*' + for line in banner: + print >>f, ' * %s' % line + print >>f, ' */' + print >>f + +# copy-paste copyright notice from this file +with open(sys.argv[0]) as my_source: + copyright = [] + for line in my_source: + if line[0] != '#': break + for line in my_source: + if line[0] == '#': + copyright.append(line) + break + for line in my_source: + if line[0] != '#': + break + copyright.append(line) + put_banner([H,C], [line[2:].rstrip() for line in copyright]) + +put_banner([H,C], ["Automatically generated by tools/codegen/core/gen_settings_ids.py"]) + +print >>H, "#ifndef SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H" +print >>H, "#define SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H" +print >>H +print >>H, "#include " +print >>H, "#include " +print >>H + +print >>C, "#include \"src/core/ext/transport/chttp2/transport/http2_settings.h\"" +print >>C +print >>C, "#include " +print >>C, "#include \"src/core/lib/transport/http2_errors.h\"" +print >>C + +p = perfection.hash_parameters(sorted(x.id for x in _SETTINGS.values())) print p def hash(i): @@ -50,17 +102,24 @@ def hash(i): y = i / p.t return x + p.r[y] -print 'typedef enum {' +decorated_settings = [DecoratedSetting(hash(setting.id), name, setting) + for name, setting in _SETTINGS.iteritems()] + +print >>H, 'typedef enum {' for name in sorted(_SETTINGS.keys()): - index = _SETTINGS[name] - print ' GRPC_CHTTP2_SETTING_%s = %d, /* wire id %d */' % ( - name, hash(index), index) -print '} grpc_chttp2_setting_id;' + setting = _SETTINGS[name] + print >>H, ' GRPC_CHTTP2_SETTINGS_%s = %d, /* wire id %d */' % ( + name, hash(setting.id), setting.id) +print >>H, '} grpc_chttp2_setting_id;' +print >>H +print >>H, '#define GRPC_CHTTP2_NUM_SETTINGS %d' % (max(x.enum for x in decorated_settings) + 1) -print 'const uint16_t grpc_setting_id_to_wire_id[] = {%s};' % ','.join( +print >>H, 'extern const uint16_t grpc_setting_id_to_wire_id[];' +print >>C, 'const uint16_t grpc_setting_id_to_wire_id[] = {%s};' % ','.join( '%d' % s for s in p.slots) - -print """ +print >>H +print >>H, "bool grpc_wire_id_to_setting_id(uint32_t wire_id, grpc_chttp2_setting_id *out);" +print >>C, """ bool grpc_wire_id_to_setting_id(uint32_t wire_id, grpc_chttp2_setting_id *out) { static const uint32_t r[] = {%(r)s}; uint32_t i = wire_id %(offset_sign)s %(offset)d; @@ -79,3 +138,42 @@ bool grpc_wire_id_to_setting_id(uint32_t wire_id, grpc_chttp2_setting_id *out) { 'offset': abs(p.offset), 'offset_sign': '+' if p.offset > 0 else '-' } + +print >>H, """ +typedef enum { + GRPC_CHTTP2_CLAMP_INVALID_VALUE, + GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE +} grpc_chttp2_invalid_value_behavior; + +typedef struct { + const char *name; + uint32_t default_value; + uint32_t min_value; + uint32_t max_value; + grpc_chttp2_invalid_value_behavior invalid_value_behavior; + uint32_t error_value; +} grpc_chttp2_setting_parameters; +""" +print >>H, "extern const grpc_chttp2_setting_parameters grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS];" +print >>C, "const grpc_chttp2_setting_parameters grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS] = {" +i = 0 +for decorated_setting in sorted(decorated_settings): + while i < decorated_setting.enum: + print >>C, "{NULL, 0, 0, 0, GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE, GRPC_HTTP2_PROTOCOL_ERROR}," + i += 1 + print >>C, "{\"%s\", %du, %du, %du, GRPC_CHTTP2_%s, GRPC_HTTP2_%s}," % ( + decorated_setting.name, + decorated_setting.setting.default, + decorated_setting.setting.min, + decorated_setting.setting.max, + decorated_setting.setting.on_error.behavior, + decorated_setting.setting.on_error.code, + ) + i += 1 +print >>C, "};" + +print >>H +print >>H, "#endif /* SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H */" + +H.close() +C.close() diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index a9343499e76..08a0213f0e1 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1003,6 +1003,8 @@ src/core/ext/transport/chttp2/transport/hpack_parser.c \ src/core/ext/transport/chttp2/transport/hpack_parser.h \ src/core/ext/transport/chttp2/transport/hpack_table.c \ src/core/ext/transport/chttp2/transport/hpack_table.h \ +src/core/ext/transport/chttp2/transport/http2_settings.c \ +src/core/ext/transport/chttp2/transport/http2_settings.h \ src/core/ext/transport/chttp2/transport/huffsyms.c \ src/core/ext/transport/chttp2/transport/huffsyms.h \ src/core/ext/transport/chttp2/transport/incoming_metadata.c \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index be1d8768bd5..e621ca39ce8 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -8297,6 +8297,7 @@ "src/core/ext/transport/chttp2/transport/hpack_encoder.h", "src/core/ext/transport/chttp2/transport/hpack_parser.h", "src/core/ext/transport/chttp2/transport/hpack_table.h", + "src/core/ext/transport/chttp2/transport/http2_settings.h", "src/core/ext/transport/chttp2/transport/huffsyms.h", "src/core/ext/transport/chttp2/transport/incoming_metadata.h", "src/core/ext/transport/chttp2/transport/internal.h", @@ -8333,6 +8334,8 @@ "src/core/ext/transport/chttp2/transport/hpack_parser.h", "src/core/ext/transport/chttp2/transport/hpack_table.c", "src/core/ext/transport/chttp2/transport/hpack_table.h", + "src/core/ext/transport/chttp2/transport/http2_settings.c", + "src/core/ext/transport/chttp2/transport/http2_settings.h", "src/core/ext/transport/chttp2/transport/huffsyms.c", "src/core/ext/transport/chttp2/transport/huffsyms.h", "src/core/ext/transport/chttp2/transport/incoming_metadata.c", diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index ada8f1a2289..366678cafd7 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -424,6 +424,7 @@ + @@ -784,6 +785,8 @@ + + diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index 02468451e98..7e8b8b12466 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -421,6 +421,9 @@ src\core\ext\transport\chttp2\transport + + src\core\ext\transport\chttp2\transport + src\core\ext\transport\chttp2\transport @@ -1169,6 +1172,9 @@ src\core\ext\transport\chttp2\transport + + src\core\ext\transport\chttp2\transport + src\core\ext\transport\chttp2\transport diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index 83e76586ac2..7cfbb959863 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -414,6 +414,7 @@ + @@ -754,6 +755,8 @@ + + diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index 5e2b7c2c318..650fdbc57e5 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -427,6 +427,9 @@ src\core\ext\transport\chttp2\transport + + src\core\ext\transport\chttp2\transport + src\core\ext\transport\chttp2\transport @@ -1082,6 +1085,9 @@ src\core\ext\transport\chttp2\transport + + src\core\ext\transport\chttp2\transport + src\core\ext\transport\chttp2\transport From f408784ae9c3aebb7c76ea66708ef985dc466be1 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 3 Apr 2017 16:50:14 -0700 Subject: [PATCH 154/461] better logging --- src/core/ext/transport/chttp2/transport/frame_settings.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/frame_settings.c b/src/core/ext/transport/chttp2/transport/frame_settings.c index 5719bf19b2f..46630a6cc62 100644 --- a/src/core/ext/transport/chttp2/transport/frame_settings.c +++ b/src/core/ext/transport/chttp2/transport/frame_settings.c @@ -228,8 +228,8 @@ grpc_error *grpc_chttp2_settings_parser_parse(grpc_exec_ctx *exec_ctx, void *p, } parser->incoming_settings[id] = parser->value; if (grpc_http_trace) { - gpr_log(GPR_DEBUG, "CHTTP2:%s:%s: got setting %d = %d", - t->is_client ? "CLI" : "SVR", t->peer_string, parser->id, + gpr_log(GPR_DEBUG, "CHTTP2:%s:%s: got setting %s = %d", + t->is_client ? "CLI" : "SVR", t->peer_string, sp->name, parser->value); } } else if (grpc_http_trace) { From c84d67e85b7939abffab996995562be06edb0854 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 3 Apr 2017 16:52:03 -0700 Subject: [PATCH 155/461] Keep changes from #10093 --- src/node/src/protobuf_js_5_common.js | 1 + src/node/src/protobuf_js_6_common.js | 1 + 2 files changed, 2 insertions(+) diff --git a/src/node/src/protobuf_js_5_common.js b/src/node/src/protobuf_js_5_common.js index b16228b9ee8..62cf2f4acaa 100644 --- a/src/node/src/protobuf_js_5_common.js +++ b/src/node/src/protobuf_js_5_common.js @@ -120,6 +120,7 @@ exports.getProtobufServiceAttrs = function getProtobufServiceAttrs(service, return _.camelCase(method.name); }), _.map(service.children, function(method) { return { + originalName: method.name, path: prefix + method.name, requestStream: method.requestStream, responseStream: method.responseStream, diff --git a/src/node/src/protobuf_js_6_common.js b/src/node/src/protobuf_js_6_common.js index 7e523731d3b..cac0f711451 100644 --- a/src/node/src/protobuf_js_6_common.js +++ b/src/node/src/protobuf_js_6_common.js @@ -121,6 +121,7 @@ exports.getProtobufServiceAttrs = function getProtobufServiceAttrs(service, return _.camelCase(method.name); }), _.map(service.methods, function(method) { return { + originalName: method.name, path: prefix + method.name, requestStream: !!method.requestStream, responseStream: !!method.responseStream, From 87c79795e6bc0047d22e9c5f638df832587f3418 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 3 Apr 2017 17:05:12 -0700 Subject: [PATCH 156/461] Perform option exchange --- include/grpc/impl/codegen/grpc_types.h | 2 + .../chttp2/transport/chttp2_transport.c | 47 +++++++++++-------- .../chttp2/transport/http2_settings.c | 6 +-- tools/codegen/core/gen_settings_ids.py | 4 +- 4 files changed, 34 insertions(+), 25 deletions(-) diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index aa4210b1a76..c76f9e0ac47 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -205,6 +205,8 @@ typedef struct { /** How much data are we willing to queue up per stream if GRPC_WRITE_BUFFER_HINT is set? This is an upper bound */ #define GRPC_ARG_HTTP2_WRITE_BUFFER_SIZE "grpc.http2.write_buffer_size" +/** Should we allow receipt of true-binary data on http2 connections? */ +#define GRPC_ARG_HTTP2_ENABLE_TRUE_BINARY "grpc.http2.true_binary" /** After a duration of this time the client pings the server to see if the transport is still alive. Int valued, seconds. */ #define GRPC_ARG_CLIENT_KEEPALIVE_TIME_S "grpc.client_keepalive_time" diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 26f9449f4b9..2347bf6d902 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -346,6 +346,8 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, DEFAULT_WINDOW); push_setting(exec_ctx, t, GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE, DEFAULT_MAX_HEADER_LIST_SIZE); + push_setting(exec_ctx, t, + GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA, 1); t->ping_policy = (grpc_chttp2_repeated_ping_policy){ .max_pings_without_data = DEFAULT_MAX_PINGS_BETWEEN_DATA, @@ -442,26 +444,31 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_setting_id setting_id; grpc_integer_options integer_options; bool availability[2] /* server, client */; - } settings_map[] = {{GRPC_ARG_MAX_CONCURRENT_STREAMS, - GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, - {-1, 0, INT32_MAX}, - {true, false}}, - {GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_DECODER, - GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE, - {-1, 0, INT32_MAX}, - {true, true}}, - {GRPC_ARG_MAX_METADATA_SIZE, - GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE, - {-1, 0, INT32_MAX}, - {true, true}}, - {GRPC_ARG_HTTP2_MAX_FRAME_SIZE, - GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE, - {-1, 16384, 16777215}, - {true, true}}, - {GRPC_ARG_HTTP2_STREAM_LOOKAHEAD_BYTES, - GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, - {-1, 5, INT32_MAX}, - {true, true}}}; + } settings_map[] = { + {GRPC_ARG_MAX_CONCURRENT_STREAMS, + GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, + {-1, 0, INT32_MAX}, + {true, false}}, + {GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_DECODER, + GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE, + {-1, 0, INT32_MAX}, + {true, true}}, + {GRPC_ARG_MAX_METADATA_SIZE, + GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE, + {-1, 0, INT32_MAX}, + {true, true}}, + {GRPC_ARG_HTTP2_MAX_FRAME_SIZE, + GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE, + {-1, 16384, 16777215}, + {true, true}}, + {GRPC_ARG_HTTP2_ENABLE_TRUE_BINARY, + GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA, + {1, 0, 1}, + {true, true}}, + {GRPC_ARG_HTTP2_STREAM_LOOKAHEAD_BYTES, + GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, + {-1, 5, INT32_MAX}, + {true, true}}}; for (j = 0; j < (int)GPR_ARRAY_SIZE(settings_map); j++) { if (0 == strcmp(channel_args->args[i].key, settings_map[j].channel_arg_name)) { diff --git a/src/core/ext/transport/chttp2/transport/http2_settings.c b/src/core/ext/transport/chttp2/transport/http2_settings.c index eea6305c8ee..05f0d8cb468 100644 --- a/src/core/ext/transport/chttp2/transport/http2_settings.c +++ b/src/core/ext/transport/chttp2/transport/http2_settings.c @@ -61,9 +61,9 @@ bool grpc_wire_id_to_setting_id(uint32_t wire_id, grpc_chttp2_setting_id *out) { uint32_t delta = (uint32_t)r[y]; h += delta; } - *out = (grpc_chttp2_setting_id)i; - return i < GPR_ARRAY_SIZE(grpc_setting_id_to_wire_id) && - grpc_setting_id_to_wire_id[i] == wire_id; + *out = (grpc_chttp2_setting_id)h; + return h < GPR_ARRAY_SIZE(grpc_setting_id_to_wire_id) && + grpc_setting_id_to_wire_id[h] == wire_id; } const grpc_chttp2_setting_parameters grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS] = { diff --git a/tools/codegen/core/gen_settings_ids.py b/tools/codegen/core/gen_settings_ids.py index c807f70c2ac..54498a18f25 100755 --- a/tools/codegen/core/gen_settings_ids.py +++ b/tools/codegen/core/gen_settings_ids.py @@ -130,8 +130,8 @@ bool grpc_wire_id_to_setting_id(uint32_t wire_id, grpc_chttp2_setting_id *out) { uint32_t delta = (uint32_t)r[y]; h += delta; } - *out = (grpc_chttp2_setting_id)i; - return i < GPR_ARRAY_SIZE(grpc_setting_id_to_wire_id) && grpc_setting_id_to_wire_id[i] == wire_id; + *out = (grpc_chttp2_setting_id)h; + return h < GPR_ARRAY_SIZE(grpc_setting_id_to_wire_id) && grpc_setting_id_to_wire_id[h] == wire_id; }""" % { 'r': ','.join('%d' % (r if r is not None else 0) for r in p.r), 't': p.t, From 83f7b9559c52d3c7f857a8ac80f5c21dcb9d2490 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 4 Apr 2017 07:58:18 -0700 Subject: [PATCH 157/461] Starting the encode path --- .../chttp2/transport/hpack_encoder.c | 16 ++++----- .../chttp2/transport/hpack_encoder.h | 15 +++++--- .../ext/transport/chttp2/transport/writing.c | 36 ++++++++++++++----- 3 files changed, 45 insertions(+), 22 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.c b/src/core/ext/transport/chttp2/transport/hpack_encoder.c index 84586cd9988..f5f52a33608 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.c +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.c @@ -595,23 +595,21 @@ void grpc_chttp2_hpack_compressor_set_max_table_size( void grpc_chttp2_encode_header(grpc_exec_ctx *exec_ctx, grpc_chttp2_hpack_compressor *c, - uint32_t stream_id, - grpc_metadata_batch *metadata, int is_eof, - size_t max_frame_size, - grpc_transport_one_way_stats *stats, + grpc_metadata_batch *metadata, + const grpc_encode_header_options *options, grpc_slice_buffer *outbuf) { framer_state st; grpc_linked_mdelem *l; gpr_timespec deadline; - GPR_ASSERT(stream_id != 0); + GPR_ASSERT(options->stream_id != 0); st.seen_regular_header = 0; - st.stream_id = stream_id; + st.stream_id = options->stream_id; st.output = outbuf; st.is_first_frame = 1; - st.stats = stats; - st.max_frame_size = max_frame_size; + st.stats = options->stats; + st.max_frame_size = options->max_frame_size; /* Encode a metadata batch; store the returned values, representing a metadata element that needs to be unreffed back into the metadata @@ -630,5 +628,5 @@ void grpc_chttp2_encode_header(grpc_exec_ctx *exec_ctx, deadline_enc(exec_ctx, c, deadline, &st); } - finish_frame(&st, 1, is_eof); + finish_frame(&st, 1, options->is_eof); } diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.h b/src/core/ext/transport/chttp2/transport/hpack_encoder.h index 83ba5b1b3e0..6ce32096046 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.h +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.h @@ -90,11 +90,18 @@ void grpc_chttp2_hpack_compressor_set_max_table_size( void grpc_chttp2_hpack_compressor_set_max_usable_size( grpc_chttp2_hpack_compressor *c, uint32_t max_table_size); +typedef struct { + uint32_t stream_id; + bool is_eof; + bool use_true_binary_metadata; + size_t max_frame_size; + grpc_transport_one_way_stats *stats; +} grpc_encode_header_options; + void grpc_chttp2_encode_header(grpc_exec_ctx *exec_ctx, - grpc_chttp2_hpack_compressor *c, uint32_t id, - grpc_metadata_batch *metadata, int is_eof, - size_t max_frame_size, - grpc_transport_one_way_stats *stats, + grpc_chttp2_hpack_compressor *c, + grpc_metadata_batch *metadata, + const grpc_encode_header_options *options, grpc_slice_buffer *outbuf); #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H */ diff --git a/src/core/ext/transport/chttp2/transport/writing.c b/src/core/ext/transport/chttp2/transport/writing.c index 0869056f56d..b3918df7dca 100644 --- a/src/core/ext/transport/chttp2/transport/writing.c +++ b/src/core/ext/transport/chttp2/transport/writing.c @@ -219,10 +219,18 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx, /* send initial metadata if it's available */ if (!sent_initial_metadata && s->send_initial_metadata) { - grpc_chttp2_encode_header( - exec_ctx, &t->hpack_compressor, s->id, s->send_initial_metadata, 0, - t->settings[GRPC_ACKED_SETTINGS][GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], - &s->stats.outgoing, &t->outbuf); + grpc_encode_header_options hopt = { + .stream_id = s->id, + .is_eof = false, + .use_true_binary_metadata = + t->settings + [GRPC_ACKED_SETTINGS] + [GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA] != 0, + .max_frame_size = t->settings[GRPC_ACKED_SETTINGS] + [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], + .stats = &s->stats.outgoing}; + grpc_chttp2_encode_header(exec_ctx, &t->hpack_compressor, + s->send_initial_metadata, &hopt, &t->outbuf); s->send_initial_metadata = NULL; s->sent_initial_metadata = true; sent_initial_metadata = true; @@ -300,11 +308,21 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx, grpc_chttp2_encode_data(s->id, &s->flow_controlled_buffer, 0, true, &s->stats.outgoing, &t->outbuf); } else { - grpc_chttp2_encode_header( - exec_ctx, &t->hpack_compressor, s->id, s->send_trailing_metadata, - true, t->settings[GRPC_ACKED_SETTINGS] - [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], - &s->stats.outgoing, &t->outbuf); + grpc_encode_header_options hopt = { + .stream_id = s->id, + .is_eof = true, + .use_true_binary_metadata = + t->settings + [GRPC_ACKED_SETTINGS] + [GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA] != + 0, + .max_frame_size = + t->settings[GRPC_ACKED_SETTINGS] + [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], + .stats = &s->stats.outgoing}; + grpc_chttp2_encode_header(exec_ctx, &t->hpack_compressor, + s->send_trailing_metadata, &hopt, + &t->outbuf); } s->send_trailing_metadata = NULL; s->sent_trailing_metadata = true; From eb0e34f73616a6fd8af79d2a02f477baf82d88e1 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 4 Apr 2017 08:46:47 -0700 Subject: [PATCH 158/461] Convert everything to new encode API --- .../transport/chttp2/hpack_encoder_test.c | 61 +++++++++++-------- test/cpp/microbenchmarks/bm_chttp2_hpack.cc | 11 +++- 2 files changed, 45 insertions(+), 27 deletions(-) diff --git a/test/core/transport/chttp2/hpack_encoder_test.c b/test/core/transport/chttp2/hpack_encoder_test.c index d572d79a7ff..701d663cbbc 100644 --- a/test/core/transport/chttp2/hpack_encoder_test.c +++ b/test/core/transport/chttp2/hpack_encoder_test.c @@ -60,9 +60,9 @@ size_t cap_to_delete = 0; /* verify that the output generated by encoding the stream matches the hexstring passed in */ -static void verify(grpc_exec_ctx *exec_ctx, size_t window_available, int eof, - size_t expect_window_used, const char *expected, - size_t nheaders, ...) { +static void verify(grpc_exec_ctx *exec_ctx, size_t window_available, bool eof, + bool use_true_binary_metadata, size_t expect_window_used, + const char *expected, size_t nheaders, ...) { grpc_slice_buffer output; grpc_slice merged; grpc_slice expect = parse_hexstring(expected); @@ -103,8 +103,14 @@ static void verify(grpc_exec_ctx *exec_ctx, size_t window_available, int eof, grpc_transport_one_way_stats stats; memset(&stats, 0, sizeof(stats)); - grpc_chttp2_encode_header(exec_ctx, &g_compressor, 0xdeadbeef, &b, eof, 16384, - &stats, &output); + grpc_encode_header_options hopt = { + .stream_id = 0xdeadbeef, + .is_eof = eof, + .use_true_binary_metadata = false, + .max_frame_size = 16384, + .stats = &stats, + }; + grpc_chttp2_encode_header(exec_ctx, &g_compressor, &b, &hopt, &output); merged = grpc_slice_merge(output.slices, output.count); grpc_slice_buffer_destroy_internal(exec_ctx, &output); grpc_metadata_batch_destroy(exec_ctx, &b); @@ -127,25 +133,28 @@ static void verify(grpc_exec_ctx *exec_ctx, size_t window_available, int eof, static void test_basic_headers(grpc_exec_ctx *exec_ctx) { int i; - verify(exec_ctx, 0, 0, 0, "000005 0104 deadbeef 40 0161 0161", 1, "a", "a"); - verify(exec_ctx, 0, 0, 0, "000001 0104 deadbeef be", 1, "a", "a"); - verify(exec_ctx, 0, 0, 0, "000001 0104 deadbeef be", 1, "a", "a"); - verify(exec_ctx, 0, 0, 0, "000006 0104 deadbeef be 40 0162 0163", 2, "a", "a", - "b", "c"); - verify(exec_ctx, 0, 0, 0, "000002 0104 deadbeef bf be", 2, "a", "a", "b", - "c"); - verify(exec_ctx, 0, 0, 0, "000004 0104 deadbeef 7f 00 0164", 1, "a", "d"); + verify(exec_ctx, 0, false, false, 0, "000005 0104 deadbeef 40 0161 0161", 1, + "a", "a"); + verify(exec_ctx, 0, false, false, 0, "000001 0104 deadbeef be", 1, "a", "a"); + verify(exec_ctx, 0, false, false, 0, "000001 0104 deadbeef be", 1, "a", "a"); + verify(exec_ctx, 0, false, false, 0, "000006 0104 deadbeef be 40 0162 0163", + 2, "a", "a", "b", "c"); + verify(exec_ctx, 0, false, false, 0, "000002 0104 deadbeef bf be", 2, "a", + "a", "b", "c"); + verify(exec_ctx, 0, false, false, 0, "000004 0104 deadbeef 7f 00 0164", 1, + "a", "d"); /* flush out what's there to make a few values look very popular */ for (i = 0; i < 350; i++) { - verify(exec_ctx, 0, 0, 0, "000003 0104 deadbeef c0 bf be", 3, "a", "a", "b", - "c", "a", "d"); + verify(exec_ctx, 0, false, false, 0, "000003 0104 deadbeef c0 bf be", 3, + "a", "a", "b", "c", "a", "d"); } - verify(exec_ctx, 0, 0, 0, "000006 0104 deadbeef c0 00 016b 0176", 2, "a", "a", - "k", "v"); + verify(exec_ctx, 0, false, false, 0, "000006 0104 deadbeef c0 00 016b 0176", + 2, "a", "a", "k", "v"); /* this could be 000004 0104 deadbeef 0f 30 0176 also */ - verify(exec_ctx, 0, 0, 0, "000004 0104 deadbeef 0f 2f 0176", 1, "a", "v"); + verify(exec_ctx, 0, false, false, 0, "000004 0104 deadbeef 0f 2f 0176", 1, + "a", "v"); } static void encode_int_to_str(int i, char *p) { @@ -179,17 +188,17 @@ static void test_decode_table_overflow(grpc_exec_ctx *exec_ctx) { } if (i > 0) { - verify(exec_ctx, 0, 0, 0, expect, 2, "aa", "ba", key, value); + verify(exec_ctx, 0, false, false, 0, expect, 2, "aa", "ba", key, value); } else { - verify(exec_ctx, 0, 0, 0, expect, 1, key, value); + verify(exec_ctx, 0, false, false, 0, expect, 1, key, value); } gpr_free(expect); } /* if the above passes, then we must have just knocked this pair out of the decoder stack, and so we'll be forced to re-encode it */ - verify(exec_ctx, 0, 0, 0, "000007 0104 deadbeef 40 026161 026261", 1, "aa", - "ba"); + verify(exec_ctx, 0, false, false, 0, "000007 0104 deadbeef 40 026161 026261", + 1, "aa", "ba"); } static void verify_table_size_change_match_elem_size(grpc_exec_ctx *exec_ctx, @@ -214,8 +223,12 @@ static void verify_table_size_change_match_elem_size(grpc_exec_ctx *exec_ctx, grpc_transport_one_way_stats stats; memset(&stats, 0, sizeof(stats)); - grpc_chttp2_encode_header(exec_ctx, &g_compressor, 0xdeadbeef, &b, 0, 16384, - &stats, &output); + grpc_encode_header_options hopt = {.stream_id = 0xdeadbeef, + .is_eof = false, + .use_true_binary_metadata = false, + .max_frame_size = 16384, + .stats = &stats}; + grpc_chttp2_encode_header(exec_ctx, &g_compressor, &b, &hopt, &output); grpc_slice_buffer_destroy_internal(exec_ctx, &output); grpc_metadata_batch_destroy(exec_ctx, &b); diff --git a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc index 55d2d2f58d0..7426407874b 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc @@ -90,9 +90,14 @@ static void BM_HpackEncoderEncodeHeader(benchmark::State &state) { grpc_slice_buffer outbuf; grpc_slice_buffer_init(&outbuf); while (state.KeepRunning()) { - uint32_t stream_id = static_cast(state.iterations()); - grpc_chttp2_encode_header(&exec_ctx, &c, stream_id, &b, state.range(0), - state.range(1), &stats, &outbuf); + grpc_encode_header_options hopt = { + static_cast(state.iterations()), + state.range(0) != 0, + false, + (size_t)state.range(1), + &stats, + }; + grpc_chttp2_encode_header(&exec_ctx, &c, &b, &hopt, &outbuf); if (!logged_representative_output) { logged_representative_output = true; for (size_t i = 0; i < outbuf.count; i++) { From e3b5921559bb26fa49c10d6019cbb97634500059 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 4 Apr 2017 09:28:54 -0700 Subject: [PATCH 159/461] Potential msan fix --- include/grpc++/impl/codegen/call.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h index a3f2be6bb1e..e0095b0434c 100644 --- a/include/grpc++/impl/codegen/call.h +++ b/include/grpc++/impl/codegen/call.h @@ -528,6 +528,7 @@ class CallOpClientRecvStatus { void ClientRecvStatus(ClientContext* context, Status* status) { metadata_map_ = &context->trailing_metadata_; recv_status_ = status; + status_details_ = grpc_empty_slice(); } protected: From be094fc5e6a82b9e5904176a70e74bb66fbb32f7 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 4 Apr 2017 09:31:28 -0700 Subject: [PATCH 160/461] Fix compile --- include/grpc++/impl/codegen/call.h | 2 +- include/grpc++/impl/codegen/core_codegen.h | 1 + include/grpc++/impl/codegen/core_codegen_interface.h | 1 + src/cpp/common/core_codegen.cc | 2 ++ 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h index e0095b0434c..be6857c4829 100644 --- a/include/grpc++/impl/codegen/call.h +++ b/include/grpc++/impl/codegen/call.h @@ -528,7 +528,7 @@ class CallOpClientRecvStatus { void ClientRecvStatus(ClientContext* context, Status* status) { metadata_map_ = &context->trailing_metadata_; recv_status_ = status; - status_details_ = grpc_empty_slice(); + status_details_ = g_core_codegen_interface->grpc_empty_slice(); } protected: diff --git a/include/grpc++/impl/codegen/core_codegen.h b/include/grpc++/impl/codegen/core_codegen.h index 754bf14b259..6bf95129b81 100644 --- a/include/grpc++/impl/codegen/core_codegen.h +++ b/include/grpc++/impl/codegen/core_codegen.h @@ -76,6 +76,7 @@ class CoreCodegen : public CoreCodegenInterface { grpc_byte_buffer* grpc_raw_byte_buffer_create(grpc_slice* slice, size_t nslices) override; + grpc_slice grpc_empty_slice() override; grpc_slice grpc_slice_malloc(size_t length) override; void grpc_slice_unref(grpc_slice slice) override; grpc_slice grpc_slice_split_tail(grpc_slice* s, size_t split) override; diff --git a/include/grpc++/impl/codegen/core_codegen_interface.h b/include/grpc++/impl/codegen/core_codegen_interface.h index 45ea0403031..e111d59364b 100644 --- a/include/grpc++/impl/codegen/core_codegen_interface.h +++ b/include/grpc++/impl/codegen/core_codegen_interface.h @@ -94,6 +94,7 @@ class CoreCodegenInterface { virtual grpc_byte_buffer* grpc_raw_byte_buffer_create(grpc_slice* slice, size_t nslices) = 0; + virtual grpc_slice grpc_empty_slice() = 0; virtual grpc_slice grpc_slice_malloc(size_t length) = 0; virtual void grpc_slice_unref(grpc_slice slice) = 0; virtual grpc_slice grpc_slice_split_tail(grpc_slice* s, size_t split) = 0; diff --git a/src/cpp/common/core_codegen.cc b/src/cpp/common/core_codegen.cc index 36e4c893540..43dffe7a2a9 100644 --- a/src/cpp/common/core_codegen.cc +++ b/src/cpp/common/core_codegen.cc @@ -111,6 +111,8 @@ grpc_byte_buffer* CoreCodegen::grpc_raw_byte_buffer_create(grpc_slice* slice, return ::grpc_raw_byte_buffer_create(slice, nslices); } +grpc_slice CoreCodegen::grpc_empty_slice() { return ::grpc_empty_slice(); } + grpc_slice CoreCodegen::grpc_slice_malloc(size_t length) { return ::grpc_slice_malloc(length); } From 61d02025b55030cdae26a72b001748af2a0d1424 Mon Sep 17 00:00:00 2001 From: yang-g Date: Tue, 4 Apr 2017 10:04:18 -0700 Subject: [PATCH 161/461] Unref the tail, not the original slice --- src/core/lib/security/transport/security_handshaker.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/core/lib/security/transport/security_handshaker.c b/src/core/lib/security/transport/security_handshaker.c index 2f393276707..509b4b556d6 100644 --- a/src/core/lib/security/transport/security_handshaker.c +++ b/src/core/lib/security/transport/security_handshaker.c @@ -287,12 +287,11 @@ static void on_handshake_data_received_from_peer(grpc_exec_ctx *exec_ctx, if (num_left_overs > 0) { /* Put the leftovers in our buffer (ownership transfered). */ if (has_left_overs_in_current_slice) { - grpc_slice_buffer_add( - &h->left_overs, - grpc_slice_split_tail(&h->args->read_buffer->slices[i], - consumed_slice_size)); + grpc_slice tail = grpc_slice_split_tail(&h->args->read_buffer->slices[i], + consumed_slice_size); + grpc_slice_buffer_add(&h->left_overs, tail); /* split_tail above increments refcount. */ - grpc_slice_unref_internal(exec_ctx, h->args->read_buffer->slices[i]); + grpc_slice_unref_internal(exec_ctx, tail); } grpc_slice_buffer_addn( &h->left_overs, &h->args->read_buffer->slices[i + 1], From 5ce09f08d2ba9eb8b7e75273bcd92c0d7af1b89e Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 4 Apr 2017 10:21:21 -0700 Subject: [PATCH 162/461] Disable CronetUnitTests for possible Jenkins flakiness --- src/objective-c/tests/run_tests.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/objective-c/tests/run_tests.sh b/src/objective-c/tests/run_tests.sh index bd7c2945a27..0e82bcaa44a 100755 --- a/src/objective-c/tests/run_tests.sh +++ b/src/objective-c/tests/run_tests.sh @@ -68,12 +68,16 @@ xcodebuild \ -destination name="iPhone 6" \ test | xcpretty -echo "TIME: $(date)" -xcodebuild \ - -workspace Tests.xcworkspace \ - -scheme CronetUnitTests \ - -destination name="iPhone 6" \ - test | xcpretty +# 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 \ From 97a598365077a217d6cb80e2f24bb6575a0e41b7 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 4 Apr 2017 13:00:13 -0700 Subject: [PATCH 163/461] Reprioritize to fix test --- src/core/ext/filters/client_channel/client_channel_plugin.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel_plugin.c b/src/core/ext/filters/client_channel/client_channel_plugin.c index 944af01af46..113de6927ba 100644 --- a/src/core/ext/filters/client_channel/client_channel_plugin.c +++ b/src/core/ext/filters/client_channel/client_channel_plugin.c @@ -89,8 +89,9 @@ void grpc_client_channel_init(void) { grpc_subchannel_index_init(); grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MIN, set_default_host_if_unset, NULL); - grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MAX, append_filter, - (void *)&grpc_client_channel_filter); + grpc_channel_init_register_stage( + GRPC_CLIENT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, append_filter, + (void *)&grpc_client_channel_filter); grpc_http_connect_register_handshaker_factory(); } From 6f9bb71c2bb3aeeee5d6dc0fee7ff1d81d2b3b41 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 4 Apr 2017 13:03:27 -0700 Subject: [PATCH 164/461] Fix BUILD --- BUILD | 2 -- 1 file changed, 2 deletions(-) diff --git a/BUILD b/BUILD index 78f5b16f6f6..bc4f4eb9789 100644 --- a/BUILD +++ b/BUILD @@ -440,7 +440,6 @@ grpc_cc_library( "src/core/lib/channel/channel_stack.c", "src/core/lib/channel/channel_stack_builder.c", "src/core/lib/channel/connected_channel.c", - "src/core/ext/filters/deadline/deadline_filter.c", "src/core/lib/channel/handshaker.c", "src/core/lib/channel/handshaker_factory.c", "src/core/lib/channel/handshaker_registry.c", @@ -563,7 +562,6 @@ grpc_cc_library( "src/core/lib/channel/channel_stack_builder.h", "src/core/lib/channel/connected_channel.h", "src/core/lib/channel/context.h", - "src/core/ext/filters/deadline/deadline_filter.h", "src/core/lib/channel/handshaker.h", "src/core/lib/channel/handshaker_factory.h", "src/core/lib/channel/handshaker_registry.h", From 1d77b44c0031bb49205d2716013439a0f925aaa2 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 4 Apr 2017 13:23:09 -0700 Subject: [PATCH 165/461] Add representative benchmarks of minimal stacks on chttp2 --- .../bm_fullstack_streaming_ping_pong.cc | 15 +++++++ .../bm_fullstack_streaming_pump.cc | 8 ++++ .../bm_fullstack_unary_ping_pong.cc | 9 ++++ test/cpp/microbenchmarks/fullstack_fixtures.h | 43 ++++++++++++++----- 4 files changed, 65 insertions(+), 10 deletions(-) diff --git a/test/cpp/microbenchmarks/bm_fullstack_streaming_ping_pong.cc b/test/cpp/microbenchmarks/bm_fullstack_streaming_ping_pong.cc index c536e15a2cc..fd2210c4747 100644 --- a/test/cpp/microbenchmarks/bm_fullstack_streaming_ping_pong.cc +++ b/test/cpp/microbenchmarks/bm_fullstack_streaming_ping_pong.cc @@ -436,6 +436,18 @@ BENCHMARK_TEMPLATE(BM_StreamingPingPongMsgs, InProcessCHTTP2, NoOpMutator, BENCHMARK_TEMPLATE(BM_StreamingPingPongMsgs, TCP, NoOpMutator, NoOpMutator) ->Range(0, 128 * 1024 * 1024); +BENCHMARK_TEMPLATE(BM_StreamingPingPong, MinInProcessCHTTP2, NoOpMutator, + NoOpMutator) + ->Apply(StreamingPingPongArgs); +BENCHMARK_TEMPLATE(BM_StreamingPingPong, MinTCP, NoOpMutator, NoOpMutator) + ->Apply(StreamingPingPongArgs); + +BENCHMARK_TEMPLATE(BM_StreamingPingPongMsgs, MinInProcessCHTTP2, NoOpMutator, + NoOpMutator) + ->Range(0, 128 * 1024 * 1024); +BENCHMARK_TEMPLATE(BM_StreamingPingPongMsgs, MinTCP, NoOpMutator, NoOpMutator) + ->Range(0, 128 * 1024 * 1024); + // Generate Args for StreamingPingPongWithCoalescingApi benchmarks. Currently // generates args for only "small streams" (i.e streams with 0, 1 or 2 messages) static void StreamingPingPongWithCoalescingApiArgs( @@ -459,6 +471,9 @@ static void StreamingPingPongWithCoalescingApiArgs( BENCHMARK_TEMPLATE(BM_StreamingPingPongWithCoalescingApi, InProcessCHTTP2, NoOpMutator, NoOpMutator) ->Apply(StreamingPingPongWithCoalescingApiArgs); +BENCHMARK_TEMPLATE(BM_StreamingPingPongWithCoalescingApi, MinInProcessCHTTP2, + NoOpMutator, NoOpMutator) + ->Apply(StreamingPingPongWithCoalescingApiArgs); } // namespace testing } // namespace grpc diff --git a/test/cpp/microbenchmarks/bm_fullstack_streaming_pump.cc b/test/cpp/microbenchmarks/bm_fullstack_streaming_pump.cc index 5c1eb1165b5..47705d30318 100644 --- a/test/cpp/microbenchmarks/bm_fullstack_streaming_pump.cc +++ b/test/cpp/microbenchmarks/bm_fullstack_streaming_pump.cc @@ -189,6 +189,14 @@ BENCHMARK_TEMPLATE(BM_PumpStreamServerToClient, SockPair) ->Range(0, 128 * 1024 * 1024); BENCHMARK_TEMPLATE(BM_PumpStreamServerToClient, InProcessCHTTP2) ->Range(0, 128 * 1024 * 1024); +BENCHMARK_TEMPLATE(BM_PumpStreamClientToServer, MinTCP)->Arg(0); +BENCHMARK_TEMPLATE(BM_PumpStreamClientToServer, MinUDS)->Arg(0); +BENCHMARK_TEMPLATE(BM_PumpStreamClientToServer, MinSockPair)->Arg(0); +BENCHMARK_TEMPLATE(BM_PumpStreamClientToServer, MinInProcessCHTTP2)->Arg(0); +BENCHMARK_TEMPLATE(BM_PumpStreamServerToClient, MinTCP)->Arg(0); +BENCHMARK_TEMPLATE(BM_PumpStreamServerToClient, MinUDS)->Arg(0); +BENCHMARK_TEMPLATE(BM_PumpStreamServerToClient, MinSockPair)->Arg(0); +BENCHMARK_TEMPLATE(BM_PumpStreamServerToClient, MinInProcessCHTTP2)->Arg(0); } // namespace testing } // namespace grpc diff --git a/test/cpp/microbenchmarks/bm_fullstack_unary_ping_pong.cc b/test/cpp/microbenchmarks/bm_fullstack_unary_ping_pong.cc index 615b05b7c7f..7524751fbce 100644 --- a/test/cpp/microbenchmarks/bm_fullstack_unary_ping_pong.cc +++ b/test/cpp/microbenchmarks/bm_fullstack_unary_ping_pong.cc @@ -141,12 +141,21 @@ static void SweepSizesArgs(benchmark::internal::Benchmark* b) { BENCHMARK_TEMPLATE(BM_UnaryPingPong, TCP, NoOpMutator, NoOpMutator) ->Apply(SweepSizesArgs); +BENCHMARK_TEMPLATE(BM_UnaryPingPong, MinTCP, NoOpMutator, NoOpMutator) + ->Apply(SweepSizesArgs); BENCHMARK_TEMPLATE(BM_UnaryPingPong, UDS, NoOpMutator, NoOpMutator) ->Args({0, 0}); +BENCHMARK_TEMPLATE(BM_UnaryPingPong, MinUDS, NoOpMutator, NoOpMutator) + ->Args({0, 0}); BENCHMARK_TEMPLATE(BM_UnaryPingPong, SockPair, NoOpMutator, NoOpMutator) ->Args({0, 0}); +BENCHMARK_TEMPLATE(BM_UnaryPingPong, MinSockPair, NoOpMutator, NoOpMutator) + ->Args({0, 0}); BENCHMARK_TEMPLATE(BM_UnaryPingPong, InProcessCHTTP2, NoOpMutator, NoOpMutator) ->Apply(SweepSizesArgs); +BENCHMARK_TEMPLATE(BM_UnaryPingPong, MinInProcessCHTTP2, NoOpMutator, + NoOpMutator) + ->Apply(SweepSizesArgs); BENCHMARK_TEMPLATE(BM_UnaryPingPong, InProcessCHTTP2, Client_AddMetadata, 1>, NoOpMutator) ->Args({0, 0}); diff --git a/test/cpp/microbenchmarks/fullstack_fixtures.h b/test/cpp/microbenchmarks/fullstack_fixtures.h index dc297010599..0aa35361202 100644 --- a/test/cpp/microbenchmarks/fullstack_fixtures.h +++ b/test/cpp/microbenchmarks/fullstack_fixtures.h @@ -61,17 +61,18 @@ extern "C" { namespace grpc { namespace testing { -static void ApplyCommonServerBuilderConfig(ServerBuilder* b) { - b->SetMaxReceiveMessageSize(INT_MAX); - b->SetMaxSendMessageSize(INT_MAX); -} - -static void ApplyCommonChannelArguments(ChannelArguments* c) { - c->SetInt(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH, INT_MAX); - c->SetInt(GRPC_ARG_MAX_SEND_MESSAGE_LENGTH, INT_MAX); -} +class BaseFixture : public TrackCounters { + public: + virtual void ApplyCommonChannelArguments(ChannelArguments* c) { + c->SetInt(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH, INT_MAX); + c->SetInt(GRPC_ARG_MAX_SEND_MESSAGE_LENGTH, INT_MAX); + } -class BaseFixture : public TrackCounters {}; + virtual void ApplyCommonServerBuilderConfig(ServerBuilder* b) { + b->SetMaxReceiveMessageSize(INT_MAX); + b->SetMaxSendMessageSize(INT_MAX); + } +}; class FullstackFixture : public BaseFixture { public: @@ -238,6 +239,28 @@ class InProcessCHTTP2 : public EndpointPairFixture { } }; +//////////////////////////////////////////////////////////////////////////////// +// Minimal stack fixtures + +template +class MinStackize : public Base { + public: + MinStackize(Service* service) : Base(service) {} + + void ApplyCommonChannelArguments(ChannelArguments* a) { + a->SetInt(GRPC_ARG_MINIMAL_STACK, 1); + } + + void ApplyCommonServerBuilderConfig(ServerBuilder* b) { + b->AddChannelArgument(GRPC_ARG_MINIMAL_STACK, 1); + } +}; + +typedef MinStackize MinTCP; +typedef MinStackize MinUDS; +typedef MinStackize MinSockPair; +typedef MinStackize MinInProcessCHTTP2; + } // namespace testing } // namespace grpc From 7477a14e3caa36d77c3c19789e63bb1676d65054 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Tue, 4 Apr 2017 13:26:44 -0700 Subject: [PATCH 166/461] Remove invalid gpr_free() of arena-allocated memory. --- src/core/ext/filters/client_channel/subchannel.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/core/ext/filters/client_channel/subchannel.c b/src/core/ext/filters/client_channel/subchannel.c index 8086cdb87e0..29a1a095553 100644 --- a/src/core/ext/filters/client_channel/subchannel.c +++ b/src/core/ext/filters/client_channel/subchannel.c @@ -782,8 +782,6 @@ grpc_error *grpc_connected_subchannel_create_call( if (error != GRPC_ERROR_NONE) { const char *error_string = grpc_error_string(error); gpr_log(GPR_ERROR, "error: %s", error_string); - - gpr_free(*call); return error; } GRPC_CONNECTED_SUBCHANNEL_REF(con, "subchannel_call"); From 794952733368b1f56ce13d1736479ef3769fc537 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 4 Apr 2017 13:36:47 -0700 Subject: [PATCH 167/461] Actually instantiate minstack --- test/cpp/microbenchmarks/fullstack_fixtures.h | 60 ++++++++++++------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/test/cpp/microbenchmarks/fullstack_fixtures.h b/test/cpp/microbenchmarks/fullstack_fixtures.h index 0aa35361202..ada1b5747f4 100644 --- a/test/cpp/microbenchmarks/fullstack_fixtures.h +++ b/test/cpp/microbenchmarks/fullstack_fixtures.h @@ -61,30 +61,33 @@ extern "C" { namespace grpc { namespace testing { -class BaseFixture : public TrackCounters { +class FixtureConfiguration { public: - virtual void ApplyCommonChannelArguments(ChannelArguments* c) { + virtual void ApplyCommonChannelArguments(ChannelArguments* c) const { c->SetInt(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH, INT_MAX); c->SetInt(GRPC_ARG_MAX_SEND_MESSAGE_LENGTH, INT_MAX); } - virtual void ApplyCommonServerBuilderConfig(ServerBuilder* b) { + virtual void ApplyCommonServerBuilderConfig(ServerBuilder* b) const { b->SetMaxReceiveMessageSize(INT_MAX); b->SetMaxSendMessageSize(INT_MAX); } }; +class BaseFixture : public TrackCounters {}; + class FullstackFixture : public BaseFixture { public: - FullstackFixture(Service* service, const grpc::string& address) { + FullstackFixture(Service* service, const FixtureConfiguration& config, + const grpc::string& address) { ServerBuilder b; b.AddListeningPort(address, InsecureServerCredentials()); cq_ = b.AddCompletionQueue(true); b.RegisterService(service); - ApplyCommonServerBuilderConfig(&b); + config.ApplyCommonServerBuilderConfig(&b); server_ = b.BuildAndStart(); ChannelArguments args; - ApplyCommonChannelArguments(&args); + config.ApplyCommonChannelArguments(&args); channel_ = CreateCustomChannel(address, InsecureChannelCredentials(), args); } @@ -108,7 +111,9 @@ class FullstackFixture : public BaseFixture { class TCP : public FullstackFixture { public: - TCP(Service* service) : FullstackFixture(service, MakeAddress()) {} + TCP(Service* service, const FixtureConfiguration& fixture_configuration = + FixtureConfiguration()) + : FullstackFixture(service, fixture_configuration, MakeAddress()) {} private: static grpc::string MakeAddress() { @@ -121,7 +126,9 @@ class TCP : public FullstackFixture { class UDS : public FullstackFixture { public: - UDS(Service* service) : FullstackFixture(service, MakeAddress()) {} + UDS(Service* service, const FixtureConfiguration& fixture_configuration = + FixtureConfiguration()) + : FullstackFixture(service, fixture_configuration, MakeAddress()) {} private: static grpc::string MakeAddress() { @@ -135,12 +142,13 @@ class UDS : public FullstackFixture { class EndpointPairFixture : public BaseFixture { public: - EndpointPairFixture(Service* service, grpc_endpoint_pair endpoints) + EndpointPairFixture(Service* service, grpc_endpoint_pair endpoints, + const FixtureConfiguration& fixture_configuration) : endpoint_pair_(endpoints) { ServerBuilder b; cq_ = b.AddCompletionQueue(true); b.RegisterService(service); - ApplyCommonServerBuilderConfig(&b); + fixture_configuration.ApplyCommonServerBuilderConfig(&b); server_ = b.BuildAndStart(); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -170,7 +178,7 @@ class EndpointPairFixture : public BaseFixture { { ChannelArguments args; args.SetString(GRPC_ARG_DEFAULT_AUTHORITY, "test.authority"); - ApplyCommonChannelArguments(&args); + fixture_configuration.ApplyCommonChannelArguments(&args); grpc_channel_args c_args = args.c_channel_args(); client_transport_ = @@ -212,15 +220,19 @@ class EndpointPairFixture : public BaseFixture { class SockPair : public EndpointPairFixture { public: - SockPair(Service* service) + SockPair(Service* service, const FixtureConfiguration& fixture_configuration = + FixtureConfiguration()) : EndpointPairFixture(service, grpc_iomgr_create_endpoint_pair( - "test", Library::get().rq(), 8192)) {} + "test", Library::get().rq(), 8192), + fixture_configuration) {} }; class InProcessCHTTP2 : public EndpointPairFixture { public: - InProcessCHTTP2(Service* service) - : EndpointPairFixture(service, MakeEndpoints()) {} + InProcessCHTTP2(Service* service, + const FixtureConfiguration& fixture_configuration = + FixtureConfiguration()) + : EndpointPairFixture(service, MakeEndpoints(), fixture_configuration) {} void AddToLabel(std::ostream& out, benchmark::State& state) { EndpointPairFixture::AddToLabel(out, state); @@ -242,20 +254,24 @@ class InProcessCHTTP2 : public EndpointPairFixture { //////////////////////////////////////////////////////////////////////////////// // Minimal stack fixtures -template -class MinStackize : public Base { - public: - MinStackize(Service* service) : Base(service) {} - - void ApplyCommonChannelArguments(ChannelArguments* a) { +class MinStackConfiguration : public FixtureConfiguration { + void ApplyCommonChannelArguments(ChannelArguments* a) const override { a->SetInt(GRPC_ARG_MINIMAL_STACK, 1); + FixtureConfiguration::ApplyCommonChannelArguments(a); } - void ApplyCommonServerBuilderConfig(ServerBuilder* b) { + void ApplyCommonServerBuilderConfig(ServerBuilder* b) const override { b->AddChannelArgument(GRPC_ARG_MINIMAL_STACK, 1); + FixtureConfiguration::ApplyCommonServerBuilderConfig(b); } }; +template +class MinStackize : public Base { + public: + MinStackize(Service* service) : Base(service, MinStackConfiguration()) {} +}; + typedef MinStackize MinTCP; typedef MinStackize MinUDS; typedef MinStackize MinSockPair; From ca13603302e7e256ec0e950ab7b133782920facc Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Tue, 4 Apr 2017 13:53:29 -0700 Subject: [PATCH 168/461] Do not retry when we fail to create a subchannel call. --- .../ext/filters/client_channel/client_channel.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel.c b/src/core/ext/filters/client_channel/client_channel.c index 93ad53aab93..04b0ffdaf3d 100644 --- a/src/core/ext/filters/client_channel/client_channel.c +++ b/src/core/ext/filters/client_channel/client_channel.c @@ -1154,14 +1154,17 @@ static void start_transport_stream_op_batch_locked_inner( exec_ctx, calld->connected_subchannel, &call_args, &subchannel_call); if (error != GRPC_ERROR_NONE) { subchannel_call = CANCELLED_CALL; + gpr_atm_rel_store(&calld->subchannel_call, + (gpr_atm)(uintptr_t)subchannel_call); fail_locked(exec_ctx, calld, GRPC_ERROR_REF(error)); grpc_transport_stream_op_batch_finish_with_failure(exec_ctx, op, error); + } else { + gpr_atm_rel_store(&calld->subchannel_call, + (gpr_atm)(uintptr_t)subchannel_call); + retry_waiting_locked(exec_ctx, calld); + /* recurse to retry */ + start_transport_stream_op_batch_locked_inner(exec_ctx, op, elem); } - gpr_atm_rel_store(&calld->subchannel_call, - (gpr_atm)(uintptr_t)subchannel_call); - retry_waiting_locked(exec_ctx, calld); - /* recurse to retry */ - start_transport_stream_op_batch_locked_inner(exec_ctx, op, elem); /* early out */ return; } From 130568e5151ed468d8b40362272104c10aa6488e Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 4 Apr 2017 13:43:49 -0700 Subject: [PATCH 169/461] Fix call destruction bug --- src/node/ext/call.cc | 10 +++++++--- src/node/ext/call.h | 5 ++++- src/node/ext/channel.cc | 2 +- src/node/ext/server.cc | 4 ++-- src/node/ext/server_uv.cc | 3 ++- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/node/ext/call.cc b/src/node/ext/call.cc index 244546d3d78..62f0130d537 100644 --- a/src/node/ext/call.cc +++ b/src/node/ext/call.cc @@ -466,8 +466,10 @@ class ServerCloseResponseOp : public Op { int cancelled; }; -tag::tag(Callback *callback, OpVec *ops, Call *call) : +tag::tag(Callback *callback, OpVec *ops, Call *call, Local call_value) : callback(callback), ops(ops), call(call){ + HandleScope scope; + call_persist.Reset(call_value); } tag::~tag() { @@ -521,6 +523,7 @@ Call::Call(grpc_call *call) : wrapped_call(call), Call::~Call() { if (wrapped_call != NULL) { grpc_call_destroy(wrapped_call); + wrapped_call = NULL; } } @@ -567,7 +570,8 @@ void Call::CompleteBatch(bool is_final_op) { this->has_final_op_completed = true; } this->pending_batches--; - if (this->has_final_op_completed && this->pending_batches == 0) { + if (this->has_final_op_completed && this->pending_batches == 0 && + this->wrapped_call != NULL) { grpc_call_destroy(this->wrapped_call); this->wrapped_call = NULL; } @@ -721,7 +725,7 @@ NAN_METHOD(Call::StartBatch) { Callback *callback = new Callback(callback_func); grpc_call_error error = grpc_call_start_batch( call->wrapped_call, &ops[0], nops, new struct tag( - callback, op_vector.release(), call), NULL); + callback, op_vector.release(), call, info.This()), NULL); if (error != GRPC_CALL_OK) { return Nan::ThrowError(nanErrorWithCode("startBatch failed", error)); } diff --git a/src/node/ext/call.h b/src/node/ext/call.h index cffff00fce4..cceec9c45b5 100644 --- a/src/node/ext/call.h +++ b/src/node/ext/call.h @@ -109,11 +109,14 @@ class Op { typedef std::vector> OpVec; struct tag { - tag(Nan::Callback *callback, OpVec *ops, Call *call); + tag(Nan::Callback *callback, OpVec *ops, Call *call, + v8::Local call_value); ~tag(); Nan::Callback *callback; OpVec *ops; Call *call; + Nan::Persistent> + call_persist; }; v8::Local GetTagNodeValue(void *tag); diff --git a/src/node/ext/channel.cc b/src/node/ext/channel.cc index c795ff7f42f..1263cc0d286 100644 --- a/src/node/ext/channel.cc +++ b/src/node/ext/channel.cc @@ -280,7 +280,7 @@ NAN_METHOD(Channel::WatchConnectivityState) { channel->wrapped_channel, last_state, MillisecondsToTimespec(deadline), GetCompletionQueue(), new struct tag(callback, - ops.release(), NULL)); + ops.release(), NULL, Nan::Null())); CompletionQueueNext(); } diff --git a/src/node/ext/server.cc b/src/node/ext/server.cc index ccb55aa54cf..f0920c842a3 100644 --- a/src/node/ext/server.cc +++ b/src/node/ext/server.cc @@ -193,7 +193,7 @@ NAN_METHOD(Server::RequestCall) { GetCompletionQueue(), GetCompletionQueue(), new struct tag(new Callback(info[0].As()), ops.release(), - NULL)); + NULL, Nan::Null())); if (error != GRPC_CALL_OK) { return Nan::ThrowError(nanErrorWithCode("requestCall failed", error)); } @@ -246,7 +246,7 @@ NAN_METHOD(Server::TryShutdown) { grpc_server_shutdown_and_notify( server->wrapped_server, GetCompletionQueue(), new struct tag(new Nan::Callback(info[0].As()), ops.release(), - NULL)); + NULL, Nan::Null())); CompletionQueueNext(); } diff --git a/src/node/ext/server_uv.cc b/src/node/ext/server_uv.cc index c5e5ca9f42d..82e7589fc87 100644 --- a/src/node/ext/server_uv.cc +++ b/src/node/ext/server_uv.cc @@ -118,7 +118,8 @@ void Server::ShutdownServer() { grpc_server_shutdown_and_notify( this->wrapped_server, GetCompletionQueue(), - new struct tag(new Callback(**shutdown_callback), ops.release(), NULL)); + new struct tag(new Callback(**shutdown_callback), ops.release(), NULL, + Nan::Null())); grpc_server_cancel_all_calls(this->wrapped_server); CompletionQueueNext(); this->wrapped_server = NULL; From a2ca7247ae7345dce987a3542a816f4e101a9345 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Thu, 30 Mar 2017 15:31:29 -0700 Subject: [PATCH 170/461] Add max_connection_age jitter --- src/core/ext/filters/max_age/max_age_filter.c | 24 ++++++++++++++++--- test/core/end2end/tests/max_connection_age.c | 5 ++-- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/core/ext/filters/max_age/max_age_filter.c b/src/core/ext/filters/max_age/max_age_filter.c index b03cb0ba0a9..be5350bce5e 100644 --- a/src/core/ext/filters/max_age/max_age_filter.c +++ b/src/core/ext/filters/max_age/max_age_filter.c @@ -46,6 +46,7 @@ #define DEFAULT_MAX_CONNECTION_AGE_MS INT_MAX #define DEFAULT_MAX_CONNECTION_AGE_GRACE_MS INT_MAX #define DEFAULT_MAX_CONNECTION_IDLE_MS INT_MAX +#define MAX_CONNECTION_AGE_JITTER 0.1 typedef struct channel_data { /* We take a reference to the channel stack for the timer callback */ @@ -254,6 +255,19 @@ static void channel_connectivity_changed(grpc_exec_ctx* exec_ctx, void* arg, } } +/* A random jitter of +/-10% will be added to MAX_CONNECTION_AGE to spread out + connection storms. Note that the MAX_CONNECTION_AGE option without jitter + would not create connection storms by itself, but if there happened to be a + connection storm it could cause it to repeat at a fixed period. */ +static int add_random_max_connection_age_jitter(int value) { + /* generate a random number between 1 - MAX_CONNECTION_AGE_JITTER and + 1 + MAX_CONNECTION_AGE_JITTER */ + double multiplier = rand() * MAX_CONNECTION_AGE_JITTER * 2.0 / RAND_MAX + + 1.0 - MAX_CONNECTION_AGE_JITTER; + double result = multiplier * value; + return result > INT_MAX ? INT_MAX : (int)result; +} + /* Constructor for call_data. */ static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem, @@ -283,7 +297,9 @@ static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx, chand->max_connection_age = DEFAULT_MAX_CONNECTION_AGE_MS == INT_MAX ? gpr_inf_future(GPR_TIMESPAN) - : gpr_time_from_millis(DEFAULT_MAX_CONNECTION_AGE_MS, GPR_TIMESPAN); + : gpr_time_from_millis(add_random_max_connection_age_jitter( + DEFAULT_MAX_CONNECTION_AGE_MS), + GPR_TIMESPAN); chand->max_connection_age_grace = DEFAULT_MAX_CONNECTION_AGE_GRACE_MS == INT_MAX ? gpr_inf_future(GPR_TIMESPAN) @@ -300,8 +316,10 @@ static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx, &args->channel_args->args[i], (grpc_integer_options){DEFAULT_MAX_CONNECTION_AGE_MS, 1, INT_MAX}); chand->max_connection_age = - value == INT_MAX ? gpr_inf_future(GPR_TIMESPAN) - : gpr_time_from_millis(value, GPR_TIMESPAN); + value == INT_MAX + ? gpr_inf_future(GPR_TIMESPAN) + : gpr_time_from_millis( + add_random_max_connection_age_jitter(value), GPR_TIMESPAN); } else if (0 == strcmp(args->channel_args->args[i].key, GRPC_ARG_MAX_CONNECTION_AGE_GRACE_MS)) { const int value = grpc_channel_arg_get_integer( diff --git a/test/core/end2end/tests/max_connection_age.c b/test/core/end2end/tests/max_connection_age.c index 59bfdbabb9b..04bdb39445f 100644 --- a/test/core/end2end/tests/max_connection_age.c +++ b/test/core/end2end/tests/max_connection_age.c @@ -47,6 +47,7 @@ #define MAX_CONNECTION_AGE_GRACE_MS 1000 #define MAX_CONNECTION_IDLE_MS 9999 +#define MAX_CONNECTION_AGE_JITTER_MULTIPLIER 1.1 #define CALL_DEADLINE_S 10 /* The amount of time we wait for the connection to time out, but after it the connection should not use up its grace period. It should be a number between @@ -169,8 +170,8 @@ static void test_max_age_forcibly_close(grpc_end2end_test_config config) { cq_verify(cqv); gpr_timespec expect_shutdown_time = grpc_timeout_milliseconds_to_deadline( - MAX_CONNECTION_AGE_MS + MAX_CONNECTION_AGE_GRACE_MS + - IMMEDIATE_SHUTDOWN_GRACE_TIME_MS); + (int)(MAX_CONNECTION_AGE_MS * MAX_CONNECTION_AGE_JITTER_MULTIPLIER) + + MAX_CONNECTION_AGE_GRACE_MS + IMMEDIATE_SHUTDOWN_GRACE_TIME_MS); /* Wait for the channel to reach its max age */ cq_verify_empty_timeout(cqv, CQ_MAX_CONNECTION_AGE_WAIT_TIME_S); From 0b3d1360c2d56e32ec081304c6f2c65eb3ab1766 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Tue, 4 Apr 2017 13:55:33 -0700 Subject: [PATCH 171/461] Fix float comparison --- src/core/ext/filters/max_age/max_age_filter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/ext/filters/max_age/max_age_filter.c b/src/core/ext/filters/max_age/max_age_filter.c index be5350bce5e..f858220c010 100644 --- a/src/core/ext/filters/max_age/max_age_filter.c +++ b/src/core/ext/filters/max_age/max_age_filter.c @@ -265,7 +265,9 @@ static int add_random_max_connection_age_jitter(int value) { double multiplier = rand() * MAX_CONNECTION_AGE_JITTER * 2.0 / RAND_MAX + 1.0 - MAX_CONNECTION_AGE_JITTER; double result = multiplier * value; - return result > INT_MAX ? INT_MAX : (int)result; + /* INT_MAX - 0.5 converts the value to float, so that result will not be + cast to int implicitly before the comparison. */ + return result > INT_MAX - 0.5 ? INT_MAX : (int)result; } /* Constructor for call_data. */ From 3c754e471619f20ceba807a35b40b2decbcb54b3 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Tue, 4 Apr 2017 13:49:08 -0700 Subject: [PATCH 172/461] Microbenchmark for measuring impact of multiple threads calling cq_next --- CMakeLists.txt | 46 ++++++ Makefile | 49 ++++++ build.yaml | 21 +++ src/core/lib/iomgr/ev_posix.c | 6 + src/core/lib/iomgr/ev_posix.h | 3 + test/cpp/microbenchmarks/BUILD | 23 ++- .../microbenchmarks/bm_cq_multiple_threads.cc | 146 ++++++++++++++++++ .../generated/sources_and_headers.json | 21 +++ tools/run_tests/generated/tests.json | 22 +++ 9 files changed, 333 insertions(+), 4 deletions(-) create mode 100644 test/cpp/microbenchmarks/bm_cq_multiple_threads.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index e3b2558ad29..d260a3797b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -626,6 +626,9 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_dependencies(buildtests_cxx bm_cq) endif() if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) +add_dependencies(buildtests_cxx bm_cq_multiple_threads) +endif() +if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_dependencies(buildtests_cxx bm_error) endif() if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) @@ -8982,6 +8985,49 @@ endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) +add_executable(bm_cq_multiple_threads + test/cpp/microbenchmarks/bm_cq_multiple_threads.cc + third_party/googletest/src/gtest-all.cc +) + + +target_include_directories(bm_cq_multiple_threads + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${BORINGSSL_ROOT_DIR}/include + PRIVATE ${PROTOBUF_ROOT_DIR}/src + PRIVATE ${BENCHMARK_ROOT_DIR}/include + PRIVATE ${ZLIB_ROOT_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CARES_BUILD_INCLUDE_DIR} + PRIVATE ${CARES_INCLUDE_DIR} + PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE third_party/googletest/include + PRIVATE third_party/googletest + PRIVATE ${_gRPC_PROTO_GENS_DIR} +) + +target_link_libraries(bm_cq_multiple_threads + ${_gRPC_PROTOBUF_LIBRARIES} + ${_gRPC_ALLTARGETS_LIBRARIES} + grpc_benchmark + benchmark + grpc++_test_util + grpc_test_util + grpc++ + grpc + gpr_test_util + gpr + ${_gRPC_GFLAGS_LIBRARIES} +) + +endif() +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) +if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) + add_executable(bm_error test/cpp/microbenchmarks/bm_error.cc third_party/googletest/src/gtest-all.cc diff --git a/Makefile b/Makefile index 7499dbbf50d..0d52cb40052 100644 --- a/Makefile +++ b/Makefile @@ -1105,6 +1105,7 @@ bm_chttp2_hpack: $(BINDIR)/$(CONFIG)/bm_chttp2_hpack bm_chttp2_transport: $(BINDIR)/$(CONFIG)/bm_chttp2_transport bm_closure: $(BINDIR)/$(CONFIG)/bm_closure bm_cq: $(BINDIR)/$(CONFIG)/bm_cq +bm_cq_multiple_threads: $(BINDIR)/$(CONFIG)/bm_cq_multiple_threads bm_error: $(BINDIR)/$(CONFIG)/bm_error bm_fullstack_streaming_ping_pong: $(BINDIR)/$(CONFIG)/bm_fullstack_streaming_ping_pong bm_fullstack_streaming_pump: $(BINDIR)/$(CONFIG)/bm_fullstack_streaming_pump @@ -1530,6 +1531,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/bm_chttp2_transport \ $(BINDIR)/$(CONFIG)/bm_closure \ $(BINDIR)/$(CONFIG)/bm_cq \ + $(BINDIR)/$(CONFIG)/bm_cq_multiple_threads \ $(BINDIR)/$(CONFIG)/bm_error \ $(BINDIR)/$(CONFIG)/bm_fullstack_streaming_ping_pong \ $(BINDIR)/$(CONFIG)/bm_fullstack_streaming_pump \ @@ -1648,6 +1650,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/bm_chttp2_transport \ $(BINDIR)/$(CONFIG)/bm_closure \ $(BINDIR)/$(CONFIG)/bm_cq \ + $(BINDIR)/$(CONFIG)/bm_cq_multiple_threads \ $(BINDIR)/$(CONFIG)/bm_error \ $(BINDIR)/$(CONFIG)/bm_fullstack_streaming_ping_pong \ $(BINDIR)/$(CONFIG)/bm_fullstack_streaming_pump \ @@ -1997,6 +2000,8 @@ test_cxx: buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/bm_closure || ( echo test bm_closure failed ; exit 1 ) $(E) "[RUN] Testing bm_cq" $(Q) $(BINDIR)/$(CONFIG)/bm_cq || ( echo test bm_cq failed ; exit 1 ) + $(E) "[RUN] Testing bm_cq_multiple_threads" + $(Q) $(BINDIR)/$(CONFIG)/bm_cq_multiple_threads || ( echo test bm_cq_multiple_threads failed ; exit 1 ) $(E) "[RUN] Testing bm_error" $(Q) $(BINDIR)/$(CONFIG)/bm_error || ( echo test bm_error failed ; exit 1 ) $(E) "[RUN] Testing bm_fullstack_streaming_ping_pong" @@ -13363,6 +13368,50 @@ endif endif +BM_CQ_MULTIPLE_THREADS_SRC = \ + test/cpp/microbenchmarks/bm_cq_multiple_threads.cc \ + +BM_CQ_MULTIPLE_THREADS_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(BM_CQ_MULTIPLE_THREADS_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/bm_cq_multiple_threads: openssl_dep_error + +else + + + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. + +$(BINDIR)/$(CONFIG)/bm_cq_multiple_threads: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/bm_cq_multiple_threads: $(PROTOBUF_DEP) $(BM_CQ_MULTIPLE_THREADS_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_benchmark.a $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(BM_CQ_MULTIPLE_THREADS_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_benchmark.a $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/bm_cq_multiple_threads + +endif + +endif + +$(BM_CQ_MULTIPLE_THREADS_OBJS): CPPFLAGS += -Ithird_party/benchmark/include -DHAVE_POSIX_REGEX +$(OBJDIR)/$(CONFIG)/test/cpp/microbenchmarks/bm_cq_multiple_threads.o: $(LIBDIR)/$(CONFIG)/libgrpc_benchmark.a $(LIBDIR)/$(CONFIG)/libbenchmark.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + +deps_bm_cq_multiple_threads: $(BM_CQ_MULTIPLE_THREADS_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(BM_CQ_MULTIPLE_THREADS_OBJS:.o=.dep) +endif +endif + + BM_ERROR_SRC = \ test/cpp/microbenchmarks/bm_error.cc \ diff --git a/build.yaml b/build.yaml index 8aff16854ce..c88b1161d2f 100644 --- a/build.yaml +++ b/build.yaml @@ -3205,6 +3205,27 @@ targets: - mac - linux - posix +- name: bm_cq_multiple_threads + build: test + language: c++ + src: + - test/cpp/microbenchmarks/bm_cq_multiple_threads.cc + deps: + - grpc_benchmark + - benchmark + - grpc++_test_util + - grpc_test_util + - grpc++ + - grpc + - gpr_test_util + - gpr + args: + - --benchmark_min_time=0 + defaults: benchmark + platforms: + - mac + - linux + - posix - name: bm_error build: test language: c++ diff --git a/src/core/lib/iomgr/ev_posix.c b/src/core/lib/iomgr/ev_posix.c index b5be5504b9d..13409a4de83 100644 --- a/src/core/lib/iomgr/ev_posix.c +++ b/src/core/lib/iomgr/ev_posix.c @@ -111,6 +111,12 @@ static void try_engine(const char *engine) { } } +/* This should be used for testing purposes ONLY */ +void grpc_set_event_engine_test_only( + const grpc_event_engine_vtable *ev_engine) { + g_event_engine = ev_engine; +} + /* Call this only after calling grpc_event_engine_init() */ const char *grpc_get_poll_strategy_name() { return g_poll_strategy_name; } diff --git a/src/core/lib/iomgr/ev_posix.h b/src/core/lib/iomgr/ev_posix.h index 1a9e5c115ae..becc4d359e5 100644 --- a/src/core/lib/iomgr/ev_posix.h +++ b/src/core/lib/iomgr/ev_posix.h @@ -183,4 +183,7 @@ void grpc_pollset_set_del_fd(grpc_exec_ctx *exec_ctx, typedef int (*grpc_poll_function_type)(struct pollfd *, nfds_t, int); extern grpc_poll_function_type grpc_poll_function; +/* This should be used for testing purposes ONLY */ +void grpc_set_event_engine_test_only(const grpc_event_engine_vtable *); + #endif /* GRPC_CORE_LIB_IOMGR_EV_POSIX_H */ diff --git a/test/cpp/microbenchmarks/BUILD b/test/cpp/microbenchmarks/BUILD index 38619666dcb..cae3fa1a146 100644 --- a/test/cpp/microbenchmarks/BUILD +++ b/test/cpp/microbenchmarks/BUILD @@ -32,16 +32,25 @@ licenses(["notice"]) # 3-clause BSD cc_test( name = "noop-benchmark", srcs = ["noop-benchmark.cc"], - deps = ["//external:benchmark"], linkopts = ["-pthread"], + deps = ["//external:benchmark"], ) cc_library( name = "helpers", srcs = ["helpers.cc"], - hdrs = ["helpers.h", "fullstack_fixtures.h", "fullstack_context_mutators.h"], - deps = ["//:grpc++", "//external:benchmark", "//test/core/util:grpc_test_util", "//src/proto/grpc/testing:echo_proto"], + hdrs = [ + "fullstack_context_mutators.h", + "fullstack_fixtures.h", + "helpers.h", + ], linkopts = ["-pthread"], + deps = [ + "//:grpc++", + "//external:benchmark", + "//src/proto/grpc/testing:echo_proto", + "//test/core/util:grpc_test_util", + ], ) cc_test( @@ -56,6 +65,12 @@ cc_test( deps = [":helpers"], ) +cc_test( + name = "bm_cq_multiple_threads", + srcs = ["bm_cq_multiple_threads.cc"], + deps = [":helpers"], +) + cc_test( name = "bm_error", srcs = ["bm_error.cc"], @@ -66,8 +81,8 @@ cc_test( name = "bm_fullstack_streaming_ping_pong", srcs = ["bm_fullstack_streaming_ping_pong.cc"], deps = [":helpers"], +) - ) cc_test( name = "bm_fullstack_streaming_pump", srcs = ["bm_fullstack_streaming_pump.cc"], diff --git a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc new file mode 100644 index 00000000000..f68baad2b01 --- /dev/null +++ b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc @@ -0,0 +1,146 @@ +/* + * + * Copyright 2017, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include +#include + +#include +#include "test/cpp/microbenchmarks/helpers.h" + +extern "C" { +#include "src/core/lib/iomgr/ev_posix.h" +#include "src/core/lib/iomgr/port.h" +#include "src/core/lib/surface/completion_queue.h" +} + +struct grpc_pollset { + gpr_mu mu; +}; + +namespace grpc { +namespace testing { + +static void* make_tag(int i) { return (void*)(intptr_t)i; } +static grpc_completion_queue* g_cq; +static grpc_event_engine_vtable g_vtable; + +static __thread int g_thread_idx; +static __thread grpc_cq_completion g_cq_completion; + +static void pollset_shutdown(grpc_exec_ctx* exec_ctx, grpc_pollset* ps, + grpc_closure* closure) { + grpc_closure_sched(exec_ctx, closure, GRPC_ERROR_NONE); +} + +static void pollset_init(grpc_pollset* ps, gpr_mu** mu) { + gpr_mu_init(&ps->mu); + *mu = &ps->mu; +} + +static void pollset_destroy(grpc_pollset* ps) { gpr_mu_destroy(&ps->mu); } + +static grpc_error* pollset_kick(grpc_pollset* p, grpc_pollset_worker* worker) { + return GRPC_ERROR_NONE; +} + +/* Callback when the tag is dequeued from the completion queue. Does nothing */ +static void cq_done_cb(grpc_exec_ctx* exec_ctx, void* done_arg, + grpc_cq_completion* cq_completion) {} + +/* Queues a completion tag. ZERO polling overhead */ +static grpc_error* pollset_work(grpc_exec_ctx* exec_ctx, grpc_pollset* ps, + grpc_pollset_worker** worker, gpr_timespec now, + gpr_timespec deadline) { + gpr_mu_unlock(&ps->mu); + grpc_cq_end_op(exec_ctx, g_cq, make_tag(g_thread_idx), GRPC_ERROR_NONE, + cq_done_cb, NULL, &g_cq_completion); + grpc_exec_ctx_flush(exec_ctx); + gpr_mu_lock(&ps->mu); + return GRPC_ERROR_NONE; +} + +static void init_engine_vtable() { + memset(&g_vtable, 0, sizeof(g_vtable)); + + g_vtable.pollset_size = sizeof(grpc_pollset); + g_vtable.pollset_init = pollset_init; + g_vtable.pollset_shutdown = pollset_shutdown; + g_vtable.pollset_destroy = pollset_destroy; + g_vtable.pollset_work = pollset_work; + g_vtable.pollset_kick = pollset_kick; +} + +static void setup() { + grpc_init(); + init_engine_vtable(); + grpc_set_event_engine_test_only(&g_vtable); + + g_cq = grpc_completion_queue_create(NULL); +} + +static void BM_Cq_Throughput(benchmark::State& state) { + TrackCounters track_counters; + gpr_timespec deadline = gpr_inf_past(GPR_CLOCK_MONOTONIC); + + if (state.thread_index == 0) { + setup(); + } + + while (state.KeepRunning()) { + g_thread_idx = state.thread_index; + void* dummy_tag = make_tag(g_thread_idx); + grpc_cq_begin_op(g_cq, dummy_tag); + grpc_completion_queue_next(g_cq, deadline, NULL); + } + + if (state.thread_index == 0) { + grpc_completion_queue_shutdown(g_cq); + grpc_completion_queue_destroy(g_cq); + + state.SetItemsProcessed(state.iterations()); + } + + track_counters.Finish(state); +} + +BENCHMARK(BM_Cq_Throughput)->Threads(1); +BENCHMARK(BM_Cq_Throughput)->Threads(2); +BENCHMARK(BM_Cq_Throughput)->Threads(4); +BENCHMARK(BM_Cq_Throughput)->Threads(8); +BENCHMARK(BM_Cq_Throughput)->Threads(16); + +} // namespace testing +} // namespace grpc + +BENCHMARK_MAIN(); diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index be1d8768bd5..412eada7c0e 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -2552,6 +2552,27 @@ "third_party": false, "type": "target" }, + { + "deps": [ + "benchmark", + "gpr", + "gpr_test_util", + "grpc", + "grpc++", + "grpc++_test_util", + "grpc_benchmark", + "grpc_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c++", + "name": "bm_cq_multiple_threads", + "src": [ + "test/cpp/microbenchmarks/bm_cq_multiple_threads.cc" + ], + "third_party": false, + "type": "target" + }, { "deps": [ "benchmark", diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 7d2c51a7d44..bda62794d23 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -2737,6 +2737,28 @@ "posix" ] }, + { + "args": [ + "--benchmark_min_time=0" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "gtest": false, + "language": "c++", + "name": "bm_cq_multiple_threads", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, { "args": [ "--benchmark_min_time=0" From b7d833b865f43c808b3b68625ff7344b431b7da9 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Tue, 4 Apr 2017 14:16:09 -0700 Subject: [PATCH 173/461] Change filter_call_init_fails test to catch the bug. --- .../end2end/tests/filter_call_init_fails.c | 278 +++++++++++++++++- 1 file changed, 269 insertions(+), 9 deletions(-) diff --git a/test/core/end2end/tests/filter_call_init_fails.c b/test/core/end2end/tests/filter_call_init_fails.c index ebfe3b03dc3..2890d59a4c0 100644 --- a/test/core/end2end/tests/filter_call_init_fails.c +++ b/test/core/end2end/tests/filter_call_init_fails.c @@ -49,7 +49,9 @@ enum { TIMEOUT = 200000 }; -static bool g_enable_filter = false; +static bool g_enable_server_channel_filter = false; +static bool g_enable_client_channel_filter = false; +static bool g_enable_client_subchannel_filter = false; static void *tag(intptr_t t) { return (void *)t; } @@ -105,7 +107,7 @@ static void end_test(grpc_end2end_test_fixture *f) { // Simple request via a server filter that always fails to initialize // the call. -static void test_request(grpc_end2end_test_config config) { +static void test_server_channel_filter(grpc_end2end_test_config config) { grpc_call *c; grpc_call *s; grpc_slice request_payload_slice = @@ -199,6 +201,211 @@ static void test_request(grpc_end2end_test_config config) { config.tear_down_data(&f); } +// Simple request via a client channel filter that always fails to +// initialize the call. +static void test_client_channel_filter(grpc_end2end_test_config config) { + grpc_call *c; + grpc_slice request_payload_slice = + grpc_slice_from_copied_string("hello world"); + grpc_byte_buffer *request_payload = + grpc_raw_byte_buffer_create(&request_payload_slice, 1); + gpr_timespec deadline = five_seconds_time(); + grpc_end2end_test_fixture f = + begin_test(config, "filter_call_init_fails", NULL, NULL); + cq_verifier *cqv = cq_verifier_create(f.cq); + grpc_op ops[6]; + grpc_op *op; + grpc_metadata_array initial_metadata_recv; + grpc_metadata_array trailing_metadata_recv; + grpc_metadata_array request_metadata_recv; + grpc_byte_buffer *request_payload_recv = NULL; + grpc_call_details call_details; + grpc_status_code status; + grpc_call_error error; + grpc_slice details; + + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), + get_host_override_slice("foo.test.google.fr:1234", config), deadline, + NULL); + GPR_ASSERT(c); + + grpc_metadata_array_init(&initial_metadata_recv); + grpc_metadata_array_init(&trailing_metadata_recv); + grpc_metadata_array_init(&request_metadata_recv); + grpc_call_details_init(&call_details); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->data.send_initial_metadata.metadata = NULL; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message.send_message = request_payload; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_INITIAL_METADATA; + op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; + op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; + op->data.recv_status_on_client.status = &status; + op->data.recv_status_on_client.status_details = &details; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + CQ_EXPECT_COMPLETION(cqv, tag(1), 1); + cq_verify(cqv); + + GPR_ASSERT(status == GRPC_STATUS_PERMISSION_DENIED); + GPR_ASSERT(0 == grpc_slice_str_cmp(details, "access denied")); + + grpc_slice_unref(details); + grpc_metadata_array_destroy(&initial_metadata_recv); + grpc_metadata_array_destroy(&trailing_metadata_recv); + grpc_metadata_array_destroy(&request_metadata_recv); + grpc_call_details_destroy(&call_details); + + grpc_call_destroy(c); + + cq_verifier_destroy(cqv); + + grpc_byte_buffer_destroy(request_payload); + grpc_byte_buffer_destroy(request_payload_recv); + + end_test(&f); + config.tear_down_data(&f); +} + +// Simple request via a client subchannel filter that always fails to +// initialize the call. +static void test_client_subchannel_filter(grpc_end2end_test_config config) { + grpc_call *c; + grpc_slice request_payload_slice = + grpc_slice_from_copied_string("hello world"); + grpc_byte_buffer *request_payload = + grpc_raw_byte_buffer_create(&request_payload_slice, 1); + gpr_timespec deadline = five_seconds_time(); + grpc_end2end_test_fixture f = + begin_test(config, "filter_call_init_fails", NULL, NULL); + cq_verifier *cqv = cq_verifier_create(f.cq); + grpc_op ops[6]; + grpc_op *op; + grpc_metadata_array initial_metadata_recv; + grpc_metadata_array trailing_metadata_recv; + grpc_metadata_array request_metadata_recv; + grpc_byte_buffer *request_payload_recv = NULL; + grpc_call_details call_details; + grpc_status_code status; + grpc_call_error error; + grpc_slice details; + + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), + get_host_override_slice("foo.test.google.fr:1234", config), deadline, + NULL); + GPR_ASSERT(c); + + grpc_metadata_array_init(&initial_metadata_recv); + grpc_metadata_array_init(&trailing_metadata_recv); + grpc_metadata_array_init(&request_metadata_recv); + grpc_call_details_init(&call_details); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->data.send_initial_metadata.metadata = NULL; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message.send_message = request_payload; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_INITIAL_METADATA; + op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; + op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; + op->data.recv_status_on_client.status = &status; + op->data.recv_status_on_client.status_details = &details; + op->flags = 0; + op->reserved = NULL; + op++; + + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + CQ_EXPECT_COMPLETION(cqv, tag(1), 1); + cq_verify(cqv); + + GPR_ASSERT(status == GRPC_STATUS_PERMISSION_DENIED); + GPR_ASSERT(0 == grpc_slice_str_cmp(details, "access denied")); + + // Reset and create a new call. (The first call uses a different code + // path in client_channel.c than subsequent calls on the same channel, + // and we need to test both.) + grpc_call_destroy(c); + status = GRPC_STATUS_OK; + grpc_slice_unref(details); + details = grpc_empty_slice(); + + c = grpc_channel_create_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), + get_host_override_slice("foo.test.google.fr:1234", config), deadline, + NULL); + GPR_ASSERT(c); + + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + CQ_EXPECT_COMPLETION(cqv, tag(2), 1); + cq_verify(cqv); + + GPR_ASSERT(status == GRPC_STATUS_PERMISSION_DENIED); + GPR_ASSERT(0 == grpc_slice_str_cmp(details, "access denied")); + + grpc_slice_unref(details); + grpc_metadata_array_destroy(&initial_metadata_recv); + grpc_metadata_array_destroy(&trailing_metadata_recv); + grpc_metadata_array_destroy(&request_metadata_recv); + grpc_call_details_destroy(&call_details); + + grpc_call_destroy(c); + + cq_verifier_destroy(cqv); + + grpc_byte_buffer_destroy(request_payload); + grpc_byte_buffer_destroy(request_payload_recv); + + end_test(&f); + config.tear_down_data(&f); +} + /******************************************************************************* * Test filter - always fails to initialize a call */ @@ -242,9 +449,10 @@ static const grpc_channel_filter test_filter = { * Registration */ -static bool maybe_add_filter(grpc_exec_ctx *exec_ctx, - grpc_channel_stack_builder *builder, void *arg) { - if (g_enable_filter) { +static bool maybe_add_server_channel_filter(grpc_exec_ctx *exec_ctx, + grpc_channel_stack_builder *builder, + void *arg) { + if (g_enable_server_channel_filter) { // Want to add the filter as close to the end as possible, to make // sure that all of the filters work well together. However, we // can't add it at the very end, because the connected channel filter @@ -261,17 +469,69 @@ static bool maybe_add_filter(grpc_exec_ctx *exec_ctx, } } +static bool maybe_add_client_channel_filter(grpc_exec_ctx *exec_ctx, + grpc_channel_stack_builder *builder, + void *arg) { + if (g_enable_client_channel_filter) { + // Want to add the filter as close to the end as possible, to make + // sure that all of the filters work well together. However, we + // can't add it at the very end, because the connected channel filter + // must be the last one. So we add it right before the last one. + grpc_channel_stack_builder_iterator *it = + grpc_channel_stack_builder_create_iterator_at_last(builder); + GPR_ASSERT(grpc_channel_stack_builder_move_prev(it)); + const bool retval = grpc_channel_stack_builder_add_filter_before( + it, &test_filter, NULL, NULL); + grpc_channel_stack_builder_iterator_destroy(it); + return retval; + } else { + return true; + } +} + +static bool maybe_add_client_subchannel_filter( + grpc_exec_ctx *exec_ctx, grpc_channel_stack_builder *builder, void *arg) { + if (g_enable_client_subchannel_filter) { + // Want to add the filter as close to the end as possible, to make + // sure that all of the filters work well together. However, we + // can't add it at the very end, because the client channel filter + // must be the last one. So we add it right before the last one. + grpc_channel_stack_builder_iterator *it = + grpc_channel_stack_builder_create_iterator_at_last(builder); + GPR_ASSERT(grpc_channel_stack_builder_move_prev(it)); + const bool retval = grpc_channel_stack_builder_add_filter_before( + it, &test_filter, NULL, NULL); + grpc_channel_stack_builder_iterator_destroy(it); + return retval; + } else { + return true; + } +} + static void init_plugin(void) { grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, INT_MAX, - maybe_add_filter, NULL); + maybe_add_server_channel_filter, NULL); + grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MAX, + maybe_add_client_channel_filter, NULL); + grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, INT_MAX, + maybe_add_client_subchannel_filter, NULL); } static void destroy_plugin(void) {} void filter_call_init_fails(grpc_end2end_test_config config) { - g_enable_filter = true; - test_request(config); - g_enable_filter = false; + gpr_log(GPR_INFO, "Testing server channel filter."); + g_enable_server_channel_filter = true; + test_server_channel_filter(config); + g_enable_server_channel_filter = false; + gpr_log(GPR_INFO, "Testing client channel filter."); + g_enable_client_channel_filter = true; + test_client_channel_filter(config); + g_enable_client_channel_filter = false; + gpr_log(GPR_INFO, "Testing client subchannel filter."); + g_enable_client_subchannel_filter = true; + test_client_subchannel_filter(config); + g_enable_client_subchannel_filter = false; } void filter_call_init_fails_pre_init(void) { From 5bdffab4268977e035bb1ec8a75cd63b32f60183 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 4 Apr 2017 14:24:53 -0700 Subject: [PATCH 174/461] Add profiling annotations --- test/cpp/microbenchmarks/bm_call_create.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index 4af2263e823..2e597a5d83a 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -54,6 +54,7 @@ extern "C" { #include "src/core/lib/channel/http_client_filter.h" #include "src/core/lib/channel/http_server_filter.h" #include "src/core/lib/channel/message_size_filter.h" +#include "src/core/lib/profiling/timers.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/transport/transport_impl.h" } @@ -152,6 +153,7 @@ static void BM_LameChannelCallCreateCpp(benchmark::State &state) { grpc::testing::EchoResponse recv_response; grpc::Status recv_status; while (state.KeepRunning()) { + GPR_TIMER_SCOPE("BenchmarkCycle", 0); grpc::ClientContext cli_ctx; auto reader = stub->AsyncEcho(&cli_ctx, send_request, &cq); reader->Finish(&recv_response, &recv_status, tag(0)); @@ -426,6 +428,7 @@ static void BM_IsolatedFilter(benchmark::State &state) { const int kArenaSize = 4096; call_args.arena = gpr_arena_create(kArenaSize); while (state.KeepRunning()) { + GPR_TIMER_SCOPE("BenchmarkCycle", 0); GRPC_ERROR_UNREF(grpc_call_stack_init(&exec_ctx, channel_stack, 1, DoNothing, NULL, &call_args)); typename TestOp::Op op(&exec_ctx, &test_op_data, call_stack); @@ -590,6 +593,7 @@ static void BM_IsolatedCall_NoOp(benchmark::State &state) { void *method_hdl = grpc_channel_register_call(fixture.channel(), "/foo/bar", NULL, NULL); while (state.KeepRunning()) { + GPR_TIMER_SCOPE("BenchmarkCycle", 0); grpc_call_destroy(grpc_channel_create_registered_call( fixture.channel(), nullptr, GRPC_PROPAGATE_DEFAULTS, fixture.cq(), method_hdl, deadline, NULL)); @@ -628,6 +632,7 @@ static void BM_IsolatedCall_Unary(benchmark::State &state) { ops[5].data.recv_status_on_client.status_details = &status_details; ops[5].data.recv_status_on_client.trailing_metadata = &recv_trailing_metadata; while (state.KeepRunning()) { + GPR_TIMER_SCOPE("BenchmarkCycle", 0); grpc_call *call = grpc_channel_create_registered_call( fixture.channel(), nullptr, GRPC_PROPAGATE_DEFAULTS, fixture.cq(), method_hdl, deadline, NULL); @@ -670,6 +675,7 @@ static void BM_IsolatedCall_StreamingSend(benchmark::State &state) { ops[0].op = GRPC_OP_SEND_MESSAGE; ops[0].data.send_message.send_message = send_message; while (state.KeepRunning()) { + GPR_TIMER_SCOPE("BenchmarkCycle", 0); grpc_call_start_batch(call, ops, 1, tag(2), NULL); grpc_completion_queue_next(fixture.cq(), gpr_inf_future(GPR_CLOCK_MONOTONIC), NULL); From d0ee7a92baa0791083e03dd55745b7a7c5c51e88 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 4 Apr 2017 14:51:37 -0700 Subject: [PATCH 175/461] Fix the hard conversion problem in cronet_transport.c --- src/core/ext/transport/cronet/transport/cronet_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c index 9bd8914b988..0b9189558f8 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.c +++ b/src/core/ext/transport/cronet/transport/cronet_transport.c @@ -1178,7 +1178,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, if (stream_state->rs.compressed) { stream_state->rs.sbs.base.flags = GRPC_WRITE_INTERNAL_COMPRESS; } - *((grpc_byte_buffer **)stream_op->recv_message) = + *((grpc_byte_buffer **)stream_op->payload->recv_message.recv_message) = (grpc_byte_buffer *)&stream_state->rs.sbs; grpc_closure_sched(exec_ctx, stream_op->payload->recv_message.recv_message_ready, From 94736b9d67733b3a86ae1f405c5edcd385edcb5f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 4 Apr 2017 15:30:56 -0700 Subject: [PATCH 176/461] Add encode path --- .../chttp2/transport/hpack_encoder.c | 85 +++++++++++++------ 1 file changed, 57 insertions(+), 28 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.c b/src/core/ext/transport/chttp2/transport/hpack_encoder.c index f5f52a33608..b1bc677a7a4 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.c +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.c @@ -86,6 +86,7 @@ typedef struct { grpc_transport_one_way_stats *stats; /* maximum size of a frame */ size_t max_frame_size; + bool use_true_binary_metadata; } framer_state; /* fills p (which is expected to be 9 bytes long) with a data frame header */ @@ -290,86 +291,113 @@ static void emit_indexed(grpc_chttp2_hpack_compressor *c, uint32_t elem_index, len); } -static grpc_slice get_wire_value(grpc_mdelem elem, uint8_t *huffman_prefix) { +typedef struct { + grpc_slice data; + uint8_t huffman_prefix; + bool insert_null_before_wire_value; +} wire_value; + +static wire_value get_wire_value(grpc_mdelem elem, bool true_binary_enabled) { if (grpc_is_binary_header(GRPC_MDKEY(elem))) { - *huffman_prefix = 0x80; - return grpc_chttp2_base64_encode_and_huffman_compress(GRPC_MDVALUE(elem)); + if (true_binary_enabled) { + return (wire_value){ + .huffman_prefix = 0x00, + .insert_null_before_wire_value = true, + .data = grpc_slice_ref_internal(GRPC_MDVALUE(elem)), + }; + } else { + return (wire_value){ + .huffman_prefix = 0x80, + .insert_null_before_wire_value = false, + .data = grpc_chttp2_base64_encode_and_huffman_compress( + GRPC_MDVALUE(elem)), + }; + } + } else { + /* TODO(ctiller): opportunistically compress non-binary headers */ + return (wire_value){ + .huffman_prefix = 0x00, + .insert_null_before_wire_value = false, + .data = grpc_slice_ref_internal(GRPC_MDVALUE(elem)), + }; } - /* TODO(ctiller): opportunistically compress non-binary headers */ - *huffman_prefix = 0x00; - return grpc_slice_ref_internal(GRPC_MDVALUE(elem)); +} + +static size_t wire_value_length(wire_value v) { + return GPR_SLICE_LENGTH(v.data) + v.insert_null_before_wire_value; +} + +static void add_wire_value(framer_state *st, wire_value v) { + if (v.insert_null_before_wire_value) *add_tiny_header_data(st, 1) = 0; + add_header_data(st, v.data); } static void emit_lithdr_incidx(grpc_chttp2_hpack_compressor *c, uint32_t key_index, grpc_mdelem elem, framer_state *st) { uint32_t len_pfx = GRPC_CHTTP2_VARINT_LENGTH(key_index, 2); - uint8_t huffman_prefix; - grpc_slice value_slice = get_wire_value(elem, &huffman_prefix); - size_t len_val = GRPC_SLICE_LENGTH(value_slice); + wire_value value = get_wire_value(elem, st->use_true_binary_metadata); + size_t len_val = wire_value_length(value); uint32_t len_val_len; GPR_ASSERT(len_val <= UINT32_MAX); len_val_len = GRPC_CHTTP2_VARINT_LENGTH((uint32_t)len_val, 1); GRPC_CHTTP2_WRITE_VARINT(key_index, 2, 0x40, add_tiny_header_data(st, len_pfx), len_pfx); - GRPC_CHTTP2_WRITE_VARINT((uint32_t)len_val, 1, huffman_prefix, + GRPC_CHTTP2_WRITE_VARINT((uint32_t)len_val, 1, value.huffman_prefix, add_tiny_header_data(st, len_val_len), len_val_len); - add_header_data(st, value_slice); + add_wire_value(st, value); } static void emit_lithdr_noidx(grpc_chttp2_hpack_compressor *c, uint32_t key_index, grpc_mdelem elem, framer_state *st) { uint32_t len_pfx = GRPC_CHTTP2_VARINT_LENGTH(key_index, 4); - uint8_t huffman_prefix; - grpc_slice value_slice = get_wire_value(elem, &huffman_prefix); - size_t len_val = GRPC_SLICE_LENGTH(value_slice); + wire_value value = get_wire_value(elem, st->use_true_binary_metadata); + size_t len_val = wire_value_length(value); uint32_t len_val_len; GPR_ASSERT(len_val <= UINT32_MAX); len_val_len = GRPC_CHTTP2_VARINT_LENGTH((uint32_t)len_val, 1); GRPC_CHTTP2_WRITE_VARINT(key_index, 4, 0x00, add_tiny_header_data(st, len_pfx), len_pfx); - GRPC_CHTTP2_WRITE_VARINT((uint32_t)len_val, 1, huffman_prefix, + GRPC_CHTTP2_WRITE_VARINT((uint32_t)len_val, 1, value.huffman_prefix, add_tiny_header_data(st, len_val_len), len_val_len); - add_header_data(st, value_slice); + add_wire_value(st, value); } static void emit_lithdr_incidx_v(grpc_chttp2_hpack_compressor *c, grpc_mdelem elem, framer_state *st) { uint32_t len_key = (uint32_t)GRPC_SLICE_LENGTH(GRPC_MDKEY(elem)); - uint8_t huffman_prefix; - grpc_slice value_slice = get_wire_value(elem, &huffman_prefix); - uint32_t len_val = (uint32_t)GRPC_SLICE_LENGTH(value_slice); + wire_value value = get_wire_value(elem, st->use_true_binary_metadata); + uint32_t len_val = (uint32_t)wire_value_length(value); uint32_t len_key_len = GRPC_CHTTP2_VARINT_LENGTH(len_key, 1); uint32_t len_val_len = GRPC_CHTTP2_VARINT_LENGTH(len_val, 1); GPR_ASSERT(len_key <= UINT32_MAX); - GPR_ASSERT(GRPC_SLICE_LENGTH(value_slice) <= UINT32_MAX); + GPR_ASSERT(wire_value_length(value) <= UINT32_MAX); *add_tiny_header_data(st, 1) = 0x40; GRPC_CHTTP2_WRITE_VARINT(len_key, 1, 0x00, add_tiny_header_data(st, len_key_len), len_key_len); add_header_data(st, grpc_slice_ref_internal(GRPC_MDKEY(elem))); - GRPC_CHTTP2_WRITE_VARINT(len_val, 1, huffman_prefix, + GRPC_CHTTP2_WRITE_VARINT(len_val, 1, value.huffman_prefix, add_tiny_header_data(st, len_val_len), len_val_len); - add_header_data(st, value_slice); + add_wire_value(st, value); } static void emit_lithdr_noidx_v(grpc_chttp2_hpack_compressor *c, grpc_mdelem elem, framer_state *st) { uint32_t len_key = (uint32_t)GRPC_SLICE_LENGTH(GRPC_MDKEY(elem)); - uint8_t huffman_prefix; - grpc_slice value_slice = get_wire_value(elem, &huffman_prefix); - uint32_t len_val = (uint32_t)GRPC_SLICE_LENGTH(value_slice); + wire_value value = get_wire_value(elem, st->use_true_binary_metadata); + uint32_t len_val = (uint32_t)wire_value_length(value); uint32_t len_key_len = GRPC_CHTTP2_VARINT_LENGTH(len_key, 1); uint32_t len_val_len = GRPC_CHTTP2_VARINT_LENGTH(len_val, 1); GPR_ASSERT(len_key <= UINT32_MAX); - GPR_ASSERT(GRPC_SLICE_LENGTH(value_slice) <= UINT32_MAX); + GPR_ASSERT(wire_value_length(value) <= UINT32_MAX); *add_tiny_header_data(st, 1) = 0x00; GRPC_CHTTP2_WRITE_VARINT(len_key, 1, 0x00, add_tiny_header_data(st, len_key_len), len_key_len); add_header_data(st, grpc_slice_ref_internal(GRPC_MDKEY(elem))); - GRPC_CHTTP2_WRITE_VARINT(len_val, 1, huffman_prefix, + GRPC_CHTTP2_WRITE_VARINT(len_val, 1, value.huffman_prefix, add_tiny_header_data(st, len_val_len), len_val_len); - add_header_data(st, value_slice); + add_wire_value(st, value); } static void emit_advertise_table_size_change(grpc_chttp2_hpack_compressor *c, @@ -610,6 +638,7 @@ void grpc_chttp2_encode_header(grpc_exec_ctx *exec_ctx, st.is_first_frame = 1; st.stats = options->stats; st.max_frame_size = options->max_frame_size; + st.use_true_binary_metadata = options->use_true_binary_metadata; /* Encode a metadata batch; store the returned values, representing a metadata element that needs to be unreffed back into the metadata From c5548cce42f8c4783c3c0368ea3ce00a196ff944 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 4 Apr 2017 16:05:23 -0700 Subject: [PATCH 177/461] Add parsing for true-binary metadata --- .../transport/chttp2/transport/hpack_parser.c | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.c b/src/core/ext/transport/chttp2/transport/hpack_parser.c index 5099d736bf4..1846a85fc65 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parser.c +++ b/src/core/ext/transport/chttp2/transport/hpack_parser.c @@ -38,11 +38,6 @@ #include #include -/* This is here for grpc_is_binary_header - * TODO(murgatroid99): Remove this - */ -#include - #include #include #include @@ -55,13 +50,11 @@ #include "src/core/lib/support/string.h" #include "src/core/lib/transport/http2_errors.h" -/* TODO(ctiller): remove before submission */ -#include "src/core/lib/slice/slice_string_helpers.h" - extern int grpc_http_trace; typedef enum { NOT_BINARY, + BINARY_BEGIN, B64_BYTE0, B64_BYTE1, B64_BYTE2, @@ -1325,6 +1318,19 @@ static grpc_error *append_string(grpc_exec_ctx *exec_ctx, case NOT_BINARY: append_bytes(str, cur, (size_t)(end - cur)); return GRPC_ERROR_NONE; + case BINARY_BEGIN: + if (cur == end) { + p->binary = BINARY_BEGIN; + return GRPC_ERROR_NONE; + } + if (*cur == 0) { + /* 'true-binary' case */ + ++cur; + p->binary = NOT_BINARY; + append_bytes(str, cur, (size_t)(end - cur)); + return GRPC_ERROR_NONE; + } + /* fallthrough */ b64_byte0: case B64_BYTE0: if (cur == end) { @@ -1409,6 +1415,8 @@ static grpc_error *finish_str(grpc_exec_ctx *exec_ctx, switch ((binary_state)p->binary) { case NOT_BINARY: break; + case BINARY_BEGIN: + break; case B64_BYTE0: break; case B64_BYTE1: @@ -1571,7 +1579,7 @@ static grpc_error *parse_value_string(grpc_exec_ctx *exec_ctx, const uint8_t *cur, const uint8_t *end, bool is_binary) { return begin_parse_string(exec_ctx, p, cur, end, - is_binary ? B64_BYTE0 : NOT_BINARY, &p->value); + is_binary ? BINARY_BEGIN : NOT_BINARY, &p->value); } static grpc_error *parse_value_string_with_indexed_key( From 2c3e7e80bd861d28e6395f503650828c0eb05580 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Tue, 4 Apr 2017 16:21:52 -0700 Subject: [PATCH 178/461] use wallclock --- test/cpp/microbenchmarks/bm_cq_multiple_threads.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc index f68baad2b01..82f402d3ddd 100644 --- a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc +++ b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc @@ -127,18 +127,16 @@ static void BM_Cq_Throughput(benchmark::State& state) { if (state.thread_index == 0) { grpc_completion_queue_shutdown(g_cq); grpc_completion_queue_destroy(g_cq); - - state.SetItemsProcessed(state.iterations()); } track_counters.Finish(state); } -BENCHMARK(BM_Cq_Throughput)->Threads(1); -BENCHMARK(BM_Cq_Throughput)->Threads(2); -BENCHMARK(BM_Cq_Throughput)->Threads(4); -BENCHMARK(BM_Cq_Throughput)->Threads(8); -BENCHMARK(BM_Cq_Throughput)->Threads(16); +BENCHMARK(BM_Cq_Throughput)->Threads(1)->UseRealTime(); +BENCHMARK(BM_Cq_Throughput)->Threads(2)->UseRealTime(); +BENCHMARK(BM_Cq_Throughput)->Threads(4)->UseRealTime(); +BENCHMARK(BM_Cq_Throughput)->Threads(8)->UseRealTime(); +BENCHMARK(BM_Cq_Throughput)->Threads(16)->UseRealTime(); } // namespace testing } // namespace grpc From e76a0ecc034c135d271bac7a8fa082fbe0b80243 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 4 Apr 2017 16:24:20 -0700 Subject: [PATCH 179/461] Update hpack benchmarks for true binary --- test/cpp/microbenchmarks/bm_chttp2_hpack.cc | 143 ++++++++++++++------ 1 file changed, 101 insertions(+), 42 deletions(-) diff --git a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc index 7426407874b..5489eb99739 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc @@ -93,7 +93,7 @@ static void BM_HpackEncoderEncodeHeader(benchmark::State &state) { grpc_encode_header_options hopt = { static_cast(state.iterations()), state.range(0) != 0, - false, + Fixture::kEnableTrueBinary, (size_t)state.range(1), &stats, }; @@ -127,6 +127,7 @@ namespace hpack_encoder_fixtures { class EmptyBatch { public: + static constexpr bool kEnableTrueBinary = false; static std::vector GetElems(grpc_exec_ctx *exec_ctx) { return {}; } @@ -134,6 +135,7 @@ class EmptyBatch { class SingleStaticElem { public: + static constexpr bool kEnableTrueBinary = false; static std::vector GetElems(grpc_exec_ctx *exec_ctx) { return {GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE}; } @@ -141,6 +143,7 @@ class SingleStaticElem { class SingleInternedElem { public: + static constexpr bool kEnableTrueBinary = false; static std::vector GetElems(grpc_exec_ctx *exec_ctx) { return {grpc_mdelem_from_slices( exec_ctx, grpc_slice_intern(grpc_slice_from_static_string("abc")), @@ -148,9 +151,10 @@ class SingleInternedElem { } }; -template +template class SingleInternedBinaryElem { public: + static constexpr bool kEnableTrueBinary = kTrueBinary; static std::vector GetElems(grpc_exec_ctx *exec_ctx) { grpc_slice bytes = MakeBytes(); std::vector out = {grpc_mdelem_from_slices( @@ -172,6 +176,7 @@ class SingleInternedBinaryElem { class SingleInternedKeyElem { public: + static constexpr bool kEnableTrueBinary = false; static std::vector GetElems(grpc_exec_ctx *exec_ctx) { return {grpc_mdelem_from_slices( exec_ctx, grpc_slice_intern(grpc_slice_from_static_string("abc")), @@ -181,6 +186,7 @@ class SingleInternedKeyElem { class SingleNonInternedElem { public: + static constexpr bool kEnableTrueBinary = false; static std::vector GetElems(grpc_exec_ctx *exec_ctx) { return {grpc_mdelem_from_slices(exec_ctx, grpc_slice_from_static_string("abc"), @@ -188,9 +194,10 @@ class SingleNonInternedElem { } }; -template +template class SingleNonInternedBinaryElem { public: + static constexpr bool kEnableTrueBinary = kTrueBinary; static std::vector GetElems(grpc_exec_ctx *exec_ctx) { return {grpc_mdelem_from_slices( exec_ctx, grpc_slice_from_static_string("abc-bin"), MakeBytes())}; @@ -208,6 +215,7 @@ class SingleNonInternedBinaryElem { class RepresentativeClientInitialMetadata { public: + static constexpr bool kEnableTrueBinary = true; static std::vector GetElems(grpc_exec_ctx *exec_ctx) { return { GRPC_MDELEM_SCHEME_HTTP, GRPC_MDELEM_METHOD_POST, @@ -229,6 +237,7 @@ class RepresentativeClientInitialMetadata { class RepresentativeServerInitialMetadata { public: + static constexpr bool kEnableTrueBinary = true; static std::vector GetElems(grpc_exec_ctx *exec_ctx) { return {GRPC_MDELEM_STATUS_200, GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC, @@ -238,6 +247,7 @@ class RepresentativeServerInitialMetadata { class RepresentativeServerTrailingMetadata { public: + static constexpr bool kEnableTrueBinary = true; static std::vector GetElems(grpc_exec_ctx *exec_ctx) { return {GRPC_MDELEM_GRPC_STATUS_0}; } @@ -252,28 +262,67 @@ BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleInternedKeyElem) ->Args({0, 16384}); BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleInternedElem) ->Args({0, 16384}); -BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleInternedBinaryElem<1>) +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, + SingleInternedBinaryElem<1, false>) + ->Args({0, 16384}); +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, + SingleInternedBinaryElem<3, false>) + ->Args({0, 16384}); +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, + SingleInternedBinaryElem<10, false>) + ->Args({0, 16384}); +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, + SingleInternedBinaryElem<31, false>) + ->Args({0, 16384}); +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, + SingleInternedBinaryElem<100, false>) + ->Args({0, 16384}); +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, + SingleInternedBinaryElem<1, true>) ->Args({0, 16384}); -BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleInternedBinaryElem<3>) +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, + SingleInternedBinaryElem<3, true>) ->Args({0, 16384}); -BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleInternedBinaryElem<10>) +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, + SingleInternedBinaryElem<10, true>) ->Args({0, 16384}); -BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleInternedBinaryElem<31>) +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, + SingleInternedBinaryElem<31, true>) ->Args({0, 16384}); -BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleInternedBinaryElem<100>) +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, + SingleInternedBinaryElem<100, true>) ->Args({0, 16384}); BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleNonInternedElem) ->Args({0, 16384}); -BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleNonInternedBinaryElem<1>) +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, + SingleNonInternedBinaryElem<1, false>) + ->Args({0, 16384}); +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, + SingleNonInternedBinaryElem<3, false>) ->Args({0, 16384}); -BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleNonInternedBinaryElem<3>) +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, + SingleNonInternedBinaryElem<10, false>) ->Args({0, 16384}); -BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleNonInternedBinaryElem<10>) +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, + SingleNonInternedBinaryElem<31, false>) ->Args({0, 16384}); -BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleNonInternedBinaryElem<31>) +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, + SingleNonInternedBinaryElem<100, false>) ->Args({0, 16384}); BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, - SingleNonInternedBinaryElem<100>) + SingleNonInternedBinaryElem<1, true>) + ->Args({0, 16384}); +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, + SingleNonInternedBinaryElem<3, true>) + ->Args({0, 16384}); +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, + SingleNonInternedBinaryElem<10, true>) + ->Args({0, 16384}); +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, + SingleNonInternedBinaryElem<31, true>) + ->Args({0, 16384}); +BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, + SingleNonInternedBinaryElem<100, true>) ->Args({0, 16384}); // test with a tiny frame size, to highlight continuation costs BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, SingleNonInternedElem) @@ -426,7 +475,27 @@ class NonIndexedElem { } }; -class NonIndexedBinaryElem1 { +template +class NonIndexedBinaryElem; + +template +class NonIndexedBinaryElem { + public: + static std::vector GetInitSlices() { return {}; } + static std::vector GetBenchmarkSlices() { + std::vector v = { + 0x00, 0x07, 'a', 'b', 'c', + '-', 'b', 'i', 'n', static_cast(kLength + 1), + 0}; + for (int i = 0; i < kLength; i++) { + v.push_back(static_cast(i)); + } + return {MakeSlice(v)}; + } +}; + +template <> +class NonIndexedBinaryElem<1, false> { public: static std::vector GetInitSlices() { return {}; } static std::vector GetBenchmarkSlices() { @@ -435,7 +504,8 @@ class NonIndexedBinaryElem1 { } }; -class NonIndexedBinaryElem3 { +template <> +class NonIndexedBinaryElem<3, false> { public: static std::vector GetInitSlices() { return {}; } static std::vector GetBenchmarkSlices() { @@ -444,7 +514,8 @@ class NonIndexedBinaryElem3 { } }; -class NonIndexedBinaryElem10 { +template <> +class NonIndexedBinaryElem<10, false> { public: static std::vector GetInitSlices() { return {}; } static std::vector GetBenchmarkSlices() { @@ -454,7 +525,8 @@ class NonIndexedBinaryElem10 { } }; -class NonIndexedBinaryElem31 { +template <> +class NonIndexedBinaryElem<31, false> { public: static std::vector GetInitSlices() { return {}; } static std::vector GetBenchmarkSlices() { @@ -466,7 +538,8 @@ class NonIndexedBinaryElem31 { } }; -class NonIndexedBinaryElem100 { +template <> +class NonIndexedBinaryElem<100, false> { public: static std::vector GetInitSlices() { return {}; } static std::vector GetBenchmarkSlices() { @@ -575,11 +648,16 @@ BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, IndexedSingleInternedElem); BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, AddIndexedSingleInternedElem); BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, KeyIndexedSingleInternedElem); BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, NonIndexedElem); -BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, NonIndexedBinaryElem1); -BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, NonIndexedBinaryElem3); -BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, NonIndexedBinaryElem10); -BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, NonIndexedBinaryElem31); -BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, NonIndexedBinaryElem100); +BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, NonIndexedBinaryElem<1, false>); +BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, NonIndexedBinaryElem<3, false>); +BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, NonIndexedBinaryElem<10, false>); +BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, NonIndexedBinaryElem<31, false>); +BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, NonIndexedBinaryElem<100, false>); +BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, NonIndexedBinaryElem<1, true>); +BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, NonIndexedBinaryElem<3, true>); +BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, NonIndexedBinaryElem<10, true>); +BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, NonIndexedBinaryElem<31, true>); +BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, NonIndexedBinaryElem<100, true>); BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, RepresentativeClientInitialMetadata); BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, @@ -589,23 +667,4 @@ BENCHMARK_TEMPLATE(BM_HpackParserParseHeader, } // namespace hpack_parser_fixtures -static void BM_Base16SomeStuff(benchmark::State &state) { - uint8_t *bytes = new uint8_t[state.range(0)]; - for (int i = 0; i < state.range(0); i++) { - bytes[i] = static_cast(rand()); - } - uint8_t *encoded = new uint8_t[state.range(0) * 2]; - static const uint8_t hex[] = "0123456789abcdef"; - while (state.KeepRunning()) { - for (int i = 0; i < state.range(0); i++) { - encoded[2 * i + 0] = hex[encoded[i] >> 8]; - encoded[2 * i + 1] = hex[encoded[i] & 0xf]; - } - } - delete[] encoded; - delete[] bytes; - state.SetBytesProcessed(state.iterations() * state.range(0)); -} -BENCHMARK(BM_Base16SomeStuff)->Range(1, 4096); - BENCHMARK_MAIN(); From e4e763265bdf9e5a4d6098b3cb5380b00f3bd29f Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Tue, 4 Apr 2017 16:28:59 -0700 Subject: [PATCH 180/461] Add UpdateActions to the interop client helper --- test/cpp/interop/client.cc | 3 +++ test/cpp/interop/client_helper.cc | 3 +++ test/cpp/interop/client_helper.h | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index 5688ab79716..369413e6a1d 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -99,6 +99,7 @@ DEFINE_bool(do_not_abort_on_transient_failures, false, using grpc::testing::CreateChannelForTestCase; using grpc::testing::GetServiceAccountJsonKey; +using grpc::testing::UpdateActions; int main(int argc, char** argv) { grpc::testing::InitTest(&argc, &argv, true); @@ -165,6 +166,8 @@ int main(int argc, char** argv) { // actions["cacheable_unary"] = // std::bind(&grpc::testing::InteropClient::DoCacheableUnary, &client); + UpdateActions(&actions); + if (FLAGS_test_case == "all") { for (const auto& action : actions) { action.second(); diff --git a/test/cpp/interop/client_helper.cc b/test/cpp/interop/client_helper.cc index d3192ad0c93..784cd2826d6 100644 --- a/test/cpp/interop/client_helper.cc +++ b/test/cpp/interop/client_helper.cc @@ -89,6 +89,9 @@ grpc::string GetOauth2AccessToken() { return access_token; } +void UpdateActions( + std::unordered_map>* actions) {} + std::shared_ptr CreateChannelForTestCase( const grpc::string& test_case) { GPR_ASSERT(FLAGS_server_port); diff --git a/test/cpp/interop/client_helper.h b/test/cpp/interop/client_helper.h index 622b96e4fbf..387530a21c7 100644 --- a/test/cpp/interop/client_helper.h +++ b/test/cpp/interop/client_helper.h @@ -35,6 +35,7 @@ #define GRPC_TEST_CPP_INTEROP_CLIENT_HELPER_H #include +#include #include @@ -47,6 +48,9 @@ grpc::string GetServiceAccountJsonKey(); grpc::string GetOauth2AccessToken(); +void UpdateActions( + std::unordered_map>* actions); + std::shared_ptr CreateChannelForTestCase( const grpc::string& test_case); From 43f774e4d4077e60abe0be6211f3d9b67559b1ff Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Tue, 4 Apr 2017 16:35:37 -0700 Subject: [PATCH 181/461] Add check that we don't schedule the same closure twice at once. --- src/core/lib/iomgr/closure.c | 11 +++++++++++ src/core/lib/iomgr/closure.h | 4 ++++ src/core/lib/iomgr/combiner.c | 6 ++++++ src/core/lib/iomgr/ev_epoll_linux.c | 3 +++ src/core/lib/iomgr/exec_ctx.c | 6 ++++++ src/core/lib/iomgr/executor.c | 6 ++++++ 6 files changed, 36 insertions(+) diff --git a/src/core/lib/iomgr/closure.c b/src/core/lib/iomgr/closure.c index 6633fb68ecf..8ef0b210ad2 100644 --- a/src/core/lib/iomgr/closure.c +++ b/src/core/lib/iomgr/closure.c @@ -45,6 +45,9 @@ grpc_closure *grpc_closure_init(grpc_closure *closure, grpc_iomgr_cb_func cb, closure->cb = cb; closure->cb_arg = cb_arg; closure->scheduler = scheduler; +#ifndef NDEBUG + closure->scheduled = false; +#endif return closure; } @@ -137,6 +140,10 @@ void grpc_closure_sched(grpc_exec_ctx *exec_ctx, grpc_closure *c, grpc_error *error) { GPR_TIMER_BEGIN("grpc_closure_sched", 0); if (c != NULL) { +#ifndef NDEBUG + GPR_ASSERT(!c->scheduled); + c->scheduled = true; +#endif assert(c->cb); c->scheduler->vtable->sched(exec_ctx, c, error); } else { @@ -149,6 +156,10 @@ void grpc_closure_list_sched(grpc_exec_ctx *exec_ctx, grpc_closure_list *list) { grpc_closure *c = list->head; while (c != NULL) { grpc_closure *next = c->next_data.next; +#ifndef NDEBUG + GPR_ASSERT(!c->scheduled); + c->scheduled = true; +#endif assert(c->cb); c->scheduler->vtable->sched(exec_ctx, c, c->error_data.error); c = next; diff --git a/src/core/lib/iomgr/closure.h b/src/core/lib/iomgr/closure.h index 2510d50b428..2bedbf00d63 100644 --- a/src/core/lib/iomgr/closure.h +++ b/src/core/lib/iomgr/closure.h @@ -99,6 +99,10 @@ struct grpc_closure { grpc_error *error; uintptr_t scratch; } error_data; + +#ifndef NDEBUG + bool scheduled; +#endif }; /** Initializes \a closure with \a cb and \a cb_arg. Returns \a closure. */ diff --git a/src/core/lib/iomgr/combiner.c b/src/core/lib/iomgr/combiner.c index 2bc476bbef6..05cdbdad2b7 100644 --- a/src/core/lib/iomgr/combiner.c +++ b/src/core/lib/iomgr/combiner.c @@ -319,6 +319,9 @@ bool grpc_combiner_continue_exec_ctx(grpc_exec_ctx *exec_ctx) { GPR_TIMER_BEGIN("combiner.exec1", 0); grpc_closure *cl = (grpc_closure *)n; error_data err = unpack_error_data(cl->error_data.scratch); +#ifndef NDEBUG + cl->scheduled = false; +#endif cl->cb(exec_ctx, cl->cb_arg, err.error); if (err.covered_by_poller) { gpr_atm_no_barrier_fetch_add(&lock->elements_covered_by_poller, -1); @@ -337,6 +340,9 @@ bool grpc_combiner_continue_exec_ctx(grpc_exec_ctx *exec_ctx) { gpr_log(GPR_DEBUG, "C:%p execute_final[%d] c=%p", lock, loops, c)); grpc_closure *next = c->next_data.next; grpc_error *error = c->error_data.error; +#ifndef NDEBUG + c->scheduled = false; +#endif c->cb(exec_ctx, c->cb_arg, error); GRPC_ERROR_UNREF(error); c = next; diff --git a/src/core/lib/iomgr/ev_epoll_linux.c b/src/core/lib/iomgr/ev_epoll_linux.c index 7014b983495..748b4c4f98d 100644 --- a/src/core/lib/iomgr/ev_epoll_linux.c +++ b/src/core/lib/iomgr/ev_epoll_linux.c @@ -1549,6 +1549,9 @@ static bool maybe_do_workqueue_work(grpc_exec_ctx *exec_ctx, } grpc_closure *c = (grpc_closure *)n; grpc_error *error = c->error_data.error; +#ifndef NDEBUG + c->scheduled = false; +#endif c->cb(exec_ctx, c->cb_arg, error); GRPC_ERROR_UNREF(error); return true; diff --git a/src/core/lib/iomgr/exec_ctx.c b/src/core/lib/iomgr/exec_ctx.c index 83bb436bd0a..2532a708e7b 100644 --- a/src/core/lib/iomgr/exec_ctx.c +++ b/src/core/lib/iomgr/exec_ctx.c @@ -73,6 +73,9 @@ bool grpc_exec_ctx_flush(grpc_exec_ctx *exec_ctx) { grpc_closure *next = c->next_data.next; grpc_error *error = c->error_data.error; did_something = true; +#ifndef NDEBUG + c->scheduled = false; +#endif c->cb(exec_ctx, c->cb_arg, error); GRPC_ERROR_UNREF(error); c = next; @@ -93,6 +96,9 @@ void grpc_exec_ctx_finish(grpc_exec_ctx *exec_ctx) { static void exec_ctx_run(grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_error *error) { +#ifndef NDEBUG + closure->scheduled = false; +#endif closure->cb(exec_ctx, closure->cb_arg, error); GRPC_ERROR_UNREF(error); } diff --git a/src/core/lib/iomgr/executor.c b/src/core/lib/iomgr/executor.c index ae3e2eabc39..75fd5b1c50c 100644 --- a/src/core/lib/iomgr/executor.c +++ b/src/core/lib/iomgr/executor.c @@ -83,6 +83,9 @@ static void closure_exec_thread_func(void *ignored) { while (c != NULL) { grpc_closure *next = c->next_data.next; grpc_error *error = c->error_data.error; +#ifndef NDEBUG + c->scheduled = false; +#endif c->cb(&exec_ctx, c->cb_arg, error); GRPC_ERROR_UNREF(error); c = next; @@ -146,6 +149,9 @@ void grpc_executor_shutdown(grpc_exec_ctx *exec_ctx) { while (c != NULL) { grpc_closure *next = c->next_data.next; grpc_error *error = c->error_data.error; +#ifndef NDEBUG + c->scheduled = false; +#endif c->cb(exec_ctx, c->cb_arg, error); GRPC_ERROR_UNREF(error); c = next; From f712ae76f4ecf032c7be2f880d5193d5d4c35332 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 4 Apr 2017 16:58:05 -0700 Subject: [PATCH 182/461] Fix a couple of issues with the use of the Protobuf.js API --- src/node/src/protobuf_js_6_common.js | 4 ++-- src/node/test/common_test.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/node/src/protobuf_js_6_common.js b/src/node/src/protobuf_js_6_common.js index cac0f711451..21eddabaa8a 100644 --- a/src/node/src/protobuf_js_6_common.js +++ b/src/node/src/protobuf_js_6_common.js @@ -77,11 +77,11 @@ exports.serializeCls = function serializeCls(cls) { * @return {Buffer} The serialized object */ return function serialize(arg) { - var message = cls.fromObject(arg); - var errMsg = cls.verify(message); + var errMsg = cls.verify(arg); if (errMsg) { throw Error(errMsg); } + var message = cls.create(arg); return cls.encode(message).finish(); }; }; diff --git a/src/node/test/common_test.js b/src/node/test/common_test.js index 39ff6a5f1fc..e1ce864f975 100644 --- a/src/node/test/common_test.js +++ b/src/node/test/common_test.js @@ -176,7 +176,7 @@ describe('Proto message oneof serialize and deserialize', function() { var test_message2 = {oneof_choice: 'string_choice', string_choice: 'abc'}; var serialized2 = oneofSerialize(test_message2); var deserialized2 = oneofDeserialize(serialized2); - assert.equal(deserialized2.oneof_choice, 'int_choice'); + assert.equal(deserialized2.oneof_choice, 'string_choice'); }); }); describe('Proto message enum serialize and deserialize', function() { From 2a4731e2eb24efce9fa6322630bdf19b953260d2 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 4 Apr 2017 17:14:40 -0700 Subject: [PATCH 183/461] More merging fixes and asan fix --- src/core/ext/transport/chttp2/transport/chttp2_transport.c | 2 +- src/core/lib/channel/compress_filter.c | 2 +- src/core/lib/channel/http_client_filter.c | 2 +- src/core/lib/surface/call.c | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 965306cbbe0..c90bf69d157 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1583,7 +1583,6 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, grpc_slice_buffer_swap(&s->unprocessed_incoming_frames_buffer, &s->frame_storage); } - /* error handling ok? */ error = deframe_unprocessed_incoming_frames( exec_ctx, &s->data_parser, s, &s->unprocessed_incoming_frames_buffer, NULL, s->recv_message); @@ -1593,6 +1592,7 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, &s->frame_storage); grpc_slice_buffer_reset_and_unref_internal( exec_ctx, &s->unprocessed_incoming_frames_buffer); + GRPC_ERROR_UNREF(error); break; } else if (*s->recv_message != NULL) { break; diff --git a/src/core/lib/channel/compress_filter.c b/src/core/lib/channel/compress_filter.c index 1fc01049118..a945639faea 100644 --- a/src/core/lib/channel/compress_filter.c +++ b/src/core/lib/channel/compress_filter.c @@ -222,7 +222,7 @@ static void got_slice(grpc_exec_ctx *exec_ctx, void *elemp, grpc_error *error) { grpc_call_element *elem = elemp; call_data *calld = elem->call_data; if (GRPC_ERROR_NONE != grpc_byte_stream_pull(exec_ctx, - calld->send_op->send_message, + calld->send_op->payload->send_message.send_message, &calld->incoming_slice)) { /* Should never reach here */ abort(); diff --git a/src/core/lib/channel/http_client_filter.c b/src/core/lib/channel/http_client_filter.c index 8455e154ac1..57bbb98139d 100644 --- a/src/core/lib/channel/http_client_filter.c +++ b/src/core/lib/channel/http_client_filter.c @@ -239,7 +239,7 @@ static void got_slice(grpc_exec_ctx *exec_ctx, void *elemp, grpc_error *error) { call_data *calld = elem->call_data; calld->send_message_blocked = false; if (GRPC_ERROR_NONE != grpc_byte_stream_pull(exec_ctx, - calld->send_op.send_message, + calld->send_op->payload->send_message.send_message, &calld->incoming_slice)) { /* Should never reach here */ abort(); diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 4c1472bd4c3..99055454227 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -1210,6 +1210,7 @@ static void receiving_slice_ready(grpc_exec_ctx *exec_ctx, void *bctlp, *call->receiving_buffer = NULL; call->receiving_message = 0; finish_batch_step(exec_ctx, bctl); + GRPC_ERROR_UNREF(error); } } From 85a747ed06d4e2ce9c299439ea0923e0b9ccdd8d Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 4 Apr 2017 17:20:29 -0700 Subject: [PATCH 184/461] better representative output --- test/cpp/microbenchmarks/bm_chttp2_hpack.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc index 5489eb99739..581440682aa 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc @@ -98,7 +98,7 @@ static void BM_HpackEncoderEncodeHeader(benchmark::State &state) { &stats, }; grpc_chttp2_encode_header(&exec_ctx, &c, &b, &hopt, &outbuf); - if (!logged_representative_output) { + if (!logged_representative_output && state.iterations() > 3) { logged_representative_output = true; for (size_t i = 0; i < outbuf.count; i++) { char *s = grpc_dump_slice(outbuf.slices[i], GPR_DUMP_HEX); From 769b7c367d511e8f5e44c5e59c7bd06dc417cbca Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 4 Apr 2017 19:07:50 -0700 Subject: [PATCH 185/461] Bug fix --- src/core/ext/transport/chttp2/transport/chttp2_transport.c | 2 ++ src/core/lib/surface/call.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index c90bf69d157..7aee014e633 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -2326,6 +2326,7 @@ static void reset_byte_stream(grpc_exec_ctx *exec_ctx, void *arg, grpc_closure_sched(exec_ctx, s->on_next, GRPC_ERROR_REF(error)); s->on_next = NULL; GRPC_ERROR_UNREF(s->byte_stream_error); + s->byte_stream_error = GRPC_ERROR_NONE; grpc_chttp2_cancel_stream(exec_ctx, s->t, s, GRPC_ERROR_REF(error)); s->byte_stream_error = error; } @@ -2694,6 +2695,7 @@ static void incoming_byte_stream_publish_error( grpc_closure_sched(exec_ctx, s->on_next, GRPC_ERROR_REF(error)); s->on_next = NULL; GRPC_ERROR_UNREF(s->byte_stream_error); + s->byte_stream_error = GRPC_ERROR_NONE; grpc_chttp2_cancel_stream(exec_ctx, bs->transport, bs->stream, GRPC_ERROR_REF(error)); s->byte_stream_error = GRPC_ERROR_REF(error); diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 99055454227..4c1472bd4c3 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -1210,7 +1210,6 @@ static void receiving_slice_ready(grpc_exec_ctx *exec_ctx, void *bctlp, *call->receiving_buffer = NULL; call->receiving_message = 0; finish_batch_step(exec_ctx, bctl); - GRPC_ERROR_UNREF(error); } } From 282c1399855c4e65a449b5f535423f17904bbf70 Mon Sep 17 00:00:00 2001 From: Igor Pylypiv Date: Tue, 4 Apr 2017 19:44:06 -0700 Subject: [PATCH 186/461] Refactor pchar_parse() to use switch() Add previously missed '@' and ':' characters --- .../ext/filters/client_channel/uri_parser.c | 54 ++++++++++++------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/src/core/ext/filters/client_channel/uri_parser.c b/src/core/ext/filters/client_channel/uri_parser.c index 01b99911aa4..f28db59e270 100644 --- a/src/core/ext/filters/client_channel/uri_parser.c +++ b/src/core/ext/filters/client_channel/uri_parser.c @@ -83,6 +83,11 @@ static char *decode_and_copy_component(grpc_exec_ctx *exec_ctx, const char *src, return out; } +static bool valid_hex(char c) { + return ((c >= 'a') && (c <= 'f')) || ((c >= 'A') && (c <= 'F')) || + ((c >= '0') && (c <= '9')); +} + /** Returns how many chars to advance if \a uri_text[i] begins a valid \a pchar * production. If \a uri_text[i] introduces an invalid \a pchar (such as percent * sign not followed by two hex digits), NOT_SET is returned. */ @@ -93,27 +98,36 @@ static size_t parse_pchar(const char *uri_text, size_t i) { * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" */ char c = uri_text[i]; - if (((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z')) || - ((c >= '0') && (c <= '9')) || - (c == '-' || c == '.' || c == '_' || c == '~') || /* unreserved */ - (c == '!' || c == '$' || c == '&' || c == '\'' || c == '$' || c == '&' || - c == '(' || c == ')' || c == '*' || c == '+' || c == ',' || c == ';' || - c == '=') /* sub-delims */) { - return 1; - } - if (c == '%') { /* pct-encoded */ - size_t j; - if (uri_text[i + 1] == 0 || uri_text[i + 2] == 0) { - return NOT_SET; - } - for (j = i + 1; j < 2; j++) { - c = uri_text[j]; - if (!(((c >= '0') && (c <= '9')) || ((c >= 'a') && (c <= 'f')) || - ((c >= 'A') && (c <= 'F')))) { - return NOT_SET; + switch (c) { + default: + if (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || + ((c >= '0') && (c <= '9'))) { + return 1; } - } - return 2; + break; + case ':': + case '@': + case '-': + case '.': + case '_': + case '~': + case '!': + case '$': + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case ';': + case '=': + return 1; + case '%': /* pct-encoded */ + if (valid_hex(uri_text[i + 1]) && valid_hex(uri_text[i + 2])) { + return 2; + } + return NOT_SET; } return 0; } From a3589c5411186f0a29b661003eaa641d1a63af37 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 4 Apr 2017 21:09:08 -0700 Subject: [PATCH 187/461] Starting speedup calculation --- tools/profiling/microbenchmarks/speedup.py | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 tools/profiling/microbenchmarks/speedup.py diff --git a/tools/profiling/microbenchmarks/speedup.py b/tools/profiling/microbenchmarks/speedup.py new file mode 100644 index 00000000000..09222580ef9 --- /dev/null +++ b/tools/profiling/microbenchmarks/speedup.py @@ -0,0 +1,59 @@ +# Copyright 2017, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +from scipy import stats + +new=[66034560.0, 126765693.0, 99074674.0, 98588433.0, 96731372.0, 110179725.0, 103802110.0, 101139800.0, 102357205.0, 99016353.0, 98840824.0, 99585632.0, 98791720.0, 96171521.0, 95327098.0, 95629704.0, 98209772.0, 99779411.0, 100182488.0, 98354192.0, 99644781.0, 98546709.0, 99019176.0, 99543014.0, 99077269.0, 98046601.0, 99319039.0, 98542572.0, 98886614.0, 72560968.0] +old=[60423464.0, 71249570.0, 73213089.0, 73200055.0, 72911768.0, 72347798.0, 72494672.0, 72756976.0, 72116565.0, 71541342.0, 73442538.0, 74817383.0, 73007780.0, 72499062.0, 72404945.0, 71843504.0, 73245405.0, 72778304.0, 74004519.0, 73694464.0, 72919931.0, 72955481.0, 71583857.0, 71350467.0, 71836817.0, 70064115.0, 70355345.0, 72516202.0, 71716777.0, 71532266.0] + +_THRESHOLD = 0.01 + +def scale(a, mul): + return [x*mul for x in a] + +def cmp(a, b): + return stats.mannwhitneyu(a, b, True, 'two-sided') + +def speedup(new, old): + s0, p0 = cmp(new, old) + print s0, p0 + if s0 == 0: return 0 + if p0 >= _THRESHOLD: return 0 + if s0 < 0: + pass + else: + pct = 1 + while True: + sp, pp = cmp(new, scale(old, 1 + pct / 100.0)) + if sp <= 0: break + if pp >= _THRESHOLD: break + pct += 1 + return pct - 1 + +print speedup(new, old) From 125b04fcedd572fc171abe39cf181bafc8d08361 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 4 Apr 2017 21:31:44 -0700 Subject: [PATCH 188/461] adding speedup --- tools/profiling/microbenchmarks/bm_diff.py | 16 ++++--------- tools/profiling/microbenchmarks/speedup.py | 28 +++++++++++++--------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index f6a944babc8..5c8b93d471c 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -43,6 +43,7 @@ sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '..', '..', 'run_test import comment_on_pr import jobset import itertools +import speedup def changed_ratio(n, o): if float(o) <= .0001: o = 0 @@ -180,16 +181,9 @@ class Benchmark: new = self.samples[True][f] old = self.samples[False][f] if not new or not old: continue - p = stats.ttest_ind(new, old)[1] - new_mdn = median(new) - old_mdn = median(old) - delta = new_mdn - old_mdn - ratio = changed_ratio(new_mdn, old_mdn) - print '%s: new=%r old=%r new_mdn=%f old_mdn=%f delta=%f(%f:%f) ratio=%f(%f:%f) p=%f' % ( - f, new, old, new_mdn, old_mdn, delta, abs(delta), _INTERESTING[f]['abs_diff'], ratio, abs(ratio), _INTERESTING[f]['pct_diff']/100.0, p - ) - if p < args.p_threshold and abs(delta) > _INTERESTING[f]['abs_diff'] and abs(ratio) > _INTERESTING[f]['pct_diff']/100.0: - self.final[f] = delta + s = speedup.speedup(new, old) + if s: + self.final[f] = '%d%%' % s return self.final.keys() def skip(self): @@ -226,7 +220,7 @@ really_interesting = set() for name, bm in benchmarks.items(): print name really_interesting.update(bm.process()) -fields = [f for f in args.track if f in args.track] +fields = [f for f in args.track if f in really_interesting] headers = ['Benchmark'] + fields rows = [] diff --git a/tools/profiling/microbenchmarks/speedup.py b/tools/profiling/microbenchmarks/speedup.py index 09222580ef9..9b022da0c46 100644 --- a/tools/profiling/microbenchmarks/speedup.py +++ b/tools/profiling/microbenchmarks/speedup.py @@ -29,31 +29,37 @@ from scipy import stats -new=[66034560.0, 126765693.0, 99074674.0, 98588433.0, 96731372.0, 110179725.0, 103802110.0, 101139800.0, 102357205.0, 99016353.0, 98840824.0, 99585632.0, 98791720.0, 96171521.0, 95327098.0, 95629704.0, 98209772.0, 99779411.0, 100182488.0, 98354192.0, 99644781.0, 98546709.0, 99019176.0, 99543014.0, 99077269.0, 98046601.0, 99319039.0, 98542572.0, 98886614.0, 72560968.0] -old=[60423464.0, 71249570.0, 73213089.0, 73200055.0, 72911768.0, 72347798.0, 72494672.0, 72756976.0, 72116565.0, 71541342.0, 73442538.0, 74817383.0, 73007780.0, 72499062.0, 72404945.0, 71843504.0, 73245405.0, 72778304.0, 74004519.0, 73694464.0, 72919931.0, 72955481.0, 71583857.0, 71350467.0, 71836817.0, 70064115.0, 70355345.0, 72516202.0, 71716777.0, 71532266.0] - _THRESHOLD = 0.01 def scale(a, mul): return [x*mul for x in a] def cmp(a, b): - return stats.mannwhitneyu(a, b, True, 'two-sided') + return stats.ttest_ind(a, b) def speedup(new, old): s0, p0 = cmp(new, old) - print s0, p0 if s0 == 0: return 0 - if p0 >= _THRESHOLD: return 0 + if p0 > _THRESHOLD: return 0 if s0 < 0: - pass + pct = 1 + while True: + sp, pp = cmp(new, scale(old, 1 - pct/100.0)) + if sp > 0: break + if pp > _THRESHOLD: break + pct += 1 + return -(pct - 1) else: pct = 1 while True: - sp, pp = cmp(new, scale(old, 1 + pct / 100.0)) - if sp <= 0: break - if pp >= _THRESHOLD: break + sp, pp = cmp(new, scale(old, 1 + pct/100.0)) + if sp < 0: break + if pp > _THRESHOLD: break pct += 1 return pct - 1 -print speedup(new, old) +if __name__ == "__main__": + new=[66034560.0, 126765693.0, 99074674.0, 98588433.0, 96731372.0, 110179725.0, 103802110.0, 101139800.0, 102357205.0, 99016353.0, 98840824.0, 99585632.0, 98791720.0, 96171521.0, 95327098.0, 95629704.0, 98209772.0, 99779411.0, 100182488.0, 98354192.0, 99644781.0, 98546709.0, 99019176.0, 99543014.0, 99077269.0, 98046601.0, 99319039.0, 98542572.0, 98886614.0, 72560968.0] + old=[60423464.0, 71249570.0, 73213089.0, 73200055.0, 72911768.0, 72347798.0, 72494672.0, 72756976.0, 72116565.0, 71541342.0, 73442538.0, 74817383.0, 73007780.0, 72499062.0, 72404945.0, 71843504.0, 73245405.0, 72778304.0, 74004519.0, 73694464.0, 72919931.0, 72955481.0, 71583857.0, 71350467.0, 71836817.0, 70064115.0, 70355345.0, 72516202.0, 71716777.0, 71532266.0] + print speedup(new, old) + print speedup(old, new) From f7c673a8c789e6b521b2b83c82eb433900fd4b78 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Tue, 4 Apr 2017 22:52:44 -0700 Subject: [PATCH 189/461] minor change --- test/cpp/microbenchmarks/bm_cq_multiple_threads.cc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc index 82f402d3ddd..80f21f1f697 100644 --- a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc +++ b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc @@ -132,11 +132,7 @@ static void BM_Cq_Throughput(benchmark::State& state) { track_counters.Finish(state); } -BENCHMARK(BM_Cq_Throughput)->Threads(1)->UseRealTime(); -BENCHMARK(BM_Cq_Throughput)->Threads(2)->UseRealTime(); -BENCHMARK(BM_Cq_Throughput)->Threads(4)->UseRealTime(); -BENCHMARK(BM_Cq_Throughput)->Threads(8)->UseRealTime(); -BENCHMARK(BM_Cq_Throughput)->Threads(16)->UseRealTime(); +BENCHMARK(BM_Cq_Throughput)->ThreadRange(1, 16)->UseRealTime(); } // namespace testing } // namespace grpc From e749e34f07be72b9f804039d1210b4ca5b045026 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 06:32:47 -0700 Subject: [PATCH 190/461] Provide bounds on speedup --- tools/profiling/microbenchmarks/speedup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/profiling/microbenchmarks/speedup.py b/tools/profiling/microbenchmarks/speedup.py index 9b022da0c46..ac268fb6790 100644 --- a/tools/profiling/microbenchmarks/speedup.py +++ b/tools/profiling/microbenchmarks/speedup.py @@ -43,7 +43,7 @@ def speedup(new, old): if p0 > _THRESHOLD: return 0 if s0 < 0: pct = 1 - while True: + while pct < 101: sp, pp = cmp(new, scale(old, 1 - pct/100.0)) if sp > 0: break if pp > _THRESHOLD: break @@ -51,7 +51,7 @@ def speedup(new, old): return -(pct - 1) else: pct = 1 - while True: + while pct < 101: sp, pp = cmp(new, scale(old, 1 + pct/100.0)) if sp < 0: break if pp > _THRESHOLD: break From d6d2da11492f52a4170be34c826f6adb8ca837d1 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 06:34:07 -0700 Subject: [PATCH 191/461] Handle nans --- tools/profiling/microbenchmarks/speedup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/profiling/microbenchmarks/speedup.py b/tools/profiling/microbenchmarks/speedup.py index ac268fb6790..a06f2a91e1d 100644 --- a/tools/profiling/microbenchmarks/speedup.py +++ b/tools/profiling/microbenchmarks/speedup.py @@ -28,6 +28,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from scipy import stats +import math _THRESHOLD = 0.01 @@ -39,6 +40,7 @@ def cmp(a, b): def speedup(new, old): s0, p0 = cmp(new, old) + if math.isnan(p0) return 0 if s0 == 0: return 0 if p0 > _THRESHOLD: return 0 if s0 < 0: From b1d3dcdb7db540b7dfa2efad269cd56738ff7e79 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 06:35:49 -0700 Subject: [PATCH 192/461] fix typo --- tools/profiling/microbenchmarks/speedup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/profiling/microbenchmarks/speedup.py b/tools/profiling/microbenchmarks/speedup.py index a06f2a91e1d..ff114539604 100644 --- a/tools/profiling/microbenchmarks/speedup.py +++ b/tools/profiling/microbenchmarks/speedup.py @@ -40,7 +40,7 @@ def cmp(a, b): def speedup(new, old): s0, p0 = cmp(new, old) - if math.isnan(p0) return 0 + if math.isnan(p0): return 0 if s0 == 0: return 0 if p0 > _THRESHOLD: return 0 if s0 < 0: From 4a647145f3463cbb0c2a489bb79803c57dd2d8bb Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 06:38:48 -0700 Subject: [PATCH 193/461] Update to new API --- test/core/end2end/tests/bad_ping.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/core/end2end/tests/bad_ping.c b/test/core/end2end/tests/bad_ping.c index 01a6aeaa04f..fd896b07362 100644 --- a/test/core/end2end/tests/bad_ping.c +++ b/test/core/end2end/tests/bad_ping.c @@ -207,7 +207,7 @@ static void test_bad_ping(grpc_end2end_test_config config) { CQ_EXPECT_COMPLETION(cqv, tag(0xdead), 1); cq_verify(cqv); - grpc_call_destroy(s); + grpc_call_unref(s); // The connection should be closed immediately after the misbehaved pings, // the in-progress RPC should fail. @@ -223,7 +223,7 @@ static void test_bad_ping(grpc_end2end_test_config config) { grpc_metadata_array_destroy(&trailing_metadata_recv); grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); + grpc_call_unref(c); cq_verifier_destroy(cqv); end_test(&f); config.tear_down_data(&f); From 9e0b79e047988e9b3bff6a995a5af8e3553d03e2 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 06:43:37 -0700 Subject: [PATCH 194/461] Update to new API --- src/core/lib/iomgr/endpoint_pair_uv.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/lib/iomgr/endpoint_pair_uv.c b/src/core/lib/iomgr/endpoint_pair_uv.c index ff24894c6db..9718eb05237 100644 --- a/src/core/lib/iomgr/endpoint_pair_uv.c +++ b/src/core/lib/iomgr/endpoint_pair_uv.c @@ -41,9 +41,8 @@ #include "src/core/lib/iomgr/endpoint_pair.h" -grpc_endpoint_pair grpc_iomgr_create_endpoint_pair( - const char *name, grpc_resource_quota *resource_quota, - size_t read_slice_size) { +grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(const char *name, + grpc_channel_args *args) { grpc_endpoint_pair endpoint_pair; // TODO(mlumish): implement this properly under libuv GPR_ASSERT(false && From e645d13bda9cca7e4b7a89e78a9d8f2450377d3a Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Wed, 5 Apr 2017 06:47:35 -0700 Subject: [PATCH 195/461] Fix build. --- test/core/end2end/tests/filter_call_init_fails.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/core/end2end/tests/filter_call_init_fails.c b/test/core/end2end/tests/filter_call_init_fails.c index 3eba4920c29..bcb5e2d3ff9 100644 --- a/test/core/end2end/tests/filter_call_init_fails.c +++ b/test/core/end2end/tests/filter_call_init_fails.c @@ -107,8 +107,8 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -// Simple request via a server filter that always fails to initialize -// the call. +// Simple request via a server channel filter that always fails to +// initialize the call. static void test_server_channel_filter(grpc_end2end_test_config config) { grpc_call *c; grpc_call *s; @@ -211,7 +211,7 @@ static void test_client_channel_filter(grpc_end2end_test_config config) { grpc_slice_from_copied_string("hello world"); grpc_byte_buffer *request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); - gpr_timespec deadline = five_seconds_time(); + gpr_timespec deadline = five_seconds_from_now(); grpc_end2end_test_fixture f = begin_test(config, "filter_call_init_fails", NULL, NULL); cq_verifier *cqv = cq_verifier_create(f.cq); @@ -301,7 +301,7 @@ static void test_client_subchannel_filter(grpc_end2end_test_config config) { grpc_slice_from_copied_string("hello world"); grpc_byte_buffer *request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); - gpr_timespec deadline = five_seconds_time(); + gpr_timespec deadline = five_seconds_from_now(); grpc_end2end_test_fixture f = begin_test(config, "filter_call_init_fails", NULL, NULL); cq_verifier *cqv = cq_verifier_create(f.cq); From 702bf3b2dca1c0829bc671d2d4c5737c52ef2f44 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 06:53:57 -0700 Subject: [PATCH 196/461] Remove bogus assert --- src/core/ext/transport/chttp2/transport/frame_settings.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/core/ext/transport/chttp2/transport/frame_settings.c b/src/core/ext/transport/chttp2/transport/frame_settings.c index 46630a6cc62..d53f51a1e84 100644 --- a/src/core/ext/transport/chttp2/transport/frame_settings.c +++ b/src/core/ext/transport/chttp2/transport/frame_settings.c @@ -77,7 +77,6 @@ grpc_slice grpc_chttp2_settings_create(uint32_t *old, const uint32_t *new, for (i = 0; i < count; i++) { if (new[i] != old[i] || (force_mask & (1u << i)) != 0) { - GPR_ASSERT(i); *p++ = (uint8_t)(grpc_setting_id_to_wire_id[i] >> 8); *p++ = (uint8_t)(grpc_setting_id_to_wire_id[i]); *p++ = (uint8_t)(new[i] >> 24); From 7d55746bb3e8f177f7646222553bc0edd907686c Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 07:57:16 -0700 Subject: [PATCH 197/461] Update BUILD --- BUILD | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BUILD b/BUILD index c4632fc0a24..c164daeca1c 100644 --- a/BUILD +++ b/BUILD @@ -978,6 +978,7 @@ grpc_cc_library( "src/core/ext/transport/chttp2/transport/frame_ping.c", "src/core/ext/transport/chttp2/transport/frame_rst_stream.c", "src/core/ext/transport/chttp2/transport/frame_settings.c", + "src/core/ext/transport/chttp2/transport/http2_settings.c", "src/core/ext/transport/chttp2/transport/frame_window_update.c", "src/core/ext/transport/chttp2/transport/hpack_encoder.c", "src/core/ext/transport/chttp2/transport/hpack_parser.c", @@ -1000,6 +1001,7 @@ grpc_cc_library( "src/core/ext/transport/chttp2/transport/frame_ping.h", "src/core/ext/transport/chttp2/transport/frame_rst_stream.h", "src/core/ext/transport/chttp2/transport/frame_settings.h", + "src/core/ext/transport/chttp2/transport/http2_settings.h", "src/core/ext/transport/chttp2/transport/frame_window_update.h", "src/core/ext/transport/chttp2/transport/hpack_encoder.h", "src/core/ext/transport/chttp2/transport/hpack_parser.h", From 3d13d7e162f39c24d7bdd915981ebb74154bc91e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 08:02:42 -0700 Subject: [PATCH 198/461] Update copyright, choose a better sort order for our enum --- src/core/ext/transport/chttp2/transport/http2_settings.c | 2 +- src/core/ext/transport/chttp2/transport/http2_settings.h | 8 ++++---- tools/codegen/core/gen_settings_ids.py | 7 +++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/http2_settings.c b/src/core/ext/transport/chttp2/transport/http2_settings.c index 05f0d8cb468..52969e6b4a8 100644 --- a/src/core/ext/transport/chttp2/transport/http2_settings.c +++ b/src/core/ext/transport/chttp2/transport/http2_settings.c @@ -1,5 +1,5 @@ /* - * Copyright 2015, Google Inc. + * Copyright 2017, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/core/ext/transport/chttp2/transport/http2_settings.h b/src/core/ext/transport/chttp2/transport/http2_settings.h index 393c14f7f1b..61048a64783 100644 --- a/src/core/ext/transport/chttp2/transport/http2_settings.h +++ b/src/core/ext/transport/chttp2/transport/http2_settings.h @@ -1,5 +1,5 @@ /* - * Copyright 2015, Google Inc. + * Copyright 2017, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,13 +40,13 @@ #include typedef enum { - GRPC_CHTTP2_SETTINGS_ENABLE_PUSH = 1, /* wire id 2 */ - GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA = 6, /* wire id 65027 */ GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE = 0, /* wire id 1 */ - GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE = 3, /* wire id 4 */ + GRPC_CHTTP2_SETTINGS_ENABLE_PUSH = 1, /* wire id 2 */ GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS = 2, /* wire id 3 */ + GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE = 3, /* wire id 4 */ GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE = 4, /* wire id 5 */ GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE = 5, /* wire id 6 */ + GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA = 6, /* wire id 65027 */ } grpc_chttp2_setting_id; #define GRPC_CHTTP2_NUM_SETTINGS 7 diff --git a/tools/codegen/core/gen_settings_ids.py b/tools/codegen/core/gen_settings_ids.py index 54498a18f25..4253396ead4 100755 --- a/tools/codegen/core/gen_settings_ids.py +++ b/tools/codegen/core/gen_settings_ids.py @@ -1,6 +1,6 @@ #!/usr/bin/env python2.7 -# Copyright 2015, Google Inc. +# Copyright 2017, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -106,10 +106,9 @@ decorated_settings = [DecoratedSetting(hash(setting.id), name, setting) for name, setting in _SETTINGS.iteritems()] print >>H, 'typedef enum {' -for name in sorted(_SETTINGS.keys()): - setting = _SETTINGS[name] +for decorated_setting in sorted(decorated_settings): print >>H, ' GRPC_CHTTP2_SETTINGS_%s = %d, /* wire id %d */' % ( - name, hash(setting.id), setting.id) + decorated_setting.name, decorated_setting.enum, decorated_setting.setting.id) print >>H, '} grpc_chttp2_setting_id;' print >>H print >>H, '#define GRPC_CHTTP2_NUM_SETTINGS %d' % (max(x.enum for x in decorated_settings) + 1) From bcf9d9f4632e54526b34d44b6b9838bf9626c66a Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 08:03:07 -0700 Subject: [PATCH 199/461] Remove old code --- src/core/ext/transport/chttp2/transport/frame_settings.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/frame_settings.c b/src/core/ext/transport/chttp2/transport/frame_settings.c index d53f51a1e84..4f2b8278326 100644 --- a/src/core/ext/transport/chttp2/transport/frame_settings.c +++ b/src/core/ext/transport/chttp2/transport/frame_settings.c @@ -46,8 +46,6 @@ #include "src/core/lib/debug/trace.h" #include "src/core/lib/transport/http2_errors.h" -#define MAX_MAX_HEADER_LIST_SIZE (1024 * 1024 * 1024) - static uint8_t *fill_header(uint8_t *out, uint32_t length, uint8_t flags) { *out++ = (uint8_t)(length >> 16); *out++ = (uint8_t)(length >> 8); From dd2f706b8b9672f31ee40f678afea54c7bab899d Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 08:11:44 -0700 Subject: [PATCH 200/461] Generate slightly more efficient code --- .../chttp2/transport/http2_settings.c | 19 ++++----------- tools/codegen/core/gen_settings_ids.py | 24 +++++++++++-------- 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/http2_settings.c b/src/core/ext/transport/chttp2/transport/http2_settings.c index 52969e6b4a8..bca3834b55f 100644 --- a/src/core/ext/transport/chttp2/transport/http2_settings.c +++ b/src/core/ext/transport/chttp2/transport/http2_settings.c @@ -41,25 +41,14 @@ const uint16_t grpc_setting_id_to_wire_id[] = {1, 2, 3, 4, 5, 6, 65027}; bool grpc_wire_id_to_setting_id(uint32_t wire_id, grpc_chttp2_setting_id *out) { - static const uint32_t r[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0}; uint32_t i = wire_id - 1; uint32_t x = i % 256; uint32_t y = i / 256; uint32_t h = x; - if (y < GPR_ARRAY_SIZE(r)) { - uint32_t delta = (uint32_t)r[y]; - h += delta; + switch (y) { + case 254: + h += 4; + break; } *out = (grpc_chttp2_setting_id)h; return h < GPR_ARRAY_SIZE(grpc_setting_id_to_wire_id) && diff --git a/tools/codegen/core/gen_settings_ids.py b/tools/codegen/core/gen_settings_ids.py index 4253396ead4..cfc2c5d0a40 100755 --- a/tools/codegen/core/gen_settings_ids.py +++ b/tools/codegen/core/gen_settings_ids.py @@ -118,25 +118,29 @@ print >>C, 'const uint16_t grpc_setting_id_to_wire_id[] = {%s};' % ','.join( '%d' % s for s in p.slots) print >>H print >>H, "bool grpc_wire_id_to_setting_id(uint32_t wire_id, grpc_chttp2_setting_id *out);" +cgargs = { + 'r': ','.join('%d' % (r if r is not None else 0) for r in p.r), + 't': p.t, + 'offset': abs(p.offset), + 'offset_sign': '+' if p.offset > 0 else '-' + } print >>C, """ bool grpc_wire_id_to_setting_id(uint32_t wire_id, grpc_chttp2_setting_id *out) { - static const uint32_t r[] = {%(r)s}; uint32_t i = wire_id %(offset_sign)s %(offset)d; uint32_t x = i %% %(t)d; uint32_t y = i / %(t)d; uint32_t h = x; - if (y < GPR_ARRAY_SIZE(r)) { - uint32_t delta = (uint32_t)r[y]; - h += delta; + switch (y) { +""" % cgargs +for i, r in enumerate(p.r): + if not r: continue + if r < 0: print >>C, 'case %d: h -= %d; break;' % (i, -r) + else: print >>C, 'case %d: h += %d; break;' % (i, r) +print >>C, """ } *out = (grpc_chttp2_setting_id)h; return h < GPR_ARRAY_SIZE(grpc_setting_id_to_wire_id) && grpc_setting_id_to_wire_id[h] == wire_id; -}""" % { - 'r': ','.join('%d' % (r if r is not None else 0) for r in p.r), - 't': p.t, - 'offset': abs(p.offset), - 'offset_sign': '+' if p.offset > 0 else '-' - } +}""" % cgargs print >>H, """ typedef enum { From 358f1024ea1afaa12e923296cab7e74082f52b7a Mon Sep 17 00:00:00 2001 From: Eric Gribkoff Date: Wed, 5 Apr 2017 08:42:21 -0700 Subject: [PATCH 201/461] backport #10100 and #10377 --- .../grpc_interop_http2/Dockerfile.template | 2 +- test/http2_test/http2_server_health_check.py | 49 ++++++++++++++ test/http2_test/http2_test_server.py | 21 +++++- .../interoptest/grpc_interop_http2/Dockerfile | 2 +- tools/run_tests/python_utils/dockerjob.py | 20 ++++++ tools/run_tests/run_interop_tests.py | 66 +++++++++++-------- 6 files changed, 129 insertions(+), 31 deletions(-) create mode 100644 test/http2_test/http2_server_health_check.py diff --git a/templates/tools/dockerfile/interoptest/grpc_interop_http2/Dockerfile.template b/templates/tools/dockerfile/interoptest/grpc_interop_http2/Dockerfile.template index 0899e007d9e..b517921f087 100644 --- a/templates/tools/dockerfile/interoptest/grpc_interop_http2/Dockerfile.template +++ b/templates/tools/dockerfile/interoptest/grpc_interop_http2/Dockerfile.template @@ -33,7 +33,7 @@ <%include file="../../go_path.include"/> <%include file="../../python_deps.include"/> - RUN pip install twisted h2 + RUN pip install twisted h2==2.6.1 hyper # Define the default command. CMD ["bash"] diff --git a/test/http2_test/http2_server_health_check.py b/test/http2_test/http2_server_health_check.py new file mode 100644 index 00000000000..dd9402b8557 --- /dev/null +++ b/test/http2_test/http2_server_health_check.py @@ -0,0 +1,49 @@ +# Copyright 2017, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import argparse +import hyper +import sys + +# Utility to healthcheck the http2 server. Used when starting the server to +# verify that the server is live before tests begin. +if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument('--server_host', type=str, default='localhost') + parser.add_argument('--server_port', type=int, default=8080) + args = parser.parse_args() + server_host = args.server_host + server_port = args.server_port + conn = hyper.HTTP20Connection('%s:%d' % (server_host, server_port)) + conn.request('POST', '/grpc.testing.TestService/UnaryCall') + resp = conn.get_response() + if resp.headers.get('grpc-encoding') is None: + sys.exit(1) + else: + sys.exit(0) diff --git a/test/http2_test/http2_test_server.py b/test/http2_test/http2_test_server.py index abde3433ad2..46c3e00d18f 100644 --- a/test/http2_test/http2_test_server.py +++ b/test/http2_test/http2_test_server.py @@ -31,6 +31,7 @@ import argparse import logging +import sys import twisted import twisted.internet import twisted.internet.endpoints @@ -53,9 +54,11 @@ _TEST_CASE_MAPPING = { 'max_streams': test_max_streams.TestcaseSettingsMaxStreams, } +_exit_code = 0 + class H2Factory(twisted.internet.protocol.Factory): def __init__(self, testcase): - logging.info('Creating H2Factory for new connection.') + logging.info('Creating H2Factory for new connection (%s)', testcase) self._num_streams = 0 self._testcase = testcase @@ -83,6 +86,17 @@ def parse_arguments(): ) return parser.parse_args() +def listen(endpoint, test_case): + deferred = endpoint.listen(H2Factory(test_case)) + def listen_error(reason): + # If listening fails, we stop the reactor and exit the program + # with exit code 1. + global _exit_code + _exit_code = 1 + logging.error('Listening failed: %s' % reason.value) + twisted.internet.reactor.stop() + deferred.addErrback(listen_error) + def start_test_servers(base_port): """ Start one server per test case on incrementing port numbers beginning with base_port """ @@ -92,7 +106,9 @@ def start_test_servers(base_port): logging.warning('serving on port %d : %s'%(portnum, test_case)) endpoint = twisted.internet.endpoints.TCP4ServerEndpoint( twisted.internet.reactor, portnum, backlog=128) - endpoint.listen(H2Factory(test_case)) + # Wait until the reactor is running before calling endpoint.listen(). + twisted.internet.reactor.callWhenRunning(listen, endpoint, test_case) + index += 1 if __name__ == '__main__': @@ -102,3 +118,4 @@ if __name__ == '__main__': args = parse_arguments() start_test_servers(args.base_port) twisted.internet.reactor.run() + sys.exit(_exit_code) diff --git a/tools/dockerfile/interoptest/grpc_interop_http2/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_http2/Dockerfile index 42e9edf98ad..094a4e096df 100644 --- a/tools/dockerfile/interoptest/grpc_interop_http2/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_http2/Dockerfile @@ -47,7 +47,7 @@ RUN pip install pip --upgrade RUN pip install virtualenv RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.2.0 six==1.10.0 -RUN pip install twisted h2 +RUN pip install twisted h2==2.6.1 hyper # Define the default command. CMD ["bash"] diff --git a/tools/run_tests/python_utils/dockerjob.py b/tools/run_tests/python_utils/dockerjob.py index 0869c5cee9b..709fc121a9b 100755 --- a/tools/run_tests/python_utils/dockerjob.py +++ b/tools/run_tests/python_utils/dockerjob.py @@ -70,6 +70,23 @@ def docker_mapped_port(cid, port, timeout_seconds=15): (port, cid)) +def wait_for_healthy(cid, shortname, timeout_seconds): + """Wait timeout_seconds for the container to become healthy""" + started = time.time() + while time.time() - started < timeout_seconds: + try: + output = subprocess.check_output( + ['docker', 'inspect', '--format="{{.State.Health.Status}}"', cid], + stderr=_DEVNULL) + if output.strip('\n') == 'healthy': + return + except subprocess.CalledProcessError as e: + pass + time.sleep(1) + raise Exception('Timed out waiting for %s (%s) to pass health check' % + (shortname, cid)) + + def finish_jobs(jobs): """Kills given docker containers and waits for corresponding jobs to finish""" for job in jobs: @@ -113,6 +130,9 @@ class DockerJob: def mapped_port(self, port): return docker_mapped_port(self._container_name, port) + def wait_for_healthy(self, timeout_seconds): + wait_for_healthy(self._container_name, self._spec.shortname, timeout_seconds) + def kill(self, suppress_failure=False): """Sends kill signal to the container.""" if suppress_failure: diff --git a/tools/run_tests/run_interop_tests.py b/tools/run_tests/run_interop_tests.py index 0d5bec1d67f..007e341ca96 100755 --- a/tools/run_tests/run_interop_tests.py +++ b/tools/run_tests/run_interop_tests.py @@ -607,17 +607,13 @@ def cloud_to_cloud_jobspec(language, test_case, server_name, server_host, common_options = [ '--test_case=%s' % test_case, '--server_host=%s' % server_host, + '--server_port=%s' % server_port, ] if test_case in _HTTP2_BADSERVER_TEST_CASES: - # We are running the http2_badserver_interop test. Adjust command line accordingly. - offset = sorted(_HTTP2_BADSERVER_TEST_CASES).index(test_case) - client_options = common_options + ['--server_port=%s' % - (int(server_port)+offset)] - cmdline = bash_cmdline(language.client_cmd_http2interop(client_options)) + cmdline = bash_cmdline(language.client_cmd_http2interop(common_options)) cwd = language.http2_cwd else: - client_options = interop_only_options + common_options + ['--server_port=%s' % server_port] - cmdline = bash_cmdline(language.client_cmd(client_options)) + cmdline = bash_cmdline(language.client_cmd(common_options+interop_only_options)) cwd = language.client_cwd environ = language.global_env() @@ -653,30 +649,40 @@ def server_jobspec(language, docker_image, insecure=False): language.server_cmd(['--port=%s' % _DEFAULT_SERVER_PORT, '--use_tls=%s' % ('false' if insecure else 'true')])) environ = language.global_env() + docker_args = ['--name=%s' % container_name] if language.safename == 'http2': # we are running the http2 interop server. Open next N ports beginning # with the server port. These ports are used for http2 interop test - # (one test case per port). We also attach the docker container running - # the server to local network, so we don't have to mess with port mapping - port_args = [ - '-p', str(_DEFAULT_SERVER_PORT+0), - '-p', str(_DEFAULT_SERVER_PORT+1), - '-p', str(_DEFAULT_SERVER_PORT+2), - '-p', str(_DEFAULT_SERVER_PORT+3), - '-p', str(_DEFAULT_SERVER_PORT+4), - '-p', str(_DEFAULT_SERVER_PORT+5), - '-p', str(_DEFAULT_SERVER_PORT+6), - '--net=host', + # (one test case per port). + docker_args += list( + itertools.chain.from_iterable(('-p', str(_DEFAULT_SERVER_PORT + i)) + for i in range( + len(_HTTP2_BADSERVER_TEST_CASES)))) + # Enable docker's healthcheck mechanism. + # This runs a Python script inside the container every second. The script + # pings the http2 server to verify it is ready. The 'health-retries' flag + # specifies the number of consecutive failures before docker will report + # the container's status as 'unhealthy'. Prior to the first 'health_retries' + # failures or the first success, the status will be 'starting'. 'docker ps' + # or 'docker inspect' can be used to see the health of the container on the + # command line. + docker_args += [ + '--health-cmd=python test/http2_test/http2_server_health_check.py ' + '--server_host=%s --server_port=%d' + % ('localhost', _DEFAULT_SERVER_PORT), + '--health-interval=1s', + '--health-retries=5', + '--health-timeout=10s', ] + else: - port_args = ['-p', str(_DEFAULT_SERVER_PORT)] + docker_args += ['-p', str(_DEFAULT_SERVER_PORT)] docker_cmdline = docker_run_cmdline(cmdline, image=docker_image, cwd=language.server_cwd, environ=environ, - docker_args=port_args + - ['--name', container_name]) + docker_args=docker_args) server_job = jobset.JobSpec( cmdline=docker_cmdline, environ=environ, @@ -849,7 +855,8 @@ languages = set(_LANGUAGES[l] languages_http2_badserver_interop = set() if args.http2_badserver_interop: languages_http2_badserver_interop = set( - _LANGUAGES[l] for l in _LANGUAGES_FOR_HTTP2_BADSERVER_TESTS) + _LANGUAGES[l] for l in _LANGUAGES_FOR_HTTP2_BADSERVER_TESTS + if 'all' in args.language or l in args.language) http2Interop = Http2Client() if args.http2_interop else None http2InteropServer = Http2Server() if args.http2_badserver_interop else None @@ -888,8 +895,9 @@ if args.use_docker: sys.exit(1) # Start interop servers. -server_jobs={} -server_addresses={} +server_jobs = {} +server_addresses = {} +http2_badserver_ports = () try: for s in servers: lang = str(s) @@ -899,12 +907,13 @@ try: server_jobs[lang] = job server_addresses[lang] = ('localhost', job.mapped_port(_DEFAULT_SERVER_PORT)) + http2_badserver_job = None if args.http2_badserver_interop: # launch a HTTP2 server emulator that creates edge cases lang = str(http2InteropServer) spec = server_jobspec(http2InteropServer, docker_images.get(lang)) - job = dockerjob.DockerJob(spec) - server_jobs[lang] = job + http2_badserver_job = dockerjob.DockerJob(spec) + server_jobs[lang] = http2_badserver_job jobs = [] if args.cloud_to_prod: @@ -981,13 +990,16 @@ try: jobs.append(test_job) if args.http2_badserver_interop: + http2_badserver_job.wait_for_healthy(timeout_seconds=600) for language in languages_http2_badserver_interop: for test_case in _HTTP2_BADSERVER_TEST_CASES: + offset = sorted(_HTTP2_BADSERVER_TEST_CASES).index(test_case) + server_port = http2_badserver_job.mapped_port(_DEFAULT_SERVER_PORT+offset) test_job = cloud_to_cloud_jobspec(language, test_case, str(http2InteropServer), 'localhost', - _DEFAULT_SERVER_PORT, + server_port, docker_image=docker_images.get(str(language))) jobs.append(test_job) From b39bf85dfce99804a4e07991a36431696a43d10c Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Wed, 5 Apr 2017 08:55:37 -0700 Subject: [PATCH 202/461] Fix test for CLIENT_DIRECT_CHANNEL fixtures. --- .../end2end/tests/filter_call_init_fails.c | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/test/core/end2end/tests/filter_call_init_fails.c b/test/core/end2end/tests/filter_call_init_fails.c index bcb5e2d3ff9..0c4f0dd42fe 100644 --- a/test/core/end2end/tests/filter_call_init_fails.c +++ b/test/core/end2end/tests/filter_call_init_fails.c @@ -107,7 +107,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_destroy(f->cq); } -// Simple request via a server channel filter that always fails to +// Simple request via a SERVER_CHANNEL filter that always fails to // initialize the call. static void test_server_channel_filter(grpc_end2end_test_config config) { grpc_call *c; @@ -203,8 +203,8 @@ static void test_server_channel_filter(grpc_end2end_test_config config) { config.tear_down_data(&f); } -// Simple request via a client channel filter that always fails to -// initialize the call. +// Simple request via a CLIENT_CHANNEL or CLIENT_DIRECT_CHANNEL filter +// that always fails to initialize the call. static void test_client_channel_filter(grpc_end2end_test_config config) { grpc_call *c; grpc_slice request_payload_slice = @@ -293,7 +293,7 @@ static void test_client_channel_filter(grpc_end2end_test_config config) { config.tear_down_data(&f); } -// Simple request via a client subchannel filter that always fails to +// Simple request via a CLIENT_SUBCHANNEL filter that always fails to // initialize the call. static void test_client_subchannel_filter(grpc_end2end_test_config config) { grpc_call *c; @@ -517,23 +517,27 @@ static void init_plugin(void) { maybe_add_client_channel_filter, NULL); grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, INT_MAX, maybe_add_client_subchannel_filter, NULL); + grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX, + maybe_add_client_channel_filter, NULL); } static void destroy_plugin(void) {} void filter_call_init_fails(grpc_end2end_test_config config) { - gpr_log(GPR_INFO, "Testing server channel filter."); + gpr_log(GPR_INFO, "Testing SERVER_CHANNEL filter."); g_enable_server_channel_filter = true; test_server_channel_filter(config); g_enable_server_channel_filter = false; - gpr_log(GPR_INFO, "Testing client channel filter."); + gpr_log(GPR_INFO, "Testing CLIENT_CHANNEL / CLIENT_DIRECT_CHANNEL filter."); g_enable_client_channel_filter = true; test_client_channel_filter(config); g_enable_client_channel_filter = false; - gpr_log(GPR_INFO, "Testing client subchannel filter."); - g_enable_client_subchannel_filter = true; - test_client_subchannel_filter(config); - g_enable_client_subchannel_filter = false; + if (config.feature_mask & FEATURE_MASK_SUPPORTS_CLIENT_CHANNEL) { + gpr_log(GPR_INFO, "Testing CLIENT_SUBCHANNEL filter."); + g_enable_client_subchannel_filter = true; + test_client_subchannel_filter(config); + g_enable_client_subchannel_filter = false; + } } void filter_call_init_fails_pre_init(void) { From e5f18281755cbacf51613124c3f762ad0129b9d1 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 09:08:37 -0700 Subject: [PATCH 203/461] Tweak parameters --- tools/profiling/microbenchmarks/bm_diff.py | 3 ++- tools/profiling/microbenchmarks/speedup.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index 5c8b93d471c..37d500d114f 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -181,9 +181,10 @@ class Benchmark: new = self.samples[True][f] old = self.samples[False][f] if not new or not old: continue + print '%s: new=%r old=%r' % (f, new, old) s = speedup.speedup(new, old) if s: - self.final[f] = '%d%%' % s + self.final[f] = '%+d%%' % s return self.final.keys() def skip(self): diff --git a/tools/profiling/microbenchmarks/speedup.py b/tools/profiling/microbenchmarks/speedup.py index ff114539604..35d392a57db 100644 --- a/tools/profiling/microbenchmarks/speedup.py +++ b/tools/profiling/microbenchmarks/speedup.py @@ -30,7 +30,7 @@ from scipy import stats import math -_THRESHOLD = 0.01 +_THRESHOLD = 0.001 def scale(a, mul): return [x*mul for x in a] From 61a6398675ae3afd3ee305a4bba3c6c148939a05 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Wed, 5 Apr 2017 09:56:12 -0700 Subject: [PATCH 204/461] Fix refcounting for subchannel call stack init failures. --- .../ext/filters/client_channel/client_channel.c | 15 ++++++--------- src/core/ext/filters/client_channel/subchannel.c | 3 +-- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel.c b/src/core/ext/filters/client_channel/client_channel.c index 04b0ffdaf3d..83e3b8f118d 100644 --- a/src/core/ext/filters/client_channel/client_channel.c +++ b/src/core/ext/filters/client_channel/client_channel.c @@ -914,14 +914,14 @@ static void subchannel_ready_locked(grpc_exec_ctx *exec_ctx, void *arg, .arena = calld->arena}; grpc_error *new_error = grpc_connected_subchannel_create_call( exec_ctx, calld->connected_subchannel, &call_args, &subchannel_call); + gpr_atm_rel_store(&calld->subchannel_call, + (gpr_atm)(uintptr_t)subchannel_call); if (new_error != GRPC_ERROR_NONE) { new_error = grpc_error_add_child(new_error, error); - subchannel_call = CANCELLED_CALL; fail_locked(exec_ctx, calld, new_error); + } else { + retry_waiting_locked(exec_ctx, calld); } - gpr_atm_rel_store(&calld->subchannel_call, - (gpr_atm)(uintptr_t)subchannel_call); - retry_waiting_locked(exec_ctx, calld); } GRPC_CALL_STACK_UNREF(exec_ctx, calld->owning_call, "pick_subchannel"); } @@ -1152,15 +1152,12 @@ static void start_transport_stream_op_batch_locked_inner( .arena = calld->arena}; grpc_error *error = grpc_connected_subchannel_create_call( exec_ctx, calld->connected_subchannel, &call_args, &subchannel_call); + gpr_atm_rel_store(&calld->subchannel_call, + (gpr_atm)(uintptr_t)subchannel_call); if (error != GRPC_ERROR_NONE) { - subchannel_call = CANCELLED_CALL; - gpr_atm_rel_store(&calld->subchannel_call, - (gpr_atm)(uintptr_t)subchannel_call); fail_locked(exec_ctx, calld, GRPC_ERROR_REF(error)); grpc_transport_stream_op_batch_finish_with_failure(exec_ctx, op, error); } else { - gpr_atm_rel_store(&calld->subchannel_call, - (gpr_atm)(uintptr_t)subchannel_call); retry_waiting_locked(exec_ctx, calld); /* recurse to retry */ start_transport_stream_op_batch_locked_inner(exec_ctx, op, elem); diff --git a/src/core/ext/filters/client_channel/subchannel.c b/src/core/ext/filters/client_channel/subchannel.c index 29a1a095553..9a7a7a0ee5f 100644 --- a/src/core/ext/filters/client_channel/subchannel.c +++ b/src/core/ext/filters/client_channel/subchannel.c @@ -769,7 +769,7 @@ grpc_error *grpc_connected_subchannel_create_call( *call = gpr_arena_alloc( args->arena, sizeof(grpc_subchannel_call) + chanstk->call_stack_size); grpc_call_stack *callstk = SUBCHANNEL_CALL_TO_CALL_STACK(*call); - (*call)->connection = con; // Ref is added below. + (*call)->connection = GRPC_CONNECTED_SUBCHANNEL_REF(con, "subchannel_call"); const grpc_call_element_args call_args = {.call_stack = callstk, .server_transport_data = NULL, .context = NULL, @@ -784,7 +784,6 @@ grpc_error *grpc_connected_subchannel_create_call( gpr_log(GPR_ERROR, "error: %s", error_string); return error; } - GRPC_CONNECTED_SUBCHANNEL_REF(con, "subchannel_call"); grpc_call_stack_set_pollset_or_pollset_set(exec_ctx, callstk, args->pollent); return GRPC_ERROR_NONE; } From 37f80e8a8a86612f44fd8e6cd3b15d73bc737404 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 12:18:30 -0700 Subject: [PATCH 205/461] Fix reuse bug? --- tools/profiling/microbenchmarks/bm_json.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/profiling/microbenchmarks/bm_json.py b/tools/profiling/microbenchmarks/bm_json.py index e885444f410..917269823d0 100644 --- a/tools/profiling/microbenchmarks/bm_json.py +++ b/tools/profiling/microbenchmarks/bm_json.py @@ -203,4 +203,5 @@ def expand_json(js, js2 = None): row['real_time'] = bm2['real_time'] row['iterations'] = bm2['iterations'] bm2['already_used'] = True + break yield row From 32873d171be6f874cd81312f6c951c80b975edc4 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 12:19:51 -0700 Subject: [PATCH 206/461] accelerate --- tools/profiling/microbenchmarks/bm_diff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index 37d500d114f..09018594794 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -104,7 +104,7 @@ argp.add_argument('-t', '--track', help='Which metrics to track') argp.add_argument('-b', '--benchmarks', nargs='+', choices=_AVAILABLE_BENCHMARK_TESTS, default=['bm_cq']) argp.add_argument('-d', '--diff_base', type=str) -argp.add_argument('-r', '--repetitions', type=int, default=30) +argp.add_argument('-r', '--repetitions', type=int, default=10) argp.add_argument('-p', '--p_threshold', type=float, default=0.01) argp.add_argument('-j', '--jobs', type=int, default=multiprocessing.cpu_count()) args = argp.parse_args() From f3ba6a0133f654109f2484a081f5e8a97f16e3a4 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 12:29:06 -0700 Subject: [PATCH 207/461] Fix sanity --- build.yaml | 2 ++ include/grpc/impl/codegen/grpc_types.h | 2 ++ src/core/ext/filters/http/client/http_client_filter.h | 3 --- src/core/lib/security/credentials/credentials.c | 1 - src/core/lib/security/credentials/ssl/ssl_credentials.c | 1 - tools/run_tests/generated/sources_and_headers.json | 5 ++++- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/build.yaml b/build.yaml index 383090fa6f1..1df62654a4c 100644 --- a/build.yaml +++ b/build.yaml @@ -480,6 +480,8 @@ filegroups: - src/core/ext/filters/http/http_filters_plugin.c - src/core/ext/filters/http/server/http_server_filter.c plugin: grpc_http_filters + uses: + - grpc_base - name: grpc_lb_policy_grpclb headers: - src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index 37f5a49ece3..e0276f6e43a 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -205,6 +205,8 @@ typedef struct { /** Minimum time (in milliseconds) between successive ping frames being sent */ #define GRPC_ARG_HTTP2_MIN_TIME_BETWEEN_PINGS_MS \ "grpc.http2.min_time_between_pings_ms" +/* Channel arg to override the http2 :scheme header */ +#define GRPC_ARG_HTTP2_SCHEME "grpc.http2_scheme" /** How many pings can we send before needing to send a data frame or header frame? (0 indicates that an infinite number of pings can be sent without sending diff --git a/src/core/ext/filters/http/client/http_client_filter.h b/src/core/ext/filters/http/client/http_client_filter.h index 109702f6670..6e1eb3937ba 100644 --- a/src/core/ext/filters/http/client/http_client_filter.h +++ b/src/core/ext/filters/http/client/http_client_filter.h @@ -38,9 +38,6 @@ /* Processes metadata on the client side for HTTP2 transports */ extern const grpc_channel_filter grpc_http_client_filter; -/* Channel arg to override the http2 :scheme header */ -#define GRPC_ARG_HTTP2_SCHEME "grpc.http2_scheme" - /* Channel arg to determine maximum size of payload eligable for GET request */ #define GRPC_ARG_MAX_PAYLOAD_SIZE_FOR_GET "grpc.max_payload_size_for_get" diff --git a/src/core/lib/security/credentials/credentials.c b/src/core/lib/security/credentials/credentials.c index 700aae1bc5f..d89da47fc15 100644 --- a/src/core/lib/security/credentials/credentials.c +++ b/src/core/lib/security/credentials/credentials.c @@ -36,7 +36,6 @@ #include #include -#include "src/core/ext/filters/http/client/http_client_filter.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/http/httpcli.h" #include "src/core/lib/http/parser.h" diff --git a/src/core/lib/security/credentials/ssl/ssl_credentials.c b/src/core/lib/security/credentials/ssl/ssl_credentials.c index 9dccbb1e5db..b63bb6b6e9e 100644 --- a/src/core/lib/security/credentials/ssl/ssl_credentials.c +++ b/src/core/lib/security/credentials/ssl/ssl_credentials.c @@ -35,7 +35,6 @@ #include -#include "src/core/ext/filters/http/client/http_client_filter.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/surface/api_trace.h" diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index afa52f391f0..6cf4494b12f 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -8007,7 +8007,10 @@ "type": "filegroup" }, { - "deps": [], + "deps": [ + "gpr", + "grpc_base" + ], "headers": [ "src/core/ext/filters/http/client/http_client_filter.h", "src/core/ext/filters/http/compress/compress_filter.h", From 9702e92d09465d34fecc1ca07cae75f2686f1c32 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 5 Apr 2017 13:37:59 -0700 Subject: [PATCH 208/461] Asan fix --- src/core/ext/transport/chttp2/transport/chttp2_transport.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 7aee014e633..b59f02b9b68 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1651,6 +1651,7 @@ static void remove_stream(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, incoming_byte_stream_unref(exec_ctx, bs); s->data_parser.parsing_frame = NULL; } else { + GRPC_ERROR_UNREF(s->byte_stream_error); s->byte_stream_error = GRPC_ERROR_REF(error); } } From de0906553097e24c91def857c0227f281d347b7c Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 14:00:24 -0700 Subject: [PATCH 209/461] Update windows --- src/core/lib/iomgr/endpoint_pair_windows.c | 13 +++++------ src/core/lib/iomgr/tcp_client_windows.c | 20 ++++------------- src/core/lib/iomgr/tcp_server_windows.c | 25 ++++++---------------- src/core/lib/iomgr/tcp_windows.c | 17 ++++++++++++--- src/core/lib/iomgr/tcp_windows.h | 4 ++-- 5 files changed, 33 insertions(+), 46 deletions(-) diff --git a/src/core/lib/iomgr/endpoint_pair_windows.c b/src/core/lib/iomgr/endpoint_pair_windows.c index 93f71b745c6..dcf8166104e 100644 --- a/src/core/lib/iomgr/endpoint_pair_windows.c +++ b/src/core/lib/iomgr/endpoint_pair_windows.c @@ -83,15 +83,16 @@ static void create_sockets(SOCKET sv[2]) { } grpc_endpoint_pair grpc_iomgr_create_endpoint_pair( - const char *name, grpc_resource_quota *resource_quota, - size_t read_slice_size) { + const char *name, grpc_channel_args *channel_args) { SOCKET sv[2]; grpc_endpoint_pair p; create_sockets(sv); - p.client = grpc_tcp_create(grpc_winsocket_create(sv[1], "endpoint:client"), - resource_quota, "endpoint:server"); - p.server = grpc_tcp_create(grpc_winsocket_create(sv[0], "endpoint:server"), - resource_quota, "endpoint:client"); + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + p.client = grpc_tcp_create(&exec_ctx, grpc_winsocket_create(sv[1], "endpoint:client"), + channel_args, "endpoint:server"); + p.server = grpc_tcp_create(&exec_ctx,grpc_winsocket_create(sv[0], "endpoint:server"), + channel_args, "endpoint:client"); + grpc_exec_ctx_finish(&exec_ctx); return p; } diff --git a/src/core/lib/iomgr/tcp_client_windows.c b/src/core/lib/iomgr/tcp_client_windows.c index a356564766a..935f96b810e 100644 --- a/src/core/lib/iomgr/tcp_client_windows.c +++ b/src/core/lib/iomgr/tcp_client_windows.c @@ -63,7 +63,7 @@ typedef struct { int refs; grpc_closure on_connect; grpc_endpoint **endpoint; - grpc_resource_quota *resource_quota; + grpc_channel_args *channel_args; } async_connect; static void async_connect_unlock_and_cleanup(grpc_exec_ctx *exec_ctx, @@ -72,7 +72,7 @@ static void async_connect_unlock_and_cleanup(grpc_exec_ctx *exec_ctx, int done = (--ac->refs == 0); gpr_mu_unlock(&ac->mu); if (done) { - grpc_resource_quota_unref_internal(exec_ctx, ac->resource_quota); + grpc_channel_args_destroy(exec_ctx, ac->channel_args); gpr_mu_destroy(&ac->mu); gpr_free(ac->addr_name); gpr_free(ac); @@ -119,7 +119,7 @@ static void on_connect(grpc_exec_ctx *exec_ctx, void *acp, grpc_error *error) { if (!wsa_success) { error = GRPC_WSA_ERROR(WSAGetLastError(), "ConnectEx"); } else { - *ep = grpc_tcp_create(socket, ac->resource_quota, ac->addr_name); + *ep = grpc_tcp_create(exec_ctx, socket, ac->channel_args, ac->addr_name); socket = NULL; } } else { @@ -152,17 +152,6 @@ static void tcp_client_connect_impl( grpc_winsocket_callback_info *info; grpc_error *error = GRPC_ERROR_NONE; - grpc_resource_quota *resource_quota = grpc_resource_quota_create(NULL); - if (channel_args != NULL) { - for (size_t i = 0; i < channel_args->num_args; i++) { - if (0 == strcmp(channel_args->args[i].key, GRPC_ARG_RESOURCE_QUOTA)) { - grpc_resource_quota_unref_internal(exec_ctx, resource_quota); - resource_quota = grpc_resource_quota_ref_internal( - channel_args->args[i].value.pointer.p); - } - } - } - *endpoint = NULL; /* Use dualstack sockets where available. */ @@ -225,7 +214,7 @@ static void tcp_client_connect_impl( ac->refs = 2; ac->addr_name = grpc_sockaddr_to_uri(addr); ac->endpoint = endpoint; - ac->resource_quota = resource_quota; + ac->channel_args = grpc_channel_args_copy(channel_args); grpc_closure_init(&ac->on_connect, on_connect, ac, grpc_schedule_on_exec_ctx); grpc_closure_init(&ac->on_alarm, on_alarm, ac, grpc_schedule_on_exec_ctx); @@ -247,7 +236,6 @@ failure: } else if (sock != INVALID_SOCKET) { closesocket(sock); } - grpc_resource_quota_unref_internal(exec_ctx, resource_quota); grpc_closure_sched(exec_ctx, on_done, final_error); } diff --git a/src/core/lib/iomgr/tcp_server_windows.c b/src/core/lib/iomgr/tcp_server_windows.c index 12ce7d3fdd5..3b077e6d1ff 100644 --- a/src/core/lib/iomgr/tcp_server_windows.c +++ b/src/core/lib/iomgr/tcp_server_windows.c @@ -53,6 +53,7 @@ #include "src/core/lib/iomgr/socket_windows.h" #include "src/core/lib/iomgr/tcp_server.h" #include "src/core/lib/iomgr/tcp_windows.h" +#include "src/core/lib/channel/channel_args.h" #define MIN_SAFE_ACCEPT_QUEUE_SIZE 100 @@ -102,7 +103,7 @@ struct grpc_tcp_server { /* shutdown callback */ grpc_closure *shutdown_complete; - grpc_resource_quota *resource_quota; + grpc_channel_args *channel_args; }; /* Public function. Allocates the proper data structures to hold a @@ -112,21 +113,7 @@ grpc_error *grpc_tcp_server_create(grpc_exec_ctx *exec_ctx, const grpc_channel_args *args, grpc_tcp_server **server) { grpc_tcp_server *s = gpr_malloc(sizeof(grpc_tcp_server)); - s->resource_quota = grpc_resource_quota_create(NULL); - for (size_t i = 0; i < (args == NULL ? 0 : args->num_args); i++) { - if (0 == strcmp(GRPC_ARG_RESOURCE_QUOTA, args->args[i].key)) { - if (args->args[i].type == GRPC_ARG_POINTER) { - grpc_resource_quota_unref_internal(exec_ctx, s->resource_quota); - s->resource_quota = - grpc_resource_quota_ref_internal(args->args[i].value.pointer.p); - } else { - grpc_resource_quota_unref_internal(exec_ctx, s->resource_quota); - gpr_free(s); - return GRPC_ERROR_CREATE_FROM_STATIC_STRING( - GRPC_ARG_RESOURCE_QUOTA " must be a pointer to a buffer pool"); - } - } - } + s->channel_args = grpc_channel_args_copy(args); gpr_ref_init(&s->refs, 1); gpr_mu_init(&s->mu); s->active_ports = 0; @@ -155,7 +142,7 @@ static void destroy_server(grpc_exec_ctx *exec_ctx, void *arg, grpc_winsocket_destroy(sp->socket); gpr_free(sp); } - grpc_resource_quota_unref_internal(exec_ctx, s->resource_quota); + grpc_channel_args_destroy(exec_ctx, s->channel_args); gpr_free(s); } @@ -383,8 +370,8 @@ static void on_accept(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { gpr_free(utf8_message); } gpr_asprintf(&fd_name, "tcp_server:%s", peer_name_string); - ep = grpc_tcp_create(grpc_winsocket_create(sock, fd_name), - sp->server->resource_quota, peer_name_string); + ep = grpc_tcp_create(exec_ctx, grpc_winsocket_create(sock, fd_name), + sp->server->channel_args, peer_name_string); gpr_free(fd_name); gpr_free(peer_name_string); } else { diff --git a/src/core/lib/iomgr/tcp_windows.c b/src/core/lib/iomgr/tcp_windows.c index 91348832268..35b991cb127 100644 --- a/src/core/lib/iomgr/tcp_windows.c +++ b/src/core/lib/iomgr/tcp_windows.c @@ -430,10 +430,21 @@ static grpc_endpoint_vtable vtable = {win_read, win_get_peer, win_get_fd}; -grpc_endpoint *grpc_tcp_create(grpc_winsocket *socket, - grpc_resource_quota *resource_quota, +grpc_endpoint *grpc_tcp_create(grpc_exec_ctx *exec_ctx, grpc_winsocket *socket, + grpc_channel_args *channel_args, char *peer_string) { - grpc_tcp *tcp = (grpc_tcp *)gpr_malloc(sizeof(grpc_tcp)); + grpc_resource_quota *resource_quota = grpc_resource_quota_create(NULL); + if (channel_args != NULL) { + for (size_t i = 0; i < channel_args->num_args; i++) { +if (0 == + strcmp(channel_args->args[i].key, GRPC_ARG_RESOURCE_QUOTA)) { + grpc_resource_quota_unref_internal(exec_ctx, resource_quota); + resource_quota = grpc_resource_quota_ref_internal( + channel_args->args[i].value.pointer.p); + } + } + } + grpc_tcp *tcp = (grpc_tcp *)gpr_malloc(sizeof(grpc_tcp)); memset(tcp, 0, sizeof(grpc_tcp)); tcp->base.vtable = &vtable; tcp->socket = socket; diff --git a/src/core/lib/iomgr/tcp_windows.h b/src/core/lib/iomgr/tcp_windows.h index 4402de1c385..abafdb22d20 100644 --- a/src/core/lib/iomgr/tcp_windows.h +++ b/src/core/lib/iomgr/tcp_windows.h @@ -50,8 +50,8 @@ /* Create a tcp endpoint given a winsock handle. * Takes ownership of the handle. */ -grpc_endpoint *grpc_tcp_create(grpc_winsocket *socket, - grpc_resource_quota *resource_quota, +grpc_endpoint *grpc_tcp_create(grpc_exec_ctx *exec_ctx, grpc_winsocket *socket, + grpc_channel_args *channel_args, char *peer_string); grpc_error *grpc_tcp_prepare_socket(SOCKET sock); From 4254d3bc31eb12487012fe3571ea22851f238524 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 14:03:49 -0700 Subject: [PATCH 210/461] clang-format --- src/core/lib/iomgr/endpoint_pair_windows.c | 8 +++++--- src/core/lib/iomgr/tcp_client_windows.c | 5 +++-- src/core/lib/iomgr/tcp_server_windows.c | 2 +- src/core/lib/iomgr/tcp_windows.c | 23 +++++++++++----------- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/core/lib/iomgr/endpoint_pair_windows.c b/src/core/lib/iomgr/endpoint_pair_windows.c index dcf8166104e..25d6264dfb6 100644 --- a/src/core/lib/iomgr/endpoint_pair_windows.c +++ b/src/core/lib/iomgr/endpoint_pair_windows.c @@ -88,10 +88,12 @@ grpc_endpoint_pair grpc_iomgr_create_endpoint_pair( grpc_endpoint_pair p; create_sockets(sv); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - p.client = grpc_tcp_create(&exec_ctx, grpc_winsocket_create(sv[1], "endpoint:client"), + p.client = grpc_tcp_create(&exec_ctx, + grpc_winsocket_create(sv[1], "endpoint:client"), channel_args, "endpoint:server"); - p.server = grpc_tcp_create(&exec_ctx,grpc_winsocket_create(sv[0], "endpoint:server"), - channel_args, "endpoint:client"); + p.server = grpc_tcp_create(&exec_ctx, + grpc_winsocket_create(sv[0], "endpoint:server"), + channel_args, "endpoint:client"); grpc_exec_ctx_finish(&exec_ctx); return p; } diff --git a/src/core/lib/iomgr/tcp_client_windows.c b/src/core/lib/iomgr/tcp_client_windows.c index 935f96b810e..d6baca50baf 100644 --- a/src/core/lib/iomgr/tcp_client_windows.c +++ b/src/core/lib/iomgr/tcp_client_windows.c @@ -72,7 +72,7 @@ static void async_connect_unlock_and_cleanup(grpc_exec_ctx *exec_ctx, int done = (--ac->refs == 0); gpr_mu_unlock(&ac->mu); if (done) { - grpc_channel_args_destroy(exec_ctx, ac->channel_args); + grpc_channel_args_destroy(exec_ctx, ac->channel_args); gpr_mu_destroy(&ac->mu); gpr_free(ac->addr_name); gpr_free(ac); @@ -119,7 +119,8 @@ static void on_connect(grpc_exec_ctx *exec_ctx, void *acp, grpc_error *error) { if (!wsa_success) { error = GRPC_WSA_ERROR(WSAGetLastError(), "ConnectEx"); } else { - *ep = grpc_tcp_create(exec_ctx, socket, ac->channel_args, ac->addr_name); + *ep = + grpc_tcp_create(exec_ctx, socket, ac->channel_args, ac->addr_name); socket = NULL; } } else { diff --git a/src/core/lib/iomgr/tcp_server_windows.c b/src/core/lib/iomgr/tcp_server_windows.c index 3b077e6d1ff..4c17f08918b 100644 --- a/src/core/lib/iomgr/tcp_server_windows.c +++ b/src/core/lib/iomgr/tcp_server_windows.c @@ -46,6 +46,7 @@ #include #include +#include "src/core/lib/channel/channel_args.h" #include "src/core/lib/iomgr/iocp_windows.h" #include "src/core/lib/iomgr/pollset_windows.h" #include "src/core/lib/iomgr/resolve_address.h" @@ -53,7 +54,6 @@ #include "src/core/lib/iomgr/socket_windows.h" #include "src/core/lib/iomgr/tcp_server.h" #include "src/core/lib/iomgr/tcp_windows.h" -#include "src/core/lib/channel/channel_args.h" #define MIN_SAFE_ACCEPT_QUEUE_SIZE 100 diff --git a/src/core/lib/iomgr/tcp_windows.c b/src/core/lib/iomgr/tcp_windows.c index 35b991cb127..f74aa687936 100644 --- a/src/core/lib/iomgr/tcp_windows.c +++ b/src/core/lib/iomgr/tcp_windows.c @@ -433,18 +433,17 @@ static grpc_endpoint_vtable vtable = {win_read, grpc_endpoint *grpc_tcp_create(grpc_exec_ctx *exec_ctx, grpc_winsocket *socket, grpc_channel_args *channel_args, char *peer_string) { - grpc_resource_quota *resource_quota = grpc_resource_quota_create(NULL); - if (channel_args != NULL) { - for (size_t i = 0; i < channel_args->num_args; i++) { -if (0 == - strcmp(channel_args->args[i].key, GRPC_ARG_RESOURCE_QUOTA)) { - grpc_resource_quota_unref_internal(exec_ctx, resource_quota); - resource_quota = grpc_resource_quota_ref_internal( - channel_args->args[i].value.pointer.p); - } - } - } - grpc_tcp *tcp = (grpc_tcp *)gpr_malloc(sizeof(grpc_tcp)); + grpc_resource_quota *resource_quota = grpc_resource_quota_create(NULL); + if (channel_args != NULL) { + for (size_t i = 0; i < channel_args->num_args; i++) { + if (0 == strcmp(channel_args->args[i].key, GRPC_ARG_RESOURCE_QUOTA)) { + grpc_resource_quota_unref_internal(exec_ctx, resource_quota); + resource_quota = grpc_resource_quota_ref_internal( + channel_args->args[i].value.pointer.p); + } + } + } + grpc_tcp *tcp = (grpc_tcp *)gpr_malloc(sizeof(grpc_tcp)); memset(tcp, 0, sizeof(grpc_tcp)); tcp->base.vtable = &vtable; tcp->socket = socket; From b1c02cac82b9ec7988d60d53c3c2af8884c57f1a Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 14:11:28 -0700 Subject: [PATCH 211/461] exclude small absolute changes --- tools/profiling/microbenchmarks/bm_diff.py | 25 +++------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index 09018594794..3223cc1004d 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -63,26 +63,6 @@ def median(ary): def min_change(pct): return lambda n, o: abs(changed_ratio(n,o)) > pct/100.0 -nanos = { - 'abs_diff': 5, - 'pct_diff': 10, -} -counter = { - 'abs_diff': 0.5, - 'pct_diff': 10, -} - -_INTERESTING = { - 'cpu_time': nanos, - 'real_time': nanos, - 'locks_per_iteration': counter, - 'allocs_per_iteration': counter, - 'writes_per_iteration': counter, - 'atm_cas_per_iteration': counter, - 'atm_add_per_iteration': counter, -} - - _AVAILABLE_BENCHMARK_TESTS = ['bm_fullstack_unary_ping_pong', 'bm_fullstack_streaming_ping_pong', 'bm_fullstack_streaming_pump', @@ -181,9 +161,10 @@ class Benchmark: new = self.samples[True][f] old = self.samples[False][f] if not new or not old: continue - print '%s: new=%r old=%r' % (f, new, old) + mdn_diff = abs(median(new) - median(old)) + print '%s: new=%r old=%r mdn_diff=%r' % (f, new, old, mdn_diff) s = speedup.speedup(new, old) - if s: + if s and mdn_diff > 0.5: self.final[f] = '%+d%%' % s return self.final.keys() From bdeb857ab4e2233bbb796378f7212eb52cf71bb3 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 14:12:53 -0700 Subject: [PATCH 212/461] more samples --- tools/profiling/microbenchmarks/bm_diff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index 3223cc1004d..6c63f20b7df 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -84,7 +84,7 @@ argp.add_argument('-t', '--track', help='Which metrics to track') argp.add_argument('-b', '--benchmarks', nargs='+', choices=_AVAILABLE_BENCHMARK_TESTS, default=['bm_cq']) argp.add_argument('-d', '--diff_base', type=str) -argp.add_argument('-r', '--repetitions', type=int, default=10) +argp.add_argument('-r', '--repetitions', type=int, default=30) argp.add_argument('-p', '--p_threshold', type=float, default=0.01) argp.add_argument('-j', '--jobs', type=int, default=multiprocessing.cpu_count()) args = argp.parse_args() From ff558bac5c7be1571db720f23974d70b75385415 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 14:44:42 -0700 Subject: [PATCH 213/461] Fix trickle --- test/cpp/microbenchmarks/bm_fullstack_trickle.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/cpp/microbenchmarks/bm_fullstack_trickle.cc b/test/cpp/microbenchmarks/bm_fullstack_trickle.cc index c563f28b55c..a5cfeb4f955 100644 --- a/test/cpp/microbenchmarks/bm_fullstack_trickle.cc +++ b/test/cpp/microbenchmarks/bm_fullstack_trickle.cc @@ -53,7 +53,8 @@ static void* tag(intptr_t x) { return reinterpret_cast(x); } class TrickledCHTTP2 : public EndpointPairFixture { public: TrickledCHTTP2(Service* service, size_t megabits_per_second) - : EndpointPairFixture(service, MakeEndpoints(megabits_per_second)) {} + : EndpointPairFixture(service, MakeEndpoints(megabits_per_second), + FixtureConfiguration()) {} void AddToLabel(std::ostream& out, benchmark::State& state) { out << " writes/iter:" From bee6a33c5c1c33548406849f9b52f9ddcce13d27 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 14:46:56 -0700 Subject: [PATCH 214/461] Fix include guards --- src/core/ext/transport/chttp2/transport/http2_settings.h | 6 +++--- tools/codegen/core/gen_settings_ids.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/http2_settings.h b/src/core/ext/transport/chttp2/transport/http2_settings.h index 61048a64783..9781cdc9893 100644 --- a/src/core/ext/transport/chttp2/transport/http2_settings.h +++ b/src/core/ext/transport/chttp2/transport/http2_settings.h @@ -33,8 +33,8 @@ * Automatically generated by tools/codegen/core/gen_settings_ids.py */ -#ifndef SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H -#define SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H +#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H +#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H #include #include @@ -71,4 +71,4 @@ typedef struct { extern const grpc_chttp2_setting_parameters grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS]; -#endif /* SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H */ +#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H */ diff --git a/tools/codegen/core/gen_settings_ids.py b/tools/codegen/core/gen_settings_ids.py index cfc2c5d0a40..29c67956c70 100755 --- a/tools/codegen/core/gen_settings_ids.py +++ b/tools/codegen/core/gen_settings_ids.py @@ -80,8 +80,8 @@ with open(sys.argv[0]) as my_source: put_banner([H,C], ["Automatically generated by tools/codegen/core/gen_settings_ids.py"]) -print >>H, "#ifndef SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H" -print >>H, "#define SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H" +print >>H, "#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H" +print >>H, "#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H" print >>H print >>H, "#include " print >>H, "#include " @@ -176,7 +176,7 @@ for decorated_setting in sorted(decorated_settings): print >>C, "};" print >>H -print >>H, "#endif /* SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H */" +print >>H, "#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HTTP2_SETTINGS_H */" H.close() C.close() From d4da50b2cb1575b9a2661c47e7d393931d28bc84 Mon Sep 17 00:00:00 2001 From: Mehrdad Afshari Date: Wed, 5 Apr 2017 10:50:03 -0700 Subject: [PATCH 215/461] Add manifest to fix grpcio_reflection packaging --- src/python/grpcio_reflection/MANIFEST.in | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/python/grpcio_reflection/MANIFEST.in diff --git a/src/python/grpcio_reflection/MANIFEST.in b/src/python/grpcio_reflection/MANIFEST.in new file mode 100644 index 00000000000..0f2130c0b58 --- /dev/null +++ b/src/python/grpcio_reflection/MANIFEST.in @@ -0,0 +1,4 @@ +include grpc_version.py +include reflection_commands.py +graft grpc_reflection +global-exclude *.pyc From 7281d19de374852abf38521a20ef96b88e2916e9 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 15:04:55 -0700 Subject: [PATCH 216/461] fix --- tools/profiling/microbenchmarks/bm_diff.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index 6c63f20b7df..e4ef8df91c7 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -45,6 +45,16 @@ import jobset import itertools import speedup +_INTERESTING = ( + 'cpu_time', + 'real_time', + 'locks_per_iteration', + 'allocs_per_iteration', + 'writes_per_iteration', + 'atm_cas_per_iteration', + 'atm_add_per_iteration', +) + def changed_ratio(n, o): if float(o) <= .0001: o = 0 if float(n) <= .0001: n = 0 @@ -78,9 +88,9 @@ _AVAILABLE_BENCHMARK_TESTS = ['bm_fullstack_unary_ping_pong', argp = argparse.ArgumentParser(description='Perform diff on microbenchmarks') argp.add_argument('-t', '--track', - choices=sorted(_INTERESTING.keys()), + choices=sorted(_INTERESTING), nargs='+', - default=sorted(_INTERESTING.keys()), + default=sorted(_INTERESTING), help='Which metrics to track') argp.add_argument('-b', '--benchmarks', nargs='+', choices=_AVAILABLE_BENCHMARK_TESTS, default=['bm_cq']) argp.add_argument('-d', '--diff_base', type=str) From fa416cbe3ba9b2f31666932235407c1c7d5e4e6f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 15:14:30 -0700 Subject: [PATCH 217/461] Dont break codegen barrier --- include/grpc++/impl/codegen/async_unary_call.h | 5 ++--- include/grpc++/impl/codegen/core_codegen.h | 1 + include/grpc++/impl/codegen/core_codegen_interface.h | 1 + src/cpp/common/core_codegen.cc | 3 +++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/grpc++/impl/codegen/async_unary_call.h b/include/grpc++/impl/codegen/async_unary_call.h index b120b37f1fe..13b0cc419c6 100644 --- a/include/grpc++/impl/codegen/async_unary_call.h +++ b/include/grpc++/impl/codegen/async_unary_call.h @@ -42,8 +42,6 @@ #include #include -extern "C" void* grpc_call_arena_alloc(grpc_call* call, size_t size); - namespace grpc { class CompletionQueue; @@ -69,7 +67,8 @@ class ClientAsyncResponseReader final const W& request) { Call call = channel->CreateCall(method, context, cq); ClientAsyncResponseReader* reader = - new (grpc_call_arena_alloc(call.call(), sizeof(*reader))) + new (g_core_codegen_interface->grpc_call_arena_alloc(call.call(), + sizeof(*reader))) ClientAsyncResponseReader(call, context); reader->init_buf_.SendInitialMetadata(context->send_initial_metadata_, diff --git a/include/grpc++/impl/codegen/core_codegen.h b/include/grpc++/impl/codegen/core_codegen.h index a5f762e21da..90bb6584555 100644 --- a/include/grpc++/impl/codegen/core_codegen.h +++ b/include/grpc++/impl/codegen/core_codegen.h @@ -66,6 +66,7 @@ class CoreCodegen : public CoreCodegenInterface { void grpc_call_ref(grpc_call* call) override; void grpc_call_unref(grpc_call* call) override; + virtual void* grpc_call_arena_alloc(grpc_call* call, size_t length) override; void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) override; diff --git a/include/grpc++/impl/codegen/core_codegen_interface.h b/include/grpc++/impl/codegen/core_codegen_interface.h index a3df913c264..8833de0748d 100644 --- a/include/grpc++/impl/codegen/core_codegen_interface.h +++ b/include/grpc++/impl/codegen/core_codegen_interface.h @@ -96,6 +96,7 @@ class CoreCodegenInterface { virtual void grpc_call_ref(grpc_call* call) = 0; virtual void grpc_call_unref(grpc_call* call) = 0; + virtual void* grpc_call_arena_alloc(grpc_call* call, size_t length) = 0; virtual grpc_slice grpc_empty_slice() = 0; virtual grpc_slice grpc_slice_malloc(size_t length) = 0; diff --git a/src/cpp/common/core_codegen.cc b/src/cpp/common/core_codegen.cc index c2b5c6f450e..88a7968b9b2 100644 --- a/src/cpp/common/core_codegen.cc +++ b/src/cpp/common/core_codegen.cc @@ -93,6 +93,9 @@ void CoreCodegen::grpc_byte_buffer_destroy(grpc_byte_buffer* bb) { void CoreCodegen::grpc_call_ref(grpc_call* call) { ::grpc_call_ref(call); } void CoreCodegen::grpc_call_unref(grpc_call* call) { ::grpc_call_unref(call); } +void* CoreCodegen::grpc_call_arena_alloc(grpc_call* call, size_t length) { + return ::grpc_call_arena_alloc(call, length); +} int CoreCodegen::grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader, grpc_byte_buffer* buffer) { From 5fa46127b67351bcd00fc6eefdb9846366ba483c Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Wed, 5 Apr 2017 15:41:18 -0700 Subject: [PATCH 218/461] Fix headers included in max_age_filter.c --- src/core/ext/filters/max_age/max_age_filter.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core/ext/filters/max_age/max_age_filter.c b/src/core/ext/filters/max_age/max_age_filter.c index f858220c010..a045f0a421a 100644 --- a/src/core/ext/filters/max_age/max_age_filter.c +++ b/src/core/ext/filters/max_age/max_age_filter.c @@ -31,7 +31,7 @@ * */ -#include "src/core/lib/channel/message_size_filter.h" +#include "src/core/ext/filters/max_age/max_age_filter.h" #include #include @@ -41,7 +41,6 @@ #include "src/core/lib/iomgr/timer.h" #include "src/core/lib/surface/channel_init.h" #include "src/core/lib/transport/http2_errors.h" -#include "src/core/lib/transport/service_config.h" #define DEFAULT_MAX_CONNECTION_AGE_MS INT_MAX #define DEFAULT_MAX_CONNECTION_AGE_GRACE_MS INT_MAX From d4e9a4863a25f40389db01347aaabcb798dc9138 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 15:41:59 -0700 Subject: [PATCH 219/461] Convert all async client stream types to not allocate --- include/grpc++/impl/codegen/async_stream.h | 129 ++++++++++++------ .../grpc++/impl/codegen/async_unary_call.h | 27 ++-- src/compiler/cpp_generator.cc | 19 +-- src/cpp/client/generic_stub.cc | 2 +- 4 files changed, 110 insertions(+), 67 deletions(-) diff --git a/include/grpc++/impl/codegen/async_stream.h b/include/grpc++/impl/codegen/async_stream.h index 8f529895cac..f97d824bafe 100644 --- a/include/grpc++/impl/codegen/async_stream.h +++ b/include/grpc++/impl/codegen/async_stream.h @@ -145,17 +145,19 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface { public: /// Create a stream and write the first request out. template - ClientAsyncReader(ChannelInterface* channel, CompletionQueue* cq, - const RpcMethod& method, ClientContext* context, - const W& request, void* tag) - : context_(context), call_(channel->CreateCall(method, context, cq)) { - init_ops_.set_output_tag(tag); - init_ops_.SendInitialMetadata(context->send_initial_metadata_, - context->initial_metadata_flags()); - // TODO(ctiller): don't assert - GPR_CODEGEN_ASSERT(init_ops_.SendMessage(request).ok()); - init_ops_.ClientSendClose(); - call_.PerformOps(&init_ops_); + static ClientAsyncReader* Create(ChannelInterface* channel, + CompletionQueue* cq, const RpcMethod& method, + ClientContext* context, const W& request, + void* tag) { + Call call = channel->CreateCall(method, context, cq); + return new (g_core_codegen_interface->grpc_call_arena_alloc( + call.call(), sizeof(ClientAsyncReader))) + ClientAsyncReader(call, context, request, tag); + } + + // always allocated against a call arena, no memory free required + static void operator delete(void* ptr, std::size_t size) { + assert(size == sizeof(ClientAsyncReader)); } void ReadInitialMetadata(void* tag) override { @@ -185,6 +187,19 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface { } private: + template + ClientAsyncReader(Call call, ClientContext* context, const W& request, + void* tag) + : context_(context), call_(call) { + init_ops_.set_output_tag(tag); + init_ops_.SendInitialMetadata(context->send_initial_metadata_, + context->initial_metadata_flags()); + // TODO(ctiller): don't assert + GPR_CODEGEN_ASSERT(init_ops_.SendMessage(request).ok()); + init_ops_.ClientSendClose(); + call_.PerformOps(&init_ops_); + } + ClientContext* context_; Call call_; CallOpSet @@ -210,23 +225,19 @@ template class ClientAsyncWriter final : public ClientAsyncWriterInterface { public: template - ClientAsyncWriter(ChannelInterface* channel, CompletionQueue* cq, - const RpcMethod& method, ClientContext* context, - R* response, void* tag) - : context_(context), call_(channel->CreateCall(method, context, cq)) { - finish_ops_.RecvMessage(response); - finish_ops_.AllowNoMessage(); - // if corked bit is set in context, we buffer up the initial metadata to - // coalesce with later message to be sent. No op is performed. - if (context_->initial_metadata_corked_) { - write_ops_.SendInitialMetadata(context->send_initial_metadata_, - context->initial_metadata_flags()); - } else { - write_ops_.set_output_tag(tag); - write_ops_.SendInitialMetadata(context->send_initial_metadata_, - context->initial_metadata_flags()); - call_.PerformOps(&write_ops_); - } + static ClientAsyncWriter* Create(ChannelInterface* channel, + CompletionQueue* cq, const RpcMethod& method, + ClientContext* context, R* response, + void* tag) { + Call call = channel->CreateCall(method, context, cq); + return new (g_core_codegen_interface->grpc_call_arena_alloc( + call.call(), sizeof(ClientAsyncWriter))) + ClientAsyncWriter(call, context, response, tag); + } + + // always allocated against a call arena, no memory free required + static void operator delete(void* ptr, std::size_t size) { + assert(size == sizeof(ClientAsyncWriter)); } void ReadInitialMetadata(void* tag) override { @@ -271,6 +282,24 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface { } private: + template + ClientAsyncWriter(Call call, ClientContext* context, R* response, void* tag) + : context_(context), call_(call) { + finish_ops_.RecvMessage(response); + finish_ops_.AllowNoMessage(); + // if corked bit is set in context, we buffer up the initial metadata to + // coalesce with later message to be sent. No op is performed. + if (context_->initial_metadata_corked_) { + write_ops_.SendInitialMetadata(context->send_initial_metadata_, + context->initial_metadata_flags()); + } else { + write_ops_.set_output_tag(tag); + write_ops_.SendInitialMetadata(context->send_initial_metadata_, + context->initial_metadata_flags()); + call_.PerformOps(&write_ops_); + } + } + ClientContext* context_; Call call_; CallOpSet meta_ops_; @@ -298,21 +327,20 @@ template class ClientAsyncReaderWriter final : public ClientAsyncReaderWriterInterface { public: - ClientAsyncReaderWriter(ChannelInterface* channel, CompletionQueue* cq, - const RpcMethod& method, ClientContext* context, - void* tag) - : context_(context), call_(channel->CreateCall(method, context, cq)) { - if (context_->initial_metadata_corked_) { - // if corked bit is set in context, we buffer up the initial metadata to - // coalesce with later message to be sent. No op is performed. - write_ops_.SendInitialMetadata(context->send_initial_metadata_, - context->initial_metadata_flags()); - } else { - write_ops_.set_output_tag(tag); - write_ops_.SendInitialMetadata(context->send_initial_metadata_, - context->initial_metadata_flags()); - call_.PerformOps(&write_ops_); - } + static ClientAsyncReaderWriter* Create(ChannelInterface* channel, + CompletionQueue* cq, + const RpcMethod& method, + ClientContext* context, void* tag) { + Call call = channel->CreateCall(method, context, cq); + + return new (g_core_codegen_interface->grpc_call_arena_alloc( + call.call(), sizeof(ClientAsyncReaderWriter))) + ClientAsyncReaderWriter(call, context, tag); + } + + // always allocated against a call arena, no memory free required + static void operator delete(void* ptr, std::size_t size) { + assert(size == sizeof(ClientAsyncReaderWriter)); } void ReadInitialMetadata(void* tag) override { @@ -366,6 +394,21 @@ class ClientAsyncReaderWriter final } private: + ClientAsyncReaderWriter(Call call, ClientContext* context, void* tag) + : context_(context), call_(call) { + if (context_->initial_metadata_corked_) { + // if corked bit is set in context, we buffer up the initial metadata to + // coalesce with later message to be sent. No op is performed. + write_ops_.SendInitialMetadata(context->send_initial_metadata_, + context->initial_metadata_flags()); + } else { + write_ops_.set_output_tag(tag); + write_ops_.SendInitialMetadata(context->send_initial_metadata_, + context->initial_metadata_flags()); + call_.PerformOps(&write_ops_); + } + } + ClientContext* context_; Call call_; CallOpSet meta_ops_; diff --git a/include/grpc++/impl/codegen/async_unary_call.h b/include/grpc++/impl/codegen/async_unary_call.h index 13b0cc419c6..a147a6acbf8 100644 --- a/include/grpc++/impl/codegen/async_unary_call.h +++ b/include/grpc++/impl/codegen/async_unary_call.h @@ -66,18 +66,9 @@ class ClientAsyncResponseReader final ClientContext* context, const W& request) { Call call = channel->CreateCall(method, context, cq); - ClientAsyncResponseReader* reader = - new (g_core_codegen_interface->grpc_call_arena_alloc(call.call(), - sizeof(*reader))) - ClientAsyncResponseReader(call, context); - - reader->init_buf_.SendInitialMetadata(context->send_initial_metadata_, - context->initial_metadata_flags()); - // TODO(ctiller): don't assert - GPR_CODEGEN_ASSERT(reader->init_buf_.SendMessage(request).ok()); - reader->init_buf_.ClientSendClose(); - reader->call_.PerformOps(&reader->init_buf_); - return reader; + return new (g_core_codegen_interface->grpc_call_arena_alloc( + call.call(), sizeof(ClientAsyncResponseReader))) + ClientAsyncResponseReader(call, context, request); } // always allocated against a call arena, no memory free required @@ -108,8 +99,16 @@ class ClientAsyncResponseReader final ClientContext* const context_; Call call_; - ClientAsyncResponseReader(Call call, ClientContext* context) - : context_(context), call_(call) {} + template + ClientAsyncResponseReader(Call call, ClientContext* context, const W& request) + : context_(context), call_(call) { + init_buf_.SendInitialMetadata(context->send_initial_metadata_, + context->initial_metadata_flags()); + // TODO(ctiller): don't assert + GPR_CODEGEN_ASSERT(init_buf_.SendMessage(request).ok()); + init_buf_.ClientSendClose(); + call_.PerformOps(&init_buf_); + } // disable operator new static void* operator new(std::size_t size); diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index 34d641f7385..4cc6a4cf393 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -1129,7 +1129,7 @@ void PrintSourceClientMethod(grpc_generator::Printer *printer, "::grpc::ClientContext* context, $Response$* response, " "::grpc::CompletionQueue* cq, void* tag) {\n"); printer->Print(*vars, - " return new ::grpc::ClientAsyncWriter< $Request$>(" + " return ::grpc::ClientAsyncWriter< $Request$>::Create(" "channel_.get(), cq, " "rpcmethod_$Method$_, " "context, response, tag);\n" @@ -1152,7 +1152,7 @@ void PrintSourceClientMethod(grpc_generator::Printer *printer, "::grpc::ClientContext* context, const $Request$& request, " "::grpc::CompletionQueue* cq, void* tag) {\n"); printer->Print(*vars, - " return new ::grpc::ClientAsyncReader< $Response$>(" + " return ::grpc::ClientAsyncReader< $Response$>::Create(" "channel_.get(), cq, " "rpcmethod_$Method$_, " "context, request, tag);\n" @@ -1174,13 +1174,14 @@ void PrintSourceClientMethod(grpc_generator::Printer *printer, "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>* " "$ns$$Service$::Stub::Async$Method$Raw(::grpc::ClientContext* context, " "::grpc::CompletionQueue* cq, void* tag) {\n"); - printer->Print(*vars, - " return new " - "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>(" - "channel_.get(), cq, " - "rpcmethod_$Method$_, " - "context, tag);\n" - "}\n\n"); + printer->Print( + *vars, + " return " + "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>::Create(" + "channel_.get(), cq, " + "rpcmethod_$Method$_, " + "context, tag);\n" + "}\n\n"); } } diff --git a/src/cpp/client/generic_stub.cc b/src/cpp/client/generic_stub.cc index 7a2fdf941ce..4adb2a53599 100644 --- a/src/cpp/client/generic_stub.cc +++ b/src/cpp/client/generic_stub.cc @@ -42,7 +42,7 @@ std::unique_ptr GenericStub::Call( ClientContext* context, const grpc::string& method, CompletionQueue* cq, void* tag) { return std::unique_ptr( - new GenericClientAsyncReaderWriter( + GenericClientAsyncReaderWriter::Create( channel_.get(), cq, RpcMethod(method.c_str(), RpcMethod::BIDI_STREAMING), context, tag)); } From 9fd9a442abf5fdd5c04d19d6d8a2ff1ef3b9e5d7 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 16:52:34 -0700 Subject: [PATCH 220/461] Fix nullptr deref --- src/core/lib/surface/call.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 315c906baae..97d50a91be5 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -529,14 +529,14 @@ static void destroy_call(grpc_exec_ctx *exec_ctx, void *call, } void grpc_call_destroy(grpc_call *c) { - parent_call *pc = get_parent_call(c); child_call *cc = c->child_call; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; GPR_TIMER_BEGIN("grpc_call_destroy", 0); GRPC_API_TRACE("grpc_call_destroy(c=%p)", 1, (c)); - if (pc) { + if (cc) { + parent_call *pc = get_parent_call(cc->parent); gpr_mu_lock(&pc->child_list_mu); if (c == pc->first_child) { pc->first_child = cc->sibling_next; From 557c88c3ac835f343b6510f5b6ed309773042c87 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Apr 2017 17:20:18 -0700 Subject: [PATCH 221/461] Change pollset rules --- src/core/lib/iomgr/ev_epoll_linux.c | 4 ++-- src/core/lib/iomgr/ev_poll_posix.c | 4 ++-- src/core/lib/iomgr/pollset.h | 4 ++++ src/core/lib/iomgr/pollset_windows.c | 4 ++-- src/core/lib/surface/completion_queue.c | 5 ++--- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/core/lib/iomgr/ev_epoll_linux.c b/src/core/lib/iomgr/ev_epoll_linux.c index 7014b983495..e5cf54f10a9 100644 --- a/src/core/lib/iomgr/ev_epoll_linux.c +++ b/src/core/lib/iomgr/ev_epoll_linux.c @@ -1717,7 +1717,7 @@ static grpc_error *pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, worker.pt_id = pthread_self(); gpr_atm_no_barrier_store(&worker.is_kicked, (gpr_atm)0); - *worker_hdl = &worker; + if (worker_hdl) *worker_hdl = &worker; gpr_tls_set(&g_current_thread_pollset, (intptr_t)pollset); gpr_tls_set(&g_current_thread_worker, (intptr_t)&worker); @@ -1795,7 +1795,7 @@ static grpc_error *pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, gpr_mu_lock(&pollset->po.mu); } - *worker_hdl = NULL; + if (worker_hdl) *worker_hdl = NULL; gpr_tls_set(&g_current_thread_pollset, (intptr_t)0); gpr_tls_set(&g_current_thread_worker, (intptr_t)0); diff --git a/src/core/lib/iomgr/ev_poll_posix.c b/src/core/lib/iomgr/ev_poll_posix.c index d90f2233622..9834cdd1979 100644 --- a/src/core/lib/iomgr/ev_poll_posix.c +++ b/src/core/lib/iomgr/ev_poll_posix.c @@ -871,7 +871,7 @@ static grpc_error *pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, grpc_pollset_worker **worker_hdl, gpr_timespec now, gpr_timespec deadline) { grpc_pollset_worker worker; - *worker_hdl = &worker; + if (worker_hdl) *worker_hdl = &worker; grpc_error *error = GRPC_ERROR_NONE; /* Avoid malloc for small number of elements. */ @@ -1092,7 +1092,7 @@ static grpc_error *pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, gpr_mu_lock(&pollset->mu); } } - *worker_hdl = NULL; + if (worker_hdl) *worker_hdl = NULL; GPR_TIMER_END("pollset_work", 0); GRPC_LOG_IF_ERROR("pollset_work", GRPC_ERROR_REF(error)); return error; diff --git a/src/core/lib/iomgr/pollset.h b/src/core/lib/iomgr/pollset.h index e19ce697b8d..9bf3cdac89e 100644 --- a/src/core/lib/iomgr/pollset.h +++ b/src/core/lib/iomgr/pollset.h @@ -75,6 +75,10 @@ void grpc_pollset_destroy(grpc_pollset *pollset); and it is guaranteed that it will not be released by grpc_pollset_work AFTER worker has been destroyed. + It's legal for worker to be NULL: in that case, this specific thread can not + be directly woken with a kick, but maybe be indirectly (with a kick against + the pollset as a whole). + Tries not to block past deadline. May call grpc_closure_list_run on grpc_closure_list, without holding the pollset diff --git a/src/core/lib/iomgr/pollset_windows.c b/src/core/lib/iomgr/pollset_windows.c index 17043c1ea1a..04c6b717475 100644 --- a/src/core/lib/iomgr/pollset_windows.c +++ b/src/core/lib/iomgr/pollset_windows.c @@ -120,7 +120,7 @@ grpc_error *grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset, grpc_pollset_worker **worker_hdl, gpr_timespec now, gpr_timespec deadline) { grpc_pollset_worker worker; - *worker_hdl = &worker; + if (worker_hdl) *worker_hdl = &worker; int added_worker = 0; worker.links[GRPC_POLLSET_WORKER_LINK_POLLSET].next = @@ -185,7 +185,7 @@ done: remove_worker(&worker, GRPC_POLLSET_WORKER_LINK_POLLSET); } gpr_cv_destroy(&worker.cv); - *worker_hdl = NULL; + if (worker_hdl) *worker_hdl = NULL; return GRPC_ERROR_NONE; } diff --git a/src/core/lib/surface/completion_queue.c b/src/core/lib/surface/completion_queue.c index b4594817e45..3273addf1d0 100644 --- a/src/core/lib/surface/completion_queue.c +++ b/src/core/lib/surface/completion_queue.c @@ -345,7 +345,6 @@ static void dump_pending_tags(grpc_completion_queue *cc) {} grpc_event grpc_completion_queue_next(grpc_completion_queue *cc, gpr_timespec deadline, void *reserved) { grpc_event ret; - grpc_pollset_worker *worker = NULL; gpr_timespec now; GPR_TIMER_BEGIN("grpc_completion_queue_next", 0); @@ -426,8 +425,8 @@ grpc_event grpc_completion_queue_next(grpc_completion_queue *cc, gpr_mu_lock(cc->mu); continue; } else { - grpc_error *err = grpc_pollset_work(&exec_ctx, POLLSET_FROM_CQ(cc), - &worker, now, iteration_deadline); + grpc_error *err = grpc_pollset_work(&exec_ctx, POLLSET_FROM_CQ(cc), NULL, + now, iteration_deadline); if (err != GRPC_ERROR_NONE) { gpr_mu_unlock(cc->mu); const char *msg = grpc_error_string(err); From 6cb260af72cbadead2aa28e662581e94f2e901b3 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Wed, 5 Apr 2017 18:44:36 -0700 Subject: [PATCH 222/461] Fix the server-side keepalive shutdown process --- .../chttp2/transport/chttp2_transport.c | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index e2816b0e045..5ad31c7d2cd 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -543,6 +543,10 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, exec_ctx, &t->keepalive_ping_timer, gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), t->keepalive_time), &t->init_keepalive_ping_locked, gpr_now(GPR_CLOCK_MONOTONIC)); + } else { + /* Use GRPC_CHTTP2_KEEPALIVE_STATE_DYING to indicate there are no inflight + keeaplive timers */ + t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DYING; } grpc_chttp2_initiate_write(exec_ctx, t, false, "init"); @@ -591,20 +595,18 @@ static void close_transport_locked(grpc_exec_ctx *exec_ctx, connectivity_state_set(exec_ctx, t, GRPC_CHANNEL_SHUTDOWN, GRPC_ERROR_REF(error), "close_transport"); grpc_endpoint_shutdown(exec_ctx, t->ep, GRPC_ERROR_REF(error)); - if (t->is_client) { - switch (t->keepalive_state) { - case GRPC_CHTTP2_KEEPALIVE_STATE_WAITING: { - grpc_timer_cancel(exec_ctx, &t->keepalive_ping_timer); - break; - } - case GRPC_CHTTP2_KEEPALIVE_STATE_PINGING: { - grpc_timer_cancel(exec_ctx, &t->keepalive_ping_timer); - grpc_timer_cancel(exec_ctx, &t->keepalive_watchdog_timer); - break; - } - case GRPC_CHTTP2_KEEPALIVE_STATE_DYING: { - break; - } + switch (t->keepalive_state) { + case GRPC_CHTTP2_KEEPALIVE_STATE_WAITING: { + grpc_timer_cancel(exec_ctx, &t->keepalive_ping_timer); + break; + } + case GRPC_CHTTP2_KEEPALIVE_STATE_PINGING: { + grpc_timer_cancel(exec_ctx, &t->keepalive_ping_timer); + grpc_timer_cancel(exec_ctx, &t->keepalive_watchdog_timer); + break; + } + case GRPC_CHTTP2_KEEPALIVE_STATE_DYING: { + break; } } From 512b6371f4c188cbc061ec7544d0ca3ac8941b18 Mon Sep 17 00:00:00 2001 From: yang-g Date: Wed, 5 Apr 2017 22:29:04 -0700 Subject: [PATCH 223/461] Unref the tail, not the original slice --- src/core/lib/security/transport/security_handshaker.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/core/lib/security/transport/security_handshaker.c b/src/core/lib/security/transport/security_handshaker.c index 7065d261ba2..e65368c8f84 100644 --- a/src/core/lib/security/transport/security_handshaker.c +++ b/src/core/lib/security/transport/security_handshaker.c @@ -285,12 +285,11 @@ static void on_handshake_data_received_from_peer(grpc_exec_ctx *exec_ctx, if (num_left_overs > 0) { /* Put the leftovers in our buffer (ownership transfered). */ if (has_left_overs_in_current_slice) { - grpc_slice_buffer_add( - &h->left_overs, - grpc_slice_split_tail(&h->args->read_buffer->slices[i], - consumed_slice_size)); + grpc_slice tail = grpc_slice_split_tail(&h->args->read_buffer->slices[i], + consumed_slice_size); + grpc_slice_buffer_add(&h->left_overs, tail); /* split_tail above increments refcount. */ - grpc_slice_unref_internal(exec_ctx, h->args->read_buffer->slices[i]); + grpc_slice_unref_internal(exec_ctx, tail); } grpc_slice_buffer_addn( &h->left_overs, &h->args->read_buffer->slices[i + 1], From dd2f1cab7a091f90070973a20e6693c13fa30870 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 6 Apr 2017 13:00:26 +0200 Subject: [PATCH 224/461] switch C# distribtest to use windows-build nugets --- test/distrib/csharp/run_distrib_test.bat | 2 +- test/distrib/csharp/run_distrib_test.sh | 2 +- test/distrib/csharp/run_distrib_test_dotnetcli.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/distrib/csharp/run_distrib_test.bat b/test/distrib/csharp/run_distrib_test.bat index 6cf381142f4..cb5dd552739 100644 --- a/test/distrib/csharp/run_distrib_test.bat +++ b/test/distrib/csharp/run_distrib_test.bat @@ -31,7 +31,7 @@ cd /d %~dp0 @rem extract input artifacts -powershell -Command "Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::ExtractToDirectory('../../../input_artifacts/csharp_nugets_dotnetcli.zip', 'TestNugetFeed');" +powershell -Command "Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::ExtractToDirectory('../../../input_artifacts/csharp_nugets_windows_dotnetcli.zip', 'TestNugetFeed');" update_version.sh auto diff --git a/test/distrib/csharp/run_distrib_test.sh b/test/distrib/csharp/run_distrib_test.sh index 0a77c1af440..9de5ce0cd32 100755 --- a/test/distrib/csharp/run_distrib_test.sh +++ b/test/distrib/csharp/run_distrib_test.sh @@ -32,7 +32,7 @@ set -ex cd $(dirname $0) -unzip -o "$EXTERNAL_GIT_ROOT/input_artifacts/csharp_nugets_dotnetcli.zip" -d TestNugetFeed +unzip -o "$EXTERNAL_GIT_ROOT/input_artifacts/csharp_nugets_windows_dotnetcli.zip" -d TestNugetFeed ./update_version.sh auto diff --git a/test/distrib/csharp/run_distrib_test_dotnetcli.sh b/test/distrib/csharp/run_distrib_test_dotnetcli.sh index 493c5049fb8..cdfc91bf427 100755 --- a/test/distrib/csharp/run_distrib_test_dotnetcli.sh +++ b/test/distrib/csharp/run_distrib_test_dotnetcli.sh @@ -32,7 +32,7 @@ set -ex cd $(dirname $0) -unzip -o "$EXTERNAL_GIT_ROOT/input_artifacts/csharp_nugets_dotnetcli.zip" -d TestNugetFeed +unzip -o "$EXTERNAL_GIT_ROOT/input_artifacts/csharp_nugets_windows_dotnetcli.zip" -d TestNugetFeed ./update_version.sh auto From c4c95ada896c28931869275fc1a7cff62180e12b Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 6 Apr 2017 13:20:49 +0200 Subject: [PATCH 225/461] make C# docker image in sync with GCE performance workers --- src/csharp/global.json | 2 +- templates/tools/dockerfile/csharp_dotnetcli_deps.include | 4 ++-- .../interoptest/grpc_interop_csharpcoreclr/Dockerfile | 4 ++-- tools/dockerfile/test/csharp_coreclr_x64/Dockerfile | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/csharp/global.json b/src/csharp/global.json index 32ff399ef94..f3c33cef6a5 100644 --- a/src/csharp/global.json +++ b/src/csharp/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "1.0.0-preview2-003121" + "version": "1.0.0-preview2-003131" } } \ No newline at end of file diff --git a/templates/tools/dockerfile/csharp_dotnetcli_deps.include b/templates/tools/dockerfile/csharp_dotnetcli_deps.include index 058ce15fb52..bc88d2bfa39 100644 --- a/templates/tools/dockerfile/csharp_dotnetcli_deps.include +++ b/templates/tools/dockerfile/csharp_dotnetcli_deps.include @@ -1,7 +1,7 @@ # Install dotnet SDK based on https://www.microsoft.com/net/core#debian RUN apt-get update && apt-get install -y curl libunwind8 gettext -# dotnet-dev-1.0.0-preview2-003121 -RUN curl -sSL -o dotnet100.tar.gz https://go.microsoft.com/fwlink/?LinkID=809130 +# dotnet-dev-1.0.0-preview2-003131 +RUN curl -sSL -o dotnet100.tar.gz https://go.microsoft.com/fwlink/?LinkID=827530 RUN mkdir -p /opt/dotnet && tar zxf dotnet100.tar.gz -C /opt/dotnet # dotnet-dev-1.0.1 RUN curl -sSL -o dotnet101.tar.gz https://go.microsoft.com/fwlink/?LinkID=843453 diff --git a/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile index c26c9a2826e..2a59628b487 100644 --- a/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile @@ -99,8 +99,8 @@ RUN nuget update -self # Install dotnet SDK based on https://www.microsoft.com/net/core#debian RUN apt-get update && apt-get install -y curl libunwind8 gettext -# dotnet-dev-1.0.0-preview2-003121 -RUN curl -sSL -o dotnet100.tar.gz https://go.microsoft.com/fwlink/?LinkID=809130 +# dotnet-dev-1.0.0-preview2-003131 +RUN curl -sSL -o dotnet100.tar.gz https://go.microsoft.com/fwlink/?LinkID=827530 RUN mkdir -p /opt/dotnet && tar zxf dotnet100.tar.gz -C /opt/dotnet # dotnet-dev-1.0.1 RUN curl -sSL -o dotnet101.tar.gz https://go.microsoft.com/fwlink/?LinkID=843453 diff --git a/tools/dockerfile/test/csharp_coreclr_x64/Dockerfile b/tools/dockerfile/test/csharp_coreclr_x64/Dockerfile index c26c9a2826e..2a59628b487 100644 --- a/tools/dockerfile/test/csharp_coreclr_x64/Dockerfile +++ b/tools/dockerfile/test/csharp_coreclr_x64/Dockerfile @@ -99,8 +99,8 @@ RUN nuget update -self # Install dotnet SDK based on https://www.microsoft.com/net/core#debian RUN apt-get update && apt-get install -y curl libunwind8 gettext -# dotnet-dev-1.0.0-preview2-003121 -RUN curl -sSL -o dotnet100.tar.gz https://go.microsoft.com/fwlink/?LinkID=809130 +# dotnet-dev-1.0.0-preview2-003131 +RUN curl -sSL -o dotnet100.tar.gz https://go.microsoft.com/fwlink/?LinkID=827530 RUN mkdir -p /opt/dotnet && tar zxf dotnet100.tar.gz -C /opt/dotnet # dotnet-dev-1.0.1 RUN curl -sSL -o dotnet101.tar.gz https://go.microsoft.com/fwlink/?LinkID=843453 From 376887d213f597da5abf90356ff449cb29e204ee Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 6 Apr 2017 08:27:03 -0700 Subject: [PATCH 226/461] Split event notification out of ev_epoll_linux.c --- CMakeLists.txt | 7 + Makefile | 7 + binding.gyp | 1 + build.yaml | 2 + config.m4 | 1 + gRPC-Core.podspec | 3 + grpc.gemspec | 2 + package.xml | 2 + src/core/lib/iomgr/ev_epoll_linux.c | 219 +---------------- src/core/lib/iomgr/lockfree_event.c | 224 ++++++++++++++++++ src/core/lib/iomgr/lockfree_event.h | 52 ++++ src/python/grpcio/grpc_core_dependencies.py | 1 + tools/doxygen/Doxyfile.c++.internal | 2 + tools/doxygen/Doxyfile.core.internal | 2 + .../generated/sources_and_headers.json | 3 + vsprojects/vcxproj/grpc++/grpc++.vcxproj | 3 + .../vcxproj/grpc++/grpc++.vcxproj.filters | 6 + .../grpc++_unsecure/grpc++_unsecure.vcxproj | 3 + .../grpc++_unsecure.vcxproj.filters | 6 + vsprojects/vcxproj/grpc/grpc.vcxproj | 3 + vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 6 + .../grpc_test_util/grpc_test_util.vcxproj | 3 + .../grpc_test_util.vcxproj.filters | 6 + .../grpc_unsecure/grpc_unsecure.vcxproj | 3 + .../grpc_unsecure.vcxproj.filters | 6 + 25 files changed, 363 insertions(+), 210 deletions(-) create mode 100644 src/core/lib/iomgr/lockfree_event.c create mode 100644 src/core/lib/iomgr/lockfree_event.h diff --git a/CMakeLists.txt b/CMakeLists.txt index acf47e5bfec..ca2b2598428 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -943,6 +943,7 @@ add_library(grpc src/core/lib/iomgr/iomgr_uv.c src/core/lib/iomgr/iomgr_windows.c src/core/lib/iomgr/load_file.c + src/core/lib/iomgr/lockfree_event.c src/core/lib/iomgr/network_status_tracker.c src/core/lib/iomgr/polling_entity.c src/core/lib/iomgr/pollset_set_uv.c @@ -1265,6 +1266,7 @@ add_library(grpc_cronet src/core/lib/iomgr/iomgr_uv.c src/core/lib/iomgr/iomgr_windows.c src/core/lib/iomgr/load_file.c + src/core/lib/iomgr/lockfree_event.c src/core/lib/iomgr/network_status_tracker.c src/core/lib/iomgr/polling_entity.c src/core/lib/iomgr/pollset_set_uv.c @@ -1573,6 +1575,7 @@ add_library(grpc_test_util src/core/lib/iomgr/iomgr_uv.c src/core/lib/iomgr/iomgr_windows.c src/core/lib/iomgr/load_file.c + src/core/lib/iomgr/lockfree_event.c src/core/lib/iomgr/network_status_tracker.c src/core/lib/iomgr/polling_entity.c src/core/lib/iomgr/pollset_set_uv.c @@ -1833,6 +1836,7 @@ add_library(grpc_unsecure src/core/lib/iomgr/iomgr_uv.c src/core/lib/iomgr/iomgr_windows.c src/core/lib/iomgr/load_file.c + src/core/lib/iomgr/lockfree_event.c src/core/lib/iomgr/network_status_tracker.c src/core/lib/iomgr/polling_entity.c src/core/lib/iomgr/pollset_set_uv.c @@ -2249,6 +2253,7 @@ add_library(grpc++ src/core/lib/iomgr/iomgr_uv.c src/core/lib/iomgr/iomgr_windows.c src/core/lib/iomgr/load_file.c + src/core/lib/iomgr/lockfree_event.c src/core/lib/iomgr/network_status_tracker.c src/core/lib/iomgr/polling_entity.c src/core/lib/iomgr/pollset_set_uv.c @@ -2579,6 +2584,7 @@ add_library(grpc++_cronet src/core/lib/iomgr/iomgr_uv.c src/core/lib/iomgr/iomgr_windows.c src/core/lib/iomgr/load_file.c + src/core/lib/iomgr/lockfree_event.c src/core/lib/iomgr/network_status_tracker.c src/core/lib/iomgr/polling_entity.c src/core/lib/iomgr/pollset_set_uv.c @@ -3277,6 +3283,7 @@ add_library(grpc++_unsecure src/core/lib/iomgr/iomgr_uv.c src/core/lib/iomgr/iomgr_windows.c src/core/lib/iomgr/load_file.c + src/core/lib/iomgr/lockfree_event.c src/core/lib/iomgr/network_status_tracker.c src/core/lib/iomgr/polling_entity.c src/core/lib/iomgr/pollset_set_uv.c diff --git a/Makefile b/Makefile index 5ad05570f93..1eeae6071eb 100644 --- a/Makefile +++ b/Makefile @@ -2845,6 +2845,7 @@ LIBGRPC_SRC = \ src/core/lib/iomgr/iomgr_uv.c \ src/core/lib/iomgr/iomgr_windows.c \ src/core/lib/iomgr/load_file.c \ + src/core/lib/iomgr/lockfree_event.c \ src/core/lib/iomgr/network_status_tracker.c \ src/core/lib/iomgr/polling_entity.c \ src/core/lib/iomgr/pollset_set_uv.c \ @@ -3165,6 +3166,7 @@ LIBGRPC_CRONET_SRC = \ src/core/lib/iomgr/iomgr_uv.c \ src/core/lib/iomgr/iomgr_windows.c \ src/core/lib/iomgr/load_file.c \ + src/core/lib/iomgr/lockfree_event.c \ src/core/lib/iomgr/network_status_tracker.c \ src/core/lib/iomgr/polling_entity.c \ src/core/lib/iomgr/pollset_set_uv.c \ @@ -3472,6 +3474,7 @@ LIBGRPC_TEST_UTIL_SRC = \ src/core/lib/iomgr/iomgr_uv.c \ src/core/lib/iomgr/iomgr_windows.c \ src/core/lib/iomgr/load_file.c \ + src/core/lib/iomgr/lockfree_event.c \ src/core/lib/iomgr/network_status_tracker.c \ src/core/lib/iomgr/polling_entity.c \ src/core/lib/iomgr/pollset_set_uv.c \ @@ -3704,6 +3707,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/lib/iomgr/iomgr_uv.c \ src/core/lib/iomgr/iomgr_windows.c \ src/core/lib/iomgr/load_file.c \ + src/core/lib/iomgr/lockfree_event.c \ src/core/lib/iomgr/network_status_tracker.c \ src/core/lib/iomgr/polling_entity.c \ src/core/lib/iomgr/pollset_set_uv.c \ @@ -4097,6 +4101,7 @@ LIBGRPC++_SRC = \ src/core/lib/iomgr/iomgr_uv.c \ src/core/lib/iomgr/iomgr_windows.c \ src/core/lib/iomgr/load_file.c \ + src/core/lib/iomgr/lockfree_event.c \ src/core/lib/iomgr/network_status_tracker.c \ src/core/lib/iomgr/polling_entity.c \ src/core/lib/iomgr/pollset_set_uv.c \ @@ -4435,6 +4440,7 @@ LIBGRPC++_CRONET_SRC = \ src/core/lib/iomgr/iomgr_uv.c \ src/core/lib/iomgr/iomgr_windows.c \ src/core/lib/iomgr/load_file.c \ + src/core/lib/iomgr/lockfree_event.c \ src/core/lib/iomgr/network_status_tracker.c \ src/core/lib/iomgr/polling_entity.c \ src/core/lib/iomgr/pollset_set_uv.c \ @@ -5125,6 +5131,7 @@ LIBGRPC++_UNSECURE_SRC = \ src/core/lib/iomgr/iomgr_uv.c \ src/core/lib/iomgr/iomgr_windows.c \ src/core/lib/iomgr/load_file.c \ + src/core/lib/iomgr/lockfree_event.c \ src/core/lib/iomgr/network_status_tracker.c \ src/core/lib/iomgr/polling_entity.c \ src/core/lib/iomgr/pollset_set_uv.c \ diff --git a/binding.gyp b/binding.gyp index 3444fa53dba..3df6d0aa2f4 100644 --- a/binding.gyp +++ b/binding.gyp @@ -685,6 +685,7 @@ 'src/core/lib/iomgr/iomgr_uv.c', 'src/core/lib/iomgr/iomgr_windows.c', 'src/core/lib/iomgr/load_file.c', + 'src/core/lib/iomgr/lockfree_event.c', 'src/core/lib/iomgr/network_status_tracker.c', 'src/core/lib/iomgr/polling_entity.c', 'src/core/lib/iomgr/pollset_set_uv.c', diff --git a/build.yaml b/build.yaml index c294fc9185c..c8098c51e5c 100644 --- a/build.yaml +++ b/build.yaml @@ -208,6 +208,7 @@ filegroups: - src/core/lib/iomgr/iomgr_internal.h - src/core/lib/iomgr/iomgr_posix.h - src/core/lib/iomgr/load_file.h + - src/core/lib/iomgr/lockfree_event.h - src/core/lib/iomgr/network_status_tracker.h - src/core/lib/iomgr/polling_entity.h - src/core/lib/iomgr/pollset.h @@ -320,6 +321,7 @@ filegroups: - src/core/lib/iomgr/iomgr_uv.c - src/core/lib/iomgr/iomgr_windows.c - src/core/lib/iomgr/load_file.c + - src/core/lib/iomgr/lockfree_event.c - src/core/lib/iomgr/network_status_tracker.c - src/core/lib/iomgr/polling_entity.c - src/core/lib/iomgr/pollset_set_uv.c diff --git a/config.m4 b/config.m4 index 28467810313..9470e43aaa0 100644 --- a/config.m4 +++ b/config.m4 @@ -119,6 +119,7 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/iomgr/iomgr_uv.c \ src/core/lib/iomgr/iomgr_windows.c \ src/core/lib/iomgr/load_file.c \ + src/core/lib/iomgr/lockfree_event.c \ src/core/lib/iomgr/network_status_tracker.c \ src/core/lib/iomgr/polling_entity.c \ src/core/lib/iomgr/pollset_set_uv.c \ diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 83c19afc243..2e260189fbd 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -290,6 +290,7 @@ Pod::Spec.new do |s| 'src/core/lib/iomgr/iomgr_internal.h', 'src/core/lib/iomgr/iomgr_posix.h', 'src/core/lib/iomgr/load_file.h', + 'src/core/lib/iomgr/lockfree_event.h', 'src/core/lib/iomgr/network_status_tracker.h', 'src/core/lib/iomgr/polling_entity.h', 'src/core/lib/iomgr/pollset.h', @@ -494,6 +495,7 @@ Pod::Spec.new do |s| 'src/core/lib/iomgr/iomgr_uv.c', 'src/core/lib/iomgr/iomgr_windows.c', 'src/core/lib/iomgr/load_file.c', + 'src/core/lib/iomgr/lockfree_event.c', 'src/core/lib/iomgr/network_status_tracker.c', 'src/core/lib/iomgr/polling_entity.c', 'src/core/lib/iomgr/pollset_set_uv.c', @@ -740,6 +742,7 @@ Pod::Spec.new do |s| 'src/core/lib/iomgr/iomgr_internal.h', 'src/core/lib/iomgr/iomgr_posix.h', 'src/core/lib/iomgr/load_file.h', + 'src/core/lib/iomgr/lockfree_event.h', 'src/core/lib/iomgr/network_status_tracker.h', 'src/core/lib/iomgr/polling_entity.h', 'src/core/lib/iomgr/pollset.h', diff --git a/grpc.gemspec b/grpc.gemspec index a3a5870761a..1165a91b6f3 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -206,6 +206,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/iomgr/iomgr_internal.h ) s.files += %w( src/core/lib/iomgr/iomgr_posix.h ) s.files += %w( src/core/lib/iomgr/load_file.h ) + s.files += %w( src/core/lib/iomgr/lockfree_event.h ) s.files += %w( src/core/lib/iomgr/network_status_tracker.h ) s.files += %w( src/core/lib/iomgr/polling_entity.h ) s.files += %w( src/core/lib/iomgr/pollset.h ) @@ -410,6 +411,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/iomgr/iomgr_uv.c ) s.files += %w( src/core/lib/iomgr/iomgr_windows.c ) s.files += %w( src/core/lib/iomgr/load_file.c ) + s.files += %w( src/core/lib/iomgr/lockfree_event.c ) s.files += %w( src/core/lib/iomgr/network_status_tracker.c ) s.files += %w( src/core/lib/iomgr/polling_entity.c ) s.files += %w( src/core/lib/iomgr/pollset_set_uv.c ) diff --git a/package.xml b/package.xml index 6957ecca731..c6b86a66a2b 100644 --- a/package.xml +++ b/package.xml @@ -215,6 +215,7 @@ + @@ -419,6 +420,7 @@ + diff --git a/src/core/lib/iomgr/ev_epoll_linux.c b/src/core/lib/iomgr/ev_epoll_linux.c index e5cf54f10a9..a7105a62e4d 100644 --- a/src/core/lib/iomgr/ev_epoll_linux.c +++ b/src/core/lib/iomgr/ev_epoll_linux.c @@ -56,6 +56,7 @@ #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/iomgr_internal.h" +#include "src/core/lib/iomgr/lockfree_event.h" #include "src/core/lib/iomgr/timer.h" #include "src/core/lib/iomgr/wakeup_fd_posix.h" #include "src/core/lib/iomgr/workqueue.h" @@ -141,52 +142,11 @@ struct grpc_fd { Ref/Unref by two to avoid altering the orphaned bit */ gpr_atm refst; - /* Internally stores data of type (grpc_error *). If the FD is shutdown, this - contains reason for shutdown (i.e a pointer to grpc_error) ORed with - FD_SHUTDOWN_BIT. Since address allocations are word-aligned, the lower bit - of (grpc_error *) addresses is guaranteed to be zero. Even if the - (grpc_error *), is of special types like GRPC_ERROR_NONE, GRPC_ERROR_OOM - etc, the lower bit is guaranteed to be zero. - - Once an fd is shutdown, any pending or future read/write closures on the - fd should fail */ - gpr_atm shutdown_error; - /* The fd is either closed or we relinquished control of it. In either cases, this indicates that the 'fd' on this structure is no longer valid */ bool orphaned; - /* Closures to call when the fd is readable or writable respectively. These - fields contain one of the following values: - CLOSURE_READY : The fd has an I/O event of interest but there is no - closure yet to execute - - CLOSURE_NOT_READY : The fd has no I/O event of interest - - closure ptr : The closure to be executed when the fd has an I/O - event of interest - - shutdown_error | FD_SHUTDOWN_BIT : - 'shutdown_error' field ORed with FD_SHUTDOWN_BIT. - This indicates that the fd is shutdown. Since all - memory allocations are word-aligned, the lower two - bits of the shutdown_error pointer are always 0. So - it is safe to OR these with FD_SHUTDOWN_BIT - - Valid state transitions: - - <-----3------ CLOSURE_NOT_READY ----1----> CLOSURE_READY - | | ^ | ^ | | - | | | | | | | - | +--------------4----------+ 6 +---------2---------------+ | - | | | - | v | - +-----5-------> [shutdown_error | FD_SHUTDOWN_BIT] <----7---------+ - - For 1, 4 : See set_ready() function - For 2, 3 : See notify_on() function - For 5,6,7: See set_shutdown() function */ gpr_atm read_closure; gpr_atm write_closure; @@ -218,11 +178,6 @@ static void fd_unref(grpc_fd *fd); static void fd_global_init(void); static void fd_global_shutdown(void); -#define CLOSURE_NOT_READY ((gpr_atm)0) -#define CLOSURE_READY ((gpr_atm)2) - -#define FD_SHUTDOWN_BIT 1 - /******************************************************************************* * Polling island Declarations */ @@ -949,10 +904,8 @@ static void unref_by(grpc_fd *fd, int n) { fd_freelist = fd; grpc_iomgr_unregister_object(&fd->iomgr_object); - grpc_error *err = (grpc_error *)gpr_atm_acq_load(&fd->shutdown_error); - /* Clear the least significant bit if it set (in case fd was shutdown) */ - err = (grpc_error *)((intptr_t)err & ~FD_SHUTDOWN_BIT); - GRPC_ERROR_UNREF(err); + grpc_lfev_destroy(&fd->read_closure); + grpc_lfev_destroy(&fd->write_closure); gpr_mu_unlock(&fd_freelist_mu); } else { @@ -1018,8 +971,8 @@ static grpc_fd *fd_create(int fd, const char *name) { new_fd->fd = fd; gpr_atm_no_barrier_store(&new_fd->shutdown_error, (gpr_atm)GRPC_ERROR_NONE); new_fd->orphaned = false; - gpr_atm_no_barrier_store(&new_fd->read_closure, CLOSURE_NOT_READY); - gpr_atm_no_barrier_store(&new_fd->write_closure, CLOSURE_NOT_READY); + grpc_lfev_init(&new_fd->read_closure); + grpc_lfev_init(&new_fd->write_closure); gpr_atm_no_barrier_store(&new_fd->read_notifier_pollset, (gpr_atm)NULL); new_fd->freelist_next = NULL; @@ -1105,153 +1058,6 @@ static void fd_orphan(grpc_exec_ctx *exec_ctx, grpc_fd *fd, GRPC_ERROR_UNREF(error); } -static void notify_on(grpc_exec_ctx *exec_ctx, grpc_fd *fd, gpr_atm *state, - grpc_closure *closure) { - while (true) { - gpr_atm curr = gpr_atm_no_barrier_load(state); - switch (curr) { - case CLOSURE_NOT_READY: { - /* CLOSURE_NOT_READY -> . - - We're guaranteed by API that there's an acquire barrier before here, - so there's no need to double-dip and this can be a release-only. - - The release itself pairs with the acquire half of a set_ready full - barrier. */ - if (gpr_atm_rel_cas(state, CLOSURE_NOT_READY, (gpr_atm)closure)) { - return; /* Successful. Return */ - } - - break; /* retry */ - } - - case CLOSURE_READY: { - /* Change the state to CLOSURE_NOT_READY. Schedule the closure if - successful. If not, the state most likely transitioned to shutdown. - We should retry. - - This can be a no-barrier cas since the state is being transitioned to - CLOSURE_NOT_READY; set_ready and set_shutdown do not schedule any - closure when transitioning out of CLOSURE_NO_READY state (i.e there - is no other code that needs to 'happen-after' this) */ - if (gpr_atm_no_barrier_cas(state, CLOSURE_READY, CLOSURE_NOT_READY)) { - grpc_closure_sched(exec_ctx, closure, GRPC_ERROR_NONE); - return; /* Successful. Return */ - } - - break; /* retry */ - } - - default: { - /* 'curr' is either a closure or the fd is shutdown(in which case 'curr' - contains a pointer to the shutdown-error). If the fd is shutdown, - schedule the closure with the shutdown error */ - if ((curr & FD_SHUTDOWN_BIT) > 0) { - grpc_error *shutdown_err = (grpc_error *)(curr & ~FD_SHUTDOWN_BIT); - grpc_closure_sched(exec_ctx, closure, - GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( - "FD Shutdown", &shutdown_err, 1)); - return; - } - - /* There is already a closure!. This indicates a bug in the code */ - gpr_log(GPR_ERROR, - "notify_on called with a previous callback still pending"); - abort(); - } - } - } - - GPR_UNREACHABLE_CODE(return ); -} - -static void set_shutdown(grpc_exec_ctx *exec_ctx, grpc_fd *fd, gpr_atm *state, - grpc_error *shutdown_err) { - gpr_atm new_state = (gpr_atm)shutdown_err | FD_SHUTDOWN_BIT; - - while (true) { - gpr_atm curr = gpr_atm_no_barrier_load(state); - switch (curr) { - case CLOSURE_READY: - case CLOSURE_NOT_READY: - /* Need a full barrier here so that the initial load in notify_on - doesn't need a barrier */ - if (gpr_atm_full_cas(state, curr, new_state)) { - return; /* early out */ - } - break; /* retry */ - - default: { - /* 'curr' is either a closure or the fd is already shutdown */ - - /* If fd is already shutdown, we are done */ - if ((curr & FD_SHUTDOWN_BIT) > 0) { - return; - } - - /* Fd is not shutdown. Schedule the closure and move the state to - shutdown state. - Needs an acquire to pair with setting the closure (and get a - happens-after on that edge), and a release to pair with anything - loading the shutdown state. */ - if (gpr_atm_full_cas(state, curr, new_state)) { - grpc_closure_sched(exec_ctx, (grpc_closure *)curr, - GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( - "FD Shutdown", &shutdown_err, 1)); - return; - } - - /* 'curr' was a closure but now changed to a different state. We will - have to retry */ - break; - } - } - } - - GPR_UNREACHABLE_CODE(return ); -} - -static void set_ready(grpc_exec_ctx *exec_ctx, grpc_fd *fd, gpr_atm *state) { - while (true) { - gpr_atm curr = gpr_atm_no_barrier_load(state); - - switch (curr) { - case CLOSURE_READY: { - /* Already ready. We are done here */ - return; - } - - case CLOSURE_NOT_READY: { - /* No barrier required as we're transitioning to a state that does not - involve a closure */ - if (gpr_atm_no_barrier_cas(state, CLOSURE_NOT_READY, CLOSURE_READY)) { - return; /* early out */ - } - break; /* retry */ - } - - default: { - /* 'curr' is either a closure or the fd is shutdown */ - if ((curr & FD_SHUTDOWN_BIT) > 0) { - /* The fd is shutdown. Do nothing */ - return; - } - /* Full cas: acquire pairs with this cas' release in the event of a - spurious set_ready; release pairs with this or the acquire in - notify_on (or set_shutdown) */ - else if (gpr_atm_full_cas(state, curr, CLOSURE_NOT_READY)) { - grpc_closure_sched(exec_ctx, (grpc_closure *)curr, GRPC_ERROR_NONE); - return; - } - /* else the state changed again (only possible by either a racing - set_ready or set_shutdown functions. In both these cases, the closure - would have been scheduled for execution. So we are done here */ - return; - } - } - } -} - static grpc_pollset *fd_get_read_notifier_pollset(grpc_exec_ctx *exec_ctx, grpc_fd *fd) { gpr_atm notifier = gpr_atm_acq_load(&fd->read_notifier_pollset); @@ -1259,23 +1065,16 @@ static grpc_pollset *fd_get_read_notifier_pollset(grpc_exec_ctx *exec_ctx, } static bool fd_is_shutdown(grpc_fd *fd) { - grpc_error *err = (grpc_error *)gpr_atm_acq_load(&fd->shutdown_error); - return (((intptr_t)err & FD_SHUTDOWN_BIT) > 0); + return grpc_lfev_is_shutdown(&fd->read_closure); } /* Might be called multiple times */ static void fd_shutdown(grpc_exec_ctx *exec_ctx, grpc_fd *fd, grpc_error *why) { - /* Store the shutdown error ORed with FD_SHUTDOWN_BIT in fd->shutdown_error */ - if (gpr_atm_rel_cas(&fd->shutdown_error, (gpr_atm)GRPC_ERROR_NONE, - (gpr_atm)why | FD_SHUTDOWN_BIT)) { + if (grpc_lfev_set_shutdown(&fd->read_closure, GRPC_ERROR_REF(why))) { shutdown(fd->fd, SHUT_RDWR); - - set_shutdown(exec_ctx, fd, &fd->read_closure, why); - set_shutdown(exec_ctx, fd, &fd->write_closure, why); - } else { - /* Shutdown already called */ - GRPC_ERROR_UNREF(why); + grpc_lfev_set_shutdown(&fd->write_closure, GRPC_ERROR_REF(why)); } + GRPC_ERROR_UNREF(why); } static void fd_notify_on_read(grpc_exec_ctx *exec_ctx, grpc_fd *fd, diff --git a/src/core/lib/iomgr/lockfree_event.c b/src/core/lib/iomgr/lockfree_event.c new file mode 100644 index 00000000000..a9742982f68 --- /dev/null +++ b/src/core/lib/iomgr/lockfree_event.c @@ -0,0 +1,224 @@ +/* + * + * Copyright 2017, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "src/core/lib/iomgr/lockfree_event.h" + +#include + +/* 'state' holds the to call when the fd is readable or writable respectively. + It can contain one of the following values: + CLOSURE_READY : The fd has an I/O event of interest but there is no + closure yet to execute + + CLOSURE_NOT_READY : The fd has no I/O event of interest + + closure ptr : The closure to be executed when the fd has an I/O + event of interest + + shutdown_error | FD_SHUTDOWN_BIT : + 'shutdown_error' field ORed with FD_SHUTDOWN_BIT. + This indicates that the fd is shutdown. Since all + memory allocations are word-aligned, the lower two + bits of the shutdown_error pointer are always 0. So + it is safe to OR these with FD_SHUTDOWN_BIT + + Valid state transitions: + + <-----3------ CLOSURE_NOT_READY ----1----> CLOSURE_READY + | | ^ | ^ | | + | | | | | | | + | +--------------4----------+ 6 +---------2---------------+ | + | | | + | v | + +-----5-------> [shutdown_error | FD_SHUTDOWN_BIT] <----7---------+ + + For 1, 4 : See grpc_lfev_set_ready() function + For 2, 3 : See grpc_lfev_notify_on() function + For 5,6,7: See grpc_lfev_set_shutdown() function */ + +#define CLOSURE_NOT_READY ((gpr_atm)0) +#define CLOSURE_READY ((gpr_atm)2) + +#define FD_SHUTDOWN_BIT 1 + +void grpc_lfev_init(gpr_atm *state) { + gpr_atm_no_barrier_store(state, CLOSURE_NOT_READY); +} + +void grpc_lfev_notify_on(grpc_exec_ctx *exec_ctx, gpr_atm *state, + grpc_closure *closure) { + while (true) { + gpr_atm curr = gpr_atm_no_barrier_load(state); + switch (curr) { + case CLOSURE_NOT_READY: { + /* CLOSURE_NOT_READY -> . + + We're guaranteed by API that there's an acquire barrier before here, + so there's no need to double-dip and this can be a release-only. + + The release itself pairs with the acquire half of a set_ready full + barrier. */ + if (gpr_atm_rel_cas(state, CLOSURE_NOT_READY, (gpr_atm)closure)) { + return; /* Successful. Return */ + } + + break; /* retry */ + } + + case CLOSURE_READY: { + /* Change the state to CLOSURE_NOT_READY. Schedule the closure if + successful. If not, the state most likely transitioned to shutdown. + We should retry. + + This can be a no-barrier cas since the state is being transitioned to + CLOSURE_NOT_READY; set_ready and set_shutdown do not schedule any + closure when transitioning out of CLOSURE_NO_READY state (i.e there + is no other code that needs to 'happen-after' this) */ + if (gpr_atm_no_barrier_cas(state, CLOSURE_READY, CLOSURE_NOT_READY)) { + grpc_closure_sched(exec_ctx, closure, GRPC_ERROR_NONE); + return; /* Successful. Return */ + } + + break; /* retry */ + } + + default: { + /* 'curr' is either a closure or the fd is shutdown(in which case 'curr' + contains a pointer to the shutdown-error). If the fd is shutdown, + schedule the closure with the shutdown error */ + if ((curr & FD_SHUTDOWN_BIT) > 0) { + grpc_error *shutdown_err = (grpc_error *)(curr & ~FD_SHUTDOWN_BIT); + grpc_closure_sched(exec_ctx, closure, + GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( + "FD Shutdown", &shutdown_err, 1)); + return; + } + + /* There is already a closure!. This indicates a bug in the code */ + gpr_log(GPR_ERROR, + "notify_on called with a previous callback still pending"); + abort(); + } + } + } + + GPR_UNREACHABLE_CODE(return ); +} + +bool grpc_lfev_set_shutdown(grpc_exec_ctx *exec_ctx, gpr_atm *state, + grpc_error *shutdown_err) { + gpr_atm new_state = (gpr_atm)shutdown_err | FD_SHUTDOWN_BIT; + + while (true) { + gpr_atm curr = gpr_atm_no_barrier_load(state); + switch (curr) { + case CLOSURE_READY: + case CLOSURE_NOT_READY: + /* Need a full barrier here so that the initial load in notify_on + doesn't need a barrier */ + if (gpr_atm_full_cas(state, curr, new_state)) { + return true; /* early out */ + } + break; /* retry */ + + default: { + /* 'curr' is either a closure or the fd is already shutdown */ + + /* If fd is already shutdown, we are done */ + if ((curr & FD_SHUTDOWN_BIT) > 0) { + GRPC_ERROR_UNREF(shutdown_err); + return false; + } + + /* Fd is not shutdown. Schedule the closure and move the state to + shutdown state. + Needs an acquire to pair with setting the closure (and get a + happens-after on that edge), and a release to pair with anything + loading the shutdown state. */ + if (gpr_atm_full_cas(state, curr, new_state)) { + grpc_closure_sched(exec_ctx, (grpc_closure *)curr, + GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( + "FD Shutdown", &shutdown_err, 1)); + return true; + } + + /* 'curr' was a closure but now changed to a different state. We will + have to retry */ + break; + } + } + } + + GPR_UNREACHABLE_CODE(return false); +} + +void grpc_lfev_set_ready(grpc_exec_ctx *exec_ctx, gpr_atm *state) { + while (true) { + gpr_atm curr = gpr_atm_no_barrier_load(state); + + switch (curr) { + case CLOSURE_READY: { + /* Already ready. We are done here */ + return; + } + + case CLOSURE_NOT_READY: { + /* No barrier required as we're transitioning to a state that does not + involve a closure */ + if (gpr_atm_no_barrier_cas(state, CLOSURE_NOT_READY, CLOSURE_READY)) { + return; /* early out */ + } + break; /* retry */ + } + + default: { + /* 'curr' is either a closure or the fd is shutdown */ + if ((curr & FD_SHUTDOWN_BIT) > 0) { + /* The fd is shutdown. Do nothing */ + return; + } + /* Full cas: acquire pairs with this cas' release in the event of a + spurious set_ready; release pairs with this or the acquire in + notify_on (or set_shutdown) */ + else if (gpr_atm_full_cas(state, curr, CLOSURE_NOT_READY)) { + grpc_closure_sched(exec_ctx, (grpc_closure *)curr, GRPC_ERROR_NONE); + return; + } + /* else the state changed again (only possible by either a racing + set_ready or set_shutdown functions. In both these cases, the closure + would have been scheduled for execution. So we are done here */ + return; + } + } + } +} diff --git a/src/core/lib/iomgr/lockfree_event.h b/src/core/lib/iomgr/lockfree_event.h new file mode 100644 index 00000000000..32eb7554f96 --- /dev/null +++ b/src/core/lib/iomgr/lockfree_event.h @@ -0,0 +1,52 @@ +/* + * + * Copyright 2017, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPC_CORE_LIB_IOMGR_LOCKFREE_EVENT_H +#define GRPC_CORE_LIB_IOMGR_LOCKFREE_EVENT_H + +/* Lock free event notification for file descriptors */ + +#include "src/core/lib/iomgr/exec_ctx.h" + +void grpc_lfev_init(gpr_atm *state); +void grpc_lfev_destroy(gpr_atm *state); +bool grpc_lfev_is_shutdown(gpr_atm *state); + +void grpc_lfev_notify_on(grpc_exec_ctx *exec_ctx, gpr_atm *state, + grpc_closure *closure); +/* Returns true on first successful shutdown */ +bool grpc_lfev_set_shutdown(grpc_exec_ctx *exec_ctx, gpr_atm *state, + grpc_error *shutdown_err); +void grpc_lfev_set_ready(grpc_exec_ctx *exec_ctx, gpr_atm *state); + +#endif /* GRPC_CORE_LIB_IOMGR_LOCKFREE_EVENT_H */ diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 3bcbe667e2c..0d0a5fb0887 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -113,6 +113,7 @@ CORE_SOURCE_FILES = [ 'src/core/lib/iomgr/iomgr_uv.c', 'src/core/lib/iomgr/iomgr_windows.c', 'src/core/lib/iomgr/load_file.c', + 'src/core/lib/iomgr/lockfree_event.c', 'src/core/lib/iomgr/network_status_tracker.c', 'src/core/lib/iomgr/polling_entity.c', 'src/core/lib/iomgr/pollset_set_uv.c', diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 209d5445dbc..afab2296a02 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -971,6 +971,8 @@ src/core/lib/iomgr/iomgr_uv.c \ src/core/lib/iomgr/iomgr_windows.c \ src/core/lib/iomgr/load_file.c \ src/core/lib/iomgr/load_file.h \ +src/core/lib/iomgr/lockfree_event.c \ +src/core/lib/iomgr/lockfree_event.h \ src/core/lib/iomgr/network_status_tracker.c \ src/core/lib/iomgr/network_status_tracker.h \ src/core/lib/iomgr/polling_entity.c \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 6903a0e5d5a..ee1fd1b242f 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1092,6 +1092,8 @@ src/core/lib/iomgr/iomgr_uv.c \ src/core/lib/iomgr/iomgr_windows.c \ src/core/lib/iomgr/load_file.c \ src/core/lib/iomgr/load_file.h \ +src/core/lib/iomgr/lockfree_event.c \ +src/core/lib/iomgr/lockfree_event.h \ src/core/lib/iomgr/network_status_tracker.c \ src/core/lib/iomgr/network_status_tracker.h \ src/core/lib/iomgr/polling_entity.c \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index ae5120d87c1..fa62d0aaaca 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -7549,6 +7549,7 @@ "src/core/lib/iomgr/iomgr_internal.h", "src/core/lib/iomgr/iomgr_posix.h", "src/core/lib/iomgr/load_file.h", + "src/core/lib/iomgr/lockfree_event.h", "src/core/lib/iomgr/network_status_tracker.h", "src/core/lib/iomgr/polling_entity.h", "src/core/lib/iomgr/pollset.h", @@ -7710,6 +7711,8 @@ "src/core/lib/iomgr/iomgr_windows.c", "src/core/lib/iomgr/load_file.c", "src/core/lib/iomgr/load_file.h", + "src/core/lib/iomgr/lockfree_event.c", + "src/core/lib/iomgr/lockfree_event.h", "src/core/lib/iomgr/network_status_tracker.c", "src/core/lib/iomgr/network_status_tracker.h", "src/core/lib/iomgr/polling_entity.c", diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj b/vsprojects/vcxproj/grpc++/grpc++.vcxproj index caa22a019db..cae44c5e234 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj @@ -412,6 +412,7 @@ + @@ -647,6 +648,8 @@ + + diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters index 6fc1c969309..36da089470b 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters @@ -232,6 +232,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -968,6 +971,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj index 674818182e8..4d284006e67 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -406,6 +406,7 @@ + @@ -631,6 +632,8 @@ + + diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index 2b9a5b13c1a..9d641553a2b 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -217,6 +217,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -935,6 +938,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index 948af2f29ee..dd6fdd861e4 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -335,6 +335,7 @@ + @@ -578,6 +579,8 @@ + + diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index d43b0e3f83e..51c9b7201dc 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -112,6 +112,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -902,6 +905,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj index c675cda122f..b1db7e5d15d 100644 --- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj +++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj @@ -230,6 +230,7 @@ + @@ -419,6 +420,8 @@ + + diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters index c6bd2d6c9f1..a7ecbea87c7 100644 --- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters @@ -169,6 +169,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -680,6 +683,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index 8799359bb76..8614b115898 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -325,6 +325,7 @@ + @@ -546,6 +547,8 @@ + + diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index cf2def4ff65..e7aa9fb8d6f 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -115,6 +115,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr @@ -815,6 +818,9 @@ src\core\lib\iomgr + + src\core\lib\iomgr + src\core\lib\iomgr From 70652147ceb2bedff5ac3b491f0f885f5a997cc4 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 6 Apr 2017 08:31:23 -0700 Subject: [PATCH 227/461] Update function names --- src/core/lib/iomgr/ev_epoll_linux.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/lib/iomgr/ev_epoll_linux.c b/src/core/lib/iomgr/ev_epoll_linux.c index a7105a62e4d..6bdd599c23f 100644 --- a/src/core/lib/iomgr/ev_epoll_linux.c +++ b/src/core/lib/iomgr/ev_epoll_linux.c @@ -1079,12 +1079,12 @@ static void fd_shutdown(grpc_exec_ctx *exec_ctx, grpc_fd *fd, grpc_error *why) { static void fd_notify_on_read(grpc_exec_ctx *exec_ctx, grpc_fd *fd, grpc_closure *closure) { - notify_on(exec_ctx, fd, &fd->read_closure, closure); + grpc_lfev_notify_on(exec_ctx, &fd->read_closure, closure); } static void fd_notify_on_write(grpc_exec_ctx *exec_ctx, grpc_fd *fd, grpc_closure *closure) { - notify_on(exec_ctx, fd, &fd->write_closure, closure); + grpc_lfev_notify_on(exec_ctx, &fd->write_closure, closure); } static grpc_workqueue *fd_get_workqueue(grpc_fd *fd) { @@ -1274,7 +1274,7 @@ static int poll_deadline_to_millis_timeout(gpr_timespec deadline, static void fd_become_readable(grpc_exec_ctx *exec_ctx, grpc_fd *fd, grpc_pollset *notifier) { - set_ready(exec_ctx, fd, &fd->read_closure); + grpc_lfev_set_ready(exec_ctx, &fd->read_closure); /* Note, it is possible that fd_become_readable might be called twice with different 'notifier's when an fd becomes readable and it is in two epoll @@ -1286,7 +1286,7 @@ static void fd_become_readable(grpc_exec_ctx *exec_ctx, grpc_fd *fd, } static void fd_become_writable(grpc_exec_ctx *exec_ctx, grpc_fd *fd) { - set_ready(exec_ctx, fd, &fd->write_closure); + grpc_lfev_set_ready(exec_ctx, fd, &fd->write_closure); } static void pollset_release_polling_island(grpc_exec_ctx *exec_ctx, From e16372ba4b442bcf0c1330c01f0e7f772a3b05cd Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 6 Apr 2017 08:51:39 -0700 Subject: [PATCH 228/461] Cleanup to make compile --- src/core/lib/iomgr/ev_epoll_linux.c | 8 ++++---- src/core/lib/iomgr/lockfree_event.c | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/core/lib/iomgr/ev_epoll_linux.c b/src/core/lib/iomgr/ev_epoll_linux.c index 6bdd599c23f..6db8e1a77cb 100644 --- a/src/core/lib/iomgr/ev_epoll_linux.c +++ b/src/core/lib/iomgr/ev_epoll_linux.c @@ -969,7 +969,6 @@ static grpc_fd *fd_create(int fd, const char *name) { gpr_atm_rel_store(&new_fd->refst, (gpr_atm)1); new_fd->fd = fd; - gpr_atm_no_barrier_store(&new_fd->shutdown_error, (gpr_atm)GRPC_ERROR_NONE); new_fd->orphaned = false; grpc_lfev_init(&new_fd->read_closure); grpc_lfev_init(&new_fd->write_closure); @@ -1070,9 +1069,10 @@ static bool fd_is_shutdown(grpc_fd *fd) { /* Might be called multiple times */ static void fd_shutdown(grpc_exec_ctx *exec_ctx, grpc_fd *fd, grpc_error *why) { - if (grpc_lfev_set_shutdown(&fd->read_closure, GRPC_ERROR_REF(why))) { + if (grpc_lfev_set_shutdown(exec_ctx, &fd->read_closure, + GRPC_ERROR_REF(why))) { shutdown(fd->fd, SHUT_RDWR); - grpc_lfev_set_shutdown(&fd->write_closure, GRPC_ERROR_REF(why)); + grpc_lfev_set_shutdown(exec_ctx, &fd->write_closure, GRPC_ERROR_REF(why)); } GRPC_ERROR_UNREF(why); } @@ -1286,7 +1286,7 @@ static void fd_become_readable(grpc_exec_ctx *exec_ctx, grpc_fd *fd, } static void fd_become_writable(grpc_exec_ctx *exec_ctx, grpc_fd *fd) { - grpc_lfev_set_ready(exec_ctx, fd, &fd->write_closure); + grpc_lfev_set_ready(exec_ctx, &fd->write_closure); } static void pollset_release_polling_island(grpc_exec_ctx *exec_ctx, diff --git a/src/core/lib/iomgr/lockfree_event.c b/src/core/lib/iomgr/lockfree_event.c index a9742982f68..17e3bbf7278 100644 --- a/src/core/lib/iomgr/lockfree_event.c +++ b/src/core/lib/iomgr/lockfree_event.c @@ -69,12 +69,26 @@ #define CLOSURE_NOT_READY ((gpr_atm)0) #define CLOSURE_READY ((gpr_atm)2) -#define FD_SHUTDOWN_BIT 1 +#define FD_SHUTDOWN_BIT ((gpr_atm)1) void grpc_lfev_init(gpr_atm *state) { gpr_atm_no_barrier_store(state, CLOSURE_NOT_READY); } +void grpc_lfev_destroy(gpr_atm *state) { + gpr_atm curr = gpr_atm_no_barrier_load(state); + if (curr & FD_SHUTDOWN_BIT) { + GRPC_ERROR_UNREF((grpc_error *)(curr & ~FD_SHUTDOWN_BIT)); + } else { + GPR_ASSERT(curr == CLOSURE_NOT_READY || curr == CLOSURE_READY); + } +} + +bool grpc_lfev_is_shutdown(gpr_atm *state) { + gpr_atm curr = gpr_atm_no_barrier_load(state); + return (curr & FD_SHUTDOWN_BIT) != 0; +} + void grpc_lfev_notify_on(grpc_exec_ctx *exec_ctx, gpr_atm *state, grpc_closure *closure) { while (true) { From a24b971214a3d95ddb86f6c04171b84c26da2a61 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 6 Apr 2017 09:03:21 -0700 Subject: [PATCH 229/461] Rename compress_filter --> message_compress_filter --- BUILD | 4 ++-- CMakeLists.txt | 8 ++++---- Makefile | 8 ++++---- binding.gyp | 2 +- build.yaml | 4 ++-- config.m4 | 2 +- gRPC-Core.podspec | 6 +++--- grpc.gemspec | 4 ++-- package.xml | 4 ++-- src/core/ext/filters/http/http_filters_plugin.c | 2 +- .../message_compress_filter.c} | 2 +- .../message_compress_filter.h} | 0 src/python/grpcio/grpc_core_dependencies.py | 2 +- test/core/end2end/fixtures/h2_sockpair+trace.c | 2 +- test/core/end2end/fixtures/h2_sockpair.c | 2 +- test/core/end2end/fixtures/h2_sockpair_1byte.c | 2 +- test/cpp/microbenchmarks/bm_call_create.cc | 2 +- tools/doxygen/Doxyfile.core.internal | 4 ++-- tools/run_tests/generated/sources_and_headers.json | 6 +++--- 19 files changed, 33 insertions(+), 33 deletions(-) rename src/core/ext/filters/http/{compress/compress_filter.c => message_compress/message_compress_filter.c} (99%) rename src/core/ext/filters/http/{compress/compress_filter.h => message_compress/message_compress_filter.h} (100%) diff --git a/BUILD b/BUILD index bc4f4eb9789..83cf3e651a5 100644 --- a/BUILD +++ b/BUILD @@ -780,12 +780,12 @@ grpc_cc_library( grpc_cc_library( name = "grpc_http_filters", hdrs = [ - "src/core/ext/filters/http/compress/compress_filter.h", + "src/core/ext/filters/http/message_compress/message_compress_filter.h", "src/core/ext/filters/http/client/http_client_filter.h", "src/core/ext/filters/http/server/http_server_filter.h", ], srcs = [ - "src/core/ext/filters/http/compress/compress_filter.c", + "src/core/ext/filters/http/message_compress/message_compress_filter.c", "src/core/ext/filters/http/client/http_client_filter.c", "src/core/ext/filters/http/server/http_server_filter.c", "src/core/ext/filters/http/http_filters_plugin.c" diff --git a/CMakeLists.txt b/CMakeLists.txt index 089e028bff5..f79d7154a98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1051,7 +1051,7 @@ add_library(grpc src/core/ext/transport/chttp2/transport/writing.c src/core/ext/transport/chttp2/alpn/alpn.c src/core/ext/filters/http/client/http_client_filter.c - src/core/ext/filters/http/compress/compress_filter.c + src/core/ext/filters/http/message_compress/message_compress_filter.c src/core/ext/filters/http/http_filters_plugin.c src/core/ext/filters/http/server/http_server_filter.c src/core/lib/http/httpcli_security_connector.c @@ -1377,7 +1377,7 @@ add_library(grpc_cronet src/core/ext/transport/chttp2/transport/writing.c src/core/ext/transport/chttp2/alpn/alpn.c src/core/ext/filters/http/client/http_client_filter.c - src/core/ext/filters/http/compress/compress_filter.c + src/core/ext/filters/http/message_compress/message_compress_filter.c src/core/ext/filters/http/http_filters_plugin.c src/core/ext/filters/http/server/http_server_filter.c src/core/ext/filters/client_channel/channel_connectivity.c @@ -1939,7 +1939,7 @@ add_library(grpc_unsecure src/core/ext/transport/chttp2/transport/writing.c src/core/ext/transport/chttp2/alpn/alpn.c src/core/ext/filters/http/client/http_client_filter.c - src/core/ext/filters/http/compress/compress_filter.c + src/core/ext/filters/http/message_compress/message_compress_filter.c src/core/ext/filters/http/http_filters_plugin.c src/core/ext/filters/http/server/http_server_filter.c src/core/ext/transport/chttp2/server/chttp2_server.c @@ -2687,7 +2687,7 @@ add_library(grpc++_cronet src/core/ext/transport/chttp2/transport/writing.c src/core/ext/transport/chttp2/alpn/alpn.c src/core/ext/filters/http/client/http_client_filter.c - src/core/ext/filters/http/compress/compress_filter.c + src/core/ext/filters/http/message_compress/message_compress_filter.c src/core/ext/filters/http/http_filters_plugin.c src/core/ext/filters/http/server/http_server_filter.c src/core/ext/filters/client_channel/channel_connectivity.c diff --git a/Makefile b/Makefile index 035e92f8e40..f2ee6901cfe 100644 --- a/Makefile +++ b/Makefile @@ -2956,7 +2956,7 @@ LIBGRPC_SRC = \ src/core/ext/transport/chttp2/transport/writing.c \ src/core/ext/transport/chttp2/alpn/alpn.c \ src/core/ext/filters/http/client/http_client_filter.c \ - src/core/ext/filters/http/compress/compress_filter.c \ + src/core/ext/filters/http/message_compress/message_compress_filter.c \ src/core/ext/filters/http/http_filters_plugin.c \ src/core/ext/filters/http/server/http_server_filter.c \ src/core/lib/http/httpcli_security_connector.c \ @@ -3280,7 +3280,7 @@ LIBGRPC_CRONET_SRC = \ src/core/ext/transport/chttp2/transport/writing.c \ src/core/ext/transport/chttp2/alpn/alpn.c \ src/core/ext/filters/http/client/http_client_filter.c \ - src/core/ext/filters/http/compress/compress_filter.c \ + src/core/ext/filters/http/message_compress/message_compress_filter.c \ src/core/ext/filters/http/http_filters_plugin.c \ src/core/ext/filters/http/server/http_server_filter.c \ src/core/ext/filters/client_channel/channel_connectivity.c \ @@ -3813,7 +3813,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/transport/chttp2/transport/writing.c \ src/core/ext/transport/chttp2/alpn/alpn.c \ src/core/ext/filters/http/client/http_client_filter.c \ - src/core/ext/filters/http/compress/compress_filter.c \ + src/core/ext/filters/http/message_compress/message_compress_filter.c \ src/core/ext/filters/http/http_filters_plugin.c \ src/core/ext/filters/http/server/http_server_filter.c \ src/core/ext/transport/chttp2/server/chttp2_server.c \ @@ -4546,7 +4546,7 @@ LIBGRPC++_CRONET_SRC = \ src/core/ext/transport/chttp2/transport/writing.c \ src/core/ext/transport/chttp2/alpn/alpn.c \ src/core/ext/filters/http/client/http_client_filter.c \ - src/core/ext/filters/http/compress/compress_filter.c \ + src/core/ext/filters/http/message_compress/message_compress_filter.c \ src/core/ext/filters/http/http_filters_plugin.c \ src/core/ext/filters/http/server/http_server_filter.c \ src/core/ext/filters/client_channel/channel_connectivity.c \ diff --git a/binding.gyp b/binding.gyp index ad9d7c8f28e..21cd56e6844 100644 --- a/binding.gyp +++ b/binding.gyp @@ -792,7 +792,7 @@ 'src/core/ext/transport/chttp2/transport/writing.c', 'src/core/ext/transport/chttp2/alpn/alpn.c', 'src/core/ext/filters/http/client/http_client_filter.c', - 'src/core/ext/filters/http/compress/compress_filter.c', + 'src/core/ext/filters/http/message_compress/message_compress_filter.c', 'src/core/ext/filters/http/http_filters_plugin.c', 'src/core/ext/filters/http/server/http_server_filter.c', 'src/core/lib/http/httpcli_security_connector.c', diff --git a/build.yaml b/build.yaml index 1df62654a4c..2d52b38fbf2 100644 --- a/build.yaml +++ b/build.yaml @@ -472,11 +472,11 @@ filegroups: - name: grpc_http_filters headers: - src/core/ext/filters/http/client/http_client_filter.h - - src/core/ext/filters/http/compress/compress_filter.h + - src/core/ext/filters/http/message_compress/message_compress_filter.h - src/core/ext/filters/http/server/http_server_filter.h src: - src/core/ext/filters/http/client/http_client_filter.c - - src/core/ext/filters/http/compress/compress_filter.c + - src/core/ext/filters/http/message_compress/message_compress_filter.c - src/core/ext/filters/http/http_filters_plugin.c - src/core/ext/filters/http/server/http_server_filter.c plugin: grpc_http_filters diff --git a/config.m4 b/config.m4 index 85593afd3c5..985de085628 100644 --- a/config.m4 +++ b/config.m4 @@ -226,7 +226,7 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/transport/chttp2/transport/writing.c \ src/core/ext/transport/chttp2/alpn/alpn.c \ src/core/ext/filters/http/client/http_client_filter.c \ - src/core/ext/filters/http/compress/compress_filter.c \ + src/core/ext/filters/http/message_compress/message_compress_filter.c \ src/core/ext/filters/http/http_filters_plugin.c \ src/core/ext/filters/http/server/http_server_filter.c \ src/core/lib/http/httpcli_security_connector.c \ diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 9cd92835ac5..b79a759438e 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -381,7 +381,7 @@ Pod::Spec.new do |s| 'src/core/ext/transport/chttp2/transport/varint.h', 'src/core/ext/transport/chttp2/alpn/alpn.h', 'src/core/ext/filters/http/client/http_client_filter.h', - 'src/core/ext/filters/http/compress/compress_filter.h', + 'src/core/ext/filters/http/message_compress/message_compress_filter.h', 'src/core/ext/filters/http/server/http_server_filter.h', 'src/core/lib/security/context/security_context.h', 'src/core/lib/security/credentials/composite/composite_credentials.h', @@ -601,7 +601,7 @@ Pod::Spec.new do |s| 'src/core/ext/transport/chttp2/transport/writing.c', 'src/core/ext/transport/chttp2/alpn/alpn.c', 'src/core/ext/filters/http/client/http_client_filter.c', - 'src/core/ext/filters/http/compress/compress_filter.c', + 'src/core/ext/filters/http/message_compress/message_compress_filter.c', 'src/core/ext/filters/http/http_filters_plugin.c', 'src/core/ext/filters/http/server/http_server_filter.c', 'src/core/lib/http/httpcli_security_connector.c', @@ -832,7 +832,7 @@ Pod::Spec.new do |s| 'src/core/ext/transport/chttp2/transport/varint.h', 'src/core/ext/transport/chttp2/alpn/alpn.h', 'src/core/ext/filters/http/client/http_client_filter.h', - 'src/core/ext/filters/http/compress/compress_filter.h', + 'src/core/ext/filters/http/message_compress/message_compress_filter.h', 'src/core/ext/filters/http/server/http_server_filter.h', 'src/core/lib/security/context/security_context.h', 'src/core/lib/security/credentials/composite/composite_credentials.h', diff --git a/grpc.gemspec b/grpc.gemspec index 0e4a3d6fecd..2a6563f8793 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -297,7 +297,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/transport/chttp2/transport/varint.h ) s.files += %w( src/core/ext/transport/chttp2/alpn/alpn.h ) s.files += %w( src/core/ext/filters/http/client/http_client_filter.h ) - s.files += %w( src/core/ext/filters/http/compress/compress_filter.h ) + s.files += %w( src/core/ext/filters/http/message_compress/message_compress_filter.h ) s.files += %w( src/core/ext/filters/http/server/http_server_filter.h ) s.files += %w( src/core/lib/security/context/security_context.h ) s.files += %w( src/core/lib/security/credentials/composite/composite_credentials.h ) @@ -517,7 +517,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/transport/chttp2/transport/writing.c ) s.files += %w( src/core/ext/transport/chttp2/alpn/alpn.c ) s.files += %w( src/core/ext/filters/http/client/http_client_filter.c ) - s.files += %w( src/core/ext/filters/http/compress/compress_filter.c ) + s.files += %w( src/core/ext/filters/http/message_compress/message_compress_filter.c ) s.files += %w( src/core/ext/filters/http/http_filters_plugin.c ) s.files += %w( src/core/ext/filters/http/server/http_server_filter.c ) s.files += %w( src/core/lib/http/httpcli_security_connector.c ) diff --git a/package.xml b/package.xml index 8cda68a2666..0771774b4c1 100644 --- a/package.xml +++ b/package.xml @@ -306,7 +306,7 @@ - + @@ -526,7 +526,7 @@ - + diff --git a/src/core/ext/filters/http/http_filters_plugin.c b/src/core/ext/filters/http/http_filters_plugin.c index a6e35bc181a..825c21cb6a6 100644 --- a/src/core/ext/filters/http/http_filters_plugin.c +++ b/src/core/ext/filters/http/http_filters_plugin.c @@ -34,7 +34,7 @@ #include #include "src/core/ext/filters/http/client/http_client_filter.h" -#include "src/core/ext/filters/http/compress/compress_filter.h" +#include "src/core/ext/filters/http/message_compress/message_compress_filter.h" #include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/lib/channel/channel_stack_builder.h" #include "src/core/lib/surface/channel_init.h" diff --git a/src/core/ext/filters/http/compress/compress_filter.c b/src/core/ext/filters/http/message_compress/message_compress_filter.c similarity index 99% rename from src/core/ext/filters/http/compress/compress_filter.c rename to src/core/ext/filters/http/message_compress/message_compress_filter.c index ab6c94a1539..f110e7beb63 100644 --- a/src/core/ext/filters/http/compress/compress_filter.c +++ b/src/core/ext/filters/http/message_compress/message_compress_filter.c @@ -39,7 +39,7 @@ #include #include -#include "src/core/ext/filters/http/compress/compress_filter.h" +#include "src/core/ext/filters/http/message_compress/message_compress_filter.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/compression/algorithm_metadata.h" #include "src/core/lib/compression/message_compress.h" diff --git a/src/core/ext/filters/http/compress/compress_filter.h b/src/core/ext/filters/http/message_compress/message_compress_filter.h similarity index 100% rename from src/core/ext/filters/http/compress/compress_filter.h rename to src/core/ext/filters/http/message_compress/message_compress_filter.h diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index c858dc9e1f5..afaf2acaa4d 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -220,7 +220,7 @@ CORE_SOURCE_FILES = [ 'src/core/ext/transport/chttp2/transport/writing.c', 'src/core/ext/transport/chttp2/alpn/alpn.c', 'src/core/ext/filters/http/client/http_client_filter.c', - 'src/core/ext/filters/http/compress/compress_filter.c', + 'src/core/ext/filters/http/message_compress/message_compress_filter.c', 'src/core/ext/filters/http/http_filters_plugin.c', 'src/core/ext/filters/http/server/http_server_filter.c', 'src/core/lib/http/httpcli_security_connector.c', diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.c b/test/core/end2end/fixtures/h2_sockpair+trace.c index 5fc0e4ea735..c59b544902f 100644 --- a/test/core/end2end/fixtures/h2_sockpair+trace.c +++ b/test/core/end2end/fixtures/h2_sockpair+trace.c @@ -47,7 +47,7 @@ #include #include "src/core/ext/filters/client_channel/client_channel.h" #include "src/core/ext/filters/http/client/http_client_filter.h" -#include "src/core/ext/filters/http/compress/compress_filter.h" +#include "src/core/ext/filters/http/message_compress/message_compress_filter.h" #include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/connected_channel.h" diff --git a/test/core/end2end/fixtures/h2_sockpair.c b/test/core/end2end/fixtures/h2_sockpair.c index 24ed048e7d4..1cb4e70727b 100644 --- a/test/core/end2end/fixtures/h2_sockpair.c +++ b/test/core/end2end/fixtures/h2_sockpair.c @@ -42,7 +42,7 @@ #include #include "src/core/ext/filters/client_channel/client_channel.h" #include "src/core/ext/filters/http/client/http_client_filter.h" -#include "src/core/ext/filters/http/compress/compress_filter.h" +#include "src/core/ext/filters/http/message_compress/message_compress_filter.h" #include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/connected_channel.h" diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.c b/test/core/end2end/fixtures/h2_sockpair_1byte.c index fee30946c43..9cd93c234a2 100644 --- a/test/core/end2end/fixtures/h2_sockpair_1byte.c +++ b/test/core/end2end/fixtures/h2_sockpair_1byte.c @@ -42,7 +42,7 @@ #include #include "src/core/ext/filters/client_channel/client_channel.h" #include "src/core/ext/filters/http/client/http_client_filter.h" -#include "src/core/ext/filters/http/compress/compress_filter.h" +#include "src/core/ext/filters/http/message_compress/message_compress_filter.h" #include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/lib/channel/connected_channel.h" diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index ae6041733c2..7221cf5512a 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -48,7 +48,7 @@ extern "C" { #include "src/core/ext/filters/client_channel/client_channel.h" #include "src/core/ext/filters/deadline/deadline_filter.h" #include "src/core/ext/filters/http/client/http_client_filter.h" -#include "src/core/ext/filters/http/compress/compress_filter.h" +#include "src/core/ext/filters/http/message_compress/message_compress_filter.h" #include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/ext/filters/load_reporting/load_reporting_filter.h" #include "src/core/ext/filters/message_size/message_size_filter.h" diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 8bc5896e88c..ca38e2fe0f1 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -958,8 +958,8 @@ src/core/ext/filters/deadline/deadline_filter.c \ src/core/ext/filters/deadline/deadline_filter.h \ src/core/ext/filters/http/client/http_client_filter.c \ src/core/ext/filters/http/client/http_client_filter.h \ -src/core/ext/filters/http/compress/compress_filter.c \ -src/core/ext/filters/http/compress/compress_filter.h \ +src/core/ext/filters/http/message_compress/message_compress_filter.c \ +src/core/ext/filters/http/message_compress/message_compress_filter.h \ src/core/ext/filters/http/http_filters_plugin.c \ src/core/ext/filters/http/server/http_server_filter.c \ src/core/ext/filters/http/server/http_server_filter.h \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 6cf4494b12f..63d6419146f 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -8013,7 +8013,7 @@ ], "headers": [ "src/core/ext/filters/http/client/http_client_filter.h", - "src/core/ext/filters/http/compress/compress_filter.h", + "src/core/ext/filters/http/message_compress/message_compress_filter.h", "src/core/ext/filters/http/server/http_server_filter.h" ], "is_filegroup": true, @@ -8022,8 +8022,8 @@ "src": [ "src/core/ext/filters/http/client/http_client_filter.c", "src/core/ext/filters/http/client/http_client_filter.h", - "src/core/ext/filters/http/compress/compress_filter.c", - "src/core/ext/filters/http/compress/compress_filter.h", + "src/core/ext/filters/http/message_compress/message_compress_filter.c", + "src/core/ext/filters/http/message_compress/message_compress_filter.h", "src/core/ext/filters/http/http_filters_plugin.c", "src/core/ext/filters/http/server/http_server_filter.c", "src/core/ext/filters/http/server/http_server_filter.h" From 3bd7a2111ed9ada00868ffc8c5175228262194e3 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 6 Apr 2017 09:04:18 -0700 Subject: [PATCH 230/461] Fixup code --- src/core/ext/filters/http/http_filters_plugin.c | 2 +- .../ext/filters/http/message_compress/message_compress_filter.c | 2 +- test/cpp/microbenchmarks/bm_call_create.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/ext/filters/http/http_filters_plugin.c b/src/core/ext/filters/http/http_filters_plugin.c index 825c21cb6a6..093a8c7dced 100644 --- a/src/core/ext/filters/http/http_filters_plugin.c +++ b/src/core/ext/filters/http/http_filters_plugin.c @@ -46,7 +46,7 @@ typedef struct { } optional_filter; static optional_filter compress_filter = { - &grpc_compress_filter, GRPC_ARG_ENABLE_PER_MESSAGE_COMPRESSION}; + &grpc_message_compress_filter, GRPC_ARG_ENABLE_PER_MESSAGE_COMPRESSION}; static bool is_building_http_like_transport( grpc_channel_stack_builder *builder) { diff --git a/src/core/ext/filters/http/message_compress/message_compress_filter.c b/src/core/ext/filters/http/message_compress/message_compress_filter.c index f110e7beb63..1cbc8526865 100644 --- a/src/core/ext/filters/http/message_compress/message_compress_filter.c +++ b/src/core/ext/filters/http/message_compress/message_compress_filter.c @@ -338,7 +338,7 @@ static grpc_error *init_channel_elem(grpc_exec_ctx *exec_ctx, static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem) {} -const grpc_channel_filter grpc_compress_filter = { +const grpc_channel_filter grpc_message_compress_filter = { compress_start_transport_stream_op_batch, grpc_channel_next_op, sizeof(call_data), diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index 7221cf5512a..0acfb9402f4 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -461,7 +461,7 @@ BENCHMARK_TEMPLATE(BM_IsolatedFilter, DummyFilter, NoOp); BENCHMARK_TEMPLATE(BM_IsolatedFilter, DummyFilter, SendEmptyMetadata); typedef Fixture<&grpc_client_channel_filter, 0> ClientChannelFilter; BENCHMARK_TEMPLATE(BM_IsolatedFilter, ClientChannelFilter, NoOp); -typedef Fixture<&grpc_compress_filter, CHECKS_NOT_LAST> CompressFilter; +typedef Fixture<&grpc_message_compress_filter, CHECKS_NOT_LAST> CompressFilter; BENCHMARK_TEMPLATE(BM_IsolatedFilter, CompressFilter, NoOp); BENCHMARK_TEMPLATE(BM_IsolatedFilter, CompressFilter, SendEmptyMetadata); typedef Fixture<&grpc_client_deadline_filter, CHECKS_NOT_LAST> From 71d6ce65d4f69e289f40c5c5f38928091285d46e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 6 Apr 2017 09:10:09 -0700 Subject: [PATCH 231/461] Merge deadline_init/deadline_start --- CMakeLists.txt | 19 ++++++------- Makefile | 19 ++++++------- binding.gyp | 4 +-- build.yaml | 4 +-- config.m4 | 6 ++-- gRPC-Core.podspec | 8 +++--- grpc.gemspec | 6 ++-- package.xml | 6 ++-- .../filters/client_channel/client_channel.c | 3 +- .../ext/filters/deadline/deadline_filter.c | 28 ++++++++----------- .../ext/filters/deadline/deadline_filter.h | 8 ++---- .../message_compress_filter.h | 2 +- src/python/grpcio/grpc_core_dependencies.py | 4 +-- tools/doxygen/Doxyfile.c++.internal | 2 -- tools/doxygen/Doxyfile.core.internal | 2 +- .../generated/sources_and_headers.json | 5 +--- vsprojects/vcxproj/grpc++/grpc++.vcxproj | 3 -- .../vcxproj/grpc++/grpc++.vcxproj.filters | 15 ---------- .../grpc++_unsecure/grpc++_unsecure.vcxproj | 3 -- .../grpc++_unsecure.vcxproj.filters | 15 ---------- vsprojects/vcxproj/grpc/grpc.vcxproj | 12 ++++---- vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 26 ++++++++--------- .../grpc_test_util/grpc_test_util.vcxproj | 3 -- .../grpc_test_util.vcxproj.filters | 15 ---------- .../grpc_unsecure/grpc_unsecure.vcxproj | 12 ++++---- .../grpc_unsecure.vcxproj.filters | 26 ++++++++--------- 26 files changed, 90 insertions(+), 166 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f79d7154a98..2ec5c57d740 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -908,7 +908,6 @@ endif (gRPC_BUILD_TESTS) add_library(grpc src/core/lib/surface/init.c - src/core/ext/filters/deadline/deadline_filter.c src/core/lib/channel/channel_args.c src/core/lib/channel/channel_stack.c src/core/lib/channel/channel_stack_builder.c @@ -1051,8 +1050,8 @@ add_library(grpc src/core/ext/transport/chttp2/transport/writing.c src/core/ext/transport/chttp2/alpn/alpn.c src/core/ext/filters/http/client/http_client_filter.c - src/core/ext/filters/http/message_compress/message_compress_filter.c src/core/ext/filters/http/http_filters_plugin.c + src/core/ext/filters/http/message_compress/message_compress_filter.c src/core/ext/filters/http/server/http_server_filter.c src/core/lib/http/httpcli_security_connector.c src/core/lib/security/context/security_context.c @@ -1103,6 +1102,7 @@ add_library(grpc src/core/ext/filters/client_channel/subchannel.c src/core/ext/filters/client_channel/subchannel_index.c src/core/ext/filters/client_channel/uri_parser.c + src/core/ext/filters/deadline/deadline_filter.c src/core/ext/transport/chttp2/client/chttp2_connector.c src/core/ext/transport/chttp2/server/insecure/server_chttp2.c src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c @@ -1231,7 +1231,6 @@ endif() add_library(grpc_cronet src/core/lib/surface/init.c - src/core/ext/filters/deadline/deadline_filter.c src/core/lib/channel/channel_args.c src/core/lib/channel/channel_stack.c src/core/lib/channel/channel_stack_builder.c @@ -1377,8 +1376,8 @@ add_library(grpc_cronet src/core/ext/transport/chttp2/transport/writing.c src/core/ext/transport/chttp2/alpn/alpn.c src/core/ext/filters/http/client/http_client_filter.c - src/core/ext/filters/http/message_compress/message_compress_filter.c src/core/ext/filters/http/http_filters_plugin.c + src/core/ext/filters/http/message_compress/message_compress_filter.c src/core/ext/filters/http/server/http_server_filter.c src/core/ext/filters/client_channel/channel_connectivity.c src/core/ext/filters/client_channel/client_channel.c @@ -1400,6 +1399,7 @@ add_library(grpc_cronet src/core/ext/filters/client_channel/subchannel.c src/core/ext/filters/client_channel/subchannel_index.c src/core/ext/filters/client_channel/uri_parser.c + src/core/ext/filters/deadline/deadline_filter.c src/core/lib/http/httpcli_security_connector.c src/core/lib/security/context/security_context.c src/core/lib/security/credentials/composite/composite_credentials.c @@ -1539,7 +1539,6 @@ add_library(grpc_test_util test/core/util/port_server_client.c test/core/util/slice_splitter.c test/core/util/trickle_endpoint.c - src/core/ext/filters/deadline/deadline_filter.c src/core/lib/channel/channel_args.c src/core/lib/channel/channel_stack.c src/core/lib/channel/channel_stack_builder.c @@ -1795,7 +1794,6 @@ endif (gRPC_BUILD_TESTS) add_library(grpc_unsecure src/core/lib/surface/init.c src/core/lib/surface/init_unsecure.c - src/core/ext/filters/deadline/deadline_filter.c src/core/lib/channel/channel_args.c src/core/lib/channel/channel_stack.c src/core/lib/channel/channel_stack_builder.c @@ -1939,8 +1937,8 @@ add_library(grpc_unsecure src/core/ext/transport/chttp2/transport/writing.c src/core/ext/transport/chttp2/alpn/alpn.c src/core/ext/filters/http/client/http_client_filter.c - src/core/ext/filters/http/message_compress/message_compress_filter.c src/core/ext/filters/http/http_filters_plugin.c + src/core/ext/filters/http/message_compress/message_compress_filter.c src/core/ext/filters/http/server/http_server_filter.c src/core/ext/transport/chttp2/server/chttp2_server.c src/core/ext/transport/chttp2/client/insecure/channel_create.c @@ -1966,6 +1964,7 @@ add_library(grpc_unsecure src/core/ext/filters/client_channel/subchannel.c src/core/ext/filters/client_channel/subchannel_index.c src/core/ext/filters/client_channel/uri_parser.c + src/core/ext/filters/deadline/deadline_filter.c src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c @@ -2212,7 +2211,6 @@ add_library(grpc++ src/cpp/util/status.cc src/cpp/util/string_ref.cc src/cpp/util/time_cc.cc - src/core/ext/filters/deadline/deadline_filter.c src/core/lib/channel/channel_args.c src/core/lib/channel/channel_stack.c src/core/lib/channel/channel_stack_builder.c @@ -2538,7 +2536,6 @@ add_library(grpc++_cronet src/cpp/util/status.cc src/cpp/util/string_ref.cc src/cpp/util/time_cc.cc - src/core/ext/filters/deadline/deadline_filter.c src/core/lib/channel/channel_args.c src/core/lib/channel/channel_stack.c src/core/lib/channel/channel_stack_builder.c @@ -2687,8 +2684,8 @@ add_library(grpc++_cronet src/core/ext/transport/chttp2/transport/writing.c src/core/ext/transport/chttp2/alpn/alpn.c src/core/ext/filters/http/client/http_client_filter.c - src/core/ext/filters/http/message_compress/message_compress_filter.c src/core/ext/filters/http/http_filters_plugin.c + src/core/ext/filters/http/message_compress/message_compress_filter.c src/core/ext/filters/http/server/http_server_filter.c src/core/ext/filters/client_channel/channel_connectivity.c src/core/ext/filters/client_channel/client_channel.c @@ -2710,6 +2707,7 @@ add_library(grpc++_cronet src/core/ext/filters/client_channel/subchannel.c src/core/ext/filters/client_channel/subchannel_index.c src/core/ext/filters/client_channel/uri_parser.c + src/core/ext/filters/deadline/deadline_filter.c src/core/ext/transport/chttp2/server/insecure/server_chttp2.c src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c src/core/ext/transport/chttp2/server/chttp2_server.c @@ -3236,7 +3234,6 @@ add_library(grpc++_unsecure src/cpp/util/status.cc src/cpp/util/string_ref.cc src/cpp/util/time_cc.cc - src/core/ext/filters/deadline/deadline_filter.c src/core/lib/channel/channel_args.c src/core/lib/channel/channel_stack.c src/core/lib/channel/channel_stack_builder.c diff --git a/Makefile b/Makefile index f2ee6901cfe..d932882bc2a 100644 --- a/Makefile +++ b/Makefile @@ -2813,7 +2813,6 @@ endif LIBGRPC_SRC = \ src/core/lib/surface/init.c \ - src/core/ext/filters/deadline/deadline_filter.c \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ @@ -2956,8 +2955,8 @@ LIBGRPC_SRC = \ src/core/ext/transport/chttp2/transport/writing.c \ src/core/ext/transport/chttp2/alpn/alpn.c \ src/core/ext/filters/http/client/http_client_filter.c \ - src/core/ext/filters/http/message_compress/message_compress_filter.c \ src/core/ext/filters/http/http_filters_plugin.c \ + src/core/ext/filters/http/message_compress/message_compress_filter.c \ src/core/ext/filters/http/server/http_server_filter.c \ src/core/lib/http/httpcli_security_connector.c \ src/core/lib/security/context/security_context.c \ @@ -3008,6 +3007,7 @@ LIBGRPC_SRC = \ src/core/ext/filters/client_channel/subchannel.c \ src/core/ext/filters/client_channel/subchannel_index.c \ src/core/ext/filters/client_channel/uri_parser.c \ + src/core/ext/filters/deadline/deadline_filter.c \ src/core/ext/transport/chttp2/client/chttp2_connector.c \ src/core/ext/transport/chttp2/server/insecure/server_chttp2.c \ src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c \ @@ -3134,7 +3134,6 @@ endif LIBGRPC_CRONET_SRC = \ src/core/lib/surface/init.c \ - src/core/ext/filters/deadline/deadline_filter.c \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ @@ -3280,8 +3279,8 @@ LIBGRPC_CRONET_SRC = \ src/core/ext/transport/chttp2/transport/writing.c \ src/core/ext/transport/chttp2/alpn/alpn.c \ src/core/ext/filters/http/client/http_client_filter.c \ - src/core/ext/filters/http/message_compress/message_compress_filter.c \ src/core/ext/filters/http/http_filters_plugin.c \ + src/core/ext/filters/http/message_compress/message_compress_filter.c \ src/core/ext/filters/http/server/http_server_filter.c \ src/core/ext/filters/client_channel/channel_connectivity.c \ src/core/ext/filters/client_channel/client_channel.c \ @@ -3303,6 +3302,7 @@ LIBGRPC_CRONET_SRC = \ src/core/ext/filters/client_channel/subchannel.c \ src/core/ext/filters/client_channel/subchannel_index.c \ src/core/ext/filters/client_channel/uri_parser.c \ + src/core/ext/filters/deadline/deadline_filter.c \ src/core/lib/http/httpcli_security_connector.c \ src/core/lib/security/context/security_context.c \ src/core/lib/security/credentials/composite/composite_credentials.c \ @@ -3441,7 +3441,6 @@ LIBGRPC_TEST_UTIL_SRC = \ test/core/util/port_server_client.c \ test/core/util/slice_splitter.c \ test/core/util/trickle_endpoint.c \ - src/core/ext/filters/deadline/deadline_filter.c \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ @@ -3669,7 +3668,6 @@ endif LIBGRPC_UNSECURE_SRC = \ src/core/lib/surface/init.c \ src/core/lib/surface/init_unsecure.c \ - src/core/ext/filters/deadline/deadline_filter.c \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ @@ -3813,8 +3811,8 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/transport/chttp2/transport/writing.c \ src/core/ext/transport/chttp2/alpn/alpn.c \ src/core/ext/filters/http/client/http_client_filter.c \ - src/core/ext/filters/http/message_compress/message_compress_filter.c \ src/core/ext/filters/http/http_filters_plugin.c \ + src/core/ext/filters/http/message_compress/message_compress_filter.c \ src/core/ext/filters/http/server/http_server_filter.c \ src/core/ext/transport/chttp2/server/chttp2_server.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.c \ @@ -3840,6 +3838,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/ext/filters/client_channel/subchannel.c \ src/core/ext/filters/client_channel/subchannel_index.c \ src/core/ext/filters/client_channel/uri_parser.c \ + src/core/ext/filters/deadline/deadline_filter.c \ src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c \ src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c \ src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c \ @@ -4063,7 +4062,6 @@ LIBGRPC++_SRC = \ src/cpp/util/status.cc \ src/cpp/util/string_ref.cc \ src/cpp/util/time_cc.cc \ - src/core/ext/filters/deadline/deadline_filter.c \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ @@ -4397,7 +4395,6 @@ LIBGRPC++_CRONET_SRC = \ src/cpp/util/status.cc \ src/cpp/util/string_ref.cc \ src/cpp/util/time_cc.cc \ - src/core/ext/filters/deadline/deadline_filter.c \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ @@ -4546,8 +4543,8 @@ LIBGRPC++_CRONET_SRC = \ src/core/ext/transport/chttp2/transport/writing.c \ src/core/ext/transport/chttp2/alpn/alpn.c \ src/core/ext/filters/http/client/http_client_filter.c \ - src/core/ext/filters/http/message_compress/message_compress_filter.c \ src/core/ext/filters/http/http_filters_plugin.c \ + src/core/ext/filters/http/message_compress/message_compress_filter.c \ src/core/ext/filters/http/server/http_server_filter.c \ src/core/ext/filters/client_channel/channel_connectivity.c \ src/core/ext/filters/client_channel/client_channel.c \ @@ -4569,6 +4566,7 @@ LIBGRPC++_CRONET_SRC = \ src/core/ext/filters/client_channel/subchannel.c \ src/core/ext/filters/client_channel/subchannel_index.c \ src/core/ext/filters/client_channel/uri_parser.c \ + src/core/ext/filters/deadline/deadline_filter.c \ src/core/ext/transport/chttp2/server/insecure/server_chttp2.c \ src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c \ src/core/ext/transport/chttp2/server/chttp2_server.c \ @@ -5087,7 +5085,6 @@ LIBGRPC++_UNSECURE_SRC = \ src/cpp/util/status.cc \ src/cpp/util/string_ref.cc \ src/cpp/util/time_cc.cc \ - src/core/ext/filters/deadline/deadline_filter.c \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ diff --git a/binding.gyp b/binding.gyp index 21cd56e6844..cb12489e41c 100644 --- a/binding.gyp +++ b/binding.gyp @@ -649,7 +649,6 @@ ], 'sources': [ 'src/core/lib/surface/init.c', - 'src/core/ext/filters/deadline/deadline_filter.c', 'src/core/lib/channel/channel_args.c', 'src/core/lib/channel/channel_stack.c', 'src/core/lib/channel/channel_stack_builder.c', @@ -792,8 +791,8 @@ 'src/core/ext/transport/chttp2/transport/writing.c', 'src/core/ext/transport/chttp2/alpn/alpn.c', 'src/core/ext/filters/http/client/http_client_filter.c', - 'src/core/ext/filters/http/message_compress/message_compress_filter.c', 'src/core/ext/filters/http/http_filters_plugin.c', + 'src/core/ext/filters/http/message_compress/message_compress_filter.c', 'src/core/ext/filters/http/server/http_server_filter.c', 'src/core/lib/http/httpcli_security_connector.c', 'src/core/lib/security/context/security_context.c', @@ -844,6 +843,7 @@ 'src/core/ext/filters/client_channel/subchannel.c', 'src/core/ext/filters/client_channel/subchannel_index.c', 'src/core/ext/filters/client_channel/uri_parser.c', + 'src/core/ext/filters/deadline/deadline_filter.c', 'src/core/ext/transport/chttp2/client/chttp2_connector.c', 'src/core/ext/transport/chttp2/server/insecure/server_chttp2.c', 'src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c', diff --git a/build.yaml b/build.yaml index 2d52b38fbf2..f88c13c0c96 100644 --- a/build.yaml +++ b/build.yaml @@ -173,7 +173,6 @@ filegroups: - include/grpc/slice_buffer.h - include/grpc/status.h headers: - - src/core/ext/filters/deadline/deadline_filter.h - src/core/lib/channel/channel_args.h - src/core/lib/channel/channel_stack.h - src/core/lib/channel/channel_stack_builder.h @@ -280,7 +279,6 @@ filegroups: - src/core/lib/transport/transport.h - src/core/lib/transport/transport_impl.h src: - - src/core/ext/filters/deadline/deadline_filter.c - src/core/lib/channel/channel_args.c - src/core/lib/channel/channel_stack.c - src/core/lib/channel/channel_stack_builder.c @@ -476,8 +474,8 @@ filegroups: - src/core/ext/filters/http/server/http_server_filter.h src: - src/core/ext/filters/http/client/http_client_filter.c - - src/core/ext/filters/http/message_compress/message_compress_filter.c - src/core/ext/filters/http/http_filters_plugin.c + - src/core/ext/filters/http/message_compress/message_compress_filter.c - src/core/ext/filters/http/server/http_server_filter.c plugin: grpc_http_filters uses: diff --git a/config.m4 b/config.m4 index 985de085628..ffbbe927c97 100644 --- a/config.m4 +++ b/config.m4 @@ -83,7 +83,6 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/support/tmpfile_windows.c \ src/core/lib/support/wrap_memcpy.c \ src/core/lib/surface/init.c \ - src/core/ext/filters/deadline/deadline_filter.c \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_stack.c \ src/core/lib/channel/channel_stack_builder.c \ @@ -226,8 +225,8 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/transport/chttp2/transport/writing.c \ src/core/ext/transport/chttp2/alpn/alpn.c \ src/core/ext/filters/http/client/http_client_filter.c \ - src/core/ext/filters/http/message_compress/message_compress_filter.c \ src/core/ext/filters/http/http_filters_plugin.c \ + src/core/ext/filters/http/message_compress/message_compress_filter.c \ src/core/ext/filters/http/server/http_server_filter.c \ src/core/lib/http/httpcli_security_connector.c \ src/core/lib/security/context/security_context.c \ @@ -278,6 +277,7 @@ if test "$PHP_GRPC" != "no"; then src/core/ext/filters/client_channel/subchannel.c \ src/core/ext/filters/client_channel/subchannel_index.c \ src/core/ext/filters/client_channel/uri_parser.c \ + src/core/ext/filters/deadline/deadline_filter.c \ src/core/ext/transport/chttp2/client/chttp2_connector.c \ src/core/ext/transport/chttp2/server/insecure/server_chttp2.c \ src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c \ @@ -641,7 +641,7 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/deadline) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/http) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/http/client) - PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/http/compress) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/http/message_compress) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/http/server) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/load_reporting) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/max_age) diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index b79a759438e..c67b83408b6 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -255,7 +255,6 @@ Pod::Spec.new do |s| 'src/core/lib/support/tmpfile_posix.c', 'src/core/lib/support/tmpfile_windows.c', 'src/core/lib/support/wrap_memcpy.c', - 'src/core/ext/filters/deadline/deadline_filter.h', 'src/core/lib/channel/channel_args.h', 'src/core/lib/channel/channel_stack.h', 'src/core/lib/channel/channel_stack_builder.h', @@ -426,6 +425,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel.h', 'src/core/ext/filters/client_channel/subchannel_index.h', 'src/core/ext/filters/client_channel/uri_parser.h', + 'src/core/ext/filters/deadline/deadline_filter.h', 'src/core/ext/transport/chttp2/client/chttp2_connector.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h', @@ -458,7 +458,6 @@ Pod::Spec.new do |s| 'src/core/ext/filters/max_age/max_age_filter.h', 'src/core/ext/filters/message_size/message_size_filter.h', 'src/core/lib/surface/init.c', - 'src/core/ext/filters/deadline/deadline_filter.c', 'src/core/lib/channel/channel_args.c', 'src/core/lib/channel/channel_stack.c', 'src/core/lib/channel/channel_stack_builder.c', @@ -601,8 +600,8 @@ Pod::Spec.new do |s| 'src/core/ext/transport/chttp2/transport/writing.c', 'src/core/ext/transport/chttp2/alpn/alpn.c', 'src/core/ext/filters/http/client/http_client_filter.c', - 'src/core/ext/filters/http/message_compress/message_compress_filter.c', 'src/core/ext/filters/http/http_filters_plugin.c', + 'src/core/ext/filters/http/message_compress/message_compress_filter.c', 'src/core/ext/filters/http/server/http_server_filter.c', 'src/core/lib/http/httpcli_security_connector.c', 'src/core/lib/security/context/security_context.c', @@ -653,6 +652,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel.c', 'src/core/ext/filters/client_channel/subchannel_index.c', 'src/core/ext/filters/client_channel/uri_parser.c', + 'src/core/ext/filters/deadline/deadline_filter.c', 'src/core/ext/transport/chttp2/client/chttp2_connector.c', 'src/core/ext/transport/chttp2/server/insecure/server_chttp2.c', 'src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c', @@ -706,7 +706,6 @@ Pod::Spec.new do |s| 'src/core/lib/support/thd_internal.h', 'src/core/lib/support/time_precise.h', 'src/core/lib/support/tmpfile.h', - 'src/core/ext/filters/deadline/deadline_filter.h', 'src/core/lib/channel/channel_args.h', 'src/core/lib/channel/channel_stack.h', 'src/core/lib/channel/channel_stack_builder.h', @@ -877,6 +876,7 @@ Pod::Spec.new do |s| 'src/core/ext/filters/client_channel/subchannel.h', 'src/core/ext/filters/client_channel/subchannel_index.h', 'src/core/ext/filters/client_channel/uri_parser.h', + 'src/core/ext/filters/deadline/deadline_filter.h', 'src/core/ext/transport/chttp2/client/chttp2_connector.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h', 'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h', diff --git a/grpc.gemspec b/grpc.gemspec index 2a6563f8793..a1a32a6bd28 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -171,7 +171,6 @@ Gem::Specification.new do |s| s.files += %w( include/grpc/impl/codegen/sync_windows.h ) s.files += %w( include/grpc/grpc_security.h ) s.files += %w( include/grpc/census.h ) - s.files += %w( src/core/ext/filters/deadline/deadline_filter.h ) s.files += %w( src/core/lib/channel/channel_args.h ) s.files += %w( src/core/lib/channel/channel_stack.h ) s.files += %w( src/core/lib/channel/channel_stack_builder.h ) @@ -342,6 +341,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/client_channel/subchannel.h ) s.files += %w( src/core/ext/filters/client_channel/subchannel_index.h ) s.files += %w( src/core/ext/filters/client_channel/uri_parser.h ) + s.files += %w( src/core/ext/filters/deadline/deadline_filter.h ) s.files += %w( src/core/ext/transport/chttp2/client/chttp2_connector.h ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h ) s.files += %w( src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h ) @@ -374,7 +374,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/max_age/max_age_filter.h ) s.files += %w( src/core/ext/filters/message_size/message_size_filter.h ) s.files += %w( src/core/lib/surface/init.c ) - s.files += %w( src/core/ext/filters/deadline/deadline_filter.c ) s.files += %w( src/core/lib/channel/channel_args.c ) s.files += %w( src/core/lib/channel/channel_stack.c ) s.files += %w( src/core/lib/channel/channel_stack_builder.c ) @@ -517,8 +516,8 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/transport/chttp2/transport/writing.c ) s.files += %w( src/core/ext/transport/chttp2/alpn/alpn.c ) s.files += %w( src/core/ext/filters/http/client/http_client_filter.c ) - s.files += %w( src/core/ext/filters/http/message_compress/message_compress_filter.c ) s.files += %w( src/core/ext/filters/http/http_filters_plugin.c ) + s.files += %w( src/core/ext/filters/http/message_compress/message_compress_filter.c ) s.files += %w( src/core/ext/filters/http/server/http_server_filter.c ) s.files += %w( src/core/lib/http/httpcli_security_connector.c ) s.files += %w( src/core/lib/security/context/security_context.c ) @@ -569,6 +568,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/ext/filters/client_channel/subchannel.c ) s.files += %w( src/core/ext/filters/client_channel/subchannel_index.c ) s.files += %w( src/core/ext/filters/client_channel/uri_parser.c ) + s.files += %w( src/core/ext/filters/deadline/deadline_filter.c ) s.files += %w( src/core/ext/transport/chttp2/client/chttp2_connector.c ) s.files += %w( src/core/ext/transport/chttp2/server/insecure/server_chttp2.c ) s.files += %w( src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c ) diff --git a/package.xml b/package.xml index 0771774b4c1..a1ad15b108c 100644 --- a/package.xml +++ b/package.xml @@ -180,7 +180,6 @@ - @@ -351,6 +350,7 @@ + @@ -383,7 +383,6 @@ - @@ -526,8 +525,8 @@ - + @@ -578,6 +577,7 @@ + diff --git a/src/core/ext/filters/client_channel/client_channel.c b/src/core/ext/filters/client_channel/client_channel.c index 1cc324ed3f4..16be2c70e95 100644 --- a/src/core/ext/filters/client_channel/client_channel.c +++ b/src/core/ext/filters/client_channel/client_channel.c @@ -1278,8 +1278,7 @@ static grpc_error *cc_init_call_elem(grpc_exec_ctx *exec_ctx, calld->owning_call = args->call_stack; calld->arena = args->arena; if (chand->deadline_checking_enabled) { - grpc_deadline_state_init(exec_ctx, elem, args->call_stack); - grpc_deadline_state_start(exec_ctx, elem, calld->deadline); + grpc_deadline_state_init(exec_ctx, elem, args->call_stack, calld->deadline); } return GRPC_ERROR_NONE; } diff --git a/src/core/ext/filters/deadline/deadline_filter.c b/src/core/ext/filters/deadline/deadline_filter.c index ae2398c8319..da12cc3e78d 100644 --- a/src/core/ext/filters/deadline/deadline_filter.c +++ b/src/core/ext/filters/deadline/deadline_filter.c @@ -143,18 +143,6 @@ static void inject_on_complete_cb(grpc_deadline_state* deadline_state, op->on_complete = &deadline_state->on_complete; } -void grpc_deadline_state_init(grpc_exec_ctx* exec_ctx, grpc_call_element* elem, - grpc_call_stack* call_stack) { - grpc_deadline_state* deadline_state = elem->call_data; - deadline_state->call_stack = call_stack; -} - -void grpc_deadline_state_destroy(grpc_exec_ctx* exec_ctx, - grpc_call_element* elem) { - grpc_deadline_state* deadline_state = elem->call_data; - cancel_timer_if_needed(exec_ctx, deadline_state); -} - // Callback and associated state for starting the timer after call stack // initialization has been completed. struct start_timer_after_init_state { @@ -169,8 +157,11 @@ static void start_timer_after_init(grpc_exec_ctx* exec_ctx, void* arg, gpr_free(state); } -void grpc_deadline_state_start(grpc_exec_ctx* exec_ctx, grpc_call_element* elem, - gpr_timespec deadline) { +void grpc_deadline_state_init(grpc_exec_ctx* exec_ctx, grpc_call_element* elem, + grpc_call_stack* call_stack, + gpr_timespec deadline) { + grpc_deadline_state* deadline_state = elem->call_data; + deadline_state->call_stack = call_stack; // Deadline will always be infinite on servers, so the timer will only be // set on clients with a finite deadline. deadline = gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC); @@ -191,6 +182,12 @@ void grpc_deadline_state_start(grpc_exec_ctx* exec_ctx, grpc_call_element* elem, } } +void grpc_deadline_state_destroy(grpc_exec_ctx* exec_ctx, + grpc_call_element* elem) { + grpc_deadline_state* deadline_state = elem->call_data; + cancel_timer_if_needed(exec_ctx, deadline_state); +} + void grpc_deadline_state_reset(grpc_exec_ctx* exec_ctx, grpc_call_element* elem, gpr_timespec new_deadline) { grpc_deadline_state* deadline_state = elem->call_data; @@ -250,8 +247,7 @@ typedef struct server_call_data { static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem, const grpc_call_element_args* args) { - grpc_deadline_state_init(exec_ctx, elem, args->call_stack); - grpc_deadline_state_start(exec_ctx, elem, args->deadline); + grpc_deadline_state_init(exec_ctx, elem, args->call_stack, args->deadline); return GRPC_ERROR_NONE; } diff --git a/src/core/ext/filters/deadline/deadline_filter.h b/src/core/ext/filters/deadline/deadline_filter.h index 830dcd5eaa6..5050453fa1a 100644 --- a/src/core/ext/filters/deadline/deadline_filter.h +++ b/src/core/ext/filters/deadline/deadline_filter.h @@ -64,15 +64,11 @@ typedef struct grpc_deadline_state { // assumes elem->call_data is zero'd void grpc_deadline_state_init(grpc_exec_ctx* exec_ctx, grpc_call_element* elem, - grpc_call_stack* call_stack); + grpc_call_stack* call_stack, + gpr_timespec deadline); void grpc_deadline_state_destroy(grpc_exec_ctx* exec_ctx, grpc_call_element* elem); -// Starts the timer with the specified deadline. -// Should be called from the filter's init_call_elem() method. -void grpc_deadline_state_start(grpc_exec_ctx* exec_ctx, grpc_call_element* elem, - gpr_timespec deadline); - // Cancels the existing timer and starts a new one with new_deadline. // // Note: It is generally safe to call this with an earlier deadline diff --git a/src/core/ext/filters/http/message_compress/message_compress_filter.h b/src/core/ext/filters/http/message_compress/message_compress_filter.h index 68d2b8766ab..d80d3a79ca6 100644 --- a/src/core/ext/filters/http/message_compress/message_compress_filter.h +++ b/src/core/ext/filters/http/message_compress/message_compress_filter.h @@ -62,6 +62,6 @@ extern int grpc_compression_trace; * aforementioned 'grpc-encoding' metadata value, data will pass through * uncompressed. */ -extern const grpc_channel_filter grpc_compress_filter; +extern const grpc_channel_filter grpc_message_compress_filter; #endif /* GRPC_CORE_EXT_FILTERS_HTTP_COMPRESS_COMPRESS_FILTER_H */ diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index afaf2acaa4d..a5c38012b35 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -77,7 +77,6 @@ CORE_SOURCE_FILES = [ 'src/core/lib/support/tmpfile_windows.c', 'src/core/lib/support/wrap_memcpy.c', 'src/core/lib/surface/init.c', - 'src/core/ext/filters/deadline/deadline_filter.c', 'src/core/lib/channel/channel_args.c', 'src/core/lib/channel/channel_stack.c', 'src/core/lib/channel/channel_stack_builder.c', @@ -220,8 +219,8 @@ CORE_SOURCE_FILES = [ 'src/core/ext/transport/chttp2/transport/writing.c', 'src/core/ext/transport/chttp2/alpn/alpn.c', 'src/core/ext/filters/http/client/http_client_filter.c', - 'src/core/ext/filters/http/message_compress/message_compress_filter.c', 'src/core/ext/filters/http/http_filters_plugin.c', + 'src/core/ext/filters/http/message_compress/message_compress_filter.c', 'src/core/ext/filters/http/server/http_server_filter.c', 'src/core/lib/http/httpcli_security_connector.c', 'src/core/lib/security/context/security_context.c', @@ -272,6 +271,7 @@ CORE_SOURCE_FILES = [ 'src/core/ext/filters/client_channel/subchannel.c', 'src/core/ext/filters/client_channel/subchannel_index.c', 'src/core/ext/filters/client_channel/uri_parser.c', + 'src/core/ext/filters/deadline/deadline_filter.c', 'src/core/ext/transport/chttp2/client/chttp2_connector.c', 'src/core/ext/transport/chttp2/server/insecure/server_chttp2.c', 'src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c', diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 759c7071d03..32df90f35de 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -900,8 +900,6 @@ include/grpc/load_reporting.h \ include/grpc/slice.h \ include/grpc/slice_buffer.h \ include/grpc/status.h \ -src/core/ext/filters/deadline/deadline_filter.c \ -src/core/ext/filters/deadline/deadline_filter.h \ src/core/lib/channel/channel_args.c \ src/core/lib/channel/channel_args.h \ src/core/lib/channel/channel_stack.c \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index ca38e2fe0f1..3378bc19c9c 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -958,9 +958,9 @@ src/core/ext/filters/deadline/deadline_filter.c \ src/core/ext/filters/deadline/deadline_filter.h \ src/core/ext/filters/http/client/http_client_filter.c \ src/core/ext/filters/http/client/http_client_filter.h \ +src/core/ext/filters/http/http_filters_plugin.c \ src/core/ext/filters/http/message_compress/message_compress_filter.c \ src/core/ext/filters/http/message_compress/message_compress_filter.h \ -src/core/ext/filters/http/http_filters_plugin.c \ src/core/ext/filters/http/server/http_server_filter.c \ src/core/ext/filters/http/server/http_server_filter.h \ src/core/ext/filters/load_reporting/load_reporting.c \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 63d6419146f..b7aefd41759 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -7535,7 +7535,6 @@ "include/grpc/slice.h", "include/grpc/slice_buffer.h", "include/grpc/status.h", - "src/core/ext/filters/deadline/deadline_filter.h", "src/core/lib/channel/channel_args.h", "src/core/lib/channel/channel_stack.h", "src/core/lib/channel/channel_stack_builder.h", @@ -7656,8 +7655,6 @@ "include/grpc/slice.h", "include/grpc/slice_buffer.h", "include/grpc/status.h", - "src/core/ext/filters/deadline/deadline_filter.c", - "src/core/ext/filters/deadline/deadline_filter.h", "src/core/lib/channel/channel_args.c", "src/core/lib/channel/channel_args.h", "src/core/lib/channel/channel_stack.c", @@ -8022,9 +8019,9 @@ "src": [ "src/core/ext/filters/http/client/http_client_filter.c", "src/core/ext/filters/http/client/http_client_filter.h", + "src/core/ext/filters/http/http_filters_plugin.c", "src/core/ext/filters/http/message_compress/message_compress_filter.c", "src/core/ext/filters/http/message_compress/message_compress_filter.h", - "src/core/ext/filters/http/http_filters_plugin.c", "src/core/ext/filters/http/server/http_server_filter.c", "src/core/ext/filters/http/server/http_server_filter.h" ], diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj b/vsprojects/vcxproj/grpc++/grpc++.vcxproj index 7ffd0202e0f..36a805d8427 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj @@ -377,7 +377,6 @@ - @@ -571,8 +570,6 @@ - - diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters index 5390d96a134..f526a929a83 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters @@ -124,9 +124,6 @@ src\cpp\util - - src\core\ext\filters\deadline - src\core\lib\channel @@ -851,9 +848,6 @@ src\cpp\thread_manager - - src\core\ext\filters\deadline - src\core\lib\channel @@ -1226,15 +1220,6 @@ {d02f1155-7e7e-3736-3c69-dc9146dc523d} - - {96d09c4a-59f9-3486-6c2f-cbf695b285d8} - - - {ec936f3c-c278-59b3-1fcf-d17ab77c8546} - - - {136a9e7f-2e8b-7cff-c961-5149529ca0f5} - {80567a8f-622f-a3ce-c12d-aebb63984b07} diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj index c954241d312..d71f09d88e5 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -371,7 +371,6 @@ - @@ -555,8 +554,6 @@ - - diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index 9b2463fdee1..fedd2c57d43 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -109,9 +109,6 @@ src\cpp\util - - src\core\ext\filters\deadline - src\core\lib\channel @@ -818,9 +815,6 @@ src\cpp\thread_manager - - src\core\ext\filters\deadline - src\core\lib\channel @@ -1193,15 +1187,6 @@ {595f2ea0-aafb-87e5-c938-db3ff0b0c69a} - - {52eca76b-9502-3d96-9064-6415226a860f} - - - {d2564ab1-6815-d425-3f8a-31693cc2ac81} - - - {0cc70f19-99bb-5e9e-99d9-b103398c0e76} - {cf8fd5d8-ff54-331d-2d20-36d6cae0e14b} diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index 093ac413bb7..da8b2ea8fbc 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -300,7 +300,6 @@ - @@ -426,7 +425,7 @@ - + @@ -471,6 +470,7 @@ + @@ -506,8 +506,6 @@ - - @@ -792,10 +790,10 @@ - - + + @@ -896,6 +894,8 @@ + + diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index 14a30993c86..3eac38b5397 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -4,9 +4,6 @@ src\core\lib\surface - - src\core\ext\filters\deadline - src\core\lib\channel @@ -433,12 +430,12 @@ src\core\ext\filters\http\client - - src\core\ext\filters\http\compress - src\core\ext\filters\http + + src\core\ext\filters\http\message_compress + src\core\ext\filters\http\server @@ -589,6 +586,9 @@ src\core\ext\filters\client_channel + + src\core\ext\filters\deadline + src\core\ext\transport\chttp2\client @@ -800,9 +800,6 @@ - - src\core\ext\filters\deadline - src\core\lib\channel @@ -1178,8 +1175,8 @@ src\core\ext\filters\http\client - - src\core\ext\filters\http\compress + + src\core\ext\filters\http\message_compress src\core\ext\filters\http\server @@ -1313,6 +1310,9 @@ src\core\ext\filters\client_channel + + src\core\ext\filters\deadline + src\core\ext\transport\chttp2\client @@ -1490,8 +1490,8 @@ {e4f7616b-2b49-7df9-8ca3-eb7848d4609d} - - {8f3d6045-e672-b61f-437e-052557970f41} + + {7b595f5a-c5b5-29fe-74c2-5ec5fd5c94d2} {a40e82ca-0c04-35b8-898d-7ad5f323d110} diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj index f549452cc99..6118d5982b1 100644 --- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj +++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj @@ -195,7 +195,6 @@ - @@ -343,8 +342,6 @@ - - diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters index 11dfb8baa57..89c6413a470 100644 --- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters @@ -61,9 +61,6 @@ test\core\util - - src\core\ext\filters\deadline - src\core\lib\channel @@ -563,9 +560,6 @@ test\core\util - - src\core\ext\filters\deadline - src\core\lib\channel @@ -902,15 +896,6 @@ {f7bfac91-5eb2-dea7-4601-6c63edbbf997} - - {5db70e06-741d-708c-bf0a-b59f8ca1f8bd} - - - {f0f88514-c2d8-c4c9-c3bd-591682207751} - - - {2c9ab189-bb7e-355d-9f37-385472e86b9f} - {f4e8c61e-1ca6-0fdd-7b5e-b7f9a30c9a21} diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index cfad8b85b9d..f71771dcb82 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -290,7 +290,6 @@ - @@ -416,7 +415,7 @@ - + @@ -438,6 +437,7 @@ + @@ -474,8 +474,6 @@ - - @@ -762,10 +760,10 @@ - - + + @@ -816,6 +814,8 @@ + + diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index 153fb856eeb..fdcd668a2f5 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -7,9 +7,6 @@ src\core\lib\surface - - src\core\ext\filters\deadline - src\core\lib\channel @@ -439,12 +436,12 @@ src\core\ext\filters\http\client - - src\core\ext\filters\http\compress - src\core\ext\filters\http + + src\core\ext\filters\http\message_compress + src\core\ext\filters\http\server @@ -520,6 +517,9 @@ src\core\ext\filters\client_channel + + src\core\ext\filters\deadline + src\core\ext\filters\client_channel\resolver\dns\c_ares @@ -713,9 +713,6 @@ - - src\core\ext\filters\deadline - src\core\lib\channel @@ -1091,8 +1088,8 @@ src\core\ext\filters\http\client - - src\core\ext\filters\http\compress + + src\core\ext\filters\http\message_compress src\core\ext\filters\http\server @@ -1157,6 +1154,9 @@ src\core\ext\filters\client_channel + + src\core\ext\filters\deadline + src\core\ext\filters\client_channel\resolver\dns\c_ares @@ -1331,8 +1331,8 @@ {95cd5972-7339-6f09-2332-e6769b3cba3f} - - {b257d9a5-2100-4b83-9a03-d28707827b1e} + + {cf8cb886-3020-e143-317e-730ff9bbddc3} {2c1e7897-6f69-f8b9-0b90-5c3fae59a48f} From e376970691b972e54bf5242a7ede9305bb508f1d Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 6 Apr 2017 09:13:34 -0700 Subject: [PATCH 232/461] Fix bool/pointer mixup --- src/core/ext/filters/http/http_filters_plugin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ext/filters/http/http_filters_plugin.c b/src/core/ext/filters/http/http_filters_plugin.c index 093a8c7dced..a6ba194e698 100644 --- a/src/core/ext/filters/http/http_filters_plugin.c +++ b/src/core/ext/filters/http/http_filters_plugin.c @@ -51,7 +51,7 @@ static optional_filter compress_filter = { static bool is_building_http_like_transport( grpc_channel_stack_builder *builder) { grpc_transport *t = grpc_channel_stack_builder_get_transport(builder); - return t && strstr(t->vtable->name, "http"); + return t != NULL && strstr(t->vtable->name, "http"); } static bool maybe_add_optional_filter(grpc_exec_ctx *exec_ctx, From 41f2ed68c41fda998aa99e98b97ae4982233e6b8 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 6 Apr 2017 09:33:48 -0700 Subject: [PATCH 233/461] Cleanup filter selection --- .../ext/filters/deadline/deadline_filter.c | 10 ++-- .../ext/filters/http/http_filters_plugin.c | 9 ++-- .../filters/load_reporting/load_reporting.c | 10 +--- src/core/ext/filters/max_age/max_age_filter.c | 28 +++++------ .../message_size/message_size_filter.c | 49 ++++++++----------- src/core/lib/channel/channel_args.c | 28 +++++++++-- src/core/lib/channel/channel_args.h | 5 +- 7 files changed, 69 insertions(+), 70 deletions(-) diff --git a/src/core/ext/filters/deadline/deadline_filter.c b/src/core/ext/filters/deadline/deadline_filter.c index da12cc3e78d..2e03d16bf6d 100644 --- a/src/core/ext/filters/deadline/deadline_filter.c +++ b/src/core/ext/filters/deadline/deadline_filter.c @@ -346,13 +346,9 @@ const grpc_channel_filter grpc_server_deadline_filter = { }; bool grpc_deadline_checking_enabled(const grpc_channel_args* channel_args) { - bool enable = !grpc_channel_args_want_minimal_stack(channel_args); - const grpc_arg* a = - grpc_channel_args_find(channel_args, GRPC_ARG_ENABLE_DEADLINE_CHECKS); - if (a != NULL && a->type == GRPC_ARG_INTEGER && a->value.integer != 0) { - enable = true; - } - return enable; + return grpc_channel_arg_get_bool( + grpc_channel_args_find(channel_args, GRPC_ARG_ENABLE_DEADLINE_CHECKS), + !grpc_channel_args_want_minimal_stack(channel_args)); } static bool maybe_add_deadline_filter(grpc_exec_ctx* exec_ctx, diff --git a/src/core/ext/filters/http/http_filters_plugin.c b/src/core/ext/filters/http/http_filters_plugin.c index a6ba194e698..195a1a8119b 100644 --- a/src/core/ext/filters/http/http_filters_plugin.c +++ b/src/core/ext/filters/http/http_filters_plugin.c @@ -61,12 +61,9 @@ static bool maybe_add_optional_filter(grpc_exec_ctx *exec_ctx, optional_filter *filtarg = arg; const grpc_channel_args *channel_args = grpc_channel_stack_builder_get_channel_arguments(builder); - bool enable = !grpc_channel_args_want_minimal_stack(channel_args); - const grpc_arg *ctlarg = - grpc_channel_args_find(channel_args, filtarg->control_channel_arg); - if (ctlarg != NULL) { - enable = !(ctlarg->type == GRPC_ARG_INTEGER && ctlarg->value.integer == 0); - } + bool enable = grpc_channel_arg_get_bool( + grpc_channel_args_find(channel_args, filtarg->control_channel_arg), + !grpc_channel_args_want_minimal_stack(channel_args)); return enable ? grpc_channel_stack_builder_prepend_filter( builder, filtarg->filter, NULL, NULL) : true; diff --git a/src/core/ext/filters/load_reporting/load_reporting.c b/src/core/ext/filters/load_reporting/load_reporting.c index 9fb33bab711..adb5e8b93b0 100644 --- a/src/core/ext/filters/load_reporting/load_reporting.c +++ b/src/core/ext/filters/load_reporting/load_reporting.c @@ -63,14 +63,8 @@ void grpc_call_set_load_reporting_cost_context( } static bool is_load_reporting_enabled(const grpc_channel_args *a) { - if (a == NULL) return false; - for (size_t i = 0; i < a->num_args; i++) { - if (0 == strcmp(a->args[i].key, GRPC_ARG_ENABLE_LOAD_REPORTING)) { - return a->args[i].type == GRPC_ARG_INTEGER && - a->args[i].value.integer != 0; - } - } - return false; + return grpc_channel_arg_get_bool( + grpc_channel_args_find(a, GRPC_ARG_ENABLE_LOAD_REPORTING), false); } static bool maybe_add_load_reporting_filter(grpc_exec_ctx *exec_ctx, diff --git a/src/core/ext/filters/max_age/max_age_filter.c b/src/core/ext/filters/max_age/max_age_filter.c index 72c1d9174d9..0ae23572769 100644 --- a/src/core/ext/filters/max_age/max_age_filter.c +++ b/src/core/ext/filters/max_age/max_age_filter.c @@ -48,6 +48,11 @@ #define DEFAULT_MAX_CONNECTION_IDLE_MS INT_MAX #define MAX_CONNECTION_AGE_JITTER 0.1 +#define MAX_CONNECTION_AGE_INTEGER_OPTIONS \ + (grpc_integer_options) { DEFAULT_MAX_CONNECTION_AGE_MS, 1, INT_MAX } +#define MAX_CONNECTION_IDLE_INTEGER_OPTIONS \ + (grpc_integer_options) { DEFAULT_MAX_CONNECTION_IDLE_MS, 1, INT_MAX } + typedef struct channel_data { /* We take a reference to the channel stack for the timer callback */ grpc_channel_stack* channel_stack; @@ -315,8 +320,7 @@ static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx, if (0 == strcmp(args->channel_args->args[i].key, GRPC_ARG_MAX_CONNECTION_AGE_MS)) { const int value = grpc_channel_arg_get_integer( - &args->channel_args->args[i], - (grpc_integer_options){DEFAULT_MAX_CONNECTION_AGE_MS, 1, INT_MAX}); + &args->channel_args->args[i], MAX_CONNECTION_AGE_INTEGER_OPTIONS); chand->max_connection_age = value == INT_MAX ? gpr_inf_future(GPR_TIMESPAN) @@ -334,8 +338,7 @@ static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx, } else if (0 == strcmp(args->channel_args->args[i].key, GRPC_ARG_MAX_CONNECTION_IDLE_MS)) { const int value = grpc_channel_arg_get_integer( - &args->channel_args->args[i], - (grpc_integer_options){DEFAULT_MAX_CONNECTION_IDLE_MS, 1, INT_MAX}); + &args->channel_args->args[i], MAX_CONNECTION_IDLE_INTEGER_OPTIONS); chand->max_connection_idle = value == INT_MAX ? gpr_inf_future(GPR_TIMESPAN) : gpr_time_from_millis(value, GPR_TIMESPAN); @@ -412,16 +415,13 @@ static bool maybe_add_max_age_filter(grpc_exec_ctx* exec_ctx, void* arg) { const grpc_channel_args* channel_args = grpc_channel_stack_builder_get_channel_arguments(builder); - const grpc_arg* a = - grpc_channel_args_find(channel_args, GRPC_ARG_MAX_CONNECTION_AGE_MS); - bool enable = false; - if (a != NULL && a->type == GRPC_ARG_INTEGER && a->value.integer != INT_MAX) { - enable = true; - } - a = grpc_channel_args_find(channel_args, GRPC_ARG_MAX_CONNECTION_IDLE_MS); - if (a != NULL && a->type == GRPC_ARG_INTEGER && a->value.integer != INT_MAX) { - enable = true; - } + bool enable = + grpc_channel_arg_get_integer( + grpc_channel_args_find(channel_args, GRPC_ARG_MAX_CONNECTION_AGE_MS), + MAX_CONNECTION_AGE_INTEGER_OPTIONS) != INT_MAX && + grpc_channel_arg_get_integer( + grpc_channel_args_find(channel_args, GRPC_ARG_MAX_CONNECTION_IDLE_MS), + MAX_CONNECTION_IDLE_INTEGER_OPTIONS) != INT_MAX; if (enable) { return grpc_channel_stack_builder_prepend_filter( builder, &grpc_max_age_filter, NULL, NULL); diff --git a/src/core/ext/filters/message_size/message_size_filter.c b/src/core/ext/filters/message_size/message_size_filter.c index d152d82968f..7cb2c346fd8 100644 --- a/src/core/ext/filters/message_size/message_size_filter.c +++ b/src/core/ext/filters/message_size/message_size_filter.c @@ -91,8 +91,7 @@ static void* message_size_limits_create_from_json(const grpc_json* json) { } typedef struct call_data { - int max_send_size; - int max_recv_size; + message_size_limits limits; // Receive closures are chained: we inject this closure as the // recv_message_ready up-call on transport_stream_op, and remember to // call our next_recv_message_ready member after handling it. @@ -104,8 +103,7 @@ typedef struct call_data { } call_data; typedef struct channel_data { - int max_send_size; - int max_recv_size; + message_size_limits limits; // Maps path names to message_size_limits structs. grpc_slice_hash_table* method_limit_table; } channel_data; @@ -116,12 +114,12 @@ static void recv_message_ready(grpc_exec_ctx* exec_ctx, void* user_data, grpc_error* error) { grpc_call_element* elem = user_data; call_data* calld = elem->call_data; - if (*calld->recv_message != NULL && calld->max_recv_size >= 0 && - (*calld->recv_message)->length > (size_t)calld->max_recv_size) { + if (*calld->recv_message != NULL && calld->limits.max_recv_size >= 0 && + (*calld->recv_message)->length > (size_t)calld->limits.max_recv_size) { char* message_string; gpr_asprintf(&message_string, "Received message larger than max (%u vs. %d)", - (*calld->recv_message)->length, calld->max_recv_size); + (*calld->recv_message)->length, calld->limits.max_recv_size); grpc_error* new_error = grpc_error_set_int( GRPC_ERROR_CREATE_FROM_COPIED_STRING(message_string), GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_INVALID_ARGUMENT); @@ -143,13 +141,13 @@ static void start_transport_stream_op_batch( grpc_transport_stream_op_batch* op) { call_data* calld = elem->call_data; // Check max send message size. - if (op->send_message && calld->max_send_size >= 0 && + if (op->send_message && calld->limits.max_send_size >= 0 && op->payload->send_message.send_message->length > - (size_t)calld->max_send_size) { + (size_t)calld->limits.max_send_size) { char* message_string; gpr_asprintf(&message_string, "Sent message larger than max (%u vs. %d)", op->payload->send_message.send_message->length, - calld->max_send_size); + calld->limits.max_send_size); grpc_transport_stream_op_batch_finish_with_failure( exec_ctx, op, grpc_error_set_int(GRPC_ERROR_CREATE_FROM_COPIED_STRING(message_string), @@ -182,21 +180,20 @@ static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx, // Note: Per-method config is only available on the client, so we // apply the max request size to the send limit and the max response // size to the receive limit. - calld->max_send_size = chand->max_send_size; - calld->max_recv_size = chand->max_recv_size; + calld->limits = chand->limits; if (chand->method_limit_table != NULL) { message_size_limits* limits = grpc_method_config_table_get( exec_ctx, chand->method_limit_table, args->path); if (limits != NULL) { if (limits->max_send_size >= 0 && - (limits->max_send_size < calld->max_send_size || - calld->max_send_size < 0)) { - calld->max_send_size = limits->max_send_size; + (limits->max_send_size < calld->limits.max_send_size || + calld->limits.max_send_size < 0)) { + calld->limits.max_send_size = limits->max_send_size; } if (limits->max_recv_size >= 0 && - (limits->max_recv_size < calld->max_recv_size || - calld->max_recv_size < 0)) { - calld->max_recv_size = limits->max_recv_size; + (limits->max_recv_size < calld->limits.max_recv_size || + calld->limits.max_recv_size < 0)) { + calld->limits.max_recv_size = limits->max_recv_size; } } } @@ -216,13 +213,9 @@ static int default_size(const grpc_channel_args* args, return without_minimal_stack; } -typedef struct { - int max_recv_size; - int max_send_size; -} channel_limits; - -channel_limits get_channel_limits(const grpc_channel_args* channel_args) { - channel_limits lim; +message_size_limits get_message_size_limits( + const grpc_channel_args* channel_args) { + message_size_limits lim; lim.max_send_size = default_size(channel_args, GRPC_DEFAULT_MAX_SEND_MESSAGE_LENGTH); lim.max_recv_size = @@ -254,9 +247,7 @@ static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx, grpc_channel_element_args* args) { GPR_ASSERT(!args->is_last); channel_data* chand = elem->channel_data; - channel_limits lim = get_channel_limits(args->channel_args); - chand->max_send_size = lim.max_send_size; - chand->max_recv_size = lim.max_recv_size; + chand->limits = get_message_size_limits(args->channel_args); // Get method config table from channel args. const grpc_arg* channel_arg = grpc_channel_args_find(args->channel_args, GRPC_ARG_SERVICE_CONFIG); @@ -302,7 +293,7 @@ static bool maybe_add_message_size_filter(grpc_exec_ctx* exec_ctx, const grpc_channel_args* channel_args = grpc_channel_stack_builder_get_channel_arguments(builder); bool enable = false; - channel_limits lim = get_channel_limits(channel_args); + message_size_limits lim = get_message_size_limits(channel_args); if (lim.max_send_size != INT_MAX || lim.max_recv_size != INT_MAX) { enable = true; } diff --git a/src/core/lib/channel/channel_args.c b/src/core/lib/channel/channel_args.c index a6d124c7199..3de31d99da1 100644 --- a/src/core/lib/channel/channel_args.c +++ b/src/core/lib/channel/channel_args.c @@ -329,7 +329,9 @@ const grpc_arg *grpc_channel_args_find(const grpc_channel_args *args, return NULL; } -int grpc_channel_arg_get_integer(grpc_arg *arg, grpc_integer_options options) { +int grpc_channel_arg_get_integer(const grpc_arg *arg, + grpc_integer_options options) { + if (arg == NULL) return options.default_value; if (arg->type != GRPC_ARG_INTEGER) { gpr_log(GPR_ERROR, "%s ignored: it must be an integer", arg->key); return options.default_value; @@ -347,9 +349,25 @@ int grpc_channel_arg_get_integer(grpc_arg *arg, grpc_integer_options options) { return arg->value.integer; } +bool grpc_channel_arg_get_bool(const grpc_arg *arg, bool default_value) { + if (arg == NULL) return default_value; + if (arg->type != GRPC_ARG_INTEGER) { + gpr_log(GPR_ERROR, "%s ignored: it must be an integer", arg->key); + return default_value; + } + switch (arg->value.integer) { + case 0: + return false; + case 1: + return true; + default: + gpr_log(GPR_ERROR, "%s treated as bool but set to %d (assuming true)", + arg->key, arg->value.integer); + return true; + } +} + bool grpc_channel_args_want_minimal_stack(const grpc_channel_args *args) { - const grpc_arg *arg = grpc_channel_args_find(args, GRPC_ARG_MINIMAL_STACK); - if (arg == NULL) return false; - if (arg->type == GRPC_ARG_INTEGER && arg->value.integer == 0) return false; - return true; + return grpc_channel_arg_get_bool( + grpc_channel_args_find(args, GRPC_ARG_MINIMAL_STACK), false); } diff --git a/src/core/lib/channel/channel_args.h b/src/core/lib/channel/channel_args.h index 158cda5b214..5ffcacb7fd9 100644 --- a/src/core/lib/channel/channel_args.h +++ b/src/core/lib/channel/channel_args.h @@ -121,6 +121,9 @@ typedef struct grpc_integer_options { int max_value; } grpc_integer_options; /** Returns the value of \a arg, subject to the contraints in \a options. */ -int grpc_channel_arg_get_integer(grpc_arg *arg, grpc_integer_options options); +int grpc_channel_arg_get_integer(const grpc_arg *arg, + grpc_integer_options options); + +bool grpc_channel_arg_get_bool(const grpc_arg *arg, bool default_value); #endif /* GRPC_CORE_LIB_CHANNEL_CHANNEL_ARGS_H */ From 5cecf68669aaab04f293d2f1249b50328d342ff7 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 6 Apr 2017 09:36:54 -0700 Subject: [PATCH 234/461] -1 --> unlimited --- src/core/ext/filters/message_size/message_size_filter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/ext/filters/message_size/message_size_filter.c b/src/core/ext/filters/message_size/message_size_filter.c index 7cb2c346fd8..5626f39d7a6 100644 --- a/src/core/ext/filters/message_size/message_size_filter.c +++ b/src/core/ext/filters/message_size/message_size_filter.c @@ -208,7 +208,7 @@ static void destroy_call_elem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem, static int default_size(const grpc_channel_args* args, int without_minimal_stack) { if (grpc_channel_args_want_minimal_stack(args)) { - return INT_MAX; + return -1; } return without_minimal_stack; } @@ -294,7 +294,7 @@ static bool maybe_add_message_size_filter(grpc_exec_ctx* exec_ctx, grpc_channel_stack_builder_get_channel_arguments(builder); bool enable = false; message_size_limits lim = get_message_size_limits(channel_args); - if (lim.max_send_size != INT_MAX || lim.max_recv_size != INT_MAX) { + if (lim.max_send_size != -1 || lim.max_recv_size != -1) { enable = true; } const grpc_arg* a = From 2024dbd6813648f6cc522395d126ae995dd2be5d Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 6 Apr 2017 09:40:15 -0700 Subject: [PATCH 235/461] cleanup options parsing --- src/core/ext/filters/message_size/message_size_filter.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/core/ext/filters/message_size/message_size_filter.c b/src/core/ext/filters/message_size/message_size_filter.c index 5626f39d7a6..94184065cbb 100644 --- a/src/core/ext/filters/message_size/message_size_filter.c +++ b/src/core/ext/filters/message_size/message_size_filter.c @@ -223,17 +223,13 @@ message_size_limits get_message_size_limits( for (size_t i = 0; i < channel_args->num_args; ++i) { if (strcmp(channel_args->args[i].key, GRPC_ARG_MAX_SEND_MESSAGE_LENGTH) == 0) { - const grpc_integer_options options = { - default_size(channel_args, GRPC_DEFAULT_MAX_SEND_MESSAGE_LENGTH), 0, - INT_MAX}; + const grpc_integer_options options = {lim.max_send_size, 0, INT_MAX}; lim.max_send_size = grpc_channel_arg_get_integer(&channel_args->args[i], options); } if (strcmp(channel_args->args[i].key, GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH) == 0) { - const grpc_integer_options options = { - default_size(channel_args, GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH), 0, - INT_MAX}; + const grpc_integer_options options = {lim.max_recv_size, 0, INT_MAX}; lim.max_recv_size = grpc_channel_arg_get_integer(&channel_args->args[i], options); } From 3de12630da62b83defb1987f6627733174169222 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 6 Apr 2017 10:02:31 -0700 Subject: [PATCH 236/461] Ensure cleanup before orphaning --- test/core/iomgr/ev_epoll_linux_test.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/core/iomgr/ev_epoll_linux_test.c b/test/core/iomgr/ev_epoll_linux_test.c index 5f8124aedae..0856023b14f 100644 --- a/test/core/iomgr/ev_epoll_linux_test.c +++ b/test/core/iomgr/ev_epoll_linux_test.c @@ -346,11 +346,13 @@ static void test_threading_wakeup(grpc_exec_ctx *exec_ctx, void *arg, threading_shared *shared = arg; ++shared->wakeups; ++thread_wakeups; - GPR_ASSERT(GRPC_LOG_IF_ERROR( - "consume_wakeup", grpc_wakeup_fd_consume_wakeup(shared->wakeup_fd))); - grpc_fd_notify_on_read(exec_ctx, shared->wakeup_desc, &shared->on_wakeup); - GPR_ASSERT(GRPC_LOG_IF_ERROR("wakeup_next", - grpc_wakeup_fd_wakeup(shared->wakeup_fd))); + if (error == GRPC_ERROR_NONE) { + GPR_ASSERT(GRPC_LOG_IF_ERROR( + "consume_wakeup", grpc_wakeup_fd_consume_wakeup(shared->wakeup_fd))); + grpc_fd_notify_on_read(exec_ctx, shared->wakeup_desc, &shared->on_wakeup); + GPR_ASSERT(GRPC_LOG_IF_ERROR("wakeup_next", + grpc_wakeup_fd_wakeup(shared->wakeup_fd))); + } } static void test_threading(void) { @@ -387,6 +389,7 @@ static void test_threading(void) { grpc_wakeup_fd_destroy(&fd); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_fd_shutdown(&exec_ctx, shared.wakeup_desc, GRPC_ERROR_CANCELLED); grpc_fd_orphan(&exec_ctx, shared.wakeup_desc, NULL, NULL, "done"); grpc_pollset_shutdown(&exec_ctx, shared.pollset, grpc_closure_create(destroy_pollset, shared.pollset, From 6badbb74b69d365ff775753ca0be9d75973aebd3 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 6 Apr 2017 10:03:53 -0700 Subject: [PATCH 237/461] Update BUILD --- BUILD | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BUILD b/BUILD index c4632fc0a24..c9bdae06c40 100644 --- a/BUILD +++ b/BUILD @@ -457,6 +457,7 @@ grpc_cc_library( "src/core/lib/iomgr/endpoint_pair_windows.c", "src/core/lib/iomgr/error.c", "src/core/lib/iomgr/ev_epoll_linux.c", + "src/core/lib/iomgr/lockfree_event.c", "src/core/lib/iomgr/ev_poll_posix.c", "src/core/lib/iomgr/ev_posix.c", "src/core/lib/iomgr/exec_ctx.c", @@ -583,6 +584,7 @@ grpc_cc_library( "src/core/lib/iomgr/error.h", "src/core/lib/iomgr/error_internal.h", "src/core/lib/iomgr/ev_epoll_linux.h", + "src/core/lib/iomgr/lockfree_event.h", "src/core/lib/iomgr/ev_poll_posix.h", "src/core/lib/iomgr/ev_posix.h", "src/core/lib/iomgr/exec_ctx.h", From 2d38b05671ca0c6006c775ccb8cbb945118a794c Mon Sep 17 00:00:00 2001 From: Dan Zhang Date: Thu, 6 Apr 2017 13:09:34 -0400 Subject: [PATCH 238/461] clang format --- src/core/lib/iomgr/udp_server.h | 2 +- test/core/iomgr/udp_server_test.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/lib/iomgr/udp_server.h b/src/core/lib/iomgr/udp_server.h index 2a72638709b..8006037644d 100644 --- a/src/core/lib/iomgr/udp_server.h +++ b/src/core/lib/iomgr/udp_server.h @@ -56,7 +56,7 @@ typedef void (*grpc_udp_server_write_cb)(grpc_exec_ctx *exec_ctx, grpc_fd *emfd, /* Called when the grpc_fd is about to be orphaned (and the FD closed). */ typedef void (*grpc_udp_server_orphan_cb)(grpc_exec_ctx *exec_ctx, grpc_fd *emfd, - grpc_closure* shutdown_fd_callback, + grpc_closure *shutdown_fd_callback, void *user_data); /* Create a server, initially not bound to any ports */ diff --git a/test/core/iomgr/udp_server_test.c b/test/core/iomgr/udp_server_test.c index 9cc0ea94983..1f1696a7a7a 100644 --- a/test/core/iomgr/udp_server_test.c +++ b/test/core/iomgr/udp_server_test.c @@ -91,7 +91,7 @@ static void on_write(grpc_exec_ctx *exec_ctx, grpc_fd *emfd, void *user_data) { } static void on_fd_orphaned(grpc_exec_ctx *exec_ctx, grpc_fd *emfd, - grpc_closure* closure, void *user_data) { + grpc_closure *closure, void *user_data) { gpr_log(GPR_INFO, "gRPC FD about to be orphaned: %d", grpc_fd_wrapped_fd(emfd)); g_number_of_orphan_calls++; From 77e06b2f8617f190fbd14e47238ce8d304118d2c Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 6 Apr 2017 10:37:44 -0700 Subject: [PATCH 239/461] Node: fix leak of sent metadata --- src/node/ext/call.cc | 48 +++++++++++++++++++++++--------- src/node/ext/call.h | 2 ++ src/node/ext/call_credentials.cc | 2 ++ 3 files changed, 39 insertions(+), 13 deletions(-) diff --git a/src/node/ext/call.cc b/src/node/ext/call.cc index 5c311158542..c77d6a3379b 100644 --- a/src/node/ext/call.cc +++ b/src/node/ext/call.cc @@ -99,7 +99,6 @@ Local nanErrorWithCode(const char *msg, grpc_call_error code) { bool CreateMetadataArray(Local metadata, grpc_metadata_array *array) { HandleScope scope; - grpc_metadata_array_init(array); Local keys = Nan::GetOwnPropertyNames(metadata).ToLocalChecked(); for (unsigned int i = 0; i < keys->Length(); i++) { Local current_key = Nan::To( @@ -111,18 +110,20 @@ bool CreateMetadataArray(Local metadata, grpc_metadata_array *array) { array->capacity += Local::Cast(value_array)->Length(); } array->metadata = reinterpret_cast( - gpr_malloc(array->capacity * sizeof(grpc_metadata))); + gpr_zalloc(array->capacity * sizeof(grpc_metadata))); for (unsigned int i = 0; i < keys->Length(); i++) { Local current_key(Nan::To(keys->Get(i)).ToLocalChecked()); Local values = Local::Cast( Nan::Get(metadata, current_key).ToLocalChecked()); - grpc_slice key_slice = grpc_slice_intern(CreateSliceFromString(current_key)); + grpc_slice key_slice = CreateSliceFromString(current_key); + grpc_slice key_intern_slice = grpc_slice_intern(key_slice); + grpc_slice_unref(key_slice); for (unsigned int j = 0; j < values->Length(); j++) { Local value = Nan::Get(values, j).ToLocalChecked(); grpc_metadata *current = &array->metadata[array->count]; - current->key = key_slice; + current->key = key_intern_slice; // Only allow binary headers for "-bin" keys - if (grpc_is_binary_header(key_slice)) { + if (grpc_is_binary_header(key_intern_slice)) { if (::node::Buffer::HasInstance(value)) { current->value = CreateSliceFromBuffer(value); } else { @@ -142,6 +143,14 @@ bool CreateMetadataArray(Local metadata, grpc_metadata_array *array) { return true; } +void DestroyMetadataArray(grpc_metadata_array *array) { + for (size_t i = 0; i < array->count; i++) { + // Don't unref keys because they are interned + grpc_slice_unref(array->metadata[i].value); + } + grpc_metadata_array_destroy(array); +} + Local ParseMetadata(const grpc_metadata_array *metadata_array) { EscapableHandleScope scope; grpc_metadata *metadata_elements = metadata_array->metadata; @@ -179,6 +188,12 @@ Op::~Op() { class SendMetadataOp : public Op { public: + SendMetadataOp() { + grpc_metadata_array_init(&send_metadata); + } + ~SendMetadataOp() { + DestroyMetadataArray(&send_metadata); + } Local GetNodeValue() const { EscapableHandleScope scope; return scope.Escape(Nan::True()); @@ -187,17 +202,16 @@ class SendMetadataOp : public Op { if (!value->IsObject()) { return false; } - grpc_metadata_array array; MaybeLocal maybe_metadata = Nan::To(value); if (maybe_metadata.IsEmpty()) { return false; } if (!CreateMetadataArray(maybe_metadata.ToLocalChecked(), - &array)) { + &send_metadata)) { return false; } - out->data.send_initial_metadata.count = array.count; - out->data.send_initial_metadata.metadata = array.metadata; + out->data.send_initial_metadata.count = send_metadata.count; + out->data.send_initial_metadata.metadata = send_metadata.metadata; return true; } bool IsFinalOp() { @@ -207,6 +221,8 @@ class SendMetadataOp : public Op { std::string GetTypeString() const { return "send_metadata"; } + private: + grpc_metadata_array send_metadata; }; class SendMessageOp : public Op { @@ -272,8 +288,12 @@ class SendClientCloseOp : public Op { class SendServerStatusOp : public Op { public: + SendServerStatusOp() { + grpc_metadata_array_init(&status_metadata); + } ~SendServerStatusOp() { grpc_slice_unref(details); + DestroyMetadataArray(&status_metadata); } Local GetNodeValue() const { EscapableHandleScope scope; @@ -313,12 +333,13 @@ class SendServerStatusOp : public Op { } Local details = Nan::To( maybe_details.ToLocalChecked()).ToLocalChecked(); - grpc_metadata_array array; - if (!CreateMetadataArray(metadata, &array)) { + if (!CreateMetadataArray(metadata, &status_metadata)) { return false; } - out->data.send_status_from_server.trailing_metadata_count = array.count; - out->data.send_status_from_server.trailing_metadata = array.metadata; + out->data.send_status_from_server.trailing_metadata_count = + status_metadata.count; + out->data.send_status_from_server.trailing_metadata = + status_metadata.metadata; out->data.send_status_from_server.status = static_cast(code); this->details = CreateSliceFromString(details); @@ -335,6 +356,7 @@ class SendServerStatusOp : public Op { private: grpc_slice details; + grpc_metadata_array status_metadata; }; class GetMetadataOp : public Op { diff --git a/src/node/ext/call.h b/src/node/ext/call.h index cffff00fce4..fe2abab9ee3 100644 --- a/src/node/ext/call.h +++ b/src/node/ext/call.h @@ -58,6 +58,8 @@ v8::Local ParseMetadata(const grpc_metadata_array *metadata_array); bool CreateMetadataArray(v8::Local metadata, grpc_metadata_array *array); +void DestroyMetadataArray(grpc_metadata_array *array); + /* Wrapper class for grpc_call structs. */ class Call : public Nan::ObjectWrap { public: diff --git a/src/node/ext/call_credentials.cc b/src/node/ext/call_credentials.cc index afcc363131e..5bd4bdcd5ab 100644 --- a/src/node/ext/call_credentials.cc +++ b/src/node/ext/call_credentials.cc @@ -211,6 +211,7 @@ NAN_METHOD(PluginCallback) { Utf8String details_utf8_str(info[1]); char *details = *details_utf8_str; grpc_metadata_array array; + grpc_metadata_array_init(&array); Local callback_data = Nan::To(info[3]).ToLocalChecked(); if (!CreateMetadataArray(Nan::To(info[2]).ToLocalChecked(), &array)){ @@ -226,6 +227,7 @@ NAN_METHOD(PluginCallback) { Nan::New("user_data").ToLocalChecked() ).ToLocalChecked().As()->Value(); cb(user_data, array.metadata, array.count, code, details); + DestroyMetadataArray(&array); } NAUV_WORK_CB(SendPluginCallback) { From 631e78c34975f7d1cb030cd8d1b5593ed86a2e89 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Thu, 6 Apr 2017 10:44:45 -0700 Subject: [PATCH 240/461] Print items/sec metric at the end --- test/cpp/microbenchmarks/bm_cq_multiple_threads.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc index 80f21f1f697..967c226ac73 100644 --- a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc +++ b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc @@ -124,6 +124,8 @@ static void BM_Cq_Throughput(benchmark::State& state) { grpc_completion_queue_next(g_cq, deadline, NULL); } + state.SetItemsProcessed(state.iterations()); + if (state.thread_index == 0) { grpc_completion_queue_shutdown(g_cq); grpc_completion_queue_destroy(g_cq); From dcd24e424157c4523f140cebb8618a8fd9e905a0 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 6 Apr 2017 10:47:46 -0700 Subject: [PATCH 241/461] BUILD --- BUILD | 1 + 1 file changed, 1 insertion(+) diff --git a/BUILD b/BUILD index 83cf3e651a5..4982db9e5ed 100644 --- a/BUILD +++ b/BUILD @@ -732,6 +732,7 @@ grpc_cc_library( language = "c", deps = [ "grpc_base", + "grpc_deadline_filter", ], ) From c6ec1155d026c91b1badb07ef1605bb747cff064 Mon Sep 17 00:00:00 2001 From: Noah Eisen Date: Wed, 5 Apr 2017 16:10:13 -0700 Subject: [PATCH 242/461] Fix error overflow bug --- src/core/lib/iomgr/error.c | 35 ++++++++++++++++-- .../clusterfuzz-testcase-6312731374256128 | Bin 0 -> 26793 bytes test/core/iomgr/error_test.c | 30 ++++++++++++++- tools/run_tests/generated/tests.json | 23 ++++++++++++ 4 files changed, 82 insertions(+), 6 deletions(-) create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/clusterfuzz-testcase-6312731374256128 diff --git a/src/core/lib/iomgr/error.c b/src/core/lib/iomgr/error.c index 1dbb64e8f37..766cc8a5169 100644 --- a/src/core/lib/iomgr/error.c +++ b/src/core/lib/iomgr/error.c @@ -212,7 +212,11 @@ static uint8_t get_placement(grpc_error **err, size_t size) { GPR_ASSERT(*err); uint8_t slots = (uint8_t)(size / sizeof(intptr_t)); if ((*err)->arena_size + slots > (*err)->arena_capacity) { - (*err)->arena_capacity = (uint8_t)(3 * (*err)->arena_capacity / 2); + (*err)->arena_capacity = + (uint8_t)GPR_MIN(UINT8_MAX - 1, (3 * (*err)->arena_capacity / 2)); + if ((*err)->arena_size + slots > (*err)->arena_capacity) { + return UINT8_MAX; + } *err = gpr_realloc( *err, sizeof(grpc_error) + (*err)->arena_capacity * sizeof(intptr_t)); } @@ -223,10 +227,14 @@ static uint8_t get_placement(grpc_error **err, size_t size) { static void internal_set_int(grpc_error **err, grpc_error_ints which, intptr_t value) { - // GPR_ASSERT((*err)->ints[which] == UINT8_MAX); // TODO, enforce this uint8_t slot = (*err)->ints[which]; if (slot == UINT8_MAX) { slot = get_placement(err, sizeof(value)); + if (slot == UINT8_MAX) { + gpr_log(GPR_ERROR, "Error %p is full, dropping int {\"%s\":%" PRIiPTR "}", *err, + error_int_name(which), value); + return; + } } (*err)->ints[which] = slot; (*err)->arena[slot] = value; @@ -234,10 +242,16 @@ static void internal_set_int(grpc_error **err, grpc_error_ints which, static void internal_set_str(grpc_error **err, grpc_error_strs which, grpc_slice value) { - // GPR_ASSERT((*err)->strs[which] == UINT8_MAX); // TODO, enforce this uint8_t slot = (*err)->strs[which]; if (slot == UINT8_MAX) { slot = get_placement(err, sizeof(value)); + if (slot == UINT8_MAX) { + const char *str = grpc_slice_to_c_string(value); + gpr_log(GPR_ERROR, "Error %p is full, dropping string {\"%s\":\"%s\"}", + *err, error_str_name(which), str); + gpr_free((void *)str); + return; + } } else { unref_slice(*(grpc_slice *)((*err)->arena + slot)); } @@ -245,12 +259,19 @@ static void internal_set_str(grpc_error **err, grpc_error_strs which, memcpy((*err)->arena + slot, &value, sizeof(value)); } +static char *fmt_time(gpr_timespec tm); static void internal_set_time(grpc_error **err, grpc_error_times which, gpr_timespec value) { - // GPR_ASSERT((*err)->times[which] == UINT8_MAX); // TODO, enforce this uint8_t slot = (*err)->times[which]; if (slot == UINT8_MAX) { slot = get_placement(err, sizeof(value)); + if (slot == UINT8_MAX) { + const char *time_str = fmt_time(value); + gpr_log(GPR_ERROR, "Error %p is full, dropping \"%s\":\"%s\"}", *err, + error_time_name(which), time_str); + gpr_free((void *)time_str); + return; + } } (*err)->times[which] = slot; memcpy((*err)->arena + slot, &value, sizeof(value)); @@ -259,6 +280,12 @@ static void internal_set_time(grpc_error **err, grpc_error_times which, static void internal_add_error(grpc_error **err, grpc_error *new) { grpc_linked_error new_last = {new, UINT8_MAX}; uint8_t slot = get_placement(err, sizeof(grpc_linked_error)); + if (slot == UINT8_MAX) { + gpr_log(GPR_ERROR, "Error %p is full, dropping error %p = %s", *err, new, + grpc_error_string(new)); + GRPC_ERROR_UNREF(new); + return; + } if ((*err)->first_err == UINT8_MAX) { GPR_ASSERT((*err)->last_err == UINT8_MAX); (*err)->last_err = slot; diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/clusterfuzz-testcase-6312731374256128 b/test/core/end2end/fuzzers/server_fuzzer_corpus/clusterfuzz-testcase-6312731374256128 new file mode 100644 index 0000000000000000000000000000000000000000..4c6eb601ae342400eaccb7d4688136d152f2b06d GIT binary patch literal 26793 zcmeI*u}Z@L6h`3)rAV>w(Ah!7r_ezt+V_8zn%nSuFE|ShUxyeYT@L>_2@dV~^ZoRA zdb?cC&#zA}$HVdP^-;%V+3%LyYyEM(u4lWu?e|=-YwM-^{dW21n7@1950cvnF80Es zc7hLl-~%7h0nZbjv)TsFpM2m0AG!m4-~%7{kmp7JUz#@bE^xu62*eZjP4~@dM0TMQ zlS=!73ob<Z4LUFgK5(!St=OA&}C`l+AOi0ncq zCYAOD7hH-!Jkd}6oJM39Ix(rVFSy`R1mcN)>gO~fyU>YArG3E#mm&~P^iw~l5!r=K zOe*aQF1Qqdc%q;BIgQ9JbYfCzUvR;t2*eZp)X!-|cA*oKO8bHfE=3@o=%;>8BeDyf zm{i&qTyQA@@kBrMa~hFd=)|PbzTkpO5r`-Hsh`t`>_R6dmG%V}T#7(E(NF!HMr0Q{ zF{!jKxZqL*;)#Ch=QJX_(1}T Date: Thu, 6 Apr 2017 10:53:57 -0700 Subject: [PATCH 243/461] Correct use of ProtoBuf.js 6 message encoding API --- src/node/src/protobuf_js_6_common.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/node/src/protobuf_js_6_common.js b/src/node/src/protobuf_js_6_common.js index 21eddabaa8a..00f11f27363 100644 --- a/src/node/src/protobuf_js_6_common.js +++ b/src/node/src/protobuf_js_6_common.js @@ -77,11 +77,7 @@ exports.serializeCls = function serializeCls(cls) { * @return {Buffer} The serialized object */ return function serialize(arg) { - var errMsg = cls.verify(arg); - if (errMsg) { - throw Error(errMsg); - } - var message = cls.create(arg); + var message = cls.fromObject(arg); return cls.encode(message).finish(); }; }; From fc8d671ec8b2ad977d2df6c712e2a08ab13e16ca Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 6 Apr 2017 11:39:21 -0700 Subject: [PATCH 244/461] Fix posix leakage --- include/grpc/impl/codegen/grpc_types.h | 8 ++++++++ src/core/lib/iomgr/tcp_posix.h | 10 ---------- test/core/end2end/fixtures/h2_sockpair_1byte.c | 1 - test/core/iomgr/endpoint_pair_test.c | 1 - test/core/security/secure_endpoint_test.c | 1 - 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index 8a8b20650fa..fdedf0a84f3 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -271,6 +271,14 @@ typedef struct { * possible. */ #define GRPC_ARG_USE_CRONET_PACKET_COALESCING \ "grpc.use_cronet_packet_coalescing" +/* Channel arg (integer) setting how large a slice to try and read from the wire +each time recvmsg (or equivalent) is called */ +#define GRPC_ARG_TCP_READ_CHUNK_SIZE "grpc.experimental.tcp_read_chunk_size" +#define GRPC_TCP_DEFAULT_READ_SLICE_SIZE 8192 +#define GRPC_ARG_TCP_MIN_READ_CHUNK_SIZE \ + "grpc.experimental.tcp_min_read_chunk_size" +#define GRPC_ARG_TCP_MAX_READ_CHUNK_SIZE \ + "grpc.experimental.tcp_max_read_chunk_size" /** \} */ /** Result of a grpc call. If the caller satisfies the prerequisites of a diff --git a/src/core/lib/iomgr/tcp_posix.h b/src/core/lib/iomgr/tcp_posix.h index 3bf93dfcf85..1ad5788331f 100644 --- a/src/core/lib/iomgr/tcp_posix.h +++ b/src/core/lib/iomgr/tcp_posix.h @@ -47,16 +47,6 @@ #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/ev_posix.h" -#define GRPC_TCP_DEFAULT_READ_SLICE_SIZE 8192 - -/* Channel arg (integer) setting how large a slice to try and read from the wire - each time recvmsg (or equivalent) is called */ -#define GRPC_ARG_TCP_READ_CHUNK_SIZE "grpc.experimental.tcp_read_chunk_size" -#define GRPC_ARG_TCP_MIN_READ_CHUNK_SIZE \ - "grpc.experimental.tcp_min_read_chunk_size" -#define GRPC_ARG_TCP_MAX_READ_CHUNK_SIZE \ - "grpc.experimental.tcp_max_read_chunk_size" - extern int grpc_tcp_trace; /* Create a tcp endpoint given a file desciptor and a read slice size. diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.c b/test/core/end2end/fixtures/h2_sockpair_1byte.c index 2b87602adb6..04174fa5015 100644 --- a/test/core/end2end/fixtures/h2_sockpair_1byte.c +++ b/test/core/end2end/fixtures/h2_sockpair_1byte.c @@ -48,7 +48,6 @@ #include "src/core/lib/channel/http_server_filter.h" #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/iomgr/iomgr.h" -#include "src/core/lib/iomgr/tcp_posix.h" #include "src/core/lib/surface/channel.h" #include "src/core/lib/surface/completion_queue.h" #include "src/core/lib/surface/server.h" diff --git a/test/core/iomgr/endpoint_pair_test.c b/test/core/iomgr/endpoint_pair_test.c index 491b05f41fd..c8a60776b9c 100644 --- a/test/core/iomgr/endpoint_pair_test.c +++ b/test/core/iomgr/endpoint_pair_test.c @@ -37,7 +37,6 @@ #include #include #include -#include "src/core/lib/iomgr/tcp_posix.h" #include "test/core/iomgr/endpoint_tests.h" #include "test/core/util/test_config.h" diff --git a/test/core/security/secure_endpoint_test.c b/test/core/security/secure_endpoint_test.c index f6691f8adcd..71d8057ac31 100644 --- a/test/core/security/secure_endpoint_test.c +++ b/test/core/security/secure_endpoint_test.c @@ -42,7 +42,6 @@ #include #include "src/core/lib/iomgr/endpoint_pair.h" #include "src/core/lib/iomgr/iomgr.h" -#include "src/core/lib/iomgr/tcp_posix.h" #include "src/core/lib/security/transport/secure_endpoint.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/tsi/fake_transport_security.h" From 3569a76dc5f25ddf84b791a1073021cd90aa674d Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 6 Apr 2017 11:47:10 -0700 Subject: [PATCH 245/461] Explicitly include atm to fix Windows build --- src/core/lib/iomgr/lockfree_event.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/lib/iomgr/lockfree_event.h b/src/core/lib/iomgr/lockfree_event.h index 32eb7554f96..1d9119204ca 100644 --- a/src/core/lib/iomgr/lockfree_event.h +++ b/src/core/lib/iomgr/lockfree_event.h @@ -36,6 +36,8 @@ /* Lock free event notification for file descriptors */ +#include + #include "src/core/lib/iomgr/exec_ctx.h" void grpc_lfev_init(gpr_atm *state); From e1bfff0bbedd5c0b973e5a08839a957183e006de Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Thu, 6 Apr 2017 13:17:20 -0700 Subject: [PATCH 246/461] Fix test after merge --- test/core/end2end/tests/bad_ping.c | 1 + 1 file changed, 1 insertion(+) diff --git a/test/core/end2end/tests/bad_ping.c b/test/core/end2end/tests/bad_ping.c index 01a6aeaa04f..38cd1dfa843 100644 --- a/test/core/end2end/tests/bad_ping.c +++ b/test/core/end2end/tests/bad_ping.c @@ -75,6 +75,7 @@ static void end_test(grpc_end2end_test_fixture *f) { grpc_completion_queue_shutdown(f->cq); drain_cq(f->cq); grpc_completion_queue_destroy(f->cq); + grpc_completion_queue_destroy(f->shutdown_cq); } static void test_bad_ping(grpc_end2end_test_config config) { From 7b6c7a3927f75704cb3f7f02024f284b6817405a Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 6 Apr 2017 13:27:31 -0700 Subject: [PATCH 247/461] Fix include guards --- .../http/message_compress/message_compress_filter.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/ext/filters/http/message_compress/message_compress_filter.h b/src/core/ext/filters/http/message_compress/message_compress_filter.h index d80d3a79ca6..75bfa17fba3 100644 --- a/src/core/ext/filters/http/message_compress/message_compress_filter.h +++ b/src/core/ext/filters/http/message_compress/message_compress_filter.h @@ -31,8 +31,8 @@ * */ -#ifndef GRPC_CORE_EXT_FILTERS_HTTP_COMPRESS_COMPRESS_FILTER_H -#define GRPC_CORE_EXT_FILTERS_HTTP_COMPRESS_COMPRESS_FILTER_H +#ifndef GRPC_CORE_EXT_FILTERS_HTTP_MESSAGE_COMPRESS_MESSAGE_COMPRESS_FILTER_H +#define GRPC_CORE_EXT_FILTERS_HTTP_MESSAGE_COMPRESS_MESSAGE_COMPRESS_FILTER_H #include @@ -64,4 +64,5 @@ extern int grpc_compression_trace; extern const grpc_channel_filter grpc_message_compress_filter; -#endif /* GRPC_CORE_EXT_FILTERS_HTTP_COMPRESS_COMPRESS_FILTER_H */ +#endif /* GRPC_CORE_EXT_FILTERS_HTTP_MESSAGE_COMPRESS_MESSAGE_COMPRESS_FILTER_H \ + */ From 975b5103e5037e3b9fc1bde02740b568cadeb2c5 Mon Sep 17 00:00:00 2001 From: Ken Payson Date: Thu, 30 Mar 2017 17:38:40 -0700 Subject: [PATCH 248/461] Fix build on Alpine linux + add portability tests --- CMakeLists.txt | 462 +++++++++--------- Makefile | 4 +- include/grpc/impl/codegen/port_platform.h | 6 +- src/core/ext/census/grpc_plugin.c | 2 + .../client_channel/client_channel_plugin.c | 2 + .../filters/load_reporting/load_reporting.c | 2 + src/core/lib/iomgr/ev_epoll_linux.c | 2 +- src/core/lib/iomgr/port.h | 4 + src/core/lib/support/cpu_linux.c | 5 + src/core/lib/support/wrap_memcpy.c | 2 +- src/core/lib/surface/init_secure.c | 2 + templates/CMakeLists.txt.template | 10 +- templates/Makefile.template | 4 +- .../core/end2end/invalid_call_argument_test.c | 2 + test/core/iomgr/sockaddr_utils_test.c | 2 - third_party/googletest | 2 +- third_party/gtest.BUILD | 7 +- third_party/protobuf | 2 +- .../python/grpcio_tools/protoc_lib_deps.py | 2 +- .../dockerfile/test/cxx_alpine_x64/Dockerfile | 72 +++ .../test/python_alpine_x64/Dockerfile | 67 +++ .../run_tests/helper_scripts/build_python.sh | 2 +- tools/run_tests/helper_scripts/run_python.sh | 2 +- tools/run_tests/run_tests.py | 15 +- tools/run_tests/run_tests_matrix.py | 13 +- tools/run_tests/sanity/check_submodules.sh | 4 +- 26 files changed, 439 insertions(+), 260 deletions(-) create mode 100644 tools/dockerfile/test/cxx_alpine_x64/Dockerfile create mode 100644 tools/dockerfile/test/python_alpine_x64/Dockerfile diff --git a/CMakeLists.txt b/CMakeLists.txt index acf47e5bfec..6c376ef0d9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2932,8 +2932,8 @@ target_include_directories(grpc++_proto_reflection_desc_db PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -3051,8 +3051,8 @@ target_include_directories(grpc++_test_config PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -3128,8 +3128,8 @@ target_include_directories(grpc++_test_util PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -3560,8 +3560,8 @@ target_include_directories(grpc_benchmark PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -3619,8 +3619,8 @@ target_include_directories(grpc_cli_libs PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -3758,8 +3758,8 @@ target_include_directories(http2_client_main PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -3813,8 +3813,8 @@ target_include_directories(interop_client_helper PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -3883,8 +3883,8 @@ target_include_directories(interop_client_main PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -3934,8 +3934,8 @@ target_include_directories(interop_server_helper PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -4003,8 +4003,8 @@ target_include_directories(interop_server_lib PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -4054,8 +4054,8 @@ target_include_directories(interop_server_main PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -4142,8 +4142,8 @@ target_include_directories(qps PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -8605,7 +8605,7 @@ if (gRPC_BUILD_TESTS) add_executable(alarm_cpp_test test/cpp/common/alarm_cpp_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -8622,8 +8622,8 @@ target_include_directories(alarm_cpp_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -8644,7 +8644,7 @@ if (gRPC_BUILD_TESTS) add_executable(async_end2end_test test/cpp/end2end/async_end2end_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -8661,8 +8661,8 @@ target_include_directories(async_end2end_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -8683,7 +8683,7 @@ if (gRPC_BUILD_TESTS) add_executable(auth_property_iterator_test test/cpp/common/auth_property_iterator_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -8700,8 +8700,8 @@ target_include_directories(auth_property_iterator_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -8723,7 +8723,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(bm_arena test/cpp/microbenchmarks/bm_arena.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -8740,8 +8740,8 @@ target_include_directories(bm_arena PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -8766,7 +8766,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(bm_call_create test/cpp/microbenchmarks/bm_call_create.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -8783,8 +8783,8 @@ target_include_directories(bm_call_create PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -8809,7 +8809,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(bm_chttp2_hpack test/cpp/microbenchmarks/bm_chttp2_hpack.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -8826,8 +8826,8 @@ target_include_directories(bm_chttp2_hpack PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -8852,7 +8852,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(bm_chttp2_transport test/cpp/microbenchmarks/bm_chttp2_transport.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -8869,8 +8869,8 @@ target_include_directories(bm_chttp2_transport PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -8895,7 +8895,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(bm_closure test/cpp/microbenchmarks/bm_closure.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -8912,8 +8912,8 @@ target_include_directories(bm_closure PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -8938,7 +8938,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(bm_cq test/cpp/microbenchmarks/bm_cq.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -8955,8 +8955,8 @@ target_include_directories(bm_cq PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -8981,7 +8981,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(bm_error test/cpp/microbenchmarks/bm_error.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -8998,8 +8998,8 @@ target_include_directories(bm_error PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -9024,7 +9024,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(bm_fullstack_streaming_ping_pong test/cpp/microbenchmarks/bm_fullstack_streaming_ping_pong.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -9041,8 +9041,8 @@ target_include_directories(bm_fullstack_streaming_ping_pong PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -9067,7 +9067,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(bm_fullstack_streaming_pump test/cpp/microbenchmarks/bm_fullstack_streaming_pump.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -9084,8 +9084,8 @@ target_include_directories(bm_fullstack_streaming_pump PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -9110,7 +9110,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(bm_fullstack_trickle test/cpp/microbenchmarks/bm_fullstack_trickle.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -9127,8 +9127,8 @@ target_include_directories(bm_fullstack_trickle PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -9153,7 +9153,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(bm_fullstack_unary_ping_pong test/cpp/microbenchmarks/bm_fullstack_unary_ping_pong.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -9170,8 +9170,8 @@ target_include_directories(bm_fullstack_unary_ping_pong PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -9196,7 +9196,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(bm_metadata test/cpp/microbenchmarks/bm_metadata.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -9213,8 +9213,8 @@ target_include_directories(bm_metadata PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -9239,7 +9239,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(bm_pollset test/cpp/microbenchmarks/bm_pollset.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -9256,8 +9256,8 @@ target_include_directories(bm_pollset PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -9281,7 +9281,7 @@ if (gRPC_BUILD_TESTS) add_executable(channel_arguments_test test/cpp/common/channel_arguments_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -9298,8 +9298,8 @@ target_include_directories(channel_arguments_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -9317,7 +9317,7 @@ if (gRPC_BUILD_TESTS) add_executable(channel_filter_test test/cpp/common/channel_filter_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -9334,8 +9334,8 @@ target_include_directories(channel_filter_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -9353,7 +9353,7 @@ if (gRPC_BUILD_TESTS) add_executable(cli_call_test test/cpp/util/cli_call_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -9370,8 +9370,8 @@ target_include_directories(cli_call_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -9394,7 +9394,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(client_crash_test test/cpp/end2end/client_crash_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -9411,8 +9411,8 @@ target_include_directories(client_crash_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -9434,7 +9434,7 @@ if (gRPC_BUILD_TESTS) add_executable(client_crash_test_server test/cpp/end2end/client_crash_test_server.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -9451,8 +9451,8 @@ target_include_directories(client_crash_test_server PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -9493,7 +9493,7 @@ add_executable(codegen_test_full ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/stats.pb.h ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/stats.grpc.pb.h test/cpp/codegen/codegen_test_full.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) protobuf_generate_grpc_cpp( @@ -9525,8 +9525,8 @@ target_include_directories(codegen_test_full PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -9565,7 +9565,7 @@ add_executable(codegen_test_minimal ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/stats.grpc.pb.h test/cpp/codegen/codegen_test_minimal.cc src/cpp/codegen/codegen_init.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) protobuf_generate_grpc_cpp( @@ -9597,8 +9597,8 @@ target_include_directories(codegen_test_minimal PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -9613,7 +9613,7 @@ if (gRPC_BUILD_TESTS) add_executable(credentials_test test/cpp/client/credentials_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -9630,8 +9630,8 @@ target_include_directories(credentials_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -9649,7 +9649,7 @@ if (gRPC_BUILD_TESTS) add_executable(cxx_byte_buffer_test test/cpp/util/byte_buffer_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -9666,8 +9666,8 @@ target_include_directories(cxx_byte_buffer_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -9687,7 +9687,7 @@ if (gRPC_BUILD_TESTS) add_executable(cxx_slice_test test/cpp/util/slice_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -9704,8 +9704,8 @@ target_include_directories(cxx_slice_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -9725,7 +9725,7 @@ if (gRPC_BUILD_TESTS) add_executable(cxx_string_ref_test test/cpp/util/string_ref_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -9742,8 +9742,8 @@ target_include_directories(cxx_string_ref_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -9759,7 +9759,7 @@ if (gRPC_BUILD_TESTS) add_executable(cxx_time_test test/cpp/util/time_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -9776,8 +9776,8 @@ target_include_directories(cxx_time_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -9797,7 +9797,7 @@ if (gRPC_BUILD_TESTS) add_executable(end2end_test test/cpp/end2end/end2end_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -9814,8 +9814,8 @@ target_include_directories(end2end_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -9836,7 +9836,7 @@ if (gRPC_BUILD_TESTS) add_executable(filter_end2end_test test/cpp/end2end/filter_end2end_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -9853,8 +9853,8 @@ target_include_directories(filter_end2end_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -9875,7 +9875,7 @@ if (gRPC_BUILD_TESTS) add_executable(generic_end2end_test test/cpp/end2end/generic_end2end_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -9892,8 +9892,8 @@ target_include_directories(generic_end2end_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -9918,7 +9918,7 @@ add_executable(golden_file_test ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/compiler_test.pb.h ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/compiler_test.grpc.pb.h test/cpp/codegen/golden_file_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) protobuf_generate_grpc_cpp( @@ -9938,8 +9938,8 @@ target_include_directories(golden_file_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -9957,7 +9957,7 @@ if (gRPC_BUILD_TESTS) add_executable(grpc_cli test/cpp/util/grpc_cli.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -9974,8 +9974,8 @@ target_include_directories(grpc_cli PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -10270,7 +10270,7 @@ add_executable(grpc_tool_test ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo_messages.pb.h ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo_messages.grpc.pb.h test/cpp/util/grpc_tool_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) protobuf_generate_grpc_cpp( @@ -10293,8 +10293,8 @@ target_include_directories(grpc_tool_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -10322,7 +10322,7 @@ add_executable(grpclb_api_test ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v1/load_balancer.pb.h ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v1/load_balancer.grpc.pb.h test/cpp/grpclb/grpclb_api_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) protobuf_generate_grpc_cpp( @@ -10342,8 +10342,8 @@ target_include_directories(grpclb_api_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -10366,7 +10366,7 @@ add_executable(grpclb_test ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v1/load_balancer.pb.h ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/lb/v1/load_balancer.grpc.pb.h test/cpp/grpclb/grpclb_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) protobuf_generate_grpc_cpp( @@ -10386,8 +10386,8 @@ target_include_directories(grpclb_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -10408,7 +10408,7 @@ if (gRPC_BUILD_TESTS) add_executable(health_service_end2end_test test/cpp/end2end/health_service_end2end_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -10425,8 +10425,8 @@ target_include_directories(health_service_end2end_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -10447,7 +10447,7 @@ if (gRPC_BUILD_TESTS) if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(http2_client - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -10464,8 +10464,8 @@ target_include_directories(http2_client PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -10487,7 +10487,7 @@ if (gRPC_BUILD_TESTS) add_executable(hybrid_end2end_test test/cpp/end2end/hybrid_end2end_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -10504,8 +10504,8 @@ target_include_directories(hybrid_end2end_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -10526,7 +10526,7 @@ if (gRPC_BUILD_TESTS) if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(interop_client - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -10543,8 +10543,8 @@ target_include_directories(interop_client PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -10569,7 +10569,7 @@ if (gRPC_BUILD_TESTS) if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(interop_server - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -10586,8 +10586,8 @@ target_include_directories(interop_server PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -10614,7 +10614,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(interop_test test/cpp/interop/interop_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -10631,8 +10631,8 @@ target_include_directories(interop_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -10654,7 +10654,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(json_run_localhost test/cpp/qps/json_run_localhost.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -10671,8 +10671,8 @@ target_include_directories(json_run_localhost PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -10699,7 +10699,7 @@ add_executable(metrics_client ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/metrics.pb.h ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/metrics.grpc.pb.h test/cpp/interop/metrics_client.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) protobuf_generate_grpc_cpp( @@ -10719,8 +10719,8 @@ target_include_directories(metrics_client PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -10739,7 +10739,7 @@ if (gRPC_BUILD_TESTS) add_executable(mock_test test/cpp/end2end/mock_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -10756,8 +10756,8 @@ target_include_directories(mock_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -10778,7 +10778,7 @@ if (gRPC_BUILD_TESTS) add_executable(noop-benchmark test/cpp/microbenchmarks/noop-benchmark.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -10795,8 +10795,8 @@ target_include_directories(noop-benchmark PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -10812,7 +10812,7 @@ if (gRPC_BUILD_TESTS) add_executable(proto_server_reflection_test test/cpp/end2end/proto_server_reflection_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -10829,8 +10829,8 @@ target_include_directories(proto_server_reflection_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -10853,7 +10853,7 @@ if (gRPC_BUILD_TESTS) add_executable(proto_utils_test test/cpp/codegen/proto_utils_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -10870,8 +10870,8 @@ target_include_directories(proto_utils_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -10889,7 +10889,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(qps_interarrival_test test/cpp/qps/qps_interarrival_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -10906,8 +10906,8 @@ target_include_directories(qps_interarrival_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -10930,7 +10930,7 @@ if (gRPC_BUILD_TESTS) add_executable(qps_json_driver test/cpp/qps/qps_json_driver.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -10947,8 +10947,8 @@ target_include_directories(qps_json_driver PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -10972,7 +10972,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(qps_openloop_test test/cpp/qps/qps_openloop_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -10989,8 +10989,8 @@ target_include_directories(qps_openloop_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -11014,7 +11014,7 @@ if (gRPC_BUILD_TESTS) add_executable(qps_worker test/cpp/qps/worker.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -11031,8 +11031,8 @@ target_include_directories(qps_worker PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -11067,7 +11067,7 @@ add_executable(reconnect_interop_client ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/test.pb.h ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/test.grpc.pb.h test/cpp/interop/reconnect_interop_client.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) protobuf_generate_grpc_cpp( @@ -11093,8 +11093,8 @@ target_include_directories(reconnect_interop_client PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -11128,7 +11128,7 @@ add_executable(reconnect_interop_server ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/test.pb.h ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/test.grpc.pb.h test/cpp/interop/reconnect_interop_server.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) protobuf_generate_grpc_cpp( @@ -11154,8 +11154,8 @@ target_include_directories(reconnect_interop_server PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -11179,7 +11179,7 @@ if (gRPC_BUILD_TESTS) add_executable(round_robin_end2end_test test/cpp/end2end/round_robin_end2end_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -11196,8 +11196,8 @@ target_include_directories(round_robin_end2end_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -11218,7 +11218,7 @@ if (gRPC_BUILD_TESTS) add_executable(secure_auth_context_test test/cpp/common/secure_auth_context_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -11235,8 +11235,8 @@ target_include_directories(secure_auth_context_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -11258,7 +11258,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(secure_sync_unary_ping_pong_test test/cpp/qps/secure_sync_unary_ping_pong_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -11275,8 +11275,8 @@ target_include_directories(secure_sync_unary_ping_pong_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -11299,7 +11299,7 @@ if (gRPC_BUILD_TESTS) add_executable(server_builder_plugin_test test/cpp/end2end/server_builder_plugin_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -11316,8 +11316,8 @@ target_include_directories(server_builder_plugin_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -11346,7 +11346,7 @@ add_executable(server_builder_test ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo.pb.h ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo.grpc.pb.h test/cpp/server/server_builder_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) protobuf_generate_grpc_cpp( @@ -11369,8 +11369,8 @@ target_include_directories(server_builder_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -11391,7 +11391,7 @@ if (gRPC_BUILD_TESTS) add_executable(server_context_test_spouse_test test/cpp/test/server_context_test_spouse_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -11408,8 +11408,8 @@ target_include_directories(server_context_test_spouse_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -11430,7 +11430,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(server_crash_test test/cpp/end2end/server_crash_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -11447,8 +11447,8 @@ target_include_directories(server_crash_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -11470,7 +11470,7 @@ if (gRPC_BUILD_TESTS) add_executable(server_crash_test_client test/cpp/end2end/server_crash_test_client.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -11487,8 +11487,8 @@ target_include_directories(server_crash_test_client PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -11509,7 +11509,7 @@ if (gRPC_BUILD_TESTS) add_executable(shutdown_test test/cpp/end2end/shutdown_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -11526,8 +11526,8 @@ target_include_directories(shutdown_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -11548,7 +11548,7 @@ if (gRPC_BUILD_TESTS) add_executable(status_test test/cpp/util/status_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -11565,8 +11565,8 @@ target_include_directories(status_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -11587,7 +11587,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(streaming_throughput_test test/cpp/end2end/streaming_throughput_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -11604,8 +11604,8 @@ target_include_directories(streaming_throughput_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -11646,7 +11646,7 @@ add_executable(stress_test test/cpp/interop/stress_interop_client.cc test/cpp/interop/stress_test.cc test/cpp/util/metrics_server.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) protobuf_generate_grpc_cpp( @@ -11675,8 +11675,8 @@ target_include_directories(stress_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -11698,7 +11698,7 @@ if (gRPC_BUILD_TESTS) add_executable(thread_manager_test test/cpp/thread_manager/thread_manager_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -11715,8 +11715,8 @@ target_include_directories(thread_manager_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -11735,7 +11735,7 @@ if (gRPC_BUILD_TESTS) add_executable(thread_stress_test test/cpp/end2end/thread_stress_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -11752,8 +11752,8 @@ target_include_directories(thread_stress_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) @@ -11775,7 +11775,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(writes_per_rpc_test test/cpp/performance/writes_per_rpc_test.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -11792,8 +11792,8 @@ target_include_directories(writes_per_rpc_test PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) diff --git a/Makefile b/Makefile index 5ad05570f93..5070c1d2253 100644 --- a/Makefile +++ b/Makefile @@ -409,7 +409,7 @@ AROPTS = $(GRPC_CROSS_AROPTS) # e.g., rc --target=elf32-little USE_BUILT_PROTOC = false endif -GTEST_LIB = -Ithird_party/googletest/include -Ithird_party/googletest third_party/googletest/src/gtest-all.cc +GTEST_LIB = -Ithird_party/googletest/googletest/include -Ithird_party/googletest/googletest third_party/googletest/googletest/src/gtest-all.cc GTEST_LIB += -lgflags ifeq ($(V),1) E = @: @@ -784,7 +784,7 @@ PROTOBUF_PKG_CONFIG = false PC_REQUIRES_GRPCXX = PC_LIBS_GRPCXX = -CPPFLAGS := -Ithird_party/googletest/include $(CPPFLAGS) +CPPFLAGS := -Ithird_party/googletest/googletest/include $(CPPFLAGS) PROTOC_PLUGINS_ALL = $(BINDIR)/$(CONFIG)/grpc_cpp_plugin $(BINDIR)/$(CONFIG)/grpc_csharp_plugin $(BINDIR)/$(CONFIG)/grpc_node_plugin $(BINDIR)/$(CONFIG)/grpc_objective_c_plugin $(BINDIR)/$(CONFIG)/grpc_php_plugin $(BINDIR)/$(CONFIG)/grpc_python_plugin $(BINDIR)/$(CONFIG)/grpc_ruby_plugin PROTOC_PLUGINS_DIR = $(BINDIR)/$(CONFIG) diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h index d525083cd04..813e08b86e3 100644 --- a/include/grpc/impl/codegen/port_platform.h +++ b/include/grpc/impl/codegen/port_platform.h @@ -157,7 +157,6 @@ #define GPR_GETPID_IN_UNISTD_H 1 #define GPR_SUPPORT_CHANNELS_FROM_FD 1 #elif defined(__linux__) -#define GPR_POSIX_CRASH_HANDLER 1 #define GPR_PLATFORM_STRING "linux" #ifndef _BSD_SOURCE #define _BSD_SOURCE @@ -187,6 +186,11 @@ #else /* _LP64 */ #define GPR_ARCH_32 1 #endif /* _LP64 */ +#ifdef __GLIBC__ +#define GPR_POSIX_CRASH_HANDLER 1 +#else /* musl libc */ +#define GRPC_MSG_IOVLEN_TYPE int +#endif #elif defined(__APPLE__) #include #include diff --git a/src/core/ext/census/grpc_plugin.c b/src/core/ext/census/grpc_plugin.c index 28d266e22ae..7d0c9f14ae6 100644 --- a/src/core/ext/census/grpc_plugin.c +++ b/src/core/ext/census/grpc_plugin.c @@ -31,6 +31,8 @@ * */ +#include + #include #include diff --git a/src/core/ext/filters/client_channel/client_channel_plugin.c b/src/core/ext/filters/client_channel/client_channel_plugin.c index 944af01af46..a68c01c2227 100644 --- a/src/core/ext/filters/client_channel/client_channel_plugin.c +++ b/src/core/ext/filters/client_channel/client_channel_plugin.c @@ -31,6 +31,8 @@ * */ +#include + #include #include #include diff --git a/src/core/ext/filters/load_reporting/load_reporting.c b/src/core/ext/filters/load_reporting/load_reporting.c index 9fb33bab711..f4dac15a604 100644 --- a/src/core/ext/filters/load_reporting/load_reporting.c +++ b/src/core/ext/filters/load_reporting/load_reporting.c @@ -31,6 +31,8 @@ * */ +#include + #include #include diff --git a/src/core/lib/iomgr/ev_epoll_linux.c b/src/core/lib/iomgr/ev_epoll_linux.c index e5cf54f10a9..1433c30f271 100644 --- a/src/core/lib/iomgr/ev_epoll_linux.c +++ b/src/core/lib/iomgr/ev_epoll_linux.c @@ -1333,7 +1333,7 @@ static grpc_error *pollset_worker_kick(grpc_pollset_worker *worker) { if (gpr_atm_no_barrier_cas(&worker->is_kicked, (gpr_atm)0, (gpr_atm)1)) { GRPC_POLLING_TRACE( "pollset_worker_kick: Kicking worker: %p (thread id: %ld)", - (void *)worker, worker->pt_id); + (void *)worker, (long int)worker->pt_id); int err_num = pthread_kill(worker->pt_id, grpc_wakeup_signal); if (err_num != 0) { err = GRPC_OS_ERROR(err_num, "pthread_kill"); diff --git a/src/core/lib/iomgr/port.h b/src/core/lib/iomgr/port.h index 94a454c0b7c..269dc35003e 100644 --- a/src/core/lib/iomgr/port.h +++ b/src/core/lib/iomgr/port.h @@ -85,6 +85,10 @@ #define GRPC_LINUX_SOCKETUTILS 1 #endif #endif +#ifndef __GLIBC__ +#define GRPC_LINUX_EPOLL 1 +#define GRPC_LINUX_EVENTFD 1 +#endif #ifndef GRPC_LINUX_EVENTFD #define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1 #endif diff --git a/src/core/lib/support/cpu_linux.c b/src/core/lib/support/cpu_linux.c index d6f7e7d3da6..1e50f59823f 100644 --- a/src/core/lib/support/cpu_linux.c +++ b/src/core/lib/support/cpu_linux.c @@ -67,12 +67,17 @@ unsigned gpr_cpu_num_cores(void) { } unsigned gpr_cpu_current_cpu(void) { +#ifdef __GLIBC__ int cpu = sched_getcpu(); if (cpu < 0) { gpr_log(GPR_ERROR, "Error determining current CPU: %s\n", strerror(errno)); return 0; } return (unsigned)cpu; +#else + // sched_getcpu() is undefined on musl + return 0; +#endif } #endif /* GPR_CPU_LINUX */ diff --git a/src/core/lib/support/wrap_memcpy.c b/src/core/lib/support/wrap_memcpy.c index 15c289f7b8b..050cc6db5ec 100644 --- a/src/core/lib/support/wrap_memcpy.c +++ b/src/core/lib/support/wrap_memcpy.c @@ -40,7 +40,7 @@ */ #ifdef __linux__ -#ifdef __x86_64__ +#if defined(__x86_64__) && defined(__GNU_LIBRARY__) __asm__(".symver memcpy,memcpy@GLIBC_2.2.5"); void *__wrap_memcpy(void *destination, const void *source, size_t num) { return memcpy(destination, source, num); diff --git a/src/core/lib/surface/init_secure.c b/src/core/lib/surface/init_secure.c index 921ef87e366..746134676f8 100644 --- a/src/core/lib/surface/init_secure.c +++ b/src/core/lib/surface/init_secure.c @@ -31,6 +31,8 @@ * */ +#include + #include "src/core/lib/surface/init.h" #include diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index e2fc216bca7..e7fd0e6d544 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -511,8 +511,8 @@ PRIVATE <%text>${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE <%text>${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include % if lib.build in ['test', 'private'] and lib.language == 'c++': - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest % endif % if lib.language == 'c++': PRIVATE <%text>${_gRPC_PROTO_GENS_DIR} @@ -555,7 +555,7 @@ % endif % endfor % if tgt.build == 'test' and tgt.language == 'c++': - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc % endif ) @@ -581,8 +581,8 @@ PRIVATE <%text>${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE <%text>${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include % if tgt.build in ['test', 'private'] and tgt.language == 'c++': - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest % endif % if tgt.language == 'c++': PRIVATE <%text>${_gRPC_PROTO_GENS_DIR} diff --git a/templates/Makefile.template b/templates/Makefile.template index 60362b6e43a..8f61a8b9907 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -311,7 +311,7 @@ USE_BUILT_PROTOC = false endif - GTEST_LIB = -Ithird_party/googletest/include -Ithird_party/googletest third_party/googletest/src/gtest-all.cc + GTEST_LIB = -Ithird_party/googletest/googletest/include -Ithird_party/googletest/googletest third_party/googletest/googletest/src/gtest-all.cc GTEST_LIB += -lgflags ifeq ($(V),1) E = @: @@ -716,7 +716,7 @@ PC_REQUIRES_GRPCXX = PC_LIBS_GRPCXX = - CPPFLAGS := -Ithird_party/googletest/include $(CPPFLAGS) + CPPFLAGS := -Ithird_party/googletest/googletest/include $(CPPFLAGS) PROTOC_PLUGINS_ALL =\ % for tgt in targets: diff --git a/test/core/end2end/invalid_call_argument_test.c b/test/core/end2end/invalid_call_argument_test.c index 2a9072570d3..bfd8e6fefa3 100644 --- a/test/core/end2end/invalid_call_argument_test.c +++ b/test/core/end2end/invalid_call_argument_test.c @@ -31,6 +31,8 @@ * */ +#include + #include #include diff --git a/test/core/iomgr/sockaddr_utils_test.c b/test/core/iomgr/sockaddr_utils_test.c index 70a6c323e57..09c514c8e6f 100644 --- a/test/core/iomgr/sockaddr_utils_test.c +++ b/test/core/iomgr/sockaddr_utils_test.c @@ -254,8 +254,6 @@ static void test_sockaddr_to_string(void) { expect_sockaddr_str("(sockaddr family=123)", &dummy, 0); expect_sockaddr_str("(sockaddr family=123)", &dummy, 1); GPR_ASSERT(grpc_sockaddr_to_uri(&dummy) == NULL); - - GPR_ASSERT(errno == 0x7EADBEEF); } static void test_sockaddr_set_get_port(void) { diff --git a/third_party/googletest b/third_party/googletest index c99458533a9..ec44c6c1675 160000 --- a/third_party/googletest +++ b/third_party/googletest @@ -1 +1 @@ -Subproject commit c99458533a9b4c743ed51537e25989ea55944908 +Subproject commit ec44c6c1675c25b9827aacd08c02433cccde7780 diff --git a/third_party/gtest.BUILD b/third_party/gtest.BUILD index a07db65b91b..52c9ca2ba7c 100644 --- a/third_party/gtest.BUILD +++ b/third_party/gtest.BUILD @@ -1,11 +1,12 @@ cc_library( name = "gtest", srcs = [ - "src/gtest-all.cc", + "googletest/src/gtest-all.cc", ], - hdrs = glob(["include/**/*.h", "src/*.cc", "src/*.h"]), + hdrs = glob(["googletest/include/**/*.h", "googletest/src/*.cc", "googletest/src/*.h"]), includes = [ - "include", + "googletest", + "googletest/include", ], linkstatic = 1, visibility = [ diff --git a/third_party/protobuf b/third_party/protobuf index 593e917c176..4a0dd03e52e 160000 --- a/third_party/protobuf +++ b/third_party/protobuf @@ -1 +1 @@ -Subproject commit 593e917c176b5bc5aafa57bf9f6030d749d91cd5 +Subproject commit 4a0dd03e52e09332c8fd0f8f26a8e0ae9f911182 diff --git a/tools/distrib/python/grpcio_tools/protoc_lib_deps.py b/tools/distrib/python/grpcio_tools/protoc_lib_deps.py index c2aa6198b3d..7e8cd987d5d 100644 --- a/tools/distrib/python/grpcio_tools/protoc_lib_deps.py +++ b/tools/distrib/python/grpcio_tools/protoc_lib_deps.py @@ -29,7 +29,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # AUTO-GENERATED BY make_grpcio_tools.py! -CC_FILES=['google/protobuf/compiler/zip_writer.cc', 'google/protobuf/compiler/subprocess.cc', 'google/protobuf/compiler/ruby/ruby_generator.cc', 'google/protobuf/compiler/python/python_generator.cc', 'google/protobuf/compiler/plugin.pb.cc', 'google/protobuf/compiler/plugin.cc', 'google/protobuf/compiler/php/php_generator.cc', 'google/protobuf/compiler/objectivec/objectivec_primitive_field.cc', 'google/protobuf/compiler/objectivec/objectivec_oneof.cc', 'google/protobuf/compiler/objectivec/objectivec_message_field.cc', 'google/protobuf/compiler/objectivec/objectivec_message.cc', 'google/protobuf/compiler/objectivec/objectivec_map_field.cc', 'google/protobuf/compiler/objectivec/objectivec_helpers.cc', 'google/protobuf/compiler/objectivec/objectivec_generator.cc', 'google/protobuf/compiler/objectivec/objectivec_file.cc', 'google/protobuf/compiler/objectivec/objectivec_field.cc', 'google/protobuf/compiler/objectivec/objectivec_extension.cc', 'google/protobuf/compiler/objectivec/objectivec_enum_field.cc', 'google/protobuf/compiler/objectivec/objectivec_enum.cc', 'google/protobuf/compiler/js/well_known_types_embed.cc', 'google/protobuf/compiler/js/js_generator.cc', 'google/protobuf/compiler/javanano/javanano_primitive_field.cc', 'google/protobuf/compiler/javanano/javanano_message_field.cc', 'google/protobuf/compiler/javanano/javanano_message.cc', 'google/protobuf/compiler/javanano/javanano_map_field.cc', 'google/protobuf/compiler/javanano/javanano_helpers.cc', 'google/protobuf/compiler/javanano/javanano_generator.cc', 'google/protobuf/compiler/javanano/javanano_file.cc', 'google/protobuf/compiler/javanano/javanano_field.cc', 'google/protobuf/compiler/javanano/javanano_extension.cc', 'google/protobuf/compiler/javanano/javanano_enum_field.cc', 'google/protobuf/compiler/javanano/javanano_enum.cc', 'google/protobuf/compiler/java/java_string_field_lite.cc', 'google/protobuf/compiler/java/java_string_field.cc', 'google/protobuf/compiler/java/java_shared_code_generator.cc', 'google/protobuf/compiler/java/java_service.cc', 'google/protobuf/compiler/java/java_primitive_field_lite.cc', 'google/protobuf/compiler/java/java_primitive_field.cc', 'google/protobuf/compiler/java/java_name_resolver.cc', 'google/protobuf/compiler/java/java_message_lite.cc', 'google/protobuf/compiler/java/java_message_field_lite.cc', 'google/protobuf/compiler/java/java_message_field.cc', 'google/protobuf/compiler/java/java_message_builder_lite.cc', 'google/protobuf/compiler/java/java_message_builder.cc', 'google/protobuf/compiler/java/java_message.cc', 'google/protobuf/compiler/java/java_map_field_lite.cc', 'google/protobuf/compiler/java/java_map_field.cc', 'google/protobuf/compiler/java/java_lazy_message_field_lite.cc', 'google/protobuf/compiler/java/java_lazy_message_field.cc', 'google/protobuf/compiler/java/java_helpers.cc', 'google/protobuf/compiler/java/java_generator_factory.cc', 'google/protobuf/compiler/java/java_generator.cc', 'google/protobuf/compiler/java/java_file.cc', 'google/protobuf/compiler/java/java_field.cc', 'google/protobuf/compiler/java/java_extension_lite.cc', 'google/protobuf/compiler/java/java_extension.cc', 'google/protobuf/compiler/java/java_enum_lite.cc', 'google/protobuf/compiler/java/java_enum_field_lite.cc', 'google/protobuf/compiler/java/java_enum_field.cc', 'google/protobuf/compiler/java/java_enum.cc', 'google/protobuf/compiler/java/java_doc_comment.cc', 'google/protobuf/compiler/java/java_context.cc', 'google/protobuf/compiler/csharp/csharp_wrapper_field.cc', 'google/protobuf/compiler/csharp/csharp_source_generator_base.cc', 'google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc', 'google/protobuf/compiler/csharp/csharp_repeated_message_field.cc', 'google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc', 'google/protobuf/compiler/csharp/csharp_reflection_class.cc', 'google/protobuf/compiler/csharp/csharp_primitive_field.cc', 'google/protobuf/compiler/csharp/csharp_message_field.cc', 'google/protobuf/compiler/csharp/csharp_message.cc', 'google/protobuf/compiler/csharp/csharp_map_field.cc', 'google/protobuf/compiler/csharp/csharp_helpers.cc', 'google/protobuf/compiler/csharp/csharp_generator.cc', 'google/protobuf/compiler/csharp/csharp_field_base.cc', 'google/protobuf/compiler/csharp/csharp_enum_field.cc', 'google/protobuf/compiler/csharp/csharp_enum.cc', 'google/protobuf/compiler/csharp/csharp_doc_comment.cc', 'google/protobuf/compiler/cpp/cpp_string_field.cc', 'google/protobuf/compiler/cpp/cpp_service.cc', 'google/protobuf/compiler/cpp/cpp_primitive_field.cc', 'google/protobuf/compiler/cpp/cpp_message_field.cc', 'google/protobuf/compiler/cpp/cpp_message.cc', 'google/protobuf/compiler/cpp/cpp_map_field.cc', 'google/protobuf/compiler/cpp/cpp_helpers.cc', 'google/protobuf/compiler/cpp/cpp_generator.cc', 'google/protobuf/compiler/cpp/cpp_file.cc', 'google/protobuf/compiler/cpp/cpp_field.cc', 'google/protobuf/compiler/cpp/cpp_extension.cc', 'google/protobuf/compiler/cpp/cpp_enum_field.cc', 'google/protobuf/compiler/cpp/cpp_enum.cc', 'google/protobuf/compiler/command_line_interface.cc', 'google/protobuf/compiler/code_generator.cc', 'google/protobuf/wrappers.pb.cc', 'google/protobuf/wire_format.cc', 'google/protobuf/util/type_resolver_util.cc', 'google/protobuf/util/time_util.cc', 'google/protobuf/util/message_differencer.cc', 'google/protobuf/util/json_util.cc', 'google/protobuf/util/internal/utility.cc', 'google/protobuf/util/internal/type_info_test_helper.cc', 'google/protobuf/util/internal/type_info.cc', 'google/protobuf/util/internal/protostream_objectwriter.cc', 'google/protobuf/util/internal/protostream_objectsource.cc', 'google/protobuf/util/internal/proto_writer.cc', 'google/protobuf/util/internal/object_writer.cc', 'google/protobuf/util/internal/json_stream_parser.cc', 'google/protobuf/util/internal/json_objectwriter.cc', 'google/protobuf/util/internal/json_escaping.cc', 'google/protobuf/util/internal/field_mask_utility.cc', 'google/protobuf/util/internal/error_listener.cc', 'google/protobuf/util/internal/default_value_objectwriter.cc', 'google/protobuf/util/internal/datapiece.cc', 'google/protobuf/util/field_mask_util.cc', 'google/protobuf/util/field_comparator.cc', 'google/protobuf/unknown_field_set.cc', 'google/protobuf/type.pb.cc', 'google/protobuf/timestamp.pb.cc', 'google/protobuf/text_format.cc', 'google/protobuf/stubs/substitute.cc', 'google/protobuf/stubs/mathlimits.cc', 'google/protobuf/struct.pb.cc', 'google/protobuf/source_context.pb.cc', 'google/protobuf/service.cc', 'google/protobuf/reflection_ops.cc', 'google/protobuf/message.cc', 'google/protobuf/map_field.cc', 'google/protobuf/io/zero_copy_stream_impl.cc', 'google/protobuf/io/tokenizer.cc', 'google/protobuf/io/strtod.cc', 'google/protobuf/io/printer.cc', 'google/protobuf/io/gzip_stream.cc', 'google/protobuf/generated_message_reflection.cc', 'google/protobuf/field_mask.pb.cc', 'google/protobuf/extension_set_heavy.cc', 'google/protobuf/empty.pb.cc', 'google/protobuf/dynamic_message.cc', 'google/protobuf/duration.pb.cc', 'google/protobuf/descriptor_database.cc', 'google/protobuf/descriptor.pb.cc', 'google/protobuf/descriptor.cc', 'google/protobuf/compiler/parser.cc', 'google/protobuf/compiler/importer.cc', 'google/protobuf/api.pb.cc', 'google/protobuf/any.pb.cc', 'google/protobuf/any.cc', 'google/protobuf/wire_format_lite.cc', 'google/protobuf/stubs/time.cc', 'google/protobuf/stubs/strutil.cc', 'google/protobuf/stubs/structurally_valid.cc', 'google/protobuf/stubs/stringprintf.cc', 'google/protobuf/stubs/stringpiece.cc', 'google/protobuf/stubs/statusor.cc', 'google/protobuf/stubs/status.cc', 'google/protobuf/stubs/once.cc', 'google/protobuf/stubs/int128.cc', 'google/protobuf/stubs/common.cc', 'google/protobuf/stubs/bytestream.cc', 'google/protobuf/stubs/atomicops_internals_x86_msvc.cc', 'google/protobuf/stubs/atomicops_internals_x86_gcc.cc', 'google/protobuf/repeated_field.cc', 'google/protobuf/message_lite.cc', 'google/protobuf/io/zero_copy_stream_impl_lite.cc', 'google/protobuf/io/zero_copy_stream.cc', 'google/protobuf/io/coded_stream.cc', 'google/protobuf/generated_message_util.cc', 'google/protobuf/extension_set.cc', 'google/protobuf/arenastring.cc', 'google/protobuf/arena.cc', 'google/protobuf/compiler/js/embed.cc'] +CC_FILES=['google/protobuf/compiler/zip_writer.cc', 'google/protobuf/compiler/subprocess.cc', 'google/protobuf/compiler/ruby/ruby_generator.cc', 'google/protobuf/compiler/python/python_generator.cc', 'google/protobuf/compiler/plugin.pb.cc', 'google/protobuf/compiler/plugin.cc', 'google/protobuf/compiler/php/php_generator.cc', 'google/protobuf/compiler/objectivec/objectivec_primitive_field.cc', 'google/protobuf/compiler/objectivec/objectivec_oneof.cc', 'google/protobuf/compiler/objectivec/objectivec_message_field.cc', 'google/protobuf/compiler/objectivec/objectivec_message.cc', 'google/protobuf/compiler/objectivec/objectivec_map_field.cc', 'google/protobuf/compiler/objectivec/objectivec_helpers.cc', 'google/protobuf/compiler/objectivec/objectivec_generator.cc', 'google/protobuf/compiler/objectivec/objectivec_file.cc', 'google/protobuf/compiler/objectivec/objectivec_field.cc', 'google/protobuf/compiler/objectivec/objectivec_extension.cc', 'google/protobuf/compiler/objectivec/objectivec_enum_field.cc', 'google/protobuf/compiler/objectivec/objectivec_enum.cc', 'google/protobuf/compiler/js/well_known_types_embed.cc', 'google/protobuf/compiler/js/js_generator.cc', 'google/protobuf/compiler/javanano/javanano_primitive_field.cc', 'google/protobuf/compiler/javanano/javanano_message_field.cc', 'google/protobuf/compiler/javanano/javanano_message.cc', 'google/protobuf/compiler/javanano/javanano_map_field.cc', 'google/protobuf/compiler/javanano/javanano_helpers.cc', 'google/protobuf/compiler/javanano/javanano_generator.cc', 'google/protobuf/compiler/javanano/javanano_file.cc', 'google/protobuf/compiler/javanano/javanano_field.cc', 'google/protobuf/compiler/javanano/javanano_extension.cc', 'google/protobuf/compiler/javanano/javanano_enum_field.cc', 'google/protobuf/compiler/javanano/javanano_enum.cc', 'google/protobuf/compiler/java/java_string_field_lite.cc', 'google/protobuf/compiler/java/java_string_field.cc', 'google/protobuf/compiler/java/java_shared_code_generator.cc', 'google/protobuf/compiler/java/java_service.cc', 'google/protobuf/compiler/java/java_primitive_field_lite.cc', 'google/protobuf/compiler/java/java_primitive_field.cc', 'google/protobuf/compiler/java/java_name_resolver.cc', 'google/protobuf/compiler/java/java_message_lite.cc', 'google/protobuf/compiler/java/java_message_field_lite.cc', 'google/protobuf/compiler/java/java_message_field.cc', 'google/protobuf/compiler/java/java_message_builder_lite.cc', 'google/protobuf/compiler/java/java_message_builder.cc', 'google/protobuf/compiler/java/java_message.cc', 'google/protobuf/compiler/java/java_map_field_lite.cc', 'google/protobuf/compiler/java/java_map_field.cc', 'google/protobuf/compiler/java/java_lazy_message_field_lite.cc', 'google/protobuf/compiler/java/java_lazy_message_field.cc', 'google/protobuf/compiler/java/java_helpers.cc', 'google/protobuf/compiler/java/java_generator_factory.cc', 'google/protobuf/compiler/java/java_generator.cc', 'google/protobuf/compiler/java/java_file.cc', 'google/protobuf/compiler/java/java_field.cc', 'google/protobuf/compiler/java/java_extension_lite.cc', 'google/protobuf/compiler/java/java_extension.cc', 'google/protobuf/compiler/java/java_enum_lite.cc', 'google/protobuf/compiler/java/java_enum_field_lite.cc', 'google/protobuf/compiler/java/java_enum_field.cc', 'google/protobuf/compiler/java/java_enum.cc', 'google/protobuf/compiler/java/java_doc_comment.cc', 'google/protobuf/compiler/java/java_context.cc', 'google/protobuf/compiler/csharp/csharp_wrapper_field.cc', 'google/protobuf/compiler/csharp/csharp_source_generator_base.cc', 'google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc', 'google/protobuf/compiler/csharp/csharp_repeated_message_field.cc', 'google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc', 'google/protobuf/compiler/csharp/csharp_reflection_class.cc', 'google/protobuf/compiler/csharp/csharp_primitive_field.cc', 'google/protobuf/compiler/csharp/csharp_message_field.cc', 'google/protobuf/compiler/csharp/csharp_message.cc', 'google/protobuf/compiler/csharp/csharp_map_field.cc', 'google/protobuf/compiler/csharp/csharp_helpers.cc', 'google/protobuf/compiler/csharp/csharp_generator.cc', 'google/protobuf/compiler/csharp/csharp_field_base.cc', 'google/protobuf/compiler/csharp/csharp_enum_field.cc', 'google/protobuf/compiler/csharp/csharp_enum.cc', 'google/protobuf/compiler/csharp/csharp_doc_comment.cc', 'google/protobuf/compiler/cpp/cpp_string_field.cc', 'google/protobuf/compiler/cpp/cpp_service.cc', 'google/protobuf/compiler/cpp/cpp_primitive_field.cc', 'google/protobuf/compiler/cpp/cpp_message_field.cc', 'google/protobuf/compiler/cpp/cpp_message.cc', 'google/protobuf/compiler/cpp/cpp_map_field.cc', 'google/protobuf/compiler/cpp/cpp_helpers.cc', 'google/protobuf/compiler/cpp/cpp_generator.cc', 'google/protobuf/compiler/cpp/cpp_file.cc', 'google/protobuf/compiler/cpp/cpp_field.cc', 'google/protobuf/compiler/cpp/cpp_extension.cc', 'google/protobuf/compiler/cpp/cpp_enum_field.cc', 'google/protobuf/compiler/cpp/cpp_enum.cc', 'google/protobuf/compiler/command_line_interface.cc', 'google/protobuf/compiler/code_generator.cc', 'google/protobuf/wrappers.pb.cc', 'google/protobuf/wire_format.cc', 'google/protobuf/util/type_resolver_util.cc', 'google/protobuf/util/time_util.cc', 'google/protobuf/util/message_differencer.cc', 'google/protobuf/util/json_util.cc', 'google/protobuf/util/internal/utility.cc', 'google/protobuf/util/internal/type_info_test_helper.cc', 'google/protobuf/util/internal/type_info.cc', 'google/protobuf/util/internal/protostream_objectwriter.cc', 'google/protobuf/util/internal/protostream_objectsource.cc', 'google/protobuf/util/internal/proto_writer.cc', 'google/protobuf/util/internal/object_writer.cc', 'google/protobuf/util/internal/json_stream_parser.cc', 'google/protobuf/util/internal/json_objectwriter.cc', 'google/protobuf/util/internal/json_escaping.cc', 'google/protobuf/util/internal/field_mask_utility.cc', 'google/protobuf/util/internal/error_listener.cc', 'google/protobuf/util/internal/default_value_objectwriter.cc', 'google/protobuf/util/internal/datapiece.cc', 'google/protobuf/util/field_mask_util.cc', 'google/protobuf/util/field_comparator.cc', 'google/protobuf/util/delimited_message_util.cc', 'google/protobuf/unknown_field_set.cc', 'google/protobuf/type.pb.cc', 'google/protobuf/timestamp.pb.cc', 'google/protobuf/text_format.cc', 'google/protobuf/stubs/substitute.cc', 'google/protobuf/stubs/mathlimits.cc', 'google/protobuf/struct.pb.cc', 'google/protobuf/source_context.pb.cc', 'google/protobuf/service.cc', 'google/protobuf/reflection_ops.cc', 'google/protobuf/message.cc', 'google/protobuf/map_field.cc', 'google/protobuf/io/zero_copy_stream_impl.cc', 'google/protobuf/io/tokenizer.cc', 'google/protobuf/io/strtod.cc', 'google/protobuf/io/printer.cc', 'google/protobuf/io/gzip_stream.cc', 'google/protobuf/generated_message_reflection.cc', 'google/protobuf/field_mask.pb.cc', 'google/protobuf/extension_set_heavy.cc', 'google/protobuf/empty.pb.cc', 'google/protobuf/dynamic_message.cc', 'google/protobuf/duration.pb.cc', 'google/protobuf/descriptor_database.cc', 'google/protobuf/descriptor.pb.cc', 'google/protobuf/descriptor.cc', 'google/protobuf/compiler/parser.cc', 'google/protobuf/compiler/importer.cc', 'google/protobuf/api.pb.cc', 'google/protobuf/any.pb.cc', 'google/protobuf/any.cc', 'google/protobuf/wire_format_lite.cc', 'google/protobuf/stubs/time.cc', 'google/protobuf/stubs/strutil.cc', 'google/protobuf/stubs/structurally_valid.cc', 'google/protobuf/stubs/stringprintf.cc', 'google/protobuf/stubs/stringpiece.cc', 'google/protobuf/stubs/statusor.cc', 'google/protobuf/stubs/status.cc', 'google/protobuf/stubs/once.cc', 'google/protobuf/stubs/int128.cc', 'google/protobuf/stubs/common.cc', 'google/protobuf/stubs/bytestream.cc', 'google/protobuf/stubs/atomicops_internals_x86_msvc.cc', 'google/protobuf/stubs/atomicops_internals_x86_gcc.cc', 'google/protobuf/repeated_field.cc', 'google/protobuf/message_lite.cc', 'google/protobuf/io/zero_copy_stream_impl_lite.cc', 'google/protobuf/io/zero_copy_stream.cc', 'google/protobuf/io/coded_stream.cc', 'google/protobuf/generated_message_util.cc', 'google/protobuf/extension_set.cc', 'google/protobuf/arenastring.cc', 'google/protobuf/arena.cc', 'google/protobuf/compiler/js/embed.cc'] PROTO_FILES=['google/protobuf/wrappers.proto', 'google/protobuf/type.proto', 'google/protobuf/timestamp.proto', 'google/protobuf/struct.proto', 'google/protobuf/source_context.proto', 'google/protobuf/field_mask.proto', 'google/protobuf/empty.proto', 'google/protobuf/duration.proto', 'google/protobuf/descriptor.proto', 'google/protobuf/compiler/plugin.proto', 'google/protobuf/api.proto', 'google/protobuf/any.proto'] CC_INCLUDE='third_party/protobuf/src' diff --git a/tools/dockerfile/test/cxx_alpine_x64/Dockerfile b/tools/dockerfile/test/cxx_alpine_x64/Dockerfile new file mode 100644 index 00000000000..f9468757da2 --- /dev/null +++ b/tools/dockerfile/test/cxx_alpine_x64/Dockerfile @@ -0,0 +1,72 @@ +# Copyright 2015, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +FROM alpine:3.3 + +# Install Git and basic packages. +RUN apk update && apk add \ + autoconf \ + automake \ + bzip2 \ + build-base \ + cmake \ + ccache \ + curl \ + gcc \ + git \ + libtool \ + make \ + perl \ + strace \ + python-dev \ + py-pip \ + unzip \ + wget \ + zip + +# Install Python packages from PyPI +RUN pip install pip --upgrade +RUN pip install virtualenv +RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.2.0 six==1.10.0 + +# Prepare ccache +RUN ln -s /usr/bin/ccache /usr/local/bin/gcc +RUN ln -s /usr/bin/ccache /usr/local/bin/g++ +RUN ln -s /usr/bin/ccache /usr/local/bin/cc +RUN ln -s /usr/bin/ccache /usr/local/bin/c++ + +# Install gflags +RUN git clone https://github.com/gflags/gflags.git && cd gflags && git checkout v2.2.0 +RUN cd gflags && cmake . && make && make install +RUN ln -s /usr/local/include/gflags /usr/include/gflags + +RUN mkdir -p /var/local/jenkins + +# Define the default command. +CMD ["bash"] diff --git a/tools/dockerfile/test/python_alpine_x64/Dockerfile b/tools/dockerfile/test/python_alpine_x64/Dockerfile new file mode 100644 index 00000000000..bdffbd35982 --- /dev/null +++ b/tools/dockerfile/test/python_alpine_x64/Dockerfile @@ -0,0 +1,67 @@ +# Copyright 2015, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +FROM alpine:3.3 + +# Install Git and basic packages. +RUN apk update && apk add \ + autoconf \ + automake \ + bzip2 \ + build-base \ + cmake \ + ccache \ + curl \ + gcc \ + git \ + libtool \ + make \ + perl \ + strace \ + python-dev \ + py-pip \ + unzip \ + wget \ + zip + +# Install Python packages from PyPI +RUN pip install pip --upgrade +RUN pip install virtualenv +RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.2.0 six==1.10.0 + +# Prepare ccache +RUN ln -s /usr/bin/ccache /usr/local/bin/gcc +RUN ln -s /usr/bin/ccache /usr/local/bin/g++ +RUN ln -s /usr/bin/ccache /usr/local/bin/cc +RUN ln -s /usr/bin/ccache /usr/local/bin/c++ + +RUN mkdir -p /var/local/jenkins + +# Define the default command. +CMD ["bash"] diff --git a/tools/run_tests/helper_scripts/build_python.sh b/tools/run_tests/helper_scripts/build_python.sh index 5647d9c2fcb..28397be13ef 100755 --- a/tools/run_tests/helper_scripts/build_python.sh +++ b/tools/run_tests/helper_scripts/build_python.sh @@ -155,7 +155,7 @@ fi ($PYTHON -m virtualenv $VENV || $HOST_PYTHON -m virtualenv -p $PYTHON $VENV || true) -VENV_PYTHON=`script_realpath -s "$VENV/$VENV_RELATIVE_PYTHON"` +VENV_PYTHON=`script_realpath "$VENV/$VENV_RELATIVE_PYTHON"` # pip-installs the directory specified. Used because on MSYS the vanilla Windows # Python gets confused when parsing paths. diff --git a/tools/run_tests/helper_scripts/run_python.sh b/tools/run_tests/helper_scripts/run_python.sh index 7be473428fb..e510ef40154 100755 --- a/tools/run_tests/helper_scripts/run_python.sh +++ b/tools/run_tests/helper_scripts/run_python.sh @@ -33,7 +33,7 @@ set -ex # change to grpc repo root cd $(dirname $0)/../../.. -PYTHON=`realpath -s "${1:-py27/bin/python}"` +PYTHON=`realpath "${1:-py27/bin/python}"` ROOT=`pwd` diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 0b4f26ca440..46411691e6f 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -395,6 +395,8 @@ class CLanguage(object): return ('jessie', self._gcc_make_options(version_suffix='-4.8')) elif compiler == 'gcc5.3': return ('ubuntu1604', []) + elif compiler == 'gcc_musl': + return ('alpine', []) elif compiler == 'clang3.4': # on ubuntu1404, clang-3.4 alias doesn't exist, just use 'clang' return ('ubuntu1404', self._clang_make_options()) @@ -626,7 +628,12 @@ class PythonLanguage(object): return 'tools/dockerfile/test/python_%s_%s' % (self.python_manager_name(), _docker_arch_suffix(self.args.arch)) def python_manager_name(self): - return 'pyenv' if self.args.compiler in ['python3.5', 'python3.6'] else 'jessie' + if self.args.compiler in ['python3.5', 'python3.6']: + return 'pyenv' + elif self.args.compiler == 'python_alpine': + return 'alpine' + else: + return 'jessie' def _get_pythons(self, args): if args.arch == 'x86': @@ -684,6 +691,8 @@ class PythonLanguage(object): return (pypy27_config,) elif args.compiler == 'pypy3': return (pypy32_config,) + elif args.compiler == 'python_alpine': + return (python27_config,) else: raise Exception('Compiler %s not supported.' % args.compiler) @@ -1175,10 +1184,10 @@ argp.add_argument('--arch', help='Selects architecture to target. For some platforms "default" is the only supported choice.') argp.add_argument('--compiler', choices=['default', - 'gcc4.4', 'gcc4.6', 'gcc4.8', 'gcc4.9', 'gcc5.3', + 'gcc4.4', 'gcc4.6', 'gcc4.8', 'gcc4.9', 'gcc5.3', 'gcc_musl', 'clang3.4', 'clang3.5', 'clang3.6', 'clang3.7', 'vs2013', 'vs2015', - 'python2.7', 'python3.4', 'python3.5', 'python3.6', 'pypy', 'pypy3', + 'python2.7', 'python3.4', 'python3.5', 'python3.6', 'pypy', 'pypy3', 'python_alpine', 'node0.12', 'node4', 'node5', 'node6', 'node7', 'electron1.3', 'coreclr', diff --git a/tools/run_tests/run_tests_matrix.py b/tools/run_tests/run_tests_matrix.py index 6c1d4bd15dd..a00d84fd9a7 100755 --- a/tools/run_tests/run_tests_matrix.py +++ b/tools/run_tests/run_tests_matrix.py @@ -187,7 +187,7 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS) inner_jobs=inner_jobs) # portability C and C++ on x64 - for compiler in ['gcc4.4', 'gcc4.6', 'gcc5.3', + for compiler in ['gcc4.4', 'gcc4.6', 'gcc5.3', 'gcc_musl', 'clang3.5', 'clang3.6', 'clang3.7']: test_jobs += _generate_jobs(languages=['c'], configs=['dbg'], @@ -198,7 +198,7 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS) extra_args=extra_args, inner_jobs=inner_jobs) - for compiler in ['gcc4.8', 'gcc5.3', + for compiler in ['gcc4.8', 'gcc5.3', 'gcc_musl', 'clang3.5', 'clang3.6', 'clang3.7']: test_jobs += _generate_jobs(languages=['c++'], configs=['dbg'], @@ -257,6 +257,15 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS) extra_args=extra_args, inner_jobs=inner_jobs) + test_jobs += _generate_jobs(languages=['python'], + configs=['dbg'], + platforms=['linux'], + arch='default', + compiler='python_alpine', + labels=['portability'], + extra_args=extra_args, + inner_jobs=inner_jobs) + test_jobs += _generate_jobs(languages=['csharp'], configs=['dbg'], platforms=['linux'], diff --git a/tools/run_tests/sanity/check_submodules.sh b/tools/run_tests/sanity/check_submodules.sh index 38dfe277ae3..eaf5a0580e5 100755 --- a/tools/run_tests/sanity/check_submodules.sh +++ b/tools/run_tests/sanity/check_submodules.sh @@ -45,8 +45,8 @@ cat << EOF | awk '{ print $1 }' | sort > $want_submodules 78684e5b222645828ca302e56b40b9daff2b2d27 third_party/boringssl (78684e5) 886e7d75368e3f4fab3f4d0d3584e4abfc557755 third_party/boringssl-with-bazel (version_for_cocoapods_7.0-857-g886e7d7) 30dbc81fb5ffdc98ea9b14b1918bfe4e8779b26e third_party/gflags (v2.2.0) - c99458533a9b4c743ed51537e25989ea55944908 third_party/googletest (release-1.7.0) - 593e917c176b5bc5aafa57bf9f6030d749d91cd5 third_party/protobuf (v3.1.0-alpha-1-326-g593e917) + ec44c6c1675c25b9827aacd08c02433cccde7780 third_party/googletest (release-1.8.0) + 4a0dd03e52e09332c8fd0f8f26a8e0ae9f911182 third_party/protobuf (v3.1.0-alpha-1-548-g4a0dd03e) bcad91771b7f0bff28a1cac1981d7ef2b9bcef3c third_party/thrift (bcad917) 50893291621658f355bc5b4d450a8d06a563053d third_party/zlib (v1.2.8) 7691f773af79bf75a62d1863fd0f13ebf9dc51b1 third_party/cares/cares (1.12.0) From 2a4ea2daafaf9a79f749d1fef1a6a5970613b9fb Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 6 Apr 2017 13:54:37 -0700 Subject: [PATCH 249/461] Node: consolidate call destruction logic --- src/node/ext/call.cc | 18 ++++++++++-------- src/node/ext/call.h | 2 ++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/node/ext/call.cc b/src/node/ext/call.cc index 62f0130d537..769f744b862 100644 --- a/src/node/ext/call.cc +++ b/src/node/ext/call.cc @@ -515,16 +515,20 @@ void DestroyTag(void *tag) { delete tag_struct; } +void Call::DestroyCall() { + if (this->wrapped_call != NULL) { + grpc_call_destroy(this->wrapped_call); + this->wrapped_call = NULL; + } +} + Call::Call(grpc_call *call) : wrapped_call(call), pending_batches(0), has_final_op_completed(false) { } Call::~Call() { - if (wrapped_call != NULL) { - grpc_call_destroy(wrapped_call); - wrapped_call = NULL; - } + DestroyCall(); } void Call::Init(Local exports) { @@ -570,10 +574,8 @@ void Call::CompleteBatch(bool is_final_op) { this->has_final_op_completed = true; } this->pending_batches--; - if (this->has_final_op_completed && this->pending_batches == 0 && - this->wrapped_call != NULL) { - grpc_call_destroy(this->wrapped_call); - this->wrapped_call = NULL; + if (this->has_final_op_completed && this->pending_batches == 0) { + this->DestroyCall(); } } diff --git a/src/node/ext/call.h b/src/node/ext/call.h index cceec9c45b5..7fd03ca1de3 100644 --- a/src/node/ext/call.h +++ b/src/node/ext/call.h @@ -76,6 +76,8 @@ class Call : public Nan::ObjectWrap { Call(const Call &); Call &operator=(const Call &); + void DestroyCall(); + static NAN_METHOD(New); static NAN_METHOD(StartBatch); static NAN_METHOD(Cancel); From 95b5ce0ddc02606dd7118f1e43c77790946a5a6d Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 6 Apr 2017 13:56:52 -0700 Subject: [PATCH 250/461] Python bug fix --- src/core/ext/transport/chttp2/transport/chttp2_transport.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index b59f02b9b68..43349beb29d 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1621,8 +1621,9 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx *exec_ctx, exec_ctx, &s->unprocessed_incoming_frames_buffer); } } + bool pending_data = s->pending_byte_stream || s->unprocessed_incoming_frames_buffer.length > 0; if (s->read_closed && s->frame_storage.length == 0 && - (!s->pending_byte_stream || s->seen_error) && + (!pending_data || s->seen_error) && s->recv_trailing_metadata_finished != NULL) { grpc_chttp2_incoming_metadata_buffer_publish( exec_ctx, &s->metadata_buffer[1], s->recv_trailing_metadata); From 786c852035aac17ff8584a900c6206cc151062e8 Mon Sep 17 00:00:00 2001 From: Noah Eisen Date: Thu, 6 Apr 2017 15:48:19 -0700 Subject: [PATCH 251/461] clang fmt If I had a nickle... --- src/core/lib/iomgr/error.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/lib/iomgr/error.c b/src/core/lib/iomgr/error.c index 766cc8a5169..fbbca6b4939 100644 --- a/src/core/lib/iomgr/error.c +++ b/src/core/lib/iomgr/error.c @@ -231,8 +231,8 @@ static void internal_set_int(grpc_error **err, grpc_error_ints which, if (slot == UINT8_MAX) { slot = get_placement(err, sizeof(value)); if (slot == UINT8_MAX) { - gpr_log(GPR_ERROR, "Error %p is full, dropping int {\"%s\":%" PRIiPTR "}", *err, - error_int_name(which), value); + gpr_log(GPR_ERROR, "Error %p is full, dropping int {\"%s\":%" PRIiPTR "}", + *err, error_int_name(which), value); return; } } From 2c3d835d66d5e26aa2695a148cae9c255e8e2a16 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 6 Apr 2017 16:09:52 -0700 Subject: [PATCH 252/461] Implement gpr_atm_full_cas for Windows --- include/grpc/impl/codegen/atm_windows.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/grpc/impl/codegen/atm_windows.h b/include/grpc/impl/codegen/atm_windows.h index b8f63da7587..a533651f6f9 100644 --- a/include/grpc/impl/codegen/atm_windows.h +++ b/include/grpc/impl/codegen/atm_windows.h @@ -95,6 +95,16 @@ static __inline int gpr_atm_rel_cas(gpr_atm *p, gpr_atm o, gpr_atm n) { #endif } +static __inline int gpr_atm_full_cas(gpr_atm *p, gpr_atm o, gpr_atm n) { +#ifdef GPR_ARCH_64 + return o == (gpr_atm)InterlockedCompareExchange64((volatile LONGLONG *)p, + (LONGLONG)n, (LONGLONG)o); +#else + return o == (gpr_atm)InterlockedCompareExchange((volatile LONG *)p, (LONG)n, + (LONG)o); +#endif +} + static __inline gpr_atm gpr_atm_no_barrier_fetch_add(gpr_atm *p, gpr_atm delta) { /* Use the CAS operation to get pointer-sized fetch and add */ From 3ac309eb6f511ac1194397fa82b5cec134344c3e Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 6 Apr 2017 16:10:41 -0700 Subject: [PATCH 253/461] Node: fix hang after DNS resolution failure --- src/core/lib/iomgr/resolve_address_uv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/lib/iomgr/resolve_address_uv.c b/src/core/lib/iomgr/resolve_address_uv.c index 4d715be94c7..0a0bf5f8da1 100644 --- a/src/core/lib/iomgr/resolve_address_uv.c +++ b/src/core/lib/iomgr/resolve_address_uv.c @@ -69,8 +69,9 @@ static int retry_named_port_failure(int status, request *r, int retry_status; uv_getaddrinfo_t *req = gpr_malloc(sizeof(uv_getaddrinfo_t)); req->data = r; + r->port = svc[i][1]; retry_status = uv_getaddrinfo(uv_default_loop(), req, getaddrinfo_cb, - r->host, svc[i][1], r->hints); + r->host, r->port, r->hints); if (retry_status < 0 || getaddrinfo_cb == NULL) { // The callback will not be called gpr_free(req); From 50da9d83b6420c8028b11903232db144a4eabf23 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 6 Apr 2017 18:18:00 -0700 Subject: [PATCH 254/461] Fix python bug --- .../ext/transport/chttp2/transport/chttp2_transport.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 43349beb29d..ca95d8289ad 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -2437,9 +2437,8 @@ static grpc_error *deframe_unprocessed_incoming_frames( GRPC_ERROR_NONE, 1); p->parsing_frame = NULL; p->state = GRPC_CHTTP2_DATA_FH_0; - } else { - s->pending_byte_stream = true; } + s->pending_byte_stream = true; if (cur != end) { grpc_slice_buffer_undo_take_first( @@ -2469,7 +2468,6 @@ static grpc_error *deframe_unprocessed_incoming_frames( GRPC_ERROR_NONE, 1); p->parsing_frame = NULL; p->state = GRPC_CHTTP2_DATA_FH_0; - grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_NONE); grpc_slice_unref_internal(exec_ctx, slice); return GRPC_ERROR_NONE; } else if (remaining < p->frame_size) { @@ -2502,7 +2500,6 @@ static grpc_error *deframe_unprocessed_incoming_frames( grpc_slice_buffer_undo_take_first( &s->unprocessed_incoming_frames_buffer, grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); - grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_NONE); grpc_slice_unref(slice); return GRPC_ERROR_NONE; } @@ -2670,8 +2667,14 @@ static void incoming_byte_stream_destroy_locked(grpc_exec_ctx *exec_ctx, void *byte_stream, grpc_error *error_ignored) { grpc_chttp2_incoming_byte_stream *bs = byte_stream; + grpc_chttp2_stream *s = bs->stream; + grpc_chttp2_transport *t = s->t; + GPR_ASSERT(bs->base.destroy == incoming_byte_stream_destroy); incoming_byte_stream_unref(exec_ctx, bs); + s->pending_byte_stream = false; + grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); + grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, t, s); } static void incoming_byte_stream_destroy(grpc_exec_ctx *exec_ctx, From 5eecba42c376c85166f1504b097a6890309e9891 Mon Sep 17 00:00:00 2001 From: Matt Kwong Date: Wed, 5 Apr 2017 15:09:21 -0700 Subject: [PATCH 255/461] Add test filtering to performance pull requests --- tools/jenkins/run_c_cpp_test.sh | 47 +++++++++++++++++++ .../python_utils/filter_pull_request_tests.py | 25 ++++++++-- 2 files changed, 67 insertions(+), 5 deletions(-) create mode 100755 tools/jenkins/run_c_cpp_test.sh diff --git a/tools/jenkins/run_c_cpp_test.sh b/tools/jenkins/run_c_cpp_test.sh new file mode 100755 index 00000000000..a7e574518e3 --- /dev/null +++ b/tools/jenkins/run_c_cpp_test.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +# Copyright 2017, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# This script is invoked by a Jenkins pull request job and executes all +# args passed to this script if the pull request affect C/C++ code +set -ex + +# Enter the gRPC repo root +cd $(dirname $0)/../.. + +AFFECTS_C_CPP=`python -c 'import sys; \ + sys.path.insert(0, "tools/run_tests/python_utils"); \ + import filter_pull_request_tests as filter; \ + print(filter.affects_c_cpp("origin/$ghprbTargetBranch"))'` + +if [ $AFFECTS_C_CPP == "False" ] ; then + echo "This pull request does not affect C/C++. Tests do not need to be run." +else + $@ +fi diff --git a/tools/run_tests/python_utils/filter_pull_request_tests.py b/tools/run_tests/python_utils/filter_pull_request_tests.py index e0133762959..958eb569e01 100644 --- a/tools/run_tests/python_utils/filter_pull_request_tests.py +++ b/tools/run_tests/python_utils/filter_pull_request_tests.py @@ -127,6 +127,9 @@ _WHITELIST_DICT = { 'setup\.py$': [_PYTHON_TEST_SUITE] } +# Regex that combines all keys in _WHITELIST_DICT +_ALL_TRIGGERS = "(" + ")|(".join(_WHITELIST_DICT.keys()) + ")" + # Add all triggers to their respective test suites for trigger, test_suites in six.iteritems(_WHITELIST_DICT): for test_suite in test_suites: @@ -169,6 +172,21 @@ def _remove_irrelevant_tests(tests, skippable_labels): test.labels[2] not in skippable_labels] +def affects_c_cpp(base_branch): + """ + Determines if a pull request's changes affect C/C++. This function exists because + there are pull request tests that only test C/C++ code + :param base_branch: branch that a pull request is requesting to merge into + :return: boolean indicating whether C/C++ changes are made in pull request + """ + changed_files = _get_changed_files(base_branch) + # Run all tests if any changed file is not in the whitelist dictionary + for changed_file in changed_files: + if not re.match(_ALL_TRIGGERS, changed_file): + return True + return not _can_skip_tests(changed_files, _CPP_TEST_SUITE.triggers + _CORE_TEST_SUITE.triggers) + + def filter_tests(tests, base_branch): """ Filters out tests that are safe to ignore @@ -181,11 +199,9 @@ def filter_tests(tests, base_branch): print(' %s' % changed_file) print('') - # Regex that combines all keys in _WHITELIST_DICT - all_triggers = "(" + ")|(".join(_WHITELIST_DICT.keys()) + ")" - # Check if all tests have to be run + # Run all tests if any changed file is not in the whitelist dictionary for changed_file in changed_files: - if not re.match(all_triggers, changed_file): + if not re.match(_ALL_TRIGGERS, changed_file): return(tests) # Figure out which language and platform tests to run skippable_labels = [] @@ -196,4 +212,3 @@ def filter_tests(tests, base_branch): skippable_labels.append(label) tests = _remove_irrelevant_tests(tests, skippable_labels) return tests - From 7727c7649c52756c8bffa79c6f019fedb80f8776 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 31 Mar 2017 18:44:27 +0200 Subject: [PATCH 256/461] Initial migration to new .csproj files --- src/csharp/Grpc.Auth/Grpc.Auth.csproj | 96 ++----- src/csharp/Grpc.Auth/Grpc.Auth.project.json | 8 - src/csharp/Grpc.Auth/Grpc.Auth.xproj | 18 -- src/csharp/Grpc.Auth/packages.config | 8 - .../Grpc.Core.Testing.csproj | 88 ++----- .../Grpc.Core.Testing.project.json | 8 - .../Grpc.Core.Testing/Grpc.Core.Testing.xproj | 18 -- src/csharp/Grpc.Core.Testing/packages.config | 4 - .../Grpc.Core.Tests/Grpc.Core.Tests.csproj | 118 ++------- .../Grpc.Core.Tests.project.json | 8 - .../Grpc.Core.Tests/Grpc.Core.Tests.xproj | 18 -- src/csharp/Grpc.Core.Tests/packages.config | 9 - src/csharp/Grpc.Core.Tests/project.json | 69 ----- src/csharp/Grpc.Core/Common.csproj.include | 32 +++ src/csharp/Grpc.Core/Grpc.Core.csproj | 201 +++++---------- src/csharp/Grpc.Core/Grpc.Core.project.json | 8 - src/csharp/Grpc.Core/Grpc.Core.xproj | 18 -- ...argets => NativeDeps.Linux.csproj.include} | 6 +- .../Grpc.Core/NativeDeps.Mac.csproj.include | 17 ++ src/csharp/Grpc.Core/NativeDeps.Mac.targets | 9 - ...gets => NativeDeps.Windows.csproj.include} | 6 +- ...Deps.targets => NativeDeps.csproj.include} | 9 +- src/csharp/Grpc.Core/Version.csproj.include | 7 + src/csharp/Grpc.Core/packages.config | 4 - src/csharp/Grpc.Core/project.json | 45 ---- src/csharp/Grpc.Dotnet.sln | 112 -------- .../Grpc.Examples.MathClient.csproj | 65 ++--- .../Grpc.Examples.MathClient.project.json | 8 - .../Grpc.Examples.MathClient.xproj | 18 -- .../Grpc.Examples.MathClient/packages.config | 3 - .../Grpc.Examples.MathClient/project.json | 60 ----- .../Grpc.Examples.MathServer.csproj | 65 ++--- .../Grpc.Examples.MathServer.project.json | 8 - .../Grpc.Examples.MathServer.xproj | 18 -- .../Grpc.Examples.MathServer/packages.config | 3 - .../Grpc.Examples.MathServer/project.json | 60 ----- .../Grpc.Examples.Tests.csproj | 80 ++---- .../Grpc.Examples.Tests.project.json | 8 - .../Grpc.Examples.Tests.xproj | 18 -- .../Grpc.Examples.Tests/packages.config | 7 - src/csharp/Grpc.Examples.Tests/project.json | 65 ----- src/csharp/Grpc.Examples/Grpc.Examples.csproj | 70 ++--- .../Grpc.Examples/Grpc.Examples.project.json | 8 - src/csharp/Grpc.Examples/Grpc.Examples.xproj | 18 -- src/csharp/Grpc.Examples/packages.config | 6 - src/csharp/Grpc.Examples/project.json | 22 -- .../Grpc.HealthCheck.Tests.csproj | 95 ++----- .../Grpc.HealthCheck.Tests.project.json | 8 - .../Grpc.HealthCheck.Tests.xproj | 18 -- .../Grpc.HealthCheck.Tests/packages.config | 6 - .../Grpc.HealthCheck.Tests/project.json | 65 ----- .../Grpc.HealthCheck/Grpc.HealthCheck.csproj | 88 ++----- .../Grpc.HealthCheck.project.json | 8 - .../Grpc.HealthCheck/Grpc.HealthCheck.xproj | 18 -- src/csharp/Grpc.HealthCheck/packages.config | 5 - .../Grpc.IntegrationTesting.Client.csproj | 71 ++--- ...rpc.IntegrationTesting.Client.project.json | 8 - .../Grpc.IntegrationTesting.Client.xproj | 18 -- .../project.json | 69 ----- .../Grpc.IntegrationTesting.QpsWorker.csproj | 67 ++--- ....IntegrationTesting.QpsWorker.project.json | 8 - .../Grpc.IntegrationTesting.QpsWorker.xproj | 18 -- .../project.json | 74 ------ .../Grpc.IntegrationTesting.Server.csproj | 71 ++--- ...rpc.IntegrationTesting.Server.project.json | 8 - .../Grpc.IntegrationTesting.Server.xproj | 18 -- .../project.json | 69 ----- ...rpc.IntegrationTesting.StressClient.csproj | 66 ++--- ...tegrationTesting.StressClient.project.json | 8 - ...Grpc.IntegrationTesting.StressClient.xproj | 19 -- .../project.json | 69 ----- .../Grpc.IntegrationTesting.csproj | 178 +++---------- .../Grpc.IntegrationTesting.project.json | 8 - .../Grpc.IntegrationTesting.xproj | 18 -- .../Grpc.IntegrationTesting/packages.config | 15 -- .../Grpc.IntegrationTesting/project.json | 80 ------ .../Grpc.Reflection.Tests.csproj | 98 ++----- .../Grpc.Reflection.Tests.project.json | 8 - .../Grpc.Reflection.Tests.xproj | 18 -- .../Grpc.Reflection.Tests/packages.config | 7 - src/csharp/Grpc.Reflection.Tests/project.json | 65 ----- .../Grpc.Reflection/Grpc.Reflection.csproj | 91 ++----- .../Grpc.Reflection.project.json | 8 - .../Grpc.Reflection/Grpc.Reflection.xproj | 18 -- src/csharp/Grpc.Reflection/packages.config | 5 - src/csharp/Grpc.sln | 243 +++++++++--------- .../csharp/Grpc.Auth/project.json.template | 37 --- .../Grpc.Core.Testing/project.json.template | 41 --- .../Grpc.Core.Tests/project.json.template | 30 --- .../Grpc.Core/Version.csproj.include.template | 9 + .../csharp/Grpc.Core/project.json.template | 47 ---- .../project.json.template | 21 -- .../project.json.template | 21 -- .../Grpc.Examples.Tests/project.json.template | 26 -- .../Grpc.Examples/project.json.template | 22 -- .../project.json.template | 26 -- .../Grpc.HealthCheck/project.json.template | 37 --- .../project.json.template | 24 -- .../project.json.template | 29 --- .../project.json.template | 24 -- .../project.json.template | 24 -- .../project.json.template | 35 --- .../project.json.template | 26 -- .../Grpc.Reflection/project.json.template | 37 --- templates/src/csharp/build_options.include | 56 ---- 105 files changed, 635 insertions(+), 3323 deletions(-) mode change 100644 => 100755 src/csharp/Grpc.Auth/Grpc.Auth.csproj delete mode 100644 src/csharp/Grpc.Auth/Grpc.Auth.project.json delete mode 100644 src/csharp/Grpc.Auth/Grpc.Auth.xproj delete mode 100644 src/csharp/Grpc.Auth/packages.config mode change 100644 => 100755 src/csharp/Grpc.Core.Testing/Grpc.Core.Testing.csproj delete mode 100644 src/csharp/Grpc.Core.Testing/Grpc.Core.Testing.project.json delete mode 100644 src/csharp/Grpc.Core.Testing/Grpc.Core.Testing.xproj delete mode 100644 src/csharp/Grpc.Core.Testing/packages.config mode change 100644 => 100755 src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.csproj delete mode 100644 src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.project.json delete mode 100644 src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.xproj delete mode 100644 src/csharp/Grpc.Core.Tests/packages.config delete mode 100644 src/csharp/Grpc.Core.Tests/project.json create mode 100755 src/csharp/Grpc.Core/Common.csproj.include mode change 100644 => 100755 src/csharp/Grpc.Core/Grpc.Core.csproj delete mode 100644 src/csharp/Grpc.Core/Grpc.Core.project.json delete mode 100644 src/csharp/Grpc.Core/Grpc.Core.xproj rename src/csharp/Grpc.Core/{NativeDeps.Linux.targets => NativeDeps.Linux.csproj.include} (60%) create mode 100644 src/csharp/Grpc.Core/NativeDeps.Mac.csproj.include delete mode 100644 src/csharp/Grpc.Core/NativeDeps.Mac.targets rename src/csharp/Grpc.Core/{NativeDeps.Windows.targets => NativeDeps.Windows.csproj.include} (61%) rename src/csharp/Grpc.Core/{NativeDeps.targets => NativeDeps.csproj.include} (83%) mode change 100644 => 100755 create mode 100755 src/csharp/Grpc.Core/Version.csproj.include delete mode 100644 src/csharp/Grpc.Core/packages.config delete mode 100644 src/csharp/Grpc.Core/project.json delete mode 100644 src/csharp/Grpc.Dotnet.sln mode change 100644 => 100755 src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.csproj delete mode 100644 src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.project.json delete mode 100644 src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.xproj delete mode 100644 src/csharp/Grpc.Examples.MathClient/packages.config delete mode 100644 src/csharp/Grpc.Examples.MathClient/project.json mode change 100644 => 100755 src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.csproj delete mode 100644 src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.project.json delete mode 100644 src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.xproj delete mode 100644 src/csharp/Grpc.Examples.MathServer/packages.config delete mode 100644 src/csharp/Grpc.Examples.MathServer/project.json mode change 100644 => 100755 src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.csproj delete mode 100644 src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.project.json delete mode 100644 src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.xproj delete mode 100644 src/csharp/Grpc.Examples.Tests/packages.config delete mode 100644 src/csharp/Grpc.Examples.Tests/project.json mode change 100644 => 100755 src/csharp/Grpc.Examples/Grpc.Examples.csproj delete mode 100644 src/csharp/Grpc.Examples/Grpc.Examples.project.json delete mode 100644 src/csharp/Grpc.Examples/Grpc.Examples.xproj delete mode 100644 src/csharp/Grpc.Examples/packages.config delete mode 100644 src/csharp/Grpc.Examples/project.json mode change 100644 => 100755 src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj delete mode 100644 src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.project.json delete mode 100644 src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.xproj delete mode 100644 src/csharp/Grpc.HealthCheck.Tests/packages.config delete mode 100644 src/csharp/Grpc.HealthCheck.Tests/project.json mode change 100644 => 100755 src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj delete mode 100644 src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.project.json delete mode 100644 src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.xproj delete mode 100644 src/csharp/Grpc.HealthCheck/packages.config mode change 100644 => 100755 src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.csproj delete mode 100644 src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.project.json delete mode 100644 src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.xproj delete mode 100644 src/csharp/Grpc.IntegrationTesting.Client/project.json mode change 100644 => 100755 src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.csproj delete mode 100644 src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.project.json delete mode 100644 src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.xproj delete mode 100644 src/csharp/Grpc.IntegrationTesting.QpsWorker/project.json mode change 100644 => 100755 src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.csproj delete mode 100644 src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.project.json delete mode 100644 src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.xproj delete mode 100644 src/csharp/Grpc.IntegrationTesting.Server/project.json mode change 100644 => 100755 src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.csproj delete mode 100644 src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.project.json delete mode 100644 src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.xproj delete mode 100644 src/csharp/Grpc.IntegrationTesting.StressClient/project.json mode change 100644 => 100755 src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj delete mode 100644 src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.project.json delete mode 100644 src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.xproj delete mode 100644 src/csharp/Grpc.IntegrationTesting/packages.config delete mode 100644 src/csharp/Grpc.IntegrationTesting/project.json mode change 100644 => 100755 src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.csproj delete mode 100644 src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.project.json delete mode 100644 src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.xproj delete mode 100644 src/csharp/Grpc.Reflection.Tests/packages.config delete mode 100644 src/csharp/Grpc.Reflection.Tests/project.json mode change 100644 => 100755 src/csharp/Grpc.Reflection/Grpc.Reflection.csproj delete mode 100644 src/csharp/Grpc.Reflection/Grpc.Reflection.project.json delete mode 100644 src/csharp/Grpc.Reflection/Grpc.Reflection.xproj delete mode 100644 src/csharp/Grpc.Reflection/packages.config delete mode 100644 templates/src/csharp/Grpc.Auth/project.json.template delete mode 100644 templates/src/csharp/Grpc.Core.Testing/project.json.template delete mode 100644 templates/src/csharp/Grpc.Core.Tests/project.json.template create mode 100755 templates/src/csharp/Grpc.Core/Version.csproj.include.template delete mode 100644 templates/src/csharp/Grpc.Core/project.json.template delete mode 100644 templates/src/csharp/Grpc.Examples.MathClient/project.json.template delete mode 100644 templates/src/csharp/Grpc.Examples.MathServer/project.json.template delete mode 100644 templates/src/csharp/Grpc.Examples.Tests/project.json.template delete mode 100644 templates/src/csharp/Grpc.Examples/project.json.template delete mode 100644 templates/src/csharp/Grpc.HealthCheck.Tests/project.json.template delete mode 100644 templates/src/csharp/Grpc.HealthCheck/project.json.template delete mode 100644 templates/src/csharp/Grpc.IntegrationTesting.Client/project.json.template delete mode 100644 templates/src/csharp/Grpc.IntegrationTesting.QpsWorker/project.json.template delete mode 100644 templates/src/csharp/Grpc.IntegrationTesting.Server/project.json.template delete mode 100644 templates/src/csharp/Grpc.IntegrationTesting.StressClient/project.json.template delete mode 100644 templates/src/csharp/Grpc.IntegrationTesting/project.json.template delete mode 100644 templates/src/csharp/Grpc.Reflection.Tests/project.json.template delete mode 100644 templates/src/csharp/Grpc.Reflection/project.json.template delete mode 100644 templates/src/csharp/build_options.include diff --git a/src/csharp/Grpc.Auth/Grpc.Auth.csproj b/src/csharp/Grpc.Auth/Grpc.Auth.csproj old mode 100644 new mode 100755 index 9ef98529e85..6ac25aa1f02 --- a/src/csharp/Grpc.Auth/Grpc.Auth.csproj +++ b/src/csharp/Grpc.Auth/Grpc.Auth.csproj @@ -1,78 +1,38 @@ - - + + + + + - Debug - AnyCPU - {AE21D0EE-9A2C-4C15-AB7F-5224EED5B0EA} - Library - Grpc.Auth + Copyright 2015, Google Inc. + gRPC C# Auth + $(GrpcCsharpVersion) + Google Inc. + net45;netstandard1.5 + $(DefineConstants);SIGNED Grpc.Auth - v4.5 - bin\$(Configuration)\Grpc.Auth.Xml - 455903a2 - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - false - - - pdbonly - true - bin\Release - prompt - 4 - false + Grpc.Auth + gRPC RPC Protocol HTTP/2 Auth OAuth2 + https://github.com/grpc/grpc + https://github.com/grpc/grpc/blob/master/LICENSE + 1.6.0 + - - - - - - ..\packages\Zlib.Portable.Signed.1.11.0\lib\portable-net4+sl5+wp8+win8+wpa81+MonoTouch+MonoAndroid\Zlib.Portable.dll - - - ..\packages\Google.Apis.Core.1.21.0\lib\net45\Google.Apis.Core.dll - - - ..\packages\Google.Apis.1.21.0\lib\net45\Google.Apis.dll - - - ..\packages\Google.Apis.1.21.0\lib\net45\Google.Apis.PlatformServices.dll - - - ..\packages\Google.Apis.Auth.1.21.0\lib\net45\Google.Apis.Auth.dll - - - ..\packages\Google.Apis.Auth.1.21.0\lib\net45\Google.Apis.Auth.PlatformServices.dll - - - ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - + + - - Version.cs - - - - + - + - - {CCC4440E-49F7-4790-B0AF-FEABB0837AE7} - Grpc.Core - + - - - + + + + - \ No newline at end of file + + diff --git a/src/csharp/Grpc.Auth/Grpc.Auth.project.json b/src/csharp/Grpc.Auth/Grpc.Auth.project.json deleted file mode 100644 index c2f5bcb1637..00000000000 --- a/src/csharp/Grpc.Auth/Grpc.Auth.project.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "frameworks": { - "net45": { } - }, - "runtimes": { - "win": { } - } -} diff --git a/src/csharp/Grpc.Auth/Grpc.Auth.xproj b/src/csharp/Grpc.Auth/Grpc.Auth.xproj deleted file mode 100644 index dd3d94c574a..00000000000 --- a/src/csharp/Grpc.Auth/Grpc.Auth.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0.25123 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - c82631ed-06d1-4458-87bc-8257d12307a8 - Grpc.Auth - ..\Grpc.Core\artifacts\obj\$(MSBuildProjectName) - .\bin\ - - - 2.0 - - - \ No newline at end of file diff --git a/src/csharp/Grpc.Auth/packages.config b/src/csharp/Grpc.Auth/packages.config deleted file mode 100644 index aecc65e8499..00000000000 --- a/src/csharp/Grpc.Auth/packages.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/csharp/Grpc.Core.Testing/Grpc.Core.Testing.csproj b/src/csharp/Grpc.Core.Testing/Grpc.Core.Testing.csproj old mode 100644 new mode 100755 index 9b0b3abf107..f4dd5105fc7 --- a/src/csharp/Grpc.Core.Testing/Grpc.Core.Testing.csproj +++ b/src/csharp/Grpc.Core.Testing/Grpc.Core.Testing.csproj @@ -1,68 +1,36 @@ - - - + + + + + - Debug - AnyCPU - {3AB047CA-6CF9-435D-AA61-2D86C6FA2457} - Library - Properties - Grpc.Core.Testing + Copyright 2017, Google Inc. + gRPC C# Core Testing + $(GrpcCsharpVersion) + Google Inc. + net45;netstandard1.5 + true Grpc.Core.Testing - v4.5 - 512 - bin\$(Configuration)\Grpc.Core.Testing.Xml - - - true - full - false - bin\Debug\ - prompt - 4 - - - pdbonly - true - bin\Release\ - prompt - 4 + Grpc.Core.Testing + gRPC test testing + https://github.com/grpc/grpc + https://github.com/grpc/grpc/blob/master/LICENSE + 1.6.0 + - - - - - - - - - ..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll - + + - - Version.cs - - - + - - - - - - - {CCC4440E-49F7-4790-B0AF-FEABB0837AE7} - Grpc.Core - + + + + + + - - - \ No newline at end of file + + diff --git a/src/csharp/Grpc.Core.Testing/Grpc.Core.Testing.project.json b/src/csharp/Grpc.Core.Testing/Grpc.Core.Testing.project.json deleted file mode 100644 index c2f5bcb1637..00000000000 --- a/src/csharp/Grpc.Core.Testing/Grpc.Core.Testing.project.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "frameworks": { - "net45": { } - }, - "runtimes": { - "win": { } - } -} diff --git a/src/csharp/Grpc.Core.Testing/Grpc.Core.Testing.xproj b/src/csharp/Grpc.Core.Testing/Grpc.Core.Testing.xproj deleted file mode 100644 index c9723870033..00000000000 --- a/src/csharp/Grpc.Core.Testing/Grpc.Core.Testing.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0.25123 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 2b372155-80ba-4cf9-82d6-4b938e8ec3a0 - Grpc.Core.Testing - ..\artifacts\obj\$(MSBuildProjectName) - .\bin\ - - - 2.0 - - - \ No newline at end of file diff --git a/src/csharp/Grpc.Core.Testing/packages.config b/src/csharp/Grpc.Core.Testing/packages.config deleted file mode 100644 index 53cfad52f0b..00000000000 --- a/src/csharp/Grpc.Core.Testing/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.csproj b/src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.csproj old mode 100644 new mode 100755 index a1a2e4eebd1..9be77c8875d --- a/src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.csproj +++ b/src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.csproj @@ -1,103 +1,37 @@ - - + + + + + - Debug - AnyCPU - {86EC5CB4-4EA2-40A2-8057-86542A0353BB} - Exe - Grpc.Core.Tests + net45;netcoreapp1.0 Grpc.Core.Tests - v4.5 - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - - - pdbonly - true - bin\Release - prompt - 4 + Exe + Grpc.Core.Tests + $(PackageTargetFallback);portable-net45 + 1.0.4 + - - - ..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll - - - ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - - - ..\packages\NUnit.3.6.0\lib\net45\nunit.framework.dll - - - ..\packages\NUnitLite.3.6.0\lib\net45\nunitlite.dll - + + - - Version.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - {CCC4440E-49F7-4790-B0AF-FEABB0837AE7} - Grpc.Core - - - - - - Designer - + + + + + - + - + diff --git a/src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.project.json b/src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.project.json deleted file mode 100644 index c2f5bcb1637..00000000000 --- a/src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.project.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "frameworks": { - "net45": { } - }, - "runtimes": { - "win": { } - } -} diff --git a/src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.xproj b/src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.xproj deleted file mode 100644 index 05823291542..00000000000 --- a/src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0.25123 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 759e23b2-fc04-4695-902d-b073cded3599 - Grpc.Core.Tests - ..\artifacts\obj\$(MSBuildProjectName) - .\bin\ - - - 2.0 - - - \ No newline at end of file diff --git a/src/csharp/Grpc.Core.Tests/packages.config b/src/csharp/Grpc.Core.Tests/packages.config deleted file mode 100644 index 994a2787629..00000000000 --- a/src/csharp/Grpc.Core.Tests/packages.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/csharp/Grpc.Core.Tests/project.json b/src/csharp/Grpc.Core.Tests/project.json deleted file mode 100644 index 14e5ed51adb..00000000000 --- a/src/csharp/Grpc.Core.Tests/project.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "buildOptions": { - "emitEntryPoint": true - }, - "configurations": { - "Debug": { - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - }, - "copyToOutput": { - "mappings": { - "grpc_csharp_ext.x64.dll": "../../../cmake/build/x64/Debug/grpc_csharp_ext.dll", - "grpc_csharp_ext.x86.dll": "../../../cmake/build/Win32/Debug/grpc_csharp_ext.dll", - "libgrpc_csharp_ext.x64.so": "../../../libs/dbg/libgrpc_csharp_ext.so", - "libgrpc_csharp_ext.x64.dylib": "../../../libs/dbg/libgrpc_csharp_ext.dylib" - } - } - } - }, - "Release": { - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - }, - "copyToOutput": { - "mappings": { - "grpc_csharp_ext.x64.dll": "../../../cmake/build/x64/Release/grpc_csharp_ext.dll", - "grpc_csharp_ext.x86.dll": "../../../cmake/build/Win32/Release/grpc_csharp_ext.dll", - "libgrpc_csharp_ext.x64.so": "../../../libs/opt/libgrpc_csharp_ext.so", - "libgrpc_csharp_ext.x64.dylib": "../../../libs/opt/libgrpc_csharp_ext.dylib" - } - } - } - } - }, - - "dependencies": { - "Grpc.Core": { - "target": "project" - }, - "Newtonsoft.Json": "9.0.1", - "NUnit": "3.6.0", - "NUnitLite": "3.6.0", - "NUnit.ConsoleRunner": "3.6.0", - "OpenCover": "4.6.519", - "ReportGenerator": "2.4.4.0" - }, - "frameworks": { - "net45": { }, - "netcoreapp1.0": { - "imports": [ - "portable-net45" - ], - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - }, -} diff --git a/src/csharp/Grpc.Core/Common.csproj.include b/src/csharp/Grpc.Core/Common.csproj.include new file mode 100755 index 00000000000..2cb990ba49e --- /dev/null +++ b/src/csharp/Grpc.Core/Common.csproj.include @@ -0,0 +1,32 @@ + + + + false + false + false + false + false + false + false + false + false + + + + true + + + + $(DefineConstants);SIGNED + ../keys/Grpc.snk + true + true + + + + + /usr/lib/mono/4.5-api + /usr/local/lib/mono/4.5-api + /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5-api + + diff --git a/src/csharp/Grpc.Core/Grpc.Core.csproj b/src/csharp/Grpc.Core/Grpc.Core.csproj old mode 100644 new mode 100755 index d6d8dfac224..7e0f3f053d0 --- a/src/csharp/Grpc.Core/Grpc.Core.csproj +++ b/src/csharp/Grpc.Core/Grpc.Core.csproj @@ -1,151 +1,68 @@ - - + + + + + - Debug - AnyCPU - {CCC4440E-49F7-4790-B0AF-FEABB0837AE7} - Library - Grpc.Core + Copyright 2015, Google Inc. + gRPC C# Core + $(GrpcCsharpVersion) + Google Inc. + net45;netstandard1.5 Grpc.Core - v4.5 - c0512805 - bin\$(Configuration)\Grpc.Core.Xml - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - - - pdbonly - true - bin\Release - prompt - 4 + Grpc.Core + gRPC RPC Protocol HTTP/2 + https://github.com/grpc/grpc + https://github.com/grpc/grpc/blob/master/LICENSE + 1.6.0 + - - - ..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll - + + + runtimes/osx/native/libgrpc_csharp_ext.x64.dylib + true + + + runtimes/osx/native/libgrpc_csharp_ext.x86.dylib + true + + + runtimes/linux/native/libgrpc_csharp_ext.x64.so + true + + + runtimes/linux/native/libgrpc_csharp_ext.x86.so + true + + + runtimes/win/native/grpc_csharp_ext.x64.dll + true + + + runtimes/win/native/grpc_csharp_ext.x86.dll + true + + + build/net45/ + true + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + + + + - - - - - - roots.pem - + + + + - \ No newline at end of file + + + + diff --git a/src/csharp/Grpc.Core/Grpc.Core.project.json b/src/csharp/Grpc.Core/Grpc.Core.project.json deleted file mode 100644 index c2f5bcb1637..00000000000 --- a/src/csharp/Grpc.Core/Grpc.Core.project.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "frameworks": { - "net45": { } - }, - "runtimes": { - "win": { } - } -} diff --git a/src/csharp/Grpc.Core/Grpc.Core.xproj b/src/csharp/Grpc.Core/Grpc.Core.xproj deleted file mode 100644 index 137236ffdb6..00000000000 --- a/src/csharp/Grpc.Core/Grpc.Core.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - dc9908b6-f291-4fc8-a46d-2ea2551790ec - Grpc.Core - ..\artifacts\obj\$(MSBuildProjectName) - .\bin\ - - - 2.0 - - - \ No newline at end of file diff --git a/src/csharp/Grpc.Core/NativeDeps.Linux.targets b/src/csharp/Grpc.Core/NativeDeps.Linux.csproj.include similarity index 60% rename from src/csharp/Grpc.Core/NativeDeps.Linux.targets rename to src/csharp/Grpc.Core/NativeDeps.Linux.csproj.include index e0c9132b1d5..e3bbeb071e7 100644 --- a/src/csharp/Grpc.Core/NativeDeps.Linux.targets +++ b/src/csharp/Grpc.Core/NativeDeps.Linux.csproj.include @@ -1,9 +1,9 @@ - - + - PreserveNewest libgrpc_csharp_ext.x64.so + PreserveNewest + false \ No newline at end of file diff --git a/src/csharp/Grpc.Core/NativeDeps.Mac.csproj.include b/src/csharp/Grpc.Core/NativeDeps.Mac.csproj.include new file mode 100644 index 00000000000..f1b85c3730e --- /dev/null +++ b/src/csharp/Grpc.Core/NativeDeps.Mac.csproj.include @@ -0,0 +1,17 @@ + + + + + libgrpc_csharp_ext.x86.dylib + PreserveNewest + false + + + libgrpc_csharp_ext.x64.dylib + PreserveNewest + false + + + diff --git a/src/csharp/Grpc.Core/NativeDeps.Mac.targets b/src/csharp/Grpc.Core/NativeDeps.Mac.targets deleted file mode 100644 index e22c7384fc5..00000000000 --- a/src/csharp/Grpc.Core/NativeDeps.Mac.targets +++ /dev/null @@ -1,9 +0,0 @@ - - - - - PreserveNewest - libgrpc_csharp_ext.x86.dylib - - - \ No newline at end of file diff --git a/src/csharp/Grpc.Core/NativeDeps.Windows.targets b/src/csharp/Grpc.Core/NativeDeps.Windows.csproj.include similarity index 61% rename from src/csharp/Grpc.Core/NativeDeps.Windows.targets rename to src/csharp/Grpc.Core/NativeDeps.Windows.csproj.include index 623f58b95b0..85e1b77bd0f 100644 --- a/src/csharp/Grpc.Core/NativeDeps.Windows.targets +++ b/src/csharp/Grpc.Core/NativeDeps.Windows.csproj.include @@ -1,9 +1,9 @@ - - + PreserveNewest grpc_csharp_ext.x86.dll + false - \ No newline at end of file + diff --git a/src/csharp/Grpc.Core/NativeDeps.targets b/src/csharp/Grpc.Core/NativeDeps.csproj.include old mode 100644 new mode 100755 similarity index 83% rename from src/csharp/Grpc.Core/NativeDeps.targets rename to src/csharp/Grpc.Core/NativeDeps.csproj.include index e187f72d266..a62c63e11d0 --- a/src/csharp/Grpc.Core/NativeDeps.targets +++ b/src/csharp/Grpc.Core/NativeDeps.csproj.include @@ -1,5 +1,5 @@ - - + + Debug @@ -22,5 +22,6 @@ Linux - - \ No newline at end of file + + + diff --git a/src/csharp/Grpc.Core/Version.csproj.include b/src/csharp/Grpc.Core/Version.csproj.include new file mode 100755 index 00000000000..933d0b25cd2 --- /dev/null +++ b/src/csharp/Grpc.Core/Version.csproj.include @@ -0,0 +1,7 @@ + + + + 1.2.0-pre1 + 3.2.0 + + diff --git a/src/csharp/Grpc.Core/packages.config b/src/csharp/Grpc.Core/packages.config deleted file mode 100644 index 53cfad52f0b..00000000000 --- a/src/csharp/Grpc.Core/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/csharp/Grpc.Core/project.json b/src/csharp/Grpc.Core/project.json deleted file mode 100644 index a1306baa876..00000000000 --- a/src/csharp/Grpc.Core/project.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "version": "1.3.0-dev", - "title": "gRPC C# Core", - "authors": [ "Google Inc." ], - "copyright": "Copyright 2015, Google Inc.", - "packOptions": { - "summary": "Core C# implementation of gRPC - an RPC library and framework", - "description": "Core C# implementation of gRPC - an RPC library and framework. See project site for more info.", - "owners": [ "grpc-packages" ], - "licenseUrl": "https://github.com/grpc/grpc/blob/master/LICENSE", - "projectUrl": "https://github.com/grpc/grpc", - "requireLicenseAcceptance": false, - "tags": [ "gRPC RPC Protocol HTTP/2" ], - "files": { - "mappings": { - "build/net45/": "Grpc.Core.targets", - "runtimes/win/native/grpc_csharp_ext.x86.dll": "../nativelibs/windows_x86/grpc_csharp_ext.dll", - "runtimes/win/native/grpc_csharp_ext.x64.dll": "../nativelibs/windows_x64/grpc_csharp_ext.dll", - "runtimes/linux/native/libgrpc_csharp_ext.x86.so": "../nativelibs/linux_x86/libgrpc_csharp_ext.so", - "runtimes/linux/native/libgrpc_csharp_ext.x64.so": "../nativelibs/linux_x64/libgrpc_csharp_ext.so", - "runtimes/osx/native/libgrpc_csharp_ext.x86.dylib": "../nativelibs/macosx_x86/libgrpc_csharp_ext.dylib", - "runtimes/osx/native/libgrpc_csharp_ext.x64.dylib": "../nativelibs/macosx_x64/libgrpc_csharp_ext.dylib" - } - } - }, - "buildOptions": { - "embed": [ "../../../etc/roots.pem" ], - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true - }, - "dependencies": { - "System.Interactive.Async": "3.1.1" - }, - "frameworks": { - "net45": { }, - "netstandard1.5": { - "dependencies": { - "NETStandard.Library": "1.6.0", - "System.Runtime.Loader": "4.0.0", - "System.Threading.Thread": "4.0.0" - } - } - } -} diff --git a/src/csharp/Grpc.Dotnet.sln b/src/csharp/Grpc.Dotnet.sln deleted file mode 100644 index 824c6822f7e..00000000000 --- a/src/csharp/Grpc.Dotnet.sln +++ /dev/null @@ -1,112 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.Core", "Grpc.Core\Grpc.Core.xproj", "{DC9908B6-F291-4FC8-A46D-2EA2551790EC}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.Auth", "Grpc.Auth\Grpc.Auth.xproj", "{C82631ED-06D1-4458-87BC-8257D12307A8}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.Core.Tests", "Grpc.Core.Tests\Grpc.Core.Tests.xproj", "{759E23B2-FC04-4695-902D-B073CDED3599}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.Examples", "Grpc.Examples\Grpc.Examples.xproj", "{C77B792D-FC78-4CE2-9522-B40B0803C636}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.Examples.MathClient", "Grpc.Examples.MathClient\Grpc.Examples.MathClient.xproj", "{FD48DECA-1622-4173-B1D9-2101CF5E7C5F}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.Examples.MathServer", "Grpc.Examples.MathServer\Grpc.Examples.MathServer.xproj", "{58579368-5372-4E67-ACD6-9B59CB9FA698}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.Examples.Tests", "Grpc.Examples.Tests\Grpc.Examples.Tests.xproj", "{C61714A6-F633-44FB-97F4-C91F425C1D15}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.HealthCheck", "Grpc.HealthCheck\Grpc.HealthCheck.xproj", "{3BE4AD0B-2BF0-4D68-B625-F6018EF0DCFA}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.HealthCheck.Tests", "Grpc.HealthCheck.Tests\Grpc.HealthCheck.Tests.xproj", "{43DAFAC6-5343-4621-960E-A8A977EA3F0B}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.IntegrationTesting", "Grpc.IntegrationTesting\Grpc.IntegrationTesting.xproj", "{20354386-3E71-4046-A269-3BC2A06F3EC8}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.IntegrationTesting.Client", "Grpc.IntegrationTesting.Client\Grpc.IntegrationTesting.Client.xproj", "{48EA5BBE-70E2-4198-869D-D7E59C45F30D}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.IntegrationTesting.QpsWorker", "Grpc.IntegrationTesting.QpsWorker\Grpc.IntegrationTesting.QpsWorker.xproj", "{661B70D7-F56A-46E0-9B81-6227B591B5E7}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.IntegrationTesting.Server", "Grpc.IntegrationTesting.Server\Grpc.IntegrationTesting.Server.xproj", "{881F7AD1-A84E-47A2-9402-115C63C4031E}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.IntegrationTesting.StressClient", "Grpc.IntegrationTesting.StressClient\Grpc.IntegrationTesting.StressClient.xproj", "{0EBC910B-8867-4D3E-8686-91F34183D839}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.Reflection", "Grpc.Reflection\Grpc.Reflection.xproj", "{2B372155-80BA-4CF9-82D6-4B938E8EC3A0}" -EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Grpc.Reflection.Tests", "Grpc.Reflection.Tests\Grpc.Reflection.Tests.xproj", "{FE90181D-A4B3-4A5C-8490-F07561E18E3B}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {DC9908B6-F291-4FC8-A46D-2EA2551790EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DC9908B6-F291-4FC8-A46D-2EA2551790EC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DC9908B6-F291-4FC8-A46D-2EA2551790EC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DC9908B6-F291-4FC8-A46D-2EA2551790EC}.Release|Any CPU.Build.0 = Release|Any CPU - {C82631ED-06D1-4458-87BC-8257D12307A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C82631ED-06D1-4458-87BC-8257D12307A8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C82631ED-06D1-4458-87BC-8257D12307A8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C82631ED-06D1-4458-87BC-8257D12307A8}.Release|Any CPU.Build.0 = Release|Any CPU - {759E23B2-FC04-4695-902D-B073CDED3599}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {759E23B2-FC04-4695-902D-B073CDED3599}.Debug|Any CPU.Build.0 = Debug|Any CPU - {759E23B2-FC04-4695-902D-B073CDED3599}.Release|Any CPU.ActiveCfg = Release|Any CPU - {759E23B2-FC04-4695-902D-B073CDED3599}.Release|Any CPU.Build.0 = Release|Any CPU - {C77B792D-FC78-4CE2-9522-B40B0803C636}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C77B792D-FC78-4CE2-9522-B40B0803C636}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C77B792D-FC78-4CE2-9522-B40B0803C636}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C77B792D-FC78-4CE2-9522-B40B0803C636}.Release|Any CPU.Build.0 = Release|Any CPU - {FD48DECA-1622-4173-B1D9-2101CF5E7C5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FD48DECA-1622-4173-B1D9-2101CF5E7C5F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FD48DECA-1622-4173-B1D9-2101CF5E7C5F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FD48DECA-1622-4173-B1D9-2101CF5E7C5F}.Release|Any CPU.Build.0 = Release|Any CPU - {58579368-5372-4E67-ACD6-9B59CB9FA698}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {58579368-5372-4E67-ACD6-9B59CB9FA698}.Debug|Any CPU.Build.0 = Debug|Any CPU - {58579368-5372-4E67-ACD6-9B59CB9FA698}.Release|Any CPU.ActiveCfg = Release|Any CPU - {58579368-5372-4E67-ACD6-9B59CB9FA698}.Release|Any CPU.Build.0 = Release|Any CPU - {C61714A6-F633-44FB-97F4-C91F425C1D15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C61714A6-F633-44FB-97F4-C91F425C1D15}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C61714A6-F633-44FB-97F4-C91F425C1D15}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C61714A6-F633-44FB-97F4-C91F425C1D15}.Release|Any CPU.Build.0 = Release|Any CPU - {3BE4AD0B-2BF0-4D68-B625-F6018EF0DCFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3BE4AD0B-2BF0-4D68-B625-F6018EF0DCFA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3BE4AD0B-2BF0-4D68-B625-F6018EF0DCFA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3BE4AD0B-2BF0-4D68-B625-F6018EF0DCFA}.Release|Any CPU.Build.0 = Release|Any CPU - {43DAFAC6-5343-4621-960E-A8A977EA3F0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {43DAFAC6-5343-4621-960E-A8A977EA3F0B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {43DAFAC6-5343-4621-960E-A8A977EA3F0B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {43DAFAC6-5343-4621-960E-A8A977EA3F0B}.Release|Any CPU.Build.0 = Release|Any CPU - {20354386-3E71-4046-A269-3BC2A06F3EC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {20354386-3E71-4046-A269-3BC2A06F3EC8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {20354386-3E71-4046-A269-3BC2A06F3EC8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {20354386-3E71-4046-A269-3BC2A06F3EC8}.Release|Any CPU.Build.0 = Release|Any CPU - {48EA5BBE-70E2-4198-869D-D7E59C45F30D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {48EA5BBE-70E2-4198-869D-D7E59C45F30D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {48EA5BBE-70E2-4198-869D-D7E59C45F30D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {48EA5BBE-70E2-4198-869D-D7E59C45F30D}.Release|Any CPU.Build.0 = Release|Any CPU - {661B70D7-F56A-46E0-9B81-6227B591B5E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {661B70D7-F56A-46E0-9B81-6227B591B5E7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {661B70D7-F56A-46E0-9B81-6227B591B5E7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {661B70D7-F56A-46E0-9B81-6227B591B5E7}.Release|Any CPU.Build.0 = Release|Any CPU - {881F7AD1-A84E-47A2-9402-115C63C4031E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {881F7AD1-A84E-47A2-9402-115C63C4031E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {881F7AD1-A84E-47A2-9402-115C63C4031E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {881F7AD1-A84E-47A2-9402-115C63C4031E}.Release|Any CPU.Build.0 = Release|Any CPU - {0EBC910B-8867-4D3E-8686-91F34183D839}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0EBC910B-8867-4D3E-8686-91F34183D839}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0EBC910B-8867-4D3E-8686-91F34183D839}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0EBC910B-8867-4D3E-8686-91F34183D839}.Release|Any CPU.Build.0 = Release|Any CPU - {2B372155-80BA-4CF9-82D6-4B938E8EC3A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2B372155-80BA-4CF9-82D6-4B938E8EC3A0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2B372155-80BA-4CF9-82D6-4B938E8EC3A0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2B372155-80BA-4CF9-82D6-4B938E8EC3A0}.Release|Any CPU.Build.0 = Release|Any CPU - {FE90181D-A4B3-4A5C-8490-F07561E18E3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FE90181D-A4B3-4A5C-8490-F07561E18E3B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FE90181D-A4B3-4A5C-8490-F07561E18E3B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FE90181D-A4B3-4A5C-8490-F07561E18E3B}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.csproj b/src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.csproj old mode 100644 new mode 100755 index de4005c2f66..08df026a53a --- a/src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.csproj +++ b/src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.csproj @@ -1,54 +1,27 @@ - - + + + + + - Debug - AnyCPU - 10.0.0 - 2.0 - {61ECB8EE-0C96-4F8E-B187-8E4D227417C0} + net45;netcoreapp1.0 + Grpc.Examples.MathClient Exe - math - MathClient - v4.5 - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - - - pdbonly - true - bin\Release - prompt - 4 + Grpc.Examples.MathClient + 1.0.4 + - + - - - Version.cs - - - - - - - - {CCC4440E-49F7-4790-B0AF-FEABB0837AE7} - Grpc.Core - - - {7DC1433E-3225-42C7-B7EA-546D56E27A4B} - Grpc.Examples - + + + + + - + - \ No newline at end of file + + diff --git a/src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.project.json b/src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.project.json deleted file mode 100644 index c2f5bcb1637..00000000000 --- a/src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.project.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "frameworks": { - "net45": { } - }, - "runtimes": { - "win": { } - } -} diff --git a/src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.xproj b/src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.xproj deleted file mode 100644 index 4655bd43774..00000000000 --- a/src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0.25123 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - fd48deca-1622-4173-b1d9-2101cf5e7c5f - Grpc.Examples.MathClient - ..\artifacts\obj\$(MSBuildProjectName) - .\bin\ - - - 2.0 - - - \ No newline at end of file diff --git a/src/csharp/Grpc.Examples.MathClient/packages.config b/src/csharp/Grpc.Examples.MathClient/packages.config deleted file mode 100644 index 79ece06bef6..00000000000 --- a/src/csharp/Grpc.Examples.MathClient/packages.config +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/csharp/Grpc.Examples.MathClient/project.json b/src/csharp/Grpc.Examples.MathClient/project.json deleted file mode 100644 index 81c17151aa5..00000000000 --- a/src/csharp/Grpc.Examples.MathClient/project.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "buildOptions": { - "emitEntryPoint": true - }, - "configurations": { - "Debug": { - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - }, - "copyToOutput": { - "mappings": { - "grpc_csharp_ext.x64.dll": "../../../cmake/build/x64/Debug/grpc_csharp_ext.dll", - "grpc_csharp_ext.x86.dll": "../../../cmake/build/Win32/Debug/grpc_csharp_ext.dll", - "libgrpc_csharp_ext.x64.so": "../../../libs/dbg/libgrpc_csharp_ext.so", - "libgrpc_csharp_ext.x64.dylib": "../../../libs/dbg/libgrpc_csharp_ext.dylib" - } - } - } - }, - "Release": { - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - }, - "copyToOutput": { - "mappings": { - "grpc_csharp_ext.x64.dll": "../../../cmake/build/x64/Release/grpc_csharp_ext.dll", - "grpc_csharp_ext.x86.dll": "../../../cmake/build/Win32/Release/grpc_csharp_ext.dll", - "libgrpc_csharp_ext.x64.so": "../../../libs/opt/libgrpc_csharp_ext.so", - "libgrpc_csharp_ext.x64.dylib": "../../../libs/opt/libgrpc_csharp_ext.dylib" - } - } - } - } - }, - - "dependencies": { - "Grpc.Examples": { - "target": "project" - } - }, - "frameworks": { - "net45": { }, - "netcoreapp1.0": { - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } -} diff --git a/src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.csproj b/src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.csproj old mode 100644 new mode 100755 index 3f38de2b714..a02937474a1 --- a/src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.csproj +++ b/src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.csproj @@ -1,54 +1,27 @@ - - + + + + + - Debug - AnyCPU - 10.0.0 - 2.0 - {BF62FE08-373A-43D6-9D73-41CAA38B7011} + net45;netcoreapp1.0 + Grpc.Examples.MathServer Exe - Grpc.Examples.MathServer - MathServer - v4.5 - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - - - pdbonly - true - bin\Release - prompt - 4 + Grpc.Examples.MathServer + 1.0.4 + - + - - - Version.cs - - - - - - - - {CCC4440E-49F7-4790-B0AF-FEABB0837AE7} - Grpc.Core - - - {7DC1433E-3225-42C7-B7EA-546D56E27A4B} - Grpc.Examples - + + + + + - + - \ No newline at end of file + + diff --git a/src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.project.json b/src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.project.json deleted file mode 100644 index c2f5bcb1637..00000000000 --- a/src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.project.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "frameworks": { - "net45": { } - }, - "runtimes": { - "win": { } - } -} diff --git a/src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.xproj b/src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.xproj deleted file mode 100644 index 38a449e8f29..00000000000 --- a/src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0.25123 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 58579368-5372-4e67-acd6-9b59cb9fa698 - Grpc.Examples.MathServer - ..\artifacts\obj\$(MSBuildProjectName) - .\bin\ - - - 2.0 - - - \ No newline at end of file diff --git a/src/csharp/Grpc.Examples.MathServer/packages.config b/src/csharp/Grpc.Examples.MathServer/packages.config deleted file mode 100644 index 79ece06bef6..00000000000 --- a/src/csharp/Grpc.Examples.MathServer/packages.config +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/csharp/Grpc.Examples.MathServer/project.json b/src/csharp/Grpc.Examples.MathServer/project.json deleted file mode 100644 index 81c17151aa5..00000000000 --- a/src/csharp/Grpc.Examples.MathServer/project.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "buildOptions": { - "emitEntryPoint": true - }, - "configurations": { - "Debug": { - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - }, - "copyToOutput": { - "mappings": { - "grpc_csharp_ext.x64.dll": "../../../cmake/build/x64/Debug/grpc_csharp_ext.dll", - "grpc_csharp_ext.x86.dll": "../../../cmake/build/Win32/Debug/grpc_csharp_ext.dll", - "libgrpc_csharp_ext.x64.so": "../../../libs/dbg/libgrpc_csharp_ext.so", - "libgrpc_csharp_ext.x64.dylib": "../../../libs/dbg/libgrpc_csharp_ext.dylib" - } - } - } - }, - "Release": { - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - }, - "copyToOutput": { - "mappings": { - "grpc_csharp_ext.x64.dll": "../../../cmake/build/x64/Release/grpc_csharp_ext.dll", - "grpc_csharp_ext.x86.dll": "../../../cmake/build/Win32/Release/grpc_csharp_ext.dll", - "libgrpc_csharp_ext.x64.so": "../../../libs/opt/libgrpc_csharp_ext.so", - "libgrpc_csharp_ext.x64.dylib": "../../../libs/opt/libgrpc_csharp_ext.dylib" - } - } - } - } - }, - - "dependencies": { - "Grpc.Examples": { - "target": "project" - } - }, - "frameworks": { - "net45": { }, - "netcoreapp1.0": { - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } -} diff --git a/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.csproj b/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.csproj old mode 100644 new mode 100755 index c96243b1c70..9a8e62cc8be --- a/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.csproj +++ b/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.csproj @@ -1,69 +1,33 @@ - - + + + + + - Debug - AnyCPU - {143B1C29-C442-4BE0-BF3F-A8F92288AC9F} - Exe - Grpc.Examples.Tests + net45;netcoreapp1.0 Grpc.Examples.Tests - v4.5 - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - - - pdbonly - true - bin\Release - prompt - 4 + Exe + Grpc.Examples.Tests + $(PackageTargetFallback);portable-net45 + 1.0.4 + - - - ..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll - - - ..\packages\NUnit.3.6.0\lib\net45\nunit.framework.dll - - - ..\packages\NUnitLite.3.6.0\lib\net45\nunitlite.dll - - - ..\packages\Google.Protobuf.3.2.0\lib\net45\Google.Protobuf.dll - + + - - Version.cs - - - - + + - - - - {CCC4440E-49F7-4790-B0AF-FEABB0837AE7} - Grpc.Core - - - {7DC1433E-3225-42C7-B7EA-546D56E27A4B} - Grpc.Examples - - - - - + + + + + - + + diff --git a/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.project.json b/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.project.json deleted file mode 100644 index c2f5bcb1637..00000000000 --- a/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.project.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "frameworks": { - "net45": { } - }, - "runtimes": { - "win": { } - } -} diff --git a/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.xproj b/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.xproj deleted file mode 100644 index 9cecd18b2e4..00000000000 --- a/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0.25123 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - c61714a6-f633-44fb-97f4-c91f425c1d15 - Grpc.Examples.Tests - ..\artifacts\obj\$(MSBuildProjectName) - .\bin\ - - - 2.0 - - - \ No newline at end of file diff --git a/src/csharp/Grpc.Examples.Tests/packages.config b/src/csharp/Grpc.Examples.Tests/packages.config deleted file mode 100644 index 8a7f7a0652a..00000000000 --- a/src/csharp/Grpc.Examples.Tests/packages.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/csharp/Grpc.Examples.Tests/project.json b/src/csharp/Grpc.Examples.Tests/project.json deleted file mode 100644 index 4ffcaf57fd9..00000000000 --- a/src/csharp/Grpc.Examples.Tests/project.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "buildOptions": { - "emitEntryPoint": true - }, - "configurations": { - "Debug": { - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - }, - "copyToOutput": { - "mappings": { - "grpc_csharp_ext.x64.dll": "../../../cmake/build/x64/Debug/grpc_csharp_ext.dll", - "grpc_csharp_ext.x86.dll": "../../../cmake/build/Win32/Debug/grpc_csharp_ext.dll", - "libgrpc_csharp_ext.x64.so": "../../../libs/dbg/libgrpc_csharp_ext.so", - "libgrpc_csharp_ext.x64.dylib": "../../../libs/dbg/libgrpc_csharp_ext.dylib" - } - } - } - }, - "Release": { - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - }, - "copyToOutput": { - "mappings": { - "grpc_csharp_ext.x64.dll": "../../../cmake/build/x64/Release/grpc_csharp_ext.dll", - "grpc_csharp_ext.x86.dll": "../../../cmake/build/Win32/Release/grpc_csharp_ext.dll", - "libgrpc_csharp_ext.x64.so": "../../../libs/opt/libgrpc_csharp_ext.so", - "libgrpc_csharp_ext.x64.dylib": "../../../libs/opt/libgrpc_csharp_ext.dylib" - } - } - } - } - }, - - "dependencies": { - "Grpc.Examples": { - "target": "project" - }, - "NUnit": "3.6.0", - "NUnitLite": "3.6.0" - }, - "frameworks": { - "net45": { }, - "netcoreapp1.0": { - "imports": [ - "portable-net45" - ], - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } -} diff --git a/src/csharp/Grpc.Examples/Grpc.Examples.csproj b/src/csharp/Grpc.Examples/Grpc.Examples.csproj old mode 100644 new mode 100755 index fc927543f73..625c1723bc8 --- a/src/csharp/Grpc.Examples/Grpc.Examples.csproj +++ b/src/csharp/Grpc.Examples/Grpc.Examples.csproj @@ -1,62 +1,30 @@ - - + + + + + - Debug - AnyCPU - {7DC1433E-3225-42C7-B7EA-546D56E27A4B} - Library - Grpc.Examples + net45;netcoreapp1.0 Grpc.Examples - v4.5 - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - - - pdbonly - true - bin\Release - prompt - 4 + Grpc.Examples + 1.0.4 + - - - - ..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll - - - ..\packages\NUnit.3.6.0\lib\net45\nunit.framework.dll - - - ..\packages\Google.Protobuf.3.2.0\lib\net45\Google.Protobuf.dll - + + - - Version.cs - - - - - - + - + - - {CCC4440E-49F7-4790-B0AF-FEABB0837AE7} - Grpc.Core - + - - - + + + + + diff --git a/src/csharp/Grpc.Examples/Grpc.Examples.project.json b/src/csharp/Grpc.Examples/Grpc.Examples.project.json deleted file mode 100644 index c2f5bcb1637..00000000000 --- a/src/csharp/Grpc.Examples/Grpc.Examples.project.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "frameworks": { - "net45": { } - }, - "runtimes": { - "win": { } - } -} diff --git a/src/csharp/Grpc.Examples/Grpc.Examples.xproj b/src/csharp/Grpc.Examples/Grpc.Examples.xproj deleted file mode 100644 index d1d7e6d9816..00000000000 --- a/src/csharp/Grpc.Examples/Grpc.Examples.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0.25123 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - c77b792d-fc78-4ce2-9522-b40b0803c636 - Grpc.Examples - ..\artifacts\obj\$(MSBuildProjectName) - .\bin\ - - - 2.0 - - - \ No newline at end of file diff --git a/src/csharp/Grpc.Examples/packages.config b/src/csharp/Grpc.Examples/packages.config deleted file mode 100644 index 79a898081ed..00000000000 --- a/src/csharp/Grpc.Examples/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/csharp/Grpc.Examples/project.json b/src/csharp/Grpc.Examples/project.json deleted file mode 100644 index 3ee0a713569..00000000000 --- a/src/csharp/Grpc.Examples/project.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "buildOptions": { - }, - - "dependencies": { - "Grpc.Core": { - "target": "project" - }, - "Google.Protobuf": "3.2.0" - }, - "frameworks": { - "net45": {}, - "netcoreapp1.0": { - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } -} diff --git a/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj b/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj old mode 100644 new mode 100755 index 71f0ee19b86..b0e2716e7e5 --- a/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj +++ b/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj @@ -1,82 +1,33 @@ - - - + + + + + - Debug - AnyCPU - {F8C6D937-C44B-4EE3-A431-B0FBAEACE47D} - Exe - Properties - Grpc.HealthCheck.Tests + net45;netcoreapp1.0 Grpc.HealthCheck.Tests - v4.5 - 512 - - - true - full - false - bin\Debug\ - prompt - 4 - - - pdbonly - true - bin\Release\ - prompt - 4 + Exe + Grpc.HealthCheck.Tests + $(PackageTargetFallback);portable-net45 + 1.0.4 + - - - - - - - - - ..\packages\Google.Protobuf.3.2.0\lib\net45\Google.Protobuf.dll - - - ..\packages\NUnit.3.6.0\lib\net45\nunit.framework.dll - - - ..\packages\NUnitLite.3.6.0\lib\net45\nunitlite.dll - + + - - Version.cs - - - - - + + - - - {CCC4440E-49F7-4790-B0AF-FEABB0837AE7} - Grpc.Core - - - {AA5E328A-8835-49D7-98ED-C29F2B3049F0} - Grpc.HealthCheck - - - - - + + + + + - + - - - \ No newline at end of file + + diff --git a/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.project.json b/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.project.json deleted file mode 100644 index c2f5bcb1637..00000000000 --- a/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.project.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "frameworks": { - "net45": { } - }, - "runtimes": { - "win": { } - } -} diff --git a/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.xproj b/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.xproj deleted file mode 100644 index 724c5b2a160..00000000000 --- a/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0.25123 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 43dafac6-5343-4621-960e-a8a977ea3f0b - Grpc.HealthCheck.Tests - ..\artifacts\obj\$(MSBuildProjectName) - .\bin\ - - - 2.0 - - - \ No newline at end of file diff --git a/src/csharp/Grpc.HealthCheck.Tests/packages.config b/src/csharp/Grpc.HealthCheck.Tests/packages.config deleted file mode 100644 index 48c94bc4a30..00000000000 --- a/src/csharp/Grpc.HealthCheck.Tests/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/csharp/Grpc.HealthCheck.Tests/project.json b/src/csharp/Grpc.HealthCheck.Tests/project.json deleted file mode 100644 index 2814cbfe466..00000000000 --- a/src/csharp/Grpc.HealthCheck.Tests/project.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "buildOptions": { - "emitEntryPoint": true - }, - "configurations": { - "Debug": { - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - }, - "copyToOutput": { - "mappings": { - "grpc_csharp_ext.x64.dll": "../../../cmake/build/x64/Debug/grpc_csharp_ext.dll", - "grpc_csharp_ext.x86.dll": "../../../cmake/build/Win32/Debug/grpc_csharp_ext.dll", - "libgrpc_csharp_ext.x64.so": "../../../libs/dbg/libgrpc_csharp_ext.so", - "libgrpc_csharp_ext.x64.dylib": "../../../libs/dbg/libgrpc_csharp_ext.dylib" - } - } - } - }, - "Release": { - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - }, - "copyToOutput": { - "mappings": { - "grpc_csharp_ext.x64.dll": "../../../cmake/build/x64/Release/grpc_csharp_ext.dll", - "grpc_csharp_ext.x86.dll": "../../../cmake/build/Win32/Release/grpc_csharp_ext.dll", - "libgrpc_csharp_ext.x64.so": "../../../libs/opt/libgrpc_csharp_ext.so", - "libgrpc_csharp_ext.x64.dylib": "../../../libs/opt/libgrpc_csharp_ext.dylib" - } - } - } - } - }, - - "dependencies": { - "Grpc.HealthCheck": { - "target": "project" - }, - "NUnit": "3.6.0", - "NUnitLite": "3.6.0" - }, - "frameworks": { - "net45": { }, - "netcoreapp1.0": { - "imports": [ - "portable-net45" - ], - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } -} diff --git a/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj b/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj old mode 100644 new mode 100755 index 171525b7086..eac6e1fc95f --- a/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj +++ b/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj @@ -1,73 +1,37 @@ - - - + + + + + - Debug - AnyCPU - {AA5E328A-8835-49D7-98ED-C29F2B3049F0} - Library - Properties - Grpc.HealthCheck + Copyright 2015, Google Inc. + gRPC C# Healthchecking + $(GrpcCsharpVersion) + Google Inc. + net45;netstandard1.5 Grpc.HealthCheck - v4.5 - 512 - bin\$(Configuration)\Grpc.HealthCheck.Xml - - - true - full - false - bin\Debug\ - prompt - 4 - - - pdbonly - true - bin\Release\ - prompt - 4 + Grpc.HealthCheck + gRPC health check + https://github.com/grpc/grpc + https://github.com/grpc/grpc/blob/master/LICENSE + 1.6.0 + - - - - - - - - - ..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll - - - ..\packages\Google.Protobuf.3.2.0\lib\net45\Google.Protobuf.dll - + + - - Version.cs - - - - - + + - - + - - - {CCC4440E-49F7-4790-B0AF-FEABB0837AE7} - Grpc.Core - + + + + - - + diff --git a/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.project.json b/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.project.json deleted file mode 100644 index c2f5bcb1637..00000000000 --- a/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.project.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "frameworks": { - "net45": { } - }, - "runtimes": { - "win": { } - } -} diff --git a/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.xproj b/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.xproj deleted file mode 100644 index 5806a7af979..00000000000 --- a/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0.25123 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 3be4ad0b-2bf0-4d68-b625-f6018ef0dcfa - Grpc.HealthCheck - ..\artifacts\obj\$(MSBuildProjectName) - .\bin\ - - - 2.0 - - - \ No newline at end of file diff --git a/src/csharp/Grpc.HealthCheck/packages.config b/src/csharp/Grpc.HealthCheck/packages.config deleted file mode 100644 index eec292b306d..00000000000 --- a/src/csharp/Grpc.HealthCheck/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.csproj b/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.csproj old mode 100644 new mode 100755 index a793f3f6df8..dcb24c72166 --- a/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.csproj +++ b/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.csproj @@ -1,59 +1,28 @@ - - + + + + + - Debug - AnyCPU - {3D166931-BA2D-416E-95A3-D36E8F6E90B9} - Exe - Grpc.IntegrationTesting.Client + net45;netcoreapp1.0 Grpc.IntegrationTesting.Client - Grpc.IntegrationTesting.Client.Program - v4.5 - dfa56e6c - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - AnyCPU - - - pdbonly - true - bin\Release - prompt - 4 - AnyCPU + Exe + Grpc.IntegrationTesting.Client + $(PackageTargetFallback);portable-net45 + 1.0.4 + - - - - + - - - Version.cs - - - - - - - - {C61154BA-DD4A-4838-8420-0162A28925E0} - Grpc.IntegrationTesting - - - {CCC4440E-49F7-4790-B0AF-FEABB0837AE7} - Grpc.Core - + + + + + - + - \ No newline at end of file + + diff --git a/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.project.json b/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.project.json deleted file mode 100644 index c2f5bcb1637..00000000000 --- a/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.project.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "frameworks": { - "net45": { } - }, - "runtimes": { - "win": { } - } -} diff --git a/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.xproj b/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.xproj deleted file mode 100644 index 7f456cfaef1..00000000000 --- a/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0.25123 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 48ea5bbe-70e2-4198-869d-d7e59c45f30d - Grpc.IntegrationTesting.Client - ..\artifacts\obj\$(MSBuildProjectName) - .\bin\ - - - 2.0 - - - \ No newline at end of file diff --git a/src/csharp/Grpc.IntegrationTesting.Client/project.json b/src/csharp/Grpc.IntegrationTesting.Client/project.json deleted file mode 100644 index f90528151b4..00000000000 --- a/src/csharp/Grpc.IntegrationTesting.Client/project.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "buildOptions": { - "emitEntryPoint": true - }, - "configurations": { - "Debug": { - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - }, - "copyToOutput": { - "mappings": { - "data/ca.pem": "../Grpc.IntegrationTesting/data/ca.pem", - "data/server1.key": "../Grpc.IntegrationTesting/data/server1.key", - "data/server1.pem": "../Grpc.IntegrationTesting/data/server1.pem", - "grpc_csharp_ext.x64.dll": "../../../cmake/build/x64/Debug/grpc_csharp_ext.dll", - "grpc_csharp_ext.x86.dll": "../../../cmake/build/Win32/Debug/grpc_csharp_ext.dll", - "libgrpc_csharp_ext.x64.so": "../../../libs/dbg/libgrpc_csharp_ext.so", - "libgrpc_csharp_ext.x64.dylib": "../../../libs/dbg/libgrpc_csharp_ext.dylib" - } - } - } - }, - "Release": { - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - }, - "copyToOutput": { - "mappings": { - "data/ca.pem": "../Grpc.IntegrationTesting/data/ca.pem", - "data/server1.key": "../Grpc.IntegrationTesting/data/server1.key", - "data/server1.pem": "../Grpc.IntegrationTesting/data/server1.pem", - "grpc_csharp_ext.x64.dll": "../../../cmake/build/x64/Release/grpc_csharp_ext.dll", - "grpc_csharp_ext.x86.dll": "../../../cmake/build/Win32/Release/grpc_csharp_ext.dll", - "libgrpc_csharp_ext.x64.so": "../../../libs/opt/libgrpc_csharp_ext.so", - "libgrpc_csharp_ext.x64.dylib": "../../../libs/opt/libgrpc_csharp_ext.dylib" - } - } - } - } - }, - - "dependencies": { - "Grpc.IntegrationTesting": { - "target": "project" - } - }, - "frameworks": { - "net45": { }, - "netcoreapp1.0": { - "imports": [ - "portable-net45" - ], - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } -} diff --git a/src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.csproj b/src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.csproj old mode 100644 new mode 100755 index 3b9587e3151..43772020d6f --- a/src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.csproj +++ b/src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.csproj @@ -1,54 +1,29 @@ - - + + + + + - Debug - AnyCPU - {B82B7DFE-7F7B-40EF-B3D6-064FF2B01294} - Exe - Grpc.IntegrationTesting.QpsWorker + net45;netcoreapp1.0 Grpc.IntegrationTesting.QpsWorker - v4.5 - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - AnyCPU - - - pdbonly - true - bin\Release - prompt - 4 - AnyCPU + Exe + Grpc.IntegrationTesting.QpsWorker + true + $(PackageTargetFallback);portable-net45 + 1.0.4 + - + - - - Version.cs - - - - - - - - {CCC4440E-49F7-4790-B0AF-FEABB0837AE7} - Grpc.Core - - - {C61154BA-DD4A-4838-8420-0162A28925E0} - Grpc.IntegrationTesting - + + + + + - + - \ No newline at end of file + + diff --git a/src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.project.json b/src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.project.json deleted file mode 100644 index c2f5bcb1637..00000000000 --- a/src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.project.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "frameworks": { - "net45": { } - }, - "runtimes": { - "win": { } - } -} diff --git a/src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.xproj b/src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.xproj deleted file mode 100644 index 15bec443d6c..00000000000 --- a/src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0.25123 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 661b70d7-f56a-46e0-9b81-6227b591b5e7 - Grpc.IntegrationTesting.QpsWorker - ..\artifacts\obj\$(MSBuildProjectName) - .\bin\ - - - 2.0 - - - \ No newline at end of file diff --git a/src/csharp/Grpc.IntegrationTesting.QpsWorker/project.json b/src/csharp/Grpc.IntegrationTesting.QpsWorker/project.json deleted file mode 100644 index 161e602abca..00000000000 --- a/src/csharp/Grpc.IntegrationTesting.QpsWorker/project.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "buildOptions": { - "emitEntryPoint": true - }, - "configurations": { - "Debug": { - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - }, - "copyToOutput": { - "mappings": { - "data/ca.pem": "../Grpc.IntegrationTesting/data/ca.pem", - "data/server1.key": "../Grpc.IntegrationTesting/data/server1.key", - "data/server1.pem": "../Grpc.IntegrationTesting/data/server1.pem", - "grpc_csharp_ext.x64.dll": "../../../cmake/build/x64/Debug/grpc_csharp_ext.dll", - "grpc_csharp_ext.x86.dll": "../../../cmake/build/Win32/Debug/grpc_csharp_ext.dll", - "libgrpc_csharp_ext.x64.so": "../../../libs/dbg/libgrpc_csharp_ext.so", - "libgrpc_csharp_ext.x64.dylib": "../../../libs/dbg/libgrpc_csharp_ext.dylib" - } - } - } - }, - "Release": { - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - }, - "copyToOutput": { - "mappings": { - "data/ca.pem": "../Grpc.IntegrationTesting/data/ca.pem", - "data/server1.key": "../Grpc.IntegrationTesting/data/server1.key", - "data/server1.pem": "../Grpc.IntegrationTesting/data/server1.pem", - "grpc_csharp_ext.x64.dll": "../../../cmake/build/x64/Release/grpc_csharp_ext.dll", - "grpc_csharp_ext.x86.dll": "../../../cmake/build/Win32/Release/grpc_csharp_ext.dll", - "libgrpc_csharp_ext.x64.so": "../../../libs/opt/libgrpc_csharp_ext.so", - "libgrpc_csharp_ext.x64.dylib": "../../../libs/opt/libgrpc_csharp_ext.dylib" - } - } - } - } - }, - - "dependencies": { - "Grpc.IntegrationTesting": { - "target": "project" - } - }, - "frameworks": { - "net45": { }, - "netcoreapp1.0": { - "imports": [ - "portable-net45" - ], - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - }, - "runtimeOptions": { - "configProperties": { - "System.GC.Server": true - } - } -} diff --git a/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.csproj b/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.csproj old mode 100644 new mode 100755 index 80d36363f71..db736baed05 --- a/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.csproj +++ b/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.csproj @@ -1,59 +1,28 @@ - - + + + + + - Debug - AnyCPU - {A654F3B8-E859-4E6A-B30D-227527DBEF0D} - Exe - Grpc.IntegrationTesting.Server + net45;netcoreapp1.0 Grpc.IntegrationTesting.Server - Grpc.IntegrationTesting.Server.Program - v4.5 - 7ceb739e - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - AnyCPU - - - pdbonly - true - bin\Release - prompt - 4 - AnyCPU + Exe + Grpc.IntegrationTesting.Server + $(PackageTargetFallback);portable-net45 + 1.0.4 + - - - - + - - - Version.cs - - - - - - - - {C61154BA-DD4A-4838-8420-0162A28925E0} - Grpc.IntegrationTesting - - - {CCC4440E-49F7-4790-B0AF-FEABB0837AE7} - Grpc.Core - + + + + + - + - \ No newline at end of file + + diff --git a/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.project.json b/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.project.json deleted file mode 100644 index c2f5bcb1637..00000000000 --- a/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.project.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "frameworks": { - "net45": { } - }, - "runtimes": { - "win": { } - } -} diff --git a/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.xproj b/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.xproj deleted file mode 100644 index 689eb0b8425..00000000000 --- a/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0.25123 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 881f7ad1-a84e-47a2-9402-115c63c4031e - Grpc.IntegrationTesting.Server - ..\artifacts\obj\$(MSBuildProjectName) - .\bin\ - - - 2.0 - - - \ No newline at end of file diff --git a/src/csharp/Grpc.IntegrationTesting.Server/project.json b/src/csharp/Grpc.IntegrationTesting.Server/project.json deleted file mode 100644 index f90528151b4..00000000000 --- a/src/csharp/Grpc.IntegrationTesting.Server/project.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "buildOptions": { - "emitEntryPoint": true - }, - "configurations": { - "Debug": { - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - }, - "copyToOutput": { - "mappings": { - "data/ca.pem": "../Grpc.IntegrationTesting/data/ca.pem", - "data/server1.key": "../Grpc.IntegrationTesting/data/server1.key", - "data/server1.pem": "../Grpc.IntegrationTesting/data/server1.pem", - "grpc_csharp_ext.x64.dll": "../../../cmake/build/x64/Debug/grpc_csharp_ext.dll", - "grpc_csharp_ext.x86.dll": "../../../cmake/build/Win32/Debug/grpc_csharp_ext.dll", - "libgrpc_csharp_ext.x64.so": "../../../libs/dbg/libgrpc_csharp_ext.so", - "libgrpc_csharp_ext.x64.dylib": "../../../libs/dbg/libgrpc_csharp_ext.dylib" - } - } - } - }, - "Release": { - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - }, - "copyToOutput": { - "mappings": { - "data/ca.pem": "../Grpc.IntegrationTesting/data/ca.pem", - "data/server1.key": "../Grpc.IntegrationTesting/data/server1.key", - "data/server1.pem": "../Grpc.IntegrationTesting/data/server1.pem", - "grpc_csharp_ext.x64.dll": "../../../cmake/build/x64/Release/grpc_csharp_ext.dll", - "grpc_csharp_ext.x86.dll": "../../../cmake/build/Win32/Release/grpc_csharp_ext.dll", - "libgrpc_csharp_ext.x64.so": "../../../libs/opt/libgrpc_csharp_ext.so", - "libgrpc_csharp_ext.x64.dylib": "../../../libs/opt/libgrpc_csharp_ext.dylib" - } - } - } - } - }, - - "dependencies": { - "Grpc.IntegrationTesting": { - "target": "project" - } - }, - "frameworks": { - "net45": { }, - "netcoreapp1.0": { - "imports": [ - "portable-net45" - ], - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } -} diff --git a/src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.csproj b/src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.csproj old mode 100644 new mode 100755 index 0f283404504..fe4e0da4171 --- a/src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.csproj +++ b/src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.csproj @@ -1,54 +1,28 @@ - - + + + + + - Debug - AnyCPU - {ADEBA147-80AE-4710-82E9-5B7F93690266} - Exe - Grpc.IntegrationTesting.StressClient + net45;netcoreapp1.0 Grpc.IntegrationTesting.StressClient - v4.5 - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - AnyCPU - - - pdbonly - true - bin\Release - prompt - 4 - AnyCPU + Exe + Grpc.IntegrationTesting.StressClient + $(PackageTargetFallback);portable-net45 + 1.0.4 + - + - - - Version.cs - - - - - - - - {CCC4440E-49F7-4790-B0AF-FEABB0837AE7} - Grpc.Core - - - {C61154BA-DD4A-4838-8420-0162A28925E0} - Grpc.IntegrationTesting - + + + + + - + - \ No newline at end of file + + diff --git a/src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.project.json b/src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.project.json deleted file mode 100644 index c2f5bcb1637..00000000000 --- a/src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.project.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "frameworks": { - "net45": { } - }, - "runtimes": { - "win": { } - } -} diff --git a/src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.xproj b/src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.xproj deleted file mode 100644 index 2f4fdcbb470..00000000000 --- a/src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0.25123 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 0ebc910b-8867-4d3e-8686-91f34183d839 - Grpc.IntegrationTesting.StressClient - .\obj - .\bin\ - - - - 2.0 - - - \ No newline at end of file diff --git a/src/csharp/Grpc.IntegrationTesting.StressClient/project.json b/src/csharp/Grpc.IntegrationTesting.StressClient/project.json deleted file mode 100644 index f90528151b4..00000000000 --- a/src/csharp/Grpc.IntegrationTesting.StressClient/project.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "buildOptions": { - "emitEntryPoint": true - }, - "configurations": { - "Debug": { - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - }, - "copyToOutput": { - "mappings": { - "data/ca.pem": "../Grpc.IntegrationTesting/data/ca.pem", - "data/server1.key": "../Grpc.IntegrationTesting/data/server1.key", - "data/server1.pem": "../Grpc.IntegrationTesting/data/server1.pem", - "grpc_csharp_ext.x64.dll": "../../../cmake/build/x64/Debug/grpc_csharp_ext.dll", - "grpc_csharp_ext.x86.dll": "../../../cmake/build/Win32/Debug/grpc_csharp_ext.dll", - "libgrpc_csharp_ext.x64.so": "../../../libs/dbg/libgrpc_csharp_ext.so", - "libgrpc_csharp_ext.x64.dylib": "../../../libs/dbg/libgrpc_csharp_ext.dylib" - } - } - } - }, - "Release": { - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - }, - "copyToOutput": { - "mappings": { - "data/ca.pem": "../Grpc.IntegrationTesting/data/ca.pem", - "data/server1.key": "../Grpc.IntegrationTesting/data/server1.key", - "data/server1.pem": "../Grpc.IntegrationTesting/data/server1.pem", - "grpc_csharp_ext.x64.dll": "../../../cmake/build/x64/Release/grpc_csharp_ext.dll", - "grpc_csharp_ext.x86.dll": "../../../cmake/build/Win32/Release/grpc_csharp_ext.dll", - "libgrpc_csharp_ext.x64.so": "../../../libs/opt/libgrpc_csharp_ext.so", - "libgrpc_csharp_ext.x64.dylib": "../../../libs/opt/libgrpc_csharp_ext.dylib" - } - } - } - } - }, - - "dependencies": { - "Grpc.IntegrationTesting": { - "target": "project" - } - }, - "frameworks": { - "net45": { }, - "netcoreapp1.0": { - "imports": [ - "portable-net45" - ], - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } -} diff --git a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj old mode 100644 new mode 100755 index 38b9a5d3c59..05728de8577 --- a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj +++ b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj @@ -1,152 +1,56 @@ - - + + + + + - Debug - AnyCPU - {C61154BA-DD4A-4838-8420-0162A28925E0} - Exe - Grpc.IntegrationTesting + net45;netcoreapp1.0 Grpc.IntegrationTesting - v4.5 - 3a1c655d - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - AnyCPU - - - pdbonly - true - bin\Release - prompt - 4 - AnyCPU + Exe + Grpc.IntegrationTesting + $(PackageTargetFallback);portable-net45 + 1.0.4 + - - - - - - ..\packages\Zlib.Portable.Signed.1.11.0\lib\portable-net4+sl5+wp8+win8+wpa81+MonoTouch+MonoAndroid\Zlib.Portable.dll - - - ..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll - - - ..\packages\Google.Apis.Core.1.21.0\lib\net45\Google.Apis.Core.dll - - - ..\packages\Google.Apis.1.21.0\lib\net45\Google.Apis.dll - - - ..\packages\Google.Apis.1.21.0\lib\net45\Google.Apis.PlatformServices.dll - - - ..\packages\Google.Apis.Auth.1.21.0\lib\net45\Google.Apis.Auth.dll - - - ..\packages\Google.Apis.Auth.1.21.0\lib\net45\Google.Apis.Auth.PlatformServices.dll - - - ..\packages\Google.Protobuf.3.2.0\lib\net45\Google.Protobuf.dll - - - ..\packages\NUnit.3.6.0\lib\net45\nunit.framework.dll - - - ..\packages\NUnitLite.3.6.0\lib\net45\nunitlite.dll - - - ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - - - ..\packages\Castle.Core.4.0.0\lib\net45\Castle.Core.dll - - - ..\packages\Moq.4.7.0\lib\net45\Moq.dll - - - ..\packages\CommandLineParser.2.1.1-beta\lib\net45\CommandLine.dll - + + + - - Version.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - + + + + + + + + + + - - {CCC4440E-49F7-4790-B0AF-FEABB0837AE7} - Grpc.Core - - - {AE21D0EE-9A2C-4C15-AB7F-5224EED5B0EA} - Grpc.Auth - + + - - - Designer - - - PreserveNewest - - + PreserveNewest - - + false + + PreserveNewest - - + false + + PreserveNewest - - - - + false + + diff --git a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.project.json b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.project.json deleted file mode 100644 index c2f5bcb1637..00000000000 --- a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.project.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "frameworks": { - "net45": { } - }, - "runtimes": { - "win": { } - } -} diff --git a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.xproj b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.xproj deleted file mode 100644 index 357300ecb9b..00000000000 --- a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0.25123 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 20354386-3e71-4046-a269-3bc2a06f3ec8 - Grpc.IntegrationTesting - ..\artifacts\obj\$(MSBuildProjectName) - .\bin\ - - - 2.0 - - - \ No newline at end of file diff --git a/src/csharp/Grpc.IntegrationTesting/packages.config b/src/csharp/Grpc.IntegrationTesting/packages.config deleted file mode 100644 index 030f9d97b89..00000000000 --- a/src/csharp/Grpc.IntegrationTesting/packages.config +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/csharp/Grpc.IntegrationTesting/project.json b/src/csharp/Grpc.IntegrationTesting/project.json deleted file mode 100644 index 40fc566adcf..00000000000 --- a/src/csharp/Grpc.IntegrationTesting/project.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "buildOptions": { - "emitEntryPoint": true - }, - "configurations": { - "Debug": { - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - }, - "copyToOutput": { - "mappings": { - "data/ca.pem": "../Grpc.IntegrationTesting/data/ca.pem", - "data/server1.key": "../Grpc.IntegrationTesting/data/server1.key", - "data/server1.pem": "../Grpc.IntegrationTesting/data/server1.pem", - "grpc_csharp_ext.x64.dll": "../../../cmake/build/x64/Debug/grpc_csharp_ext.dll", - "grpc_csharp_ext.x86.dll": "../../../cmake/build/Win32/Debug/grpc_csharp_ext.dll", - "libgrpc_csharp_ext.x64.so": "../../../libs/dbg/libgrpc_csharp_ext.so", - "libgrpc_csharp_ext.x64.dylib": "../../../libs/dbg/libgrpc_csharp_ext.dylib" - } - } - } - }, - "Release": { - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - }, - "copyToOutput": { - "mappings": { - "data/ca.pem": "../Grpc.IntegrationTesting/data/ca.pem", - "data/server1.key": "../Grpc.IntegrationTesting/data/server1.key", - "data/server1.pem": "../Grpc.IntegrationTesting/data/server1.pem", - "grpc_csharp_ext.x64.dll": "../../../cmake/build/x64/Release/grpc_csharp_ext.dll", - "grpc_csharp_ext.x86.dll": "../../../cmake/build/Win32/Release/grpc_csharp_ext.dll", - "libgrpc_csharp_ext.x64.so": "../../../libs/opt/libgrpc_csharp_ext.so", - "libgrpc_csharp_ext.x64.dylib": "../../../libs/opt/libgrpc_csharp_ext.dylib" - } - } - } - } - }, - - "dependencies": { - "Grpc.Auth": { - "target": "project" - }, - "Grpc.Core": { - "target": "project" - }, - "Google.Protobuf": "3.2.0", - "CommandLineParser": "2.1.1-beta", - "Moq": "4.7.0", - "NUnit": "3.6.0", - "NUnitLite": "3.6.0" - }, - "frameworks": { - "net45": { - "frameworkAssemblies": {} - }, - "netcoreapp1.0": { - "imports": [ - "portable-net45" - ], - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - }, - "System.Linq.Expressions": "4.1.0" - } - } - } -} diff --git a/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.csproj b/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.csproj old mode 100644 new mode 100755 index 7e2b551799e..af6ade852b2 --- a/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.csproj +++ b/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.csproj @@ -1,85 +1,33 @@ - - - + + + + + - Debug - AnyCPU - {B88F91D6-436D-4C78-8B99-47800FA8DE03} - Exe - Properties - Grpc.Reflection.Tests + net45;netcoreapp1.0 Grpc.Reflection.Tests - v4.5 - 512 - - - true - full - false - bin\Debug\ - prompt - 4 - - - pdbonly - true - bin\Release\ - prompt - 4 + Exe + Grpc.Reflection.Tests + $(PackageTargetFallback);portable-net45 + 1.0.4 + - - - - - - - - - ..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll - - - ..\packages\Google.Protobuf.3.2.0\lib\net45\Google.Protobuf.dll - - - ..\packages\NUnit.3.6.0\lib\net45\nunit.framework.dll - - - ..\packages\NUnitLite.3.6.0\lib\net45\nunitlite.dll - + + - - Version.cs - - - - - + + - - - {CCC4440E-49F7-4790-B0AF-FEABB0837AE7} - Grpc.Core - - - {4F18CF52-B3DB-4A77-97C5-7F7F4B6C1715} - Grpc.Reflection - - - - - + + + + + - + - - - \ No newline at end of file + + diff --git a/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.project.json b/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.project.json deleted file mode 100644 index c2f5bcb1637..00000000000 --- a/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.project.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "frameworks": { - "net45": { } - }, - "runtimes": { - "win": { } - } -} diff --git a/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.xproj b/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.xproj deleted file mode 100644 index 4a3100853d1..00000000000 --- a/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0.25123 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - fe90181d-a4b3-4a5c-8490-f07561e18e3b - Grpc.Reflection.Tests - ..\artifacts\obj\$(MSBuildProjectName) - .\bin\ - - - 2.0 - - - \ No newline at end of file diff --git a/src/csharp/Grpc.Reflection.Tests/packages.config b/src/csharp/Grpc.Reflection.Tests/packages.config deleted file mode 100644 index 8a7f7a0652a..00000000000 --- a/src/csharp/Grpc.Reflection.Tests/packages.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/csharp/Grpc.Reflection.Tests/project.json b/src/csharp/Grpc.Reflection.Tests/project.json deleted file mode 100644 index fc05557c884..00000000000 --- a/src/csharp/Grpc.Reflection.Tests/project.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "buildOptions": { - "emitEntryPoint": true - }, - "configurations": { - "Debug": { - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - }, - "copyToOutput": { - "mappings": { - "grpc_csharp_ext.x64.dll": "../../../cmake/build/x64/Debug/grpc_csharp_ext.dll", - "grpc_csharp_ext.x86.dll": "../../../cmake/build/Win32/Debug/grpc_csharp_ext.dll", - "libgrpc_csharp_ext.x64.so": "../../../libs/dbg/libgrpc_csharp_ext.so", - "libgrpc_csharp_ext.x64.dylib": "../../../libs/dbg/libgrpc_csharp_ext.dylib" - } - } - } - }, - "Release": { - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - }, - "copyToOutput": { - "mappings": { - "grpc_csharp_ext.x64.dll": "../../../cmake/build/x64/Release/grpc_csharp_ext.dll", - "grpc_csharp_ext.x86.dll": "../../../cmake/build/Win32/Release/grpc_csharp_ext.dll", - "libgrpc_csharp_ext.x64.so": "../../../libs/opt/libgrpc_csharp_ext.so", - "libgrpc_csharp_ext.x64.dylib": "../../../libs/opt/libgrpc_csharp_ext.dylib" - } - } - } - } - }, - - "dependencies": { - "Grpc.Reflection": { - "target": "project" - }, - "NUnit": "3.6.0", - "NUnitLite": "3.6.0" - }, - "frameworks": { - "net45": { }, - "netcoreapp1.0": { - "imports": [ - "portable-net45" - ], - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } -} diff --git a/src/csharp/Grpc.Reflection/Grpc.Reflection.csproj b/src/csharp/Grpc.Reflection/Grpc.Reflection.csproj old mode 100644 new mode 100755 index b0ab170e3f8..70bfcc89c5c --- a/src/csharp/Grpc.Reflection/Grpc.Reflection.csproj +++ b/src/csharp/Grpc.Reflection/Grpc.Reflection.csproj @@ -1,74 +1,37 @@ - - - + + + + + - Debug - AnyCPU - {4F18CF52-B3DB-4A77-97C5-7F7F4B6C1715} - Library - Properties - Grpc.Reflection + Copyright 2016, Google Inc. + gRPC C# Reflection + $(GrpcCsharpVersion) + Google Inc. + net45;netstandard1.5 Grpc.Reflection - v4.5 - 512 - bin\$(Configuration)\Grpc.Reflection.Xml - - - true - full - false - bin\Debug\ - prompt - 4 - - - pdbonly - true - bin\Release\ - prompt - 4 + Grpc.Reflection + gRPC reflection + https://github.com/grpc/grpc + https://github.com/grpc/grpc/blob/master/LICENSE + 1.6.0 + - - - - - - - - - ..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll - - - ..\packages\Google.Protobuf.3.2.0\lib\net45\Google.Protobuf.dll - + + - - Version.cs - - - - - - + + - - + - - - {CCC4440E-49F7-4790-B0AF-FEABB0837AE7} - Grpc.Core - + + + + - - - \ No newline at end of file + + diff --git a/src/csharp/Grpc.Reflection/Grpc.Reflection.project.json b/src/csharp/Grpc.Reflection/Grpc.Reflection.project.json deleted file mode 100644 index c2f5bcb1637..00000000000 --- a/src/csharp/Grpc.Reflection/Grpc.Reflection.project.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "frameworks": { - "net45": { } - }, - "runtimes": { - "win": { } - } -} diff --git a/src/csharp/Grpc.Reflection/Grpc.Reflection.xproj b/src/csharp/Grpc.Reflection/Grpc.Reflection.xproj deleted file mode 100644 index 833d98b1216..00000000000 --- a/src/csharp/Grpc.Reflection/Grpc.Reflection.xproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - 14.0.25123 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 2b372155-80ba-4cf9-82d6-4b938e8ec3a0 - Grpc.Reflection - ..\artifacts\obj\$(MSBuildProjectName) - .\bin\ - - - 2.0 - - - \ No newline at end of file diff --git a/src/csharp/Grpc.Reflection/packages.config b/src/csharp/Grpc.Reflection/packages.config deleted file mode 100644 index eec292b306d..00000000000 --- a/src/csharp/Grpc.Reflection/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/csharp/Grpc.sln b/src/csharp/Grpc.sln index 84ba46047f7..beab3ccb36c 100644 --- a/src/csharp/Grpc.sln +++ b/src/csharp/Grpc.sln @@ -1,125 +1,118 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -VisualStudioVersion = 12.0.31101.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.Examples", "Grpc.Examples\Grpc.Examples.csproj", "{7DC1433E-3225-42C7-B7EA-546D56E27A4B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.Core", "Grpc.Core\Grpc.Core.csproj", "{CCC4440E-49F7-4790-B0AF-FEABB0837AE7}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.Core.Tests", "Grpc.Core.Tests\Grpc.Core.Tests.csproj", "{86EC5CB4-4EA2-40A2-8057-86542A0353BB}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.Examples.Tests", "Grpc.Examples.Tests\Grpc.Examples.Tests.csproj", "{143B1C29-C442-4BE0-BF3F-A8F92288AC9F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.Examples.MathClient", "Grpc.Examples.MathClient\Grpc.Examples.MathClient.csproj", "{61ECB8EE-0C96-4F8E-B187-8E4D227417C0}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.IntegrationTesting", "Grpc.IntegrationTesting\Grpc.IntegrationTesting.csproj", "{C61154BA-DD4A-4838-8420-0162A28925E0}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.IntegrationTesting.Client", "Grpc.IntegrationTesting.Client\Grpc.IntegrationTesting.Client.csproj", "{3D166931-BA2D-416E-95A3-D36E8F6E90B9}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.IntegrationTesting.Server", "Grpc.IntegrationTesting.Server\Grpc.IntegrationTesting.Server.csproj", "{A654F3B8-E859-4E6A-B30D-227527DBEF0D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.Examples.MathServer", "Grpc.Examples.MathServer\Grpc.Examples.MathServer.csproj", "{BF62FE08-373A-43D6-9D73-41CAA38B7011}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.Auth", "Grpc.Auth\Grpc.Auth.csproj", "{AE21D0EE-9A2C-4C15-AB7F-5224EED5B0EA}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{B5B87121-35FE-49D1-8CB1-8A91AAA398A9}" - ProjectSection(SolutionItems) = preProject - .nuget\packages.config = .nuget\packages.config - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.HealthCheck", "Grpc.HealthCheck\Grpc.HealthCheck.csproj", "{AA5E328A-8835-49D7-98ED-C29F2B3049F0}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.HealthCheck.Tests", "Grpc.HealthCheck.Tests\Grpc.HealthCheck.Tests.csproj", "{F8C6D937-C44B-4EE3-A431-B0FBAEACE47D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.IntegrationTesting.QpsWorker", "Grpc.IntegrationTesting.QpsWorker\Grpc.IntegrationTesting.QpsWorker.csproj", "{B82B7DFE-7F7B-40EF-B3D6-064FF2B01294}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.IntegrationTesting.StressClient", "Grpc.IntegrationTesting.StressClient\Grpc.IntegrationTesting.StressClient.csproj", "{ADEBA147-80AE-4710-82E9-5B7F93690266}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.Reflection", "Grpc.Reflection\Grpc.Reflection.csproj", "{4F18CF52-B3DB-4A77-97C5-7F7F4B6C1715}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.Reflection.Tests", "Grpc.Reflection.Tests\Grpc.Reflection.Tests.csproj", "{B88F91D6-436D-4C78-8B99-47800FA8DE03}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.Core.Testing", "Grpc.Core.Testing\Grpc.Core.Testing.csproj", "{3AB047CA-6CF9-435D-AA61-2D86C6FA2457}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {143B1C29-C442-4BE0-BF3F-A8F92288AC9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {143B1C29-C442-4BE0-BF3F-A8F92288AC9F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {143B1C29-C442-4BE0-BF3F-A8F92288AC9F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {143B1C29-C442-4BE0-BF3F-A8F92288AC9F}.Release|Any CPU.Build.0 = Release|Any CPU - {3D166931-BA2D-416E-95A3-D36E8F6E90B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3D166931-BA2D-416E-95A3-D36E8F6E90B9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3D166931-BA2D-416E-95A3-D36E8F6E90B9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3D166931-BA2D-416E-95A3-D36E8F6E90B9}.Release|Any CPU.Build.0 = Release|Any CPU - {4F18CF52-B3DB-4A77-97C5-7F7F4B6C1715}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4F18CF52-B3DB-4A77-97C5-7F7F4B6C1715}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4F18CF52-B3DB-4A77-97C5-7F7F4B6C1715}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4F18CF52-B3DB-4A77-97C5-7F7F4B6C1715}.Release|Any CPU.Build.0 = Release|Any CPU - {61ECB8EE-0C96-4F8E-B187-8E4D227417C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {61ECB8EE-0C96-4F8E-B187-8E4D227417C0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {61ECB8EE-0C96-4F8E-B187-8E4D227417C0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {61ECB8EE-0C96-4F8E-B187-8E4D227417C0}.Release|Any CPU.Build.0 = Release|Any CPU - {7DC1433E-3225-42C7-B7EA-546D56E27A4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7DC1433E-3225-42C7-B7EA-546D56E27A4B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7DC1433E-3225-42C7-B7EA-546D56E27A4B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7DC1433E-3225-42C7-B7EA-546D56E27A4B}.Release|Any CPU.Build.0 = Release|Any CPU - {86EC5CB4-4EA2-40A2-8057-86542A0353BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {86EC5CB4-4EA2-40A2-8057-86542A0353BB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {86EC5CB4-4EA2-40A2-8057-86542A0353BB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {86EC5CB4-4EA2-40A2-8057-86542A0353BB}.Release|Any CPU.Build.0 = Release|Any CPU - {A654F3B8-E859-4E6A-B30D-227527DBEF0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A654F3B8-E859-4E6A-B30D-227527DBEF0D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A654F3B8-E859-4E6A-B30D-227527DBEF0D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A654F3B8-E859-4E6A-B30D-227527DBEF0D}.Release|Any CPU.Build.0 = Release|Any CPU - {AA5E328A-8835-49D7-98ED-C29F2B3049F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AA5E328A-8835-49D7-98ED-C29F2B3049F0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AA5E328A-8835-49D7-98ED-C29F2B3049F0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AA5E328A-8835-49D7-98ED-C29F2B3049F0}.Release|Any CPU.Build.0 = Release|Any CPU - {ADEBA147-80AE-4710-82E9-5B7F93690266}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {ADEBA147-80AE-4710-82E9-5B7F93690266}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ADEBA147-80AE-4710-82E9-5B7F93690266}.Release|Any CPU.ActiveCfg = Release|Any CPU - {ADEBA147-80AE-4710-82E9-5B7F93690266}.Release|Any CPU.Build.0 = Release|Any CPU - {AE21D0EE-9A2C-4C15-AB7F-5224EED5B0EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AE21D0EE-9A2C-4C15-AB7F-5224EED5B0EA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AE21D0EE-9A2C-4C15-AB7F-5224EED5B0EA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AE21D0EE-9A2C-4C15-AB7F-5224EED5B0EA}.Release|Any CPU.Build.0 = Release|Any CPU - {B82B7DFE-7F7B-40EF-B3D6-064FF2B01294}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B82B7DFE-7F7B-40EF-B3D6-064FF2B01294}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B82B7DFE-7F7B-40EF-B3D6-064FF2B01294}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B82B7DFE-7F7B-40EF-B3D6-064FF2B01294}.Release|Any CPU.Build.0 = Release|Any CPU - {B88F91D6-436D-4C78-8B99-47800FA8DE03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B88F91D6-436D-4C78-8B99-47800FA8DE03}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B88F91D6-436D-4C78-8B99-47800FA8DE03}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B88F91D6-436D-4C78-8B99-47800FA8DE03}.Release|Any CPU.Build.0 = Release|Any CPU - {BF62FE08-373A-43D6-9D73-41CAA38B7011}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BF62FE08-373A-43D6-9D73-41CAA38B7011}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BF62FE08-373A-43D6-9D73-41CAA38B7011}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BF62FE08-373A-43D6-9D73-41CAA38B7011}.Release|Any CPU.Build.0 = Release|Any CPU - {C61154BA-DD4A-4838-8420-0162A28925E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C61154BA-DD4A-4838-8420-0162A28925E0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C61154BA-DD4A-4838-8420-0162A28925E0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C61154BA-DD4A-4838-8420-0162A28925E0}.Release|Any CPU.Build.0 = Release|Any CPU - {CCC4440E-49F7-4790-B0AF-FEABB0837AE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CCC4440E-49F7-4790-B0AF-FEABB0837AE7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CCC4440E-49F7-4790-B0AF-FEABB0837AE7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CCC4440E-49F7-4790-B0AF-FEABB0837AE7}.Release|Any CPU.Build.0 = Release|Any CPU - {F8C6D937-C44B-4EE3-A431-B0FBAEACE47D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F8C6D937-C44B-4EE3-A431-B0FBAEACE47D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F8C6D937-C44B-4EE3-A431-B0FBAEACE47D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F8C6D937-C44B-4EE3-A431-B0FBAEACE47D}.Release|Any CPU.Build.0 = Release|Any CPU - {3AB047CA-6CF9-435D-AA61-2D86C6FA2457}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3AB047CA-6CF9-435D-AA61-2D86C6FA2457}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3AB047CA-6CF9-435D-AA61-2D86C6FA2457}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3AB047CA-6CF9-435D-AA61-2D86C6FA2457}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26228.4 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grpc.Core", "Grpc.Core\Grpc.Core.csproj", "{BD878CB3-BDB4-46AB-84EF-C3B4729F56BC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grpc.Auth", "Grpc.Auth\Grpc.Auth.csproj", "{2A16007A-5D67-4C53-BEC8-51E5064D18BF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grpc.Core.Testing", "Grpc.Core.Testing\Grpc.Core.Testing.csproj", "{05DC61DF-26F3-4F51-8577-1ABE4F4388B0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grpc.Core.Tests", "Grpc.Core.Tests\Grpc.Core.Tests.csproj", "{02C79983-6011-43E2-A52D-75F9FC64663F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grpc.Examples", "Grpc.Examples\Grpc.Examples.csproj", "{C643975D-5D26-4860-8002-3B62A132DA2B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grpc.Examples.MathClient", "Grpc.Examples.MathClient\Grpc.Examples.MathClient.csproj", "{1F498972-FD16-4A02-B133-C24652F14869}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grpc.Examples.MathServer", "Grpc.Examples.MathServer\Grpc.Examples.MathServer.csproj", "{9F2A873E-83E0-44C4-81D0-DDBC1D36F8B0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grpc.Examples.Tests", "Grpc.Examples.Tests\Grpc.Examples.Tests.csproj", "{7022461C-0D5E-4817-9A5A-3C027FD22457}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grpc.HealthCheck", "Grpc.HealthCheck\Grpc.HealthCheck.csproj", "{DBD57899-0148-4B0D-A8EA-DE3954FA657C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grpc.HealthCheck.Tests", "Grpc.HealthCheck.Tests\Grpc.HealthCheck.Tests.csproj", "{033E4DC1-5D79-4308-B8B1-9A1B71E39BA1}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grpc.IntegrationTesting", "Grpc.IntegrationTesting\Grpc.IntegrationTesting.csproj", "{CB43BF5B-4D31-4347-A97A-0164B1248B39}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grpc.IntegrationTesting.Client", "Grpc.IntegrationTesting.Client\Grpc.IntegrationTesting.Client.csproj", "{83CCB684-54E6-4552-A00D-3CF9291A1B27}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grpc.IntegrationTesting.QpsWorker", "Grpc.IntegrationTesting.QpsWorker\Grpc.IntegrationTesting.QpsWorker.csproj", "{8ED094CD-DF46-4272-A981-99F3DD184590}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grpc.IntegrationTesting.Server", "Grpc.IntegrationTesting.Server\Grpc.IntegrationTesting.Server.csproj", "{F3A264BE-A62F-4B6A-89A0-7CF7BB275460}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grpc.IntegrationTesting.StressClient", "Grpc.IntegrationTesting.StressClient\Grpc.IntegrationTesting.StressClient.csproj", "{0BB94A8B-9CE3-4A87-95BC-90F8A53CC154}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grpc.Reflection", "Grpc.Reflection\Grpc.Reflection.csproj", "{26807744-FD0B-494A-9F99-0B171E9A892E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grpc.Reflection.Tests", "Grpc.Reflection.Tests\Grpc.Reflection.Tests.csproj", "{335AD0A2-F2CC-4C2E-853C-26174206BEE7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BD878CB3-BDB4-46AB-84EF-C3B4729F56BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BD878CB3-BDB4-46AB-84EF-C3B4729F56BC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BD878CB3-BDB4-46AB-84EF-C3B4729F56BC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BD878CB3-BDB4-46AB-84EF-C3B4729F56BC}.Release|Any CPU.Build.0 = Release|Any CPU + {2A16007A-5D67-4C53-BEC8-51E5064D18BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2A16007A-5D67-4C53-BEC8-51E5064D18BF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2A16007A-5D67-4C53-BEC8-51E5064D18BF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2A16007A-5D67-4C53-BEC8-51E5064D18BF}.Release|Any CPU.Build.0 = Release|Any CPU + {05DC61DF-26F3-4F51-8577-1ABE4F4388B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {05DC61DF-26F3-4F51-8577-1ABE4F4388B0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {05DC61DF-26F3-4F51-8577-1ABE4F4388B0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {05DC61DF-26F3-4F51-8577-1ABE4F4388B0}.Release|Any CPU.Build.0 = Release|Any CPU + {02C79983-6011-43E2-A52D-75F9FC64663F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {02C79983-6011-43E2-A52D-75F9FC64663F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {02C79983-6011-43E2-A52D-75F9FC64663F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {02C79983-6011-43E2-A52D-75F9FC64663F}.Release|Any CPU.Build.0 = Release|Any CPU + {C643975D-5D26-4860-8002-3B62A132DA2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C643975D-5D26-4860-8002-3B62A132DA2B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C643975D-5D26-4860-8002-3B62A132DA2B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C643975D-5D26-4860-8002-3B62A132DA2B}.Release|Any CPU.Build.0 = Release|Any CPU + {1F498972-FD16-4A02-B133-C24652F14869}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F498972-FD16-4A02-B133-C24652F14869}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F498972-FD16-4A02-B133-C24652F14869}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F498972-FD16-4A02-B133-C24652F14869}.Release|Any CPU.Build.0 = Release|Any CPU + {9F2A873E-83E0-44C4-81D0-DDBC1D36F8B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9F2A873E-83E0-44C4-81D0-DDBC1D36F8B0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9F2A873E-83E0-44C4-81D0-DDBC1D36F8B0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9F2A873E-83E0-44C4-81D0-DDBC1D36F8B0}.Release|Any CPU.Build.0 = Release|Any CPU + {7022461C-0D5E-4817-9A5A-3C027FD22457}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7022461C-0D5E-4817-9A5A-3C027FD22457}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7022461C-0D5E-4817-9A5A-3C027FD22457}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7022461C-0D5E-4817-9A5A-3C027FD22457}.Release|Any CPU.Build.0 = Release|Any CPU + {DBD57899-0148-4B0D-A8EA-DE3954FA657C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DBD57899-0148-4B0D-A8EA-DE3954FA657C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DBD57899-0148-4B0D-A8EA-DE3954FA657C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DBD57899-0148-4B0D-A8EA-DE3954FA657C}.Release|Any CPU.Build.0 = Release|Any CPU + {033E4DC1-5D79-4308-B8B1-9A1B71E39BA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {033E4DC1-5D79-4308-B8B1-9A1B71E39BA1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {033E4DC1-5D79-4308-B8B1-9A1B71E39BA1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {033E4DC1-5D79-4308-B8B1-9A1B71E39BA1}.Release|Any CPU.Build.0 = Release|Any CPU + {CB43BF5B-4D31-4347-A97A-0164B1248B39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CB43BF5B-4D31-4347-A97A-0164B1248B39}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CB43BF5B-4D31-4347-A97A-0164B1248B39}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CB43BF5B-4D31-4347-A97A-0164B1248B39}.Release|Any CPU.Build.0 = Release|Any CPU + {83CCB684-54E6-4552-A00D-3CF9291A1B27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {83CCB684-54E6-4552-A00D-3CF9291A1B27}.Debug|Any CPU.Build.0 = Debug|Any CPU + {83CCB684-54E6-4552-A00D-3CF9291A1B27}.Release|Any CPU.ActiveCfg = Release|Any CPU + {83CCB684-54E6-4552-A00D-3CF9291A1B27}.Release|Any CPU.Build.0 = Release|Any CPU + {8ED094CD-DF46-4272-A981-99F3DD184590}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8ED094CD-DF46-4272-A981-99F3DD184590}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8ED094CD-DF46-4272-A981-99F3DD184590}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8ED094CD-DF46-4272-A981-99F3DD184590}.Release|Any CPU.Build.0 = Release|Any CPU + {F3A264BE-A62F-4B6A-89A0-7CF7BB275460}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F3A264BE-A62F-4B6A-89A0-7CF7BB275460}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F3A264BE-A62F-4B6A-89A0-7CF7BB275460}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F3A264BE-A62F-4B6A-89A0-7CF7BB275460}.Release|Any CPU.Build.0 = Release|Any CPU + {0BB94A8B-9CE3-4A87-95BC-90F8A53CC154}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0BB94A8B-9CE3-4A87-95BC-90F8A53CC154}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0BB94A8B-9CE3-4A87-95BC-90F8A53CC154}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0BB94A8B-9CE3-4A87-95BC-90F8A53CC154}.Release|Any CPU.Build.0 = Release|Any CPU + {26807744-FD0B-494A-9F99-0B171E9A892E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {26807744-FD0B-494A-9F99-0B171E9A892E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {26807744-FD0B-494A-9F99-0B171E9A892E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {26807744-FD0B-494A-9F99-0B171E9A892E}.Release|Any CPU.Build.0 = Release|Any CPU + {335AD0A2-F2CC-4C2E-853C-26174206BEE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {335AD0A2-F2CC-4C2E-853C-26174206BEE7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {335AD0A2-F2CC-4C2E-853C-26174206BEE7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {335AD0A2-F2CC-4C2E-853C-26174206BEE7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/templates/src/csharp/Grpc.Auth/project.json.template b/templates/src/csharp/Grpc.Auth/project.json.template deleted file mode 100644 index aa233db586c..00000000000 --- a/templates/src/csharp/Grpc.Auth/project.json.template +++ /dev/null @@ -1,37 +0,0 @@ -%YAML 1.2 ---- | - { - "version": "${settings.csharp_version}", - "title": "gRPC C# Auth", - "authors": [ "Google Inc." ], - "copyright": "Copyright 2015, Google Inc.", - "packOptions": { - "summary": "Auth library for C# implementation of gRPC - an RPC library and framework", - "description": "Auth library for C# implementation of gRPC - an RPC library and framework. See project site for more info.", - "owners": [ "grpc-packages" ], - "licenseUrl": "https://github.com/grpc/grpc/blob/master/LICENSE", - "projectUrl": "https://github.com/grpc/grpc", - "requireLicenseAcceptance": false, - "tags": [ "gRPC RPC Protocol HTTP/2 Auth OAuth2" ], - }, - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - } - }, - "dependencies": { - "Grpc.Core": "${settings.csharp_version}", - "Google.Apis.Auth": "1.21.0" - }, - "frameworks": { - "net45": { }, - "netstandard1.5": { - "dependencies": { - "NETStandard.Library": "1.6.0" - } - } - } - } diff --git a/templates/src/csharp/Grpc.Core.Testing/project.json.template b/templates/src/csharp/Grpc.Core.Testing/project.json.template deleted file mode 100644 index 7aff9911455..00000000000 --- a/templates/src/csharp/Grpc.Core.Testing/project.json.template +++ /dev/null @@ -1,41 +0,0 @@ -%YAML 1.2 ---- | - { - "version": "${settings.csharp_version}", - "title": "gRPC C# Core Testing", - "authors": [ "Google Inc." ], - "copyright": "Copyright 2017, Google Inc.", - "packOptions": { - "summary": "Testing support for gRPC C#", - "description": "Useful when testing code that uses gRPC.", - "owners": [ "grpc-packages" ], - "licenseUrl": "https://github.com/grpc/grpc/blob/master/LICENSE", - "projectUrl": "https://github.com/grpc/grpc", - "requireLicenseAcceptance": false, - "tags": [ "gRPC test testing" ] - }, - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - } - }, - "dependencies": { - "Grpc.Core": "${settings.csharp_version}" - }, - "frameworks": { - "net45": { - "frameworkAssemblies": { - "System.Runtime": "", - "System.IO": "" - } - }, - "netstandard1.5": { - "dependencies": { - "NETStandard.Library": "1.6.0" - } - } - } - } diff --git a/templates/src/csharp/Grpc.Core.Tests/project.json.template b/templates/src/csharp/Grpc.Core.Tests/project.json.template deleted file mode 100644 index b5f8190443a..00000000000 --- a/templates/src/csharp/Grpc.Core.Tests/project.json.template +++ /dev/null @@ -1,30 +0,0 @@ -%YAML 1.2 ---- | - { - <%include file="../build_options.include" args="executable=True"/> - "dependencies": { - "Grpc.Core": { - "target": "project" - }, - "Newtonsoft.Json": "9.0.1", - "NUnit": "3.6.0", - "NUnitLite": "3.6.0", - "NUnit.ConsoleRunner": "3.6.0", - "OpenCover": "4.6.519", - "ReportGenerator": "2.4.4.0" - }, - "frameworks": { - "net45": { }, - "netcoreapp1.0": { - "imports": [ - "portable-net45" - ], - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - }, - } diff --git a/templates/src/csharp/Grpc.Core/Version.csproj.include.template b/templates/src/csharp/Grpc.Core/Version.csproj.include.template new file mode 100755 index 00000000000..30b8d26375b --- /dev/null +++ b/templates/src/csharp/Grpc.Core/Version.csproj.include.template @@ -0,0 +1,9 @@ +%YAML 1.2 +--- | + + + + ${settings.csharp_version} + 3.2.0 + + diff --git a/templates/src/csharp/Grpc.Core/project.json.template b/templates/src/csharp/Grpc.Core/project.json.template deleted file mode 100644 index 120a9943e30..00000000000 --- a/templates/src/csharp/Grpc.Core/project.json.template +++ /dev/null @@ -1,47 +0,0 @@ -%YAML 1.2 ---- | - { - "version": "${settings.csharp_version}", - "title": "gRPC C# Core", - "authors": [ "Google Inc." ], - "copyright": "Copyright 2015, Google Inc.", - "packOptions": { - "summary": "Core C# implementation of gRPC - an RPC library and framework", - "description": "Core C# implementation of gRPC - an RPC library and framework. See project site for more info.", - "owners": [ "grpc-packages" ], - "licenseUrl": "https://github.com/grpc/grpc/blob/master/LICENSE", - "projectUrl": "https://github.com/grpc/grpc", - "requireLicenseAcceptance": false, - "tags": [ "gRPC RPC Protocol HTTP/2" ], - "files": { - "mappings": { - "build/net45/": "Grpc.Core.targets", - "runtimes/win/native/grpc_csharp_ext.x86.dll": "../nativelibs/windows_x86/grpc_csharp_ext.dll", - "runtimes/win/native/grpc_csharp_ext.x64.dll": "../nativelibs/windows_x64/grpc_csharp_ext.dll", - "runtimes/linux/native/libgrpc_csharp_ext.x86.so": "../nativelibs/linux_x86/libgrpc_csharp_ext.so", - "runtimes/linux/native/libgrpc_csharp_ext.x64.so": "../nativelibs/linux_x64/libgrpc_csharp_ext.so", - "runtimes/osx/native/libgrpc_csharp_ext.x86.dylib": "../nativelibs/macosx_x86/libgrpc_csharp_ext.dylib", - "runtimes/osx/native/libgrpc_csharp_ext.x64.dylib": "../nativelibs/macosx_x64/libgrpc_csharp_ext.dylib" - } - } - }, - "buildOptions": { - "embed": [ "../../../etc/roots.pem" ], - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true - }, - "dependencies": { - "System.Interactive.Async": "3.1.1" - }, - "frameworks": { - "net45": { }, - "netstandard1.5": { - "dependencies": { - "NETStandard.Library": "1.6.0", - "System.Runtime.Loader": "4.0.0", - "System.Threading.Thread": "4.0.0" - } - } - } - } diff --git a/templates/src/csharp/Grpc.Examples.MathClient/project.json.template b/templates/src/csharp/Grpc.Examples.MathClient/project.json.template deleted file mode 100644 index ae4ea2aaac7..00000000000 --- a/templates/src/csharp/Grpc.Examples.MathClient/project.json.template +++ /dev/null @@ -1,21 +0,0 @@ -%YAML 1.2 ---- | - { - <%include file="../build_options.include" args="executable=True"/> - "dependencies": { - "Grpc.Examples": { - "target": "project" - } - }, - "frameworks": { - "net45": { }, - "netcoreapp1.0": { - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } - } diff --git a/templates/src/csharp/Grpc.Examples.MathServer/project.json.template b/templates/src/csharp/Grpc.Examples.MathServer/project.json.template deleted file mode 100644 index ae4ea2aaac7..00000000000 --- a/templates/src/csharp/Grpc.Examples.MathServer/project.json.template +++ /dev/null @@ -1,21 +0,0 @@ -%YAML 1.2 ---- | - { - <%include file="../build_options.include" args="executable=True"/> - "dependencies": { - "Grpc.Examples": { - "target": "project" - } - }, - "frameworks": { - "net45": { }, - "netcoreapp1.0": { - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } - } diff --git a/templates/src/csharp/Grpc.Examples.Tests/project.json.template b/templates/src/csharp/Grpc.Examples.Tests/project.json.template deleted file mode 100644 index da60c017a36..00000000000 --- a/templates/src/csharp/Grpc.Examples.Tests/project.json.template +++ /dev/null @@ -1,26 +0,0 @@ -%YAML 1.2 ---- | - { - <%include file="../build_options.include" args="executable=True"/> - "dependencies": { - "Grpc.Examples": { - "target": "project" - }, - "NUnit": "3.6.0", - "NUnitLite": "3.6.0" - }, - "frameworks": { - "net45": { }, - "netcoreapp1.0": { - "imports": [ - "portable-net45" - ], - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } - } diff --git a/templates/src/csharp/Grpc.Examples/project.json.template b/templates/src/csharp/Grpc.Examples/project.json.template deleted file mode 100644 index 5de965cb1b7..00000000000 --- a/templates/src/csharp/Grpc.Examples/project.json.template +++ /dev/null @@ -1,22 +0,0 @@ -%YAML 1.2 ---- | - { - <%include file="../build_options.include" args="executable=False"/> - "dependencies": { - "Grpc.Core": { - "target": "project" - }, - "Google.Protobuf": "3.2.0" - }, - "frameworks": { - "net45": {}, - "netcoreapp1.0": { - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } - } diff --git a/templates/src/csharp/Grpc.HealthCheck.Tests/project.json.template b/templates/src/csharp/Grpc.HealthCheck.Tests/project.json.template deleted file mode 100644 index 4a993326c32..00000000000 --- a/templates/src/csharp/Grpc.HealthCheck.Tests/project.json.template +++ /dev/null @@ -1,26 +0,0 @@ -%YAML 1.2 ---- | - { - <%include file="../build_options.include" args="executable=True"/> - "dependencies": { - "Grpc.HealthCheck": { - "target": "project" - }, - "NUnit": "3.6.0", - "NUnitLite": "3.6.0" - }, - "frameworks": { - "net45": { }, - "netcoreapp1.0": { - "imports": [ - "portable-net45" - ], - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } - } diff --git a/templates/src/csharp/Grpc.HealthCheck/project.json.template b/templates/src/csharp/Grpc.HealthCheck/project.json.template deleted file mode 100644 index 9cd0d83a9be..00000000000 --- a/templates/src/csharp/Grpc.HealthCheck/project.json.template +++ /dev/null @@ -1,37 +0,0 @@ -%YAML 1.2 ---- | - { - "version": "${settings.csharp_version}", - "title": "gRPC C# Healthchecking", - "authors": [ "Google Inc." ], - "copyright": "Copyright 2015, Google Inc.", - "packOptions": { - "summary": "Implementation of gRPC health service", - "description": "Example implementation of grpc.health.v1 service that can be used for health-checking.", - "owners": [ "grpc-packages" ], - "licenseUrl": "https://github.com/grpc/grpc/blob/master/LICENSE", - "projectUrl": "https://github.com/grpc/grpc", - "requireLicenseAcceptance": false, - "tags": [ "gRPC health check" ] - }, - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - } - }, - "dependencies": { - "Grpc.Core": "${settings.csharp_version}", - "Google.Protobuf": "3.2.0" - }, - "frameworks": { - "net45": {}, - "netstandard1.5": { - "dependencies": { - "NETStandard.Library": "1.6.0" - } - } - } - } diff --git a/templates/src/csharp/Grpc.IntegrationTesting.Client/project.json.template b/templates/src/csharp/Grpc.IntegrationTesting.Client/project.json.template deleted file mode 100644 index 83b8a9befa3..00000000000 --- a/templates/src/csharp/Grpc.IntegrationTesting.Client/project.json.template +++ /dev/null @@ -1,24 +0,0 @@ -%YAML 1.2 ---- | - { - <%include file="../build_options.include" args="executable=True,includeData=True"/> - "dependencies": { - "Grpc.IntegrationTesting": { - "target": "project" - } - }, - "frameworks": { - "net45": { }, - "netcoreapp1.0": { - "imports": [ - "portable-net45" - ], - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } - } diff --git a/templates/src/csharp/Grpc.IntegrationTesting.QpsWorker/project.json.template b/templates/src/csharp/Grpc.IntegrationTesting.QpsWorker/project.json.template deleted file mode 100644 index 8304d20f2ec..00000000000 --- a/templates/src/csharp/Grpc.IntegrationTesting.QpsWorker/project.json.template +++ /dev/null @@ -1,29 +0,0 @@ -%YAML 1.2 ---- | - { - <%include file="../build_options.include" args="executable=True,includeData=True"/> - "dependencies": { - "Grpc.IntegrationTesting": { - "target": "project" - } - }, - "frameworks": { - "net45": { }, - "netcoreapp1.0": { - "imports": [ - "portable-net45" - ], - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - }, - "runtimeOptions": { - "configProperties": { - "System.GC.Server": true - } - } - } diff --git a/templates/src/csharp/Grpc.IntegrationTesting.Server/project.json.template b/templates/src/csharp/Grpc.IntegrationTesting.Server/project.json.template deleted file mode 100644 index 83b8a9befa3..00000000000 --- a/templates/src/csharp/Grpc.IntegrationTesting.Server/project.json.template +++ /dev/null @@ -1,24 +0,0 @@ -%YAML 1.2 ---- | - { - <%include file="../build_options.include" args="executable=True,includeData=True"/> - "dependencies": { - "Grpc.IntegrationTesting": { - "target": "project" - } - }, - "frameworks": { - "net45": { }, - "netcoreapp1.0": { - "imports": [ - "portable-net45" - ], - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } - } diff --git a/templates/src/csharp/Grpc.IntegrationTesting.StressClient/project.json.template b/templates/src/csharp/Grpc.IntegrationTesting.StressClient/project.json.template deleted file mode 100644 index 83b8a9befa3..00000000000 --- a/templates/src/csharp/Grpc.IntegrationTesting.StressClient/project.json.template +++ /dev/null @@ -1,24 +0,0 @@ -%YAML 1.2 ---- | - { - <%include file="../build_options.include" args="executable=True,includeData=True"/> - "dependencies": { - "Grpc.IntegrationTesting": { - "target": "project" - } - }, - "frameworks": { - "net45": { }, - "netcoreapp1.0": { - "imports": [ - "portable-net45" - ], - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } - } diff --git a/templates/src/csharp/Grpc.IntegrationTesting/project.json.template b/templates/src/csharp/Grpc.IntegrationTesting/project.json.template deleted file mode 100644 index 74b928110f1..00000000000 --- a/templates/src/csharp/Grpc.IntegrationTesting/project.json.template +++ /dev/null @@ -1,35 +0,0 @@ -%YAML 1.2 ---- | - { - <%include file="../build_options.include" args="executable=True,includeData=True"/> - "dependencies": { - "Grpc.Auth": { - "target": "project" - }, - "Grpc.Core": { - "target": "project" - }, - "Google.Protobuf": "3.2.0", - "CommandLineParser": "2.1.1-beta", - "Moq": "4.7.0", - "NUnit": "3.6.0", - "NUnitLite": "3.6.0" - }, - "frameworks": { - "net45": { - "frameworkAssemblies": {} - }, - "netcoreapp1.0": { - "imports": [ - "portable-net45" - ], - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - }, - "System.Linq.Expressions": "4.1.0" - } - } - } - } diff --git a/templates/src/csharp/Grpc.Reflection.Tests/project.json.template b/templates/src/csharp/Grpc.Reflection.Tests/project.json.template deleted file mode 100644 index 65d200e30b5..00000000000 --- a/templates/src/csharp/Grpc.Reflection.Tests/project.json.template +++ /dev/null @@ -1,26 +0,0 @@ -%YAML 1.2 ---- | - { - <%include file="../build_options.include" args="executable=True"/> - "dependencies": { - "Grpc.Reflection": { - "target": "project" - }, - "NUnit": "3.6.0", - "NUnitLite": "3.6.0" - }, - "frameworks": { - "net45": { }, - "netcoreapp1.0": { - "imports": [ - "portable-net45" - ], - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } - } diff --git a/templates/src/csharp/Grpc.Reflection/project.json.template b/templates/src/csharp/Grpc.Reflection/project.json.template deleted file mode 100644 index e6f65f8ab39..00000000000 --- a/templates/src/csharp/Grpc.Reflection/project.json.template +++ /dev/null @@ -1,37 +0,0 @@ -%YAML 1.2 ---- | - { - "version": "${settings.csharp_version}", - "title": "gRPC C# Reflection", - "authors": [ "Google Inc." ], - "copyright": "Copyright 2016, Google Inc.", - "packOptions": { - "summary": "Implementation of gRPC reflection service", - "description": "Provides information about services running on a gRPC C# server.", - "owners": [ "grpc-packages" ], - "licenseUrl": "https://github.com/grpc/grpc/blob/master/LICENSE", - "projectUrl": "https://github.com/grpc/grpc", - "requireLicenseAcceptance": false, - "tags": [ "gRPC reflection" ] - }, - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - } - }, - "dependencies": { - "Grpc.Core": "${settings.csharp_version}", - "Google.Protobuf": "3.2.0" - }, - "frameworks": { - "net45": {}, - "netstandard1.5": { - "dependencies": { - "NETStandard.Library": "1.6.0" - } - } - } - } diff --git a/templates/src/csharp/build_options.include b/templates/src/csharp/build_options.include deleted file mode 100644 index db4cc198039..00000000000 --- a/templates/src/csharp/build_options.include +++ /dev/null @@ -1,56 +0,0 @@ -<%page args="executable=False,includeData=False"/>\ -"buildOptions": { - % if executable: - "emitEntryPoint": true - % endif - }, - % if executable: - "configurations": { - "Debug": { - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - }, - "copyToOutput": { - "mappings": { - % if includeData: - "data/ca.pem": "../Grpc.IntegrationTesting/data/ca.pem", - "data/server1.key": "../Grpc.IntegrationTesting/data/server1.key", - "data/server1.pem": "../Grpc.IntegrationTesting/data/server1.pem", - % endif - "grpc_csharp_ext.x64.dll": "../../../cmake/build/x64/Debug/grpc_csharp_ext.dll", - "grpc_csharp_ext.x86.dll": "../../../cmake/build/Win32/Debug/grpc_csharp_ext.dll", - "libgrpc_csharp_ext.x64.so": "../../../libs/dbg/libgrpc_csharp_ext.so", - "libgrpc_csharp_ext.x64.dylib": "../../../libs/dbg/libgrpc_csharp_ext.dylib" - } - } - } - }, - "Release": { - "buildOptions": { - "define": [ "SIGNED" ], - "keyFile": "../keys/Grpc.snk", - "xmlDoc": true, - "compile": { - "includeFiles": [ "../Grpc.Core/Version.cs" ] - }, - "copyToOutput": { - "mappings": { - % if includeData: - "data/ca.pem": "../Grpc.IntegrationTesting/data/ca.pem", - "data/server1.key": "../Grpc.IntegrationTesting/data/server1.key", - "data/server1.pem": "../Grpc.IntegrationTesting/data/server1.pem", - % endif - "grpc_csharp_ext.x64.dll": "../../../cmake/build/x64/Release/grpc_csharp_ext.dll", - "grpc_csharp_ext.x86.dll": "../../../cmake/build/Win32/Release/grpc_csharp_ext.dll", - "libgrpc_csharp_ext.x64.so": "../../../libs/opt/libgrpc_csharp_ext.so", - "libgrpc_csharp_ext.x64.dylib": "../../../libs/opt/libgrpc_csharp_ext.dylib" - } - } - } - } - }, - %endif From 3c344d2f6955d3a3a7f784279bd66a67c6f02ce4 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 4 Apr 2017 16:49:06 +0200 Subject: [PATCH 257/461] adjust run_tests scripts --- src/csharp/Grpc.Core.Tests/SanityTest.cs | 2 +- .../NativeDeps.Windows.csproj.include | 4 +- .../grpc_interop_csharp/Dockerfile.template | 1 + .../Dockerfile.template | 41 ---------------- .../csharp_coreclr_x64/Dockerfile.template | 41 ---------------- .../csharp_jessie_x64/Dockerfile.template | 1 + ...ld_csharp_coreclr.bat => build_csharp.bat} | 4 +- .../run_tests/helper_scripts/build_csharp.sh | 11 ++++- .../helper_scripts/build_csharp_coreclr.sh | 38 -------------- .../helper_scripts/pre_build_csharp.bat | 49 +------------------ .../helper_scripts/pre_build_csharp.sh | 45 +---------------- tools/run_tests/run_interop_tests.py | 4 +- tools/run_tests/run_tests.py | 25 +++------- 13 files changed, 27 insertions(+), 239 deletions(-) delete mode 100644 templates/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile.template delete mode 100644 templates/tools/dockerfile/test/csharp_coreclr_x64/Dockerfile.template rename tools/run_tests/helper_scripts/{build_csharp_coreclr.bat => build_csharp.bat} (93%) delete mode 100755 tools/run_tests/helper_scripts/build_csharp_coreclr.sh diff --git a/src/csharp/Grpc.Core.Tests/SanityTest.cs b/src/csharp/Grpc.Core.Tests/SanityTest.cs index 1c28277df55..e02f2c9e546 100644 --- a/src/csharp/Grpc.Core.Tests/SanityTest.cs +++ b/src/csharp/Grpc.Core.Tests/SanityTest.cs @@ -101,7 +101,7 @@ namespace Grpc.Core.Tests private string ReadTestsJson() { var assemblyDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - var testsJsonFile = Path.Combine(assemblyDir, "..", "..", "..", "tests.json"); + var testsJsonFile = Path.Combine(assemblyDir, "..", "..", "..", "..", "tests.json"); return File.ReadAllText(testsJsonFile); } diff --git a/src/csharp/Grpc.Core/NativeDeps.Windows.csproj.include b/src/csharp/Grpc.Core/NativeDeps.Windows.csproj.include index 85e1b77bd0f..04f3b077ace 100644 --- a/src/csharp/Grpc.Core/NativeDeps.Windows.csproj.include +++ b/src/csharp/Grpc.Core/NativeDeps.Windows.csproj.include @@ -1,8 +1,8 @@ - + PreserveNewest - grpc_csharp_ext.x86.dll + grpc_csharp_ext.x64.dll false diff --git a/templates/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile.template b/templates/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile.template index da0c70aee0c..092f04dac6c 100644 --- a/templates/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile.template +++ b/templates/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile.template @@ -34,6 +34,7 @@ <%include file="../../apt_get_basic.include"/> <%include file="../../python_deps.include"/> <%include file="../../csharp_deps.include"/> + <%include file="../../csharp_dotnetcli_deps.include"/> <%include file="../../run_tests_addons.include"/> # Define the default command. CMD ["bash"] diff --git a/templates/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile.template b/templates/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile.template deleted file mode 100644 index 092f04dac6c..00000000000 --- a/templates/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile.template +++ /dev/null @@ -1,41 +0,0 @@ -%YAML 1.2 ---- | - # Copyright 2015, Google Inc. - # All rights reserved. - # - # Redistribution and use in source and binary forms, with or without - # modification, are permitted provided that the following conditions are - # met: - # - # * Redistributions of source code must retain the above copyright - # notice, this list of conditions and the following disclaimer. - # * Redistributions in binary form must reproduce the above - # copyright notice, this list of conditions and the following disclaimer - # in the documentation and/or other materials provided with the - # distribution. - # * Neither the name of Google Inc. nor the names of its - # contributors may be used to endorse or promote products derived from - # this software without specific prior written permission. - # - # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - FROM debian:jessie - - <%include file="../../apt_get_basic.include"/> - <%include file="../../python_deps.include"/> - <%include file="../../csharp_deps.include"/> - <%include file="../../csharp_dotnetcli_deps.include"/> - <%include file="../../run_tests_addons.include"/> - # Define the default command. - CMD ["bash"] - diff --git a/templates/tools/dockerfile/test/csharp_coreclr_x64/Dockerfile.template b/templates/tools/dockerfile/test/csharp_coreclr_x64/Dockerfile.template deleted file mode 100644 index 092f04dac6c..00000000000 --- a/templates/tools/dockerfile/test/csharp_coreclr_x64/Dockerfile.template +++ /dev/null @@ -1,41 +0,0 @@ -%YAML 1.2 ---- | - # Copyright 2015, Google Inc. - # All rights reserved. - # - # Redistribution and use in source and binary forms, with or without - # modification, are permitted provided that the following conditions are - # met: - # - # * Redistributions of source code must retain the above copyright - # notice, this list of conditions and the following disclaimer. - # * Redistributions in binary form must reproduce the above - # copyright notice, this list of conditions and the following disclaimer - # in the documentation and/or other materials provided with the - # distribution. - # * Neither the name of Google Inc. nor the names of its - # contributors may be used to endorse or promote products derived from - # this software without specific prior written permission. - # - # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - FROM debian:jessie - - <%include file="../../apt_get_basic.include"/> - <%include file="../../python_deps.include"/> - <%include file="../../csharp_deps.include"/> - <%include file="../../csharp_dotnetcli_deps.include"/> - <%include file="../../run_tests_addons.include"/> - # Define the default command. - CMD ["bash"] - diff --git a/templates/tools/dockerfile/test/csharp_jessie_x64/Dockerfile.template b/templates/tools/dockerfile/test/csharp_jessie_x64/Dockerfile.template index da0c70aee0c..092f04dac6c 100644 --- a/templates/tools/dockerfile/test/csharp_jessie_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/csharp_jessie_x64/Dockerfile.template @@ -34,6 +34,7 @@ <%include file="../../apt_get_basic.include"/> <%include file="../../python_deps.include"/> <%include file="../../csharp_deps.include"/> + <%include file="../../csharp_dotnetcli_deps.include"/> <%include file="../../run_tests_addons.include"/> # Define the default command. CMD ["bash"] diff --git a/tools/run_tests/helper_scripts/build_csharp_coreclr.bat b/tools/run_tests/helper_scripts/build_csharp.bat similarity index 93% rename from tools/run_tests/helper_scripts/build_csharp_coreclr.bat rename to tools/run_tests/helper_scripts/build_csharp.bat index 78e5f5998b8..05ea78564c4 100644 --- a/tools/run_tests/helper_scripts/build_csharp_coreclr.bat +++ b/tools/run_tests/helper_scripts/build_csharp.bat @@ -31,9 +31,7 @@ setlocal cd /d %~dp0\..\..\..\src\csharp -dotnet restore . || goto :error - -dotnet build --configuration %MSBUILD_CONFIG% "**/project.json" || goto :error +dotnet build --configuration %MSBUILD_CONFIG% Grpc.sln || goto :error endlocal diff --git a/tools/run_tests/helper_scripts/build_csharp.sh b/tools/run_tests/helper_scripts/build_csharp.sh index 84c5b1c7778..00897ecbe6c 100755 --- a/tools/run_tests/helper_scripts/build_csharp.sh +++ b/tools/run_tests/helper_scripts/build_csharp.sh @@ -32,5 +32,12 @@ set -ex cd $(dirname $0)/../../../src/csharp -# overriding NativeDependenciesConfigurationUnix is needed to make gcov code coverage work. -xbuild /p:Configuration=$MSBUILD_CONFIG /p:NativeDependenciesConfigurationUnix=$CONFIG Grpc.sln +OVERRIDE_NATIVELIB_MAYBE="" +if [ "$CONFIG" == "gcov" ] +then + # overriding NativeDependenciesConfigurationUnix makes C# project pick up + # the gcov flavor of grpc_csharp_ext + OVERRIDE_NATIVELIB_MAYBE="/p:NativeDependenciesConfigurationUnix=$CONFIG" +fi + +dotnet build --configuration $MSBUILD_CONFIG $OVERRIDE_NATIVELIB_MAYBE Grpc.sln diff --git a/tools/run_tests/helper_scripts/build_csharp_coreclr.sh b/tools/run_tests/helper_scripts/build_csharp_coreclr.sh deleted file mode 100755 index dd5fd31c759..00000000000 --- a/tools/run_tests/helper_scripts/build_csharp_coreclr.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# Copyright 2015, Google Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -set -ex - -cd $(dirname $0)/../../../src/csharp - -# TODO(jtattermusch): introduce caching -dotnet restore . - -dotnet build --configuration $MSBUILD_CONFIG '**/project.json' diff --git a/tools/run_tests/helper_scripts/pre_build_csharp.bat b/tools/run_tests/helper_scripts/pre_build_csharp.bat index bee430ac868..c7684f538e3 100644 --- a/tools/run_tests/helper_scripts/pre_build_csharp.bat +++ b/tools/run_tests/helper_scripts/pre_build_csharp.bat @@ -46,54 +46,9 @@ cd %ARCHITECTURE% cmake -G "Visual Studio 14 2015" -A %ARCHITECTURE% -DgRPC_BUILD_TESTS=OFF -DgRPC_MSVC_STATIC_RUNTIME=ON -DCMAKE_ASM_NASM_COMPILER="C:/Program Files (x86)/yasm/yasm.exe" ../../.. || goto :error cd ..\..\.. -@rem Location of nuget.exe -set NUGET=C:\nuget\nuget.exe +cd src/csharp -if exist %NUGET% ( - @rem TODO(jtattermusch): Get rid of this hack. See #8034 - @rem Restore Grpc packages by packages since Nuget client 3.4.4 doesnt support restore - @rem by solution - @rem Moving into each directory to let the restores work based on per-project packages.config files - - cd src/csharp - - cd Grpc.Auth || goto :error - %NUGET% restore -PackagesDirectory ../packages || goto :error - cd .. - - cd Grpc.Core || goto :error - %NUGET% restore -PackagesDirectory ../packages || goto :error - cd .. - - cd Grpc.Core.Tests || goto :error - %NUGET% restore -PackagesDirectory ../packages || goto :error - cd .. - - cd Grpc.Examples.MathClient || goto :error - %NUGET% restore -PackagesDirectory ../packages || goto :error - cd .. - - cd Grpc.Examples.MathServer || goto :error - %NUGET% restore -PackagesDirectory ../packages || goto :error - cd .. - - cd Grpc.Examples || goto :error - %NUGET% restore -PackagesDirectory ../packages || goto :error - cd .. - - cd Grpc.HealthCheck.Tests || goto :error - %NUGET% restore -PackagesDirectory ../packages || goto :error - cd .. - - cd Grpc.HealthCheck || goto :error - %NUGET% restore -PackagesDirectory ../packages || goto :error - cd .. - - cd Grpc.IntegrationTesting || goto :error - %NUGET% restore -PackagesDirectory ../packages || goto :error - - cd /d %~dp0\..\.. || goto :error -) +dotnet restore Grpc.sln || goto :error endlocal diff --git a/tools/run_tests/helper_scripts/pre_build_csharp.sh b/tools/run_tests/helper_scripts/pre_build_csharp.sh index d7665e15af6..40be1b6b642 100755 --- a/tools/run_tests/helper_scripts/pre_build_csharp.sh +++ b/tools/run_tests/helper_scripts/pre_build_csharp.sh @@ -33,47 +33,4 @@ set -ex # cd to gRPC csharp directory cd $(dirname $0)/../../../src/csharp -root=`pwd` - -if [ -x "$(command -v nuget)" ] -then - # TODO(jtattermusch): Get rid of this hack. See #8034 - # Restoring Nuget packages by packages rather than by solution because of - # inability to restore by solution with Nuget client 3.4.4 - # Moving into each directory to let the restores work based on per-project packages.config files - cd Grpc.Auth - nuget restore -PackagesDirectory ../packages - cd .. - - cd Grpc.Core.Tests - nuget restore -PackagesDirectory ../packages - cd .. - - cd Grpc.Core - nuget restore -PackagesDirectory ../packages - cd .. - - cd Grpc.Examples.MathClient - nuget restore -PackagesDirectory ../packages - cd .. - - cd Grpc.Examples.MathServer - nuget restore -PackagesDirectory ../packages - cd .. - - cd Grpc.Examples - nuget restore -PackagesDirectory ../packages - cd .. - - cd Grpc.HealthCheck.Tests - nuget restore -PackagesDirectory ../packages - cd .. - - cd Grpc.HealthCheck - nuget restore -PackagesDirectory ../packages - cd .. - - cd Grpc.IntegrationTesting - nuget restore -PackagesDirectory ../packages - cd .. -fi +dotnet restore Grpc.sln diff --git a/tools/run_tests/run_interop_tests.py b/tools/run_tests/run_interop_tests.py index 2d7f4a625d6..d2bf529fef3 100755 --- a/tools/run_tests/run_interop_tests.py +++ b/tools/run_tests/run_interop_tests.py @@ -114,8 +114,8 @@ class CXXLanguage: class CSharpLanguage: def __init__(self): - self.client_cwd = 'src/csharp/Grpc.IntegrationTesting.Client/bin/Debug' - self.server_cwd = 'src/csharp/Grpc.IntegrationTesting.Server/bin/Debug' + self.client_cwd = 'src/csharp/Grpc.IntegrationTesting.Client/bin/Debug/net45' + self.server_cwd = 'src/csharp/Grpc.IntegrationTesting.Server/bin/Debug/net45' self.safename = str(self) def client_cmd(self, args): diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 0b4f26ca440..9fa7cca14e3 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -743,14 +743,11 @@ class CSharpLanguage(object): if self.platform == 'windows': _check_compiler(self.args.compiler, ['coreclr', 'default']) _check_arch(self.args.arch, ['default']) - self._cmake_arch_option = 'x64' if self.args.compiler == 'coreclr' else 'Win32' + self._cmake_arch_option = 'x64' self._make_options = [] else: _check_compiler(self.args.compiler, ['default', 'coreclr']) - if self.platform == 'linux' and self.args.compiler == 'coreclr': - self._docker_distro = 'coreclr' - else: - self._docker_distro = 'jessie' + self._docker_distro = 'jessie' if self.platform == 'mac': # TODO(jtattermusch): EMBED_ZLIB=true currently breaks the mac build @@ -766,7 +763,7 @@ class CSharpLanguage(object): tests_by_assembly = json.load(f) msbuild_config = _MSBUILD_CONFIG[self.config.build_config] - nunit_args = ['--labels=All'] + nunit_args = ['--labels=All','--noresult', '--workers=1'] assembly_subdir = 'bin/%s' % msbuild_config assembly_extension = '.exe' @@ -775,7 +772,7 @@ class CSharpLanguage(object): runtime_cmd = ['dotnet', 'exec'] assembly_extension = '.dll' else: - nunit_args += ['--noresult', '--workers=1'] + assembly_subdir += '/net45' if self.platform == 'windows': runtime_cmd = [] else: @@ -827,18 +824,10 @@ class CSharpLanguage(object): return self._make_options; def build_steps(self): - if self.args.compiler == 'coreclr': - if self.platform == 'windows': - return [['tools\\run_tests\\helper_scripts\\build_csharp_coreclr.bat']] - else: - return [['tools/run_tests/helper_scripts/build_csharp_coreclr.sh']] + if self.platform == 'windows': + return [['tools\\run_tests\\helper_scripts\\build_csharp.bat']] else: - if self.platform == 'windows': - return [['vsprojects\\build_vs2015.bat', - 'src/csharp/Grpc.sln', - '/p:Configuration=%s' % _MSBUILD_CONFIG[self.config.build_config]]] - else: - return [['tools/run_tests/helper_scripts/build_csharp.sh']] + return [['tools/run_tests/helper_scripts/build_csharp.sh']] def post_tests_steps(self): if self.platform == 'windows': From 8b4352134388405614c55b88c56b521d59a66ea0 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 5 Apr 2017 13:34:37 +0200 Subject: [PATCH 258/461] fix C# build_packages scripts --- src/csharp/Grpc.Core/Version.csproj.include | 2 +- src/csharp/build_packages_dotnetcli.bat | 18 ++++++++++-------- src/csharp/build_packages_dotnetcli.sh | 16 ++++++++++------ .../build_packages_dotnetcli.bat.template | 18 ++++++++++-------- .../build_packages_dotnetcli.sh.template | 16 ++++++++++------ .../interoptest/grpc_interop_csharp/Dockerfile | 18 ++++++++++++++++++ .../test/csharp_jessie_x64/Dockerfile | 18 ++++++++++++++++++ 7 files changed, 77 insertions(+), 29 deletions(-) diff --git a/src/csharp/Grpc.Core/Version.csproj.include b/src/csharp/Grpc.Core/Version.csproj.include index 933d0b25cd2..ce9d0d2d5d2 100755 --- a/src/csharp/Grpc.Core/Version.csproj.include +++ b/src/csharp/Grpc.Core/Version.csproj.include @@ -1,7 +1,7 @@ - 1.2.0-pre1 + 1.3.0-dev 3.2.0 diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat index 4fec2c71cf8..7558ca60c71 100755 --- a/src/csharp/build_packages_dotnetcli.bat +++ b/src/csharp/build_packages_dotnetcli.bat @@ -29,11 +29,10 @@ @rem Current package versions set VERSION=1.3.0-dev -set PROTOBUF_VERSION=3.0.0 @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe -set DOTNET=C:\dotnet\dotnet.exe +set DOTNET=dotnet set -ex @@ -56,13 +55,16 @@ xcopy /Y /I ..\..\architecture=x64,language=protoc,platform=linux\artifacts\* pr xcopy /Y /I ..\..\architecture=x86,language=protoc,platform=macos\artifacts\* protoc_plugins\macosx_x86\ xcopy /Y /I ..\..\architecture=x64,language=protoc,platform=macos\artifacts\* protoc_plugins\macosx_x64\ -%DOTNET% restore . || goto :error +%DOTNET% restore Grpc.sln || goto :error -%DOTNET% pack --configuration Release Grpc.Core\project.json --output ..\..\artifacts || goto :error -%DOTNET% pack --configuration Release Grpc.Core.Testing\project.json --output ..\..\artifacts || goto :error -%DOTNET% pack --configuration Release Grpc.Auth\project.json --output ..\..\artifacts || goto :error -%DOTNET% pack --configuration Release Grpc.HealthCheck\project.json --output ..\..\artifacts || goto :error -%DOTNET% pack --configuration Release Grpc.Reflection\project.json --output ..\..\artifacts || goto :error +@rem To be able to build, we also need to put grpc_csharp_ext to its normal location +xcopy /Y /I nativelibs\windows_x64\grpc_csharp_ext.dll ..\..\cmake\build\x64\Release\ + +%DOTNET% pack --configuration Release Grpc.Core --output ..\..\..\artifacts || goto :error +%DOTNET% pack --configuration Release Grpc.Core.Testing --output ..\..\..\artifacts || goto :error +%DOTNET% pack --configuration Release Grpc.Auth --output ..\..\..\artifacts || goto :error +%DOTNET% pack --configuration Release Grpc.HealthCheck --output ..\..\..\artifacts || goto :error +%DOTNET% pack --configuration Release Grpc.Reflection --output ..\..\..\artifacts || goto :error %NUGET% pack Grpc.nuspec -Version %VERSION% -OutputDirectory ..\..\artifacts || goto :error %NUGET% pack Grpc.Tools.nuspec -Version %VERSION% -OutputDirectory ..\..\artifacts diff --git a/src/csharp/build_packages_dotnetcli.sh b/src/csharp/build_packages_dotnetcli.sh index f51b42bc8c1..2186bd3c568 100755 --- a/src/csharp/build_packages_dotnetcli.sh +++ b/src/csharp/build_packages_dotnetcli.sh @@ -58,13 +58,17 @@ cp $EXTERNAL_GIT_ROOT/architecture=x64,language=protoc,platform=linux/artifacts/ cp $EXTERNAL_GIT_ROOT/architecture=x86,language=protoc,platform=macos/artifacts/* protoc_plugins/macosx_x86 || true cp $EXTERNAL_GIT_ROOT/architecture=x64,language=protoc,platform=macos/artifacts/* protoc_plugins/macosx_x64 || true -dotnet restore . +dotnet restore Grpc.sln -dotnet pack --configuration Release Grpc.Core/project.json --output ../../artifacts -dotnet pack --configuration Release Grpc.Core.Testing/project.json --output ../../artifacts -dotnet pack --configuration Release Grpc.Auth/project.json --output ../../artifacts -dotnet pack --configuration Release Grpc.HealthCheck/project.json --output ../../artifacts -dotnet pack --configuration Release Grpc.Reflection/project.json --output ../../artifacts +# To be able to build, we also need to put grpc_csharp_ext to its normal location +mkdir -p ../../libs/opt +cp nativelibs/linux_x64/libgrpc_csharp_ext.so ../../libs/opt + +dotnet pack --configuration Release Grpc.Core --output ../../../artifacts +dotnet pack --configuration Release Grpc.Core.Testing --output ../../../artifacts +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.3.0-dev" -OutputDirectory ../../artifacts nuget pack Grpc.Tools.nuspec -Version "1.3.0-dev" -OutputDirectory ../../artifacts diff --git a/templates/src/csharp/build_packages_dotnetcli.bat.template b/templates/src/csharp/build_packages_dotnetcli.bat.template index 2f91d485ec4..91808e0d266 100755 --- a/templates/src/csharp/build_packages_dotnetcli.bat.template +++ b/templates/src/csharp/build_packages_dotnetcli.bat.template @@ -31,11 +31,10 @@ @rem Current package versions set VERSION=${settings.csharp_version} - set PROTOBUF_VERSION=3.0.0 @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe - set DOTNET=C:\dotnet\dotnet.exe + set DOTNET=dotnet set -ex @@ -58,13 +57,16 @@ xcopy /Y /I ..\..\architecture=x86,language=protoc,platform=macos\artifacts\* protoc_plugins\macosx_x86${"\\"} xcopy /Y /I ..\..\architecture=x64,language=protoc,platform=macos\artifacts\* protoc_plugins\macosx_x64${"\\"} - %%DOTNET% restore . || goto :error + %%DOTNET% restore Grpc.sln || goto :error - %%DOTNET% pack --configuration Release Grpc.Core\project.json --output ..\..\artifacts || goto :error - %%DOTNET% pack --configuration Release Grpc.Core.Testing\project.json --output ..\..\artifacts || goto :error - %%DOTNET% pack --configuration Release Grpc.Auth\project.json --output ..\..\artifacts || goto :error - %%DOTNET% pack --configuration Release Grpc.HealthCheck\project.json --output ..\..\artifacts || goto :error - %%DOTNET% pack --configuration Release Grpc.Reflection\project.json --output ..\..\artifacts || goto :error + @rem To be able to build, we also need to put grpc_csharp_ext to its normal location + xcopy /Y /I nativelibs\windows_x64\grpc_csharp_ext.dll ..\..\cmake\build\x64\Release${"\\"} + + %%DOTNET% pack --configuration Release Grpc.Core --output ..\..\..\artifacts || goto :error + %%DOTNET% pack --configuration Release Grpc.Core.Testing --output ..\..\..\artifacts || goto :error + %%DOTNET% pack --configuration Release Grpc.Auth --output ..\..\..\artifacts || goto :error + %%DOTNET% pack --configuration Release Grpc.HealthCheck --output ..\..\..\artifacts || goto :error + %%DOTNET% pack --configuration Release Grpc.Reflection --output ..\..\..\artifacts || goto :error %%NUGET% pack Grpc.nuspec -Version %VERSION% -OutputDirectory ..\..\artifacts || goto :error %%NUGET% pack Grpc.Tools.nuspec -Version %VERSION% -OutputDirectory ..\..\artifacts diff --git a/templates/src/csharp/build_packages_dotnetcli.sh.template b/templates/src/csharp/build_packages_dotnetcli.sh.template index c5364377b99..374b236f93c 100755 --- a/templates/src/csharp/build_packages_dotnetcli.sh.template +++ b/templates/src/csharp/build_packages_dotnetcli.sh.template @@ -60,13 +60,17 @@ cp $EXTERNAL_GIT_ROOT/architecture=x86,language=protoc,platform=macos/artifacts/* protoc_plugins/macosx_x86 || true cp $EXTERNAL_GIT_ROOT/architecture=x64,language=protoc,platform=macos/artifacts/* protoc_plugins/macosx_x64 || true - dotnet restore . + dotnet restore Grpc.sln - dotnet pack --configuration Release Grpc.Core/project.json --output ../../artifacts - dotnet pack --configuration Release Grpc.Core.Testing/project.json --output ../../artifacts - dotnet pack --configuration Release Grpc.Auth/project.json --output ../../artifacts - dotnet pack --configuration Release Grpc.HealthCheck/project.json --output ../../artifacts - dotnet pack --configuration Release Grpc.Reflection/project.json --output ../../artifacts + # To be able to build, we also need to put grpc_csharp_ext to its normal location + mkdir -p ../../libs/opt + cp nativelibs/linux_x64/libgrpc_csharp_ext.so ../../libs/opt + + dotnet pack --configuration Release Grpc.Core --output ../../../artifacts + dotnet pack --configuration Release Grpc.Core.Testing --output ../../../artifacts + 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 "${settings.csharp_version}" -OutputDirectory ../../artifacts nuget pack Grpc.Tools.nuspec -Version "${settings.csharp_version}" -OutputDirectory ../../artifacts diff --git a/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile index 14a2468abc7..2a59628b487 100644 --- a/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile @@ -97,6 +97,24 @@ RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y \ RUN nuget update -self +# Install dotnet SDK based on https://www.microsoft.com/net/core#debian +RUN apt-get update && apt-get install -y curl libunwind8 gettext +# dotnet-dev-1.0.0-preview2-003131 +RUN curl -sSL -o dotnet100.tar.gz https://go.microsoft.com/fwlink/?LinkID=827530 +RUN mkdir -p /opt/dotnet && tar zxf dotnet100.tar.gz -C /opt/dotnet +# dotnet-dev-1.0.1 +RUN curl -sSL -o dotnet101.tar.gz https://go.microsoft.com/fwlink/?LinkID=843453 +RUN mkdir -p /opt/dotnet && tar zxf dotnet101.tar.gz -C /opt/dotnet +RUN ln -s /opt/dotnet/dotnet /usr/local/bin + +# Trigger the population of the local package cache +ENV NUGET_XMLDOC_MODE skip +RUN mkdir warmup \ + && cd warmup \ + && dotnet new \ + && cd .. \ + && rm -rf warmup + # Prepare ccache RUN ln -s /usr/bin/ccache /usr/local/bin/gcc RUN ln -s /usr/bin/ccache /usr/local/bin/g++ diff --git a/tools/dockerfile/test/csharp_jessie_x64/Dockerfile b/tools/dockerfile/test/csharp_jessie_x64/Dockerfile index 14a2468abc7..2a59628b487 100644 --- a/tools/dockerfile/test/csharp_jessie_x64/Dockerfile +++ b/tools/dockerfile/test/csharp_jessie_x64/Dockerfile @@ -97,6 +97,24 @@ RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y \ RUN nuget update -self +# Install dotnet SDK based on https://www.microsoft.com/net/core#debian +RUN apt-get update && apt-get install -y curl libunwind8 gettext +# dotnet-dev-1.0.0-preview2-003131 +RUN curl -sSL -o dotnet100.tar.gz https://go.microsoft.com/fwlink/?LinkID=827530 +RUN mkdir -p /opt/dotnet && tar zxf dotnet100.tar.gz -C /opt/dotnet +# dotnet-dev-1.0.1 +RUN curl -sSL -o dotnet101.tar.gz https://go.microsoft.com/fwlink/?LinkID=843453 +RUN mkdir -p /opt/dotnet && tar zxf dotnet101.tar.gz -C /opt/dotnet +RUN ln -s /opt/dotnet/dotnet /usr/local/bin + +# Trigger the population of the local package cache +ENV NUGET_XMLDOC_MODE skip +RUN mkdir warmup \ + && cd warmup \ + && dotnet new \ + && cd .. \ + && rm -rf warmup + # Prepare ccache RUN ln -s /usr/bin/ccache /usr/local/bin/gcc RUN ln -s /usr/bin/ccache /usr/local/bin/g++ From 17ce30eaaba8d4aabf085f2bf2da66c8c2654e1c Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 5 Apr 2017 18:10:50 +0200 Subject: [PATCH 259/461] update init perf worker script --- tools/gce/linux_performance_worker_init.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/gce/linux_performance_worker_init.sh b/tools/gce/linux_performance_worker_init.sh index 63fb0d81c54..641271214ee 100755 --- a/tools/gce/linux_performance_worker_init.sh +++ b/tools/gce/linux_performance_worker_init.sh @@ -126,6 +126,7 @@ sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotne sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893 sudo apt-get update sudo apt-get install -y dotnet-dev-1.0.0-preview2-003131 +sudo apt-get install -y dotnet-dev-1.0.1 # Ruby dependencies gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 From b58d946efaf8e9dd26d1e35e92b1fa79eab9f9e9 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 6 Apr 2017 10:25:44 +0200 Subject: [PATCH 260/461] fix package downgrade warning in dotnet restore --- .../Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj index 05728de8577..6f2f06a6522 100755 --- a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj +++ b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj @@ -31,7 +31,7 @@ - + From 3ddc5da0c22f252490e116e95eed9b0b1abc78e0 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 6 Apr 2017 18:44:57 +0200 Subject: [PATCH 261/461] update docs --- src/csharp/README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/csharp/README.md b/src/csharp/README.md index a21b72f2253..a973d2e5970 100644 --- a/src/csharp/README.md +++ b/src/csharp/README.md @@ -16,7 +16,7 @@ PREREQUISITES When using gRPC C# under .NET Core you only need to [install .NET Core](https://www.microsoft.com/net/core). -- Windows: .NET Framework 4.5+, Visual Studio 2013 or 2015 +- Windows: .NET Framework 4.5+, Visual Studio 2013, 2015, 2017 - Linux: Mono 4+, MonoDevelop 5.9+ (with NuGet add-in installed) - Mac OS X: Xamarin Studio 5.9+ @@ -45,7 +45,9 @@ If you are a user of gRPC C#, go to Usage section above. $ python tools/run_tests/run_tests.py -c dbg -l csharp --build_only ``` -- Use Visual Studio / MonoDevelop / Xamarin Studio to open the solution Grpc.sln +- Use Visual Studio 2017 (on Windows) to open the solution `Grpc.sln` or use Visual Studio Code with C# extension (on Linux and Mac). gRPC C# code has been migrated to + dotnet SDK `.csproj` projects that are much simpler to maintain, but are not yet supported by Xamarin Studio or Monodevelop (the NuGet packages still + support both `net45` and `netstandard` and can be used in all IDEs). RUNNING TESTS ------------- @@ -55,9 +57,6 @@ gRPC C# is using NUnit as the testing framework. Under Visual Studio, make sure NUnit test adapter is installed (under "Extensions and Updates"). Then you should be able to run all the tests using Test Explorer. -Under Monodevelop or Xamarin Studio, make sure you installed "NUnit support" in Add-in manager. -Then you should be able to run all the test from the Test View. - gRPC team uses a Python script to simplify facilitate running tests for different languages. From 97a0ded7c59a123dfe2be0d2a4e0e27b58754a1b Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 7 Apr 2017 00:34:19 -0700 Subject: [PATCH 262/461] Fix bm_chttp2_transport --- test/cpp/microbenchmarks/bm_chttp2_transport.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/cpp/microbenchmarks/bm_chttp2_transport.cc b/test/cpp/microbenchmarks/bm_chttp2_transport.cc index 16112508500..d3ca27a68e5 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_transport.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_transport.cc @@ -572,11 +572,13 @@ static void BM_TransportStreamRecv(benchmark::State &state) { } while (grpc_byte_stream_next(exec_ctx, recv_stream, recv_stream->length - received, drain_continue.get()) && - GRPC_ERROR_NONE == grpc_byte_stream_pull(exec_ctx, recv_stream, - &recv_slice)); + GRPC_ERROR_NONE == + grpc_byte_stream_pull(exec_ctx, recv_stream, &recv_slice) && + (received += GRPC_SLICE_LENGTH(recv_slice), true)); }); drain_continue = MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) { + grpc_byte_stream_pull(exec_ctx, recv_stream, &recv_slice); received += GRPC_SLICE_LENGTH(recv_slice); grpc_slice_unref_internal(exec_ctx, recv_slice); grpc_closure_run(exec_ctx, drain.get(), GRPC_ERROR_NONE); From e27f061fa91cc57c6d4f0620b63cdbac83afeead Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 7 Apr 2017 00:37:04 -0700 Subject: [PATCH 263/461] Unban --- src/core/ext/transport/chttp2/transport/chttp2_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index ca95d8289ad..ed3f5e61925 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -2445,7 +2445,7 @@ static grpc_error *deframe_unprocessed_incoming_frames( &s->unprocessed_incoming_frames_buffer, grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); } - grpc_slice_unref(slice); + grpc_slice_unref_internal(exec_ctx, slice); return GRPC_ERROR_NONE; case GRPC_CHTTP2_DATA_FRAME: { GPR_ASSERT(p->parsing_frame != NULL); From 9c9e00958d1f5a09ec4ad80fb176fe6f48367639 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 9 Mar 2017 10:15:41 +0100 Subject: [PATCH 264/461] Add newest dotnet SDK to C# dockerfile --- templates/tools/dockerfile/csharp_dotnetcli_deps.include | 8 ++++++-- .../interoptest/grpc_interop_csharpcoreclr/Dockerfile | 8 ++++++-- tools/dockerfile/test/csharp_coreclr_x64/Dockerfile | 8 ++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/templates/tools/dockerfile/csharp_dotnetcli_deps.include b/templates/tools/dockerfile/csharp_dotnetcli_deps.include index 430f3fa3f22..058ce15fb52 100644 --- a/templates/tools/dockerfile/csharp_dotnetcli_deps.include +++ b/templates/tools/dockerfile/csharp_dotnetcli_deps.include @@ -1,7 +1,11 @@ # Install dotnet SDK based on https://www.microsoft.com/net/core#debian RUN apt-get update && apt-get install -y curl libunwind8 gettext -RUN curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=809130 -RUN mkdir -p /opt/dotnet && tar zxf dotnet.tar.gz -C /opt/dotnet +# dotnet-dev-1.0.0-preview2-003121 +RUN curl -sSL -o dotnet100.tar.gz https://go.microsoft.com/fwlink/?LinkID=809130 +RUN mkdir -p /opt/dotnet && tar zxf dotnet100.tar.gz -C /opt/dotnet +# dotnet-dev-1.0.1 +RUN curl -sSL -o dotnet101.tar.gz https://go.microsoft.com/fwlink/?LinkID=843453 +RUN mkdir -p /opt/dotnet && tar zxf dotnet101.tar.gz -C /opt/dotnet RUN ln -s /opt/dotnet/dotnet /usr/local/bin # Trigger the population of the local package cache diff --git a/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile index 91639829dcd..c26c9a2826e 100644 --- a/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile @@ -99,8 +99,12 @@ RUN nuget update -self # Install dotnet SDK based on https://www.microsoft.com/net/core#debian RUN apt-get update && apt-get install -y curl libunwind8 gettext -RUN curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=809130 -RUN mkdir -p /opt/dotnet && tar zxf dotnet.tar.gz -C /opt/dotnet +# dotnet-dev-1.0.0-preview2-003121 +RUN curl -sSL -o dotnet100.tar.gz https://go.microsoft.com/fwlink/?LinkID=809130 +RUN mkdir -p /opt/dotnet && tar zxf dotnet100.tar.gz -C /opt/dotnet +# dotnet-dev-1.0.1 +RUN curl -sSL -o dotnet101.tar.gz https://go.microsoft.com/fwlink/?LinkID=843453 +RUN mkdir -p /opt/dotnet && tar zxf dotnet101.tar.gz -C /opt/dotnet RUN ln -s /opt/dotnet/dotnet /usr/local/bin # Trigger the population of the local package cache diff --git a/tools/dockerfile/test/csharp_coreclr_x64/Dockerfile b/tools/dockerfile/test/csharp_coreclr_x64/Dockerfile index 91639829dcd..c26c9a2826e 100644 --- a/tools/dockerfile/test/csharp_coreclr_x64/Dockerfile +++ b/tools/dockerfile/test/csharp_coreclr_x64/Dockerfile @@ -99,8 +99,12 @@ RUN nuget update -self # Install dotnet SDK based on https://www.microsoft.com/net/core#debian RUN apt-get update && apt-get install -y curl libunwind8 gettext -RUN curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=809130 -RUN mkdir -p /opt/dotnet && tar zxf dotnet.tar.gz -C /opt/dotnet +# dotnet-dev-1.0.0-preview2-003121 +RUN curl -sSL -o dotnet100.tar.gz https://go.microsoft.com/fwlink/?LinkID=809130 +RUN mkdir -p /opt/dotnet && tar zxf dotnet100.tar.gz -C /opt/dotnet +# dotnet-dev-1.0.1 +RUN curl -sSL -o dotnet101.tar.gz https://go.microsoft.com/fwlink/?LinkID=843453 +RUN mkdir -p /opt/dotnet && tar zxf dotnet101.tar.gz -C /opt/dotnet RUN ln -s /opt/dotnet/dotnet /usr/local/bin # Trigger the population of the local package cache From d3a563554668a3a3fb64b1149418f90d1143dc96 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 9 Mar 2017 16:55:06 +0100 Subject: [PATCH 265/461] Add global.json file to pick dotnet core SDK version --- examples/csharp/helloworld-from-cli/global.json | 5 +++++ src/csharp/global.json | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 examples/csharp/helloworld-from-cli/global.json create mode 100644 src/csharp/global.json diff --git a/examples/csharp/helloworld-from-cli/global.json b/examples/csharp/helloworld-from-cli/global.json new file mode 100644 index 00000000000..32ff399ef94 --- /dev/null +++ b/examples/csharp/helloworld-from-cli/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "1.0.0-preview2-003121" + } +} \ No newline at end of file diff --git a/src/csharp/global.json b/src/csharp/global.json new file mode 100644 index 00000000000..32ff399ef94 --- /dev/null +++ b/src/csharp/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "1.0.0-preview2-003121" + } +} \ No newline at end of file From 6ed454ef44d100e21dd1cb6b34951de150454640 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 6 Apr 2017 13:20:49 +0200 Subject: [PATCH 266/461] make C# docker image in sync with GCE performance workers --- src/csharp/global.json | 2 +- templates/tools/dockerfile/csharp_dotnetcli_deps.include | 4 ++-- .../interoptest/grpc_interop_csharpcoreclr/Dockerfile | 4 ++-- tools/dockerfile/test/csharp_coreclr_x64/Dockerfile | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/csharp/global.json b/src/csharp/global.json index 32ff399ef94..f3c33cef6a5 100644 --- a/src/csharp/global.json +++ b/src/csharp/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "1.0.0-preview2-003121" + "version": "1.0.0-preview2-003131" } } \ No newline at end of file diff --git a/templates/tools/dockerfile/csharp_dotnetcli_deps.include b/templates/tools/dockerfile/csharp_dotnetcli_deps.include index 058ce15fb52..bc88d2bfa39 100644 --- a/templates/tools/dockerfile/csharp_dotnetcli_deps.include +++ b/templates/tools/dockerfile/csharp_dotnetcli_deps.include @@ -1,7 +1,7 @@ # Install dotnet SDK based on https://www.microsoft.com/net/core#debian RUN apt-get update && apt-get install -y curl libunwind8 gettext -# dotnet-dev-1.0.0-preview2-003121 -RUN curl -sSL -o dotnet100.tar.gz https://go.microsoft.com/fwlink/?LinkID=809130 +# dotnet-dev-1.0.0-preview2-003131 +RUN curl -sSL -o dotnet100.tar.gz https://go.microsoft.com/fwlink/?LinkID=827530 RUN mkdir -p /opt/dotnet && tar zxf dotnet100.tar.gz -C /opt/dotnet # dotnet-dev-1.0.1 RUN curl -sSL -o dotnet101.tar.gz https://go.microsoft.com/fwlink/?LinkID=843453 diff --git a/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile index c26c9a2826e..2a59628b487 100644 --- a/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile @@ -99,8 +99,8 @@ RUN nuget update -self # Install dotnet SDK based on https://www.microsoft.com/net/core#debian RUN apt-get update && apt-get install -y curl libunwind8 gettext -# dotnet-dev-1.0.0-preview2-003121 -RUN curl -sSL -o dotnet100.tar.gz https://go.microsoft.com/fwlink/?LinkID=809130 +# dotnet-dev-1.0.0-preview2-003131 +RUN curl -sSL -o dotnet100.tar.gz https://go.microsoft.com/fwlink/?LinkID=827530 RUN mkdir -p /opt/dotnet && tar zxf dotnet100.tar.gz -C /opt/dotnet # dotnet-dev-1.0.1 RUN curl -sSL -o dotnet101.tar.gz https://go.microsoft.com/fwlink/?LinkID=843453 diff --git a/tools/dockerfile/test/csharp_coreclr_x64/Dockerfile b/tools/dockerfile/test/csharp_coreclr_x64/Dockerfile index c26c9a2826e..2a59628b487 100644 --- a/tools/dockerfile/test/csharp_coreclr_x64/Dockerfile +++ b/tools/dockerfile/test/csharp_coreclr_x64/Dockerfile @@ -99,8 +99,8 @@ RUN nuget update -self # Install dotnet SDK based on https://www.microsoft.com/net/core#debian RUN apt-get update && apt-get install -y curl libunwind8 gettext -# dotnet-dev-1.0.0-preview2-003121 -RUN curl -sSL -o dotnet100.tar.gz https://go.microsoft.com/fwlink/?LinkID=809130 +# dotnet-dev-1.0.0-preview2-003131 +RUN curl -sSL -o dotnet100.tar.gz https://go.microsoft.com/fwlink/?LinkID=827530 RUN mkdir -p /opt/dotnet && tar zxf dotnet100.tar.gz -C /opt/dotnet # dotnet-dev-1.0.1 RUN curl -sSL -o dotnet101.tar.gz https://go.microsoft.com/fwlink/?LinkID=843453 From 87b211244399b5d03b41860180c0a2aad7b86d5d Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 7 Apr 2017 10:18:12 +0200 Subject: [PATCH 267/461] also fix global.json in helloworld --- examples/csharp/helloworld-from-cli/global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/csharp/helloworld-from-cli/global.json b/examples/csharp/helloworld-from-cli/global.json index 32ff399ef94..f3c33cef6a5 100644 --- a/examples/csharp/helloworld-from-cli/global.json +++ b/examples/csharp/helloworld-from-cli/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "1.0.0-preview2-003121" + "version": "1.0.0-preview2-003131" } } \ No newline at end of file From 3f5b8aad6485d7107fa72f3b9df1cb9f400ee1a8 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 7 Apr 2017 10:30:55 +0200 Subject: [PATCH 268/461] remove global.json --- src/csharp/global.json | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 src/csharp/global.json diff --git a/src/csharp/global.json b/src/csharp/global.json deleted file mode 100644 index f3c33cef6a5..00000000000 --- a/src/csharp/global.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sdk": { - "version": "1.0.0-preview2-003131" - } -} \ No newline at end of file From f6a4d9fc271f0b12df3878ae1bcecd5cb438a117 Mon Sep 17 00:00:00 2001 From: Edmundo Rodrigues Date: Mon, 20 Mar 2017 13:35:31 -0300 Subject: [PATCH 269/461] Make min_backoff_ms timeout configurable --- include/grpc/impl/codegen/grpc_types.h | 2 ++ src/core/ext/filters/client_channel/subchannel.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index fdedf0a84f3..0b0ef71caf1 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -237,6 +237,8 @@ typedef struct { /** Secondary user agent: goes at the end of the user-agent metadata sent on each request. A string. */ #define GRPC_ARG_SECONDARY_USER_AGENT_STRING "grpc.secondary_user_agent" +/** The minimum time between subsequent connection attempts, in ms */ +#define GRPC_ARG_MIN_RECONNECT_BACKOFF_MS "grpc.min_reconnect_backoff_ms" /** The maximum time between subsequent connection attempts, in ms */ #define GRPC_ARG_MAX_RECONNECT_BACKOFF_MS "grpc.max_reconnect_backoff_ms" /** The time between the first and second connection attempts, in ms */ diff --git a/src/core/ext/filters/client_channel/subchannel.c b/src/core/ext/filters/client_channel/subchannel.c index 9a7a7a0ee5f..0fc73eb116c 100644 --- a/src/core/ext/filters/client_channel/subchannel.c +++ b/src/core/ext/filters/client_channel/subchannel.c @@ -59,9 +59,9 @@ #define INTERNAL_REF_BITS 16 #define STRONG_REF_MASK (~(gpr_atm)((1 << INTERNAL_REF_BITS) - 1)) -#define GRPC_SUBCHANNEL_MIN_CONNECT_TIMEOUT_SECONDS 20 #define GRPC_SUBCHANNEL_INITIAL_CONNECT_BACKOFF_SECONDS 1 #define GRPC_SUBCHANNEL_RECONNECT_BACKOFF_MULTIPLIER 1.6 +#define GRPC_SUBCHANNEL_RECONNECT_MIN_BACKOFF_SECONDS 20 #define GRPC_SUBCHANNEL_RECONNECT_MAX_BACKOFF_SECONDS 120 #define GRPC_SUBCHANNEL_RECONNECT_JITTER 0.2 @@ -353,8 +353,8 @@ grpc_subchannel *grpc_subchannel_create(grpc_exec_ctx *exec_ctx, "subchannel"); int initial_backoff_ms = GRPC_SUBCHANNEL_INITIAL_CONNECT_BACKOFF_SECONDS * 1000; + int min_backoff_ms = GRPC_SUBCHANNEL_RECONNECT_MIN_BACKOFF_SECONDS * 1000; int max_backoff_ms = GRPC_SUBCHANNEL_RECONNECT_MAX_BACKOFF_SECONDS * 1000; - int min_backoff_ms = GRPC_SUBCHANNEL_MIN_CONNECT_TIMEOUT_SECONDS * 1000; bool fixed_reconnect_backoff = false; if (c->args) { for (size_t i = 0; i < c->args->num_args; i++) { @@ -365,6 +365,12 @@ grpc_subchannel *grpc_subchannel_create(grpc_exec_ctx *exec_ctx, grpc_channel_arg_get_integer( &c->args->args[i], (grpc_integer_options){initial_backoff_ms, 100, INT_MAX}); + } else if (0 == strcmp(c->args->args[i].key, + GRPC_ARG_MIN_RECONNECT_BACKOFF_MS)) { + fixed_reconnect_backoff = false; + min_backoff_ms = grpc_channel_arg_get_integer( + &c->args->args[i], + (grpc_integer_options){min_backoff_ms, 100, INT_MAX}); } else if (0 == strcmp(c->args->args[i].key, GRPC_ARG_MAX_RECONNECT_BACKOFF_MS)) { fixed_reconnect_backoff = false; From 58aa2cb8f19bead7d4436fa9fcaee6ef8519f217 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 7 Apr 2017 09:30:49 +0200 Subject: [PATCH 270/461] fix 1MB perf scenarios --- tools/run_tests/generated/tests.json | 16 +++++++-------- .../run_tests/performance/scenario_config.py | 20 +++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index d9c878170d7..e0b8a4cc6fb 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -41456,7 +41456,7 @@ { "args": [ "--scenarios_json", - "{\"scenarios\": [{\"name\": \"cpp_protobuf_async_unary_ping_pong_secure_1mb\", \"warmup_seconds\": 0, \"benchmark_seconds\": 1, \"num_servers\": 1, \"server_config\": {\"async_server_threads\": 0, \"security_params\": {\"use_test_ca\": true, \"server_host_override\": \"foo.test.google.fr\"}, \"server_type\": \"ASYNC_SERVER\"}, \"num_clients\": 1, \"client_config\": {\"client_type\": \"ASYNC_CLIENT\", \"security_params\": {\"use_test_ca\": true, \"server_host_override\": \"foo.test.google.fr\"}, \"payload_config\": {\"simple_params\": {\"resp_size\": 1048576, \"req_size\": 1048576}}, \"client_channels\": 1, \"async_client_threads\": 1, \"outstanding_rpcs_per_channel\": 1, \"rpc_type\": \"UNARY\", \"load_params\": {\"closed_loop\": {}}, \"histogram_params\": {\"max_possible\": 60000000000.0, \"resolution\": 0.01}}}]}" + "{\"scenarios\": [{\"name\": \"cpp_protobuf_async_unary_ping_pong_secure_1MB\", \"warmup_seconds\": 0, \"benchmark_seconds\": 1, \"num_servers\": 1, \"server_config\": {\"async_server_threads\": 0, \"security_params\": {\"use_test_ca\": true, \"server_host_override\": \"foo.test.google.fr\"}, \"server_type\": \"ASYNC_SERVER\"}, \"num_clients\": 1, \"client_config\": {\"client_type\": \"ASYNC_CLIENT\", \"security_params\": {\"use_test_ca\": true, \"server_host_override\": \"foo.test.google.fr\"}, \"payload_config\": {\"simple_params\": {\"resp_size\": 1048576, \"req_size\": 1048576}}, \"client_channels\": 1, \"async_client_threads\": 1, \"outstanding_rpcs_per_channel\": 1, \"rpc_type\": \"UNARY\", \"load_params\": {\"closed_loop\": {}}, \"histogram_params\": {\"max_possible\": 60000000000.0, \"resolution\": 0.01}}}]}" ], "boringssl": true, "ci_platforms": [ @@ -41475,7 +41475,7 @@ "platforms": [ "linux" ], - "shortname": "json_run_localhost:cpp_protobuf_async_unary_ping_pong_secure_1mb", + "shortname": "json_run_localhost:cpp_protobuf_async_unary_ping_pong_secure_1MB", "timeout_seconds": 360 }, { @@ -42035,7 +42035,7 @@ { "args": [ "--scenarios_json", - "{\"scenarios\": [{\"name\": \"cpp_protobuf_async_unary_ping_pong_insecure_1mb\", \"warmup_seconds\": 0, \"benchmark_seconds\": 1, \"num_servers\": 1, \"server_config\": {\"async_server_threads\": 0, \"security_params\": null, \"server_type\": \"ASYNC_SERVER\"}, \"num_clients\": 1, \"client_config\": {\"client_type\": \"ASYNC_CLIENT\", \"security_params\": null, \"payload_config\": {\"simple_params\": {\"resp_size\": 1048576, \"req_size\": 1048576}}, \"client_channels\": 1, \"async_client_threads\": 1, \"outstanding_rpcs_per_channel\": 1, \"rpc_type\": \"UNARY\", \"load_params\": {\"closed_loop\": {}}, \"histogram_params\": {\"max_possible\": 60000000000.0, \"resolution\": 0.01}}}]}" + "{\"scenarios\": [{\"name\": \"cpp_protobuf_async_unary_ping_pong_insecure_1MB\", \"warmup_seconds\": 0, \"benchmark_seconds\": 1, \"num_servers\": 1, \"server_config\": {\"async_server_threads\": 0, \"security_params\": null, \"server_type\": \"ASYNC_SERVER\"}, \"num_clients\": 1, \"client_config\": {\"client_type\": \"ASYNC_CLIENT\", \"security_params\": null, \"payload_config\": {\"simple_params\": {\"resp_size\": 1048576, \"req_size\": 1048576}}, \"client_channels\": 1, \"async_client_threads\": 1, \"outstanding_rpcs_per_channel\": 1, \"rpc_type\": \"UNARY\", \"load_params\": {\"closed_loop\": {}}, \"histogram_params\": {\"max_possible\": 60000000000.0, \"resolution\": 0.01}}}]}" ], "boringssl": true, "ci_platforms": [ @@ -42054,7 +42054,7 @@ "platforms": [ "linux" ], - "shortname": "json_run_localhost:cpp_protobuf_async_unary_ping_pong_insecure_1mb", + "shortname": "json_run_localhost:cpp_protobuf_async_unary_ping_pong_insecure_1MB", "timeout_seconds": 360 }, { @@ -42734,7 +42734,7 @@ { "args": [ "--scenarios_json", - "{\"scenarios\": [{\"name\": \"cpp_protobuf_async_unary_ping_pong_secure_1mb\", \"warmup_seconds\": 0, \"benchmark_seconds\": 1, \"num_servers\": 1, \"server_config\": {\"async_server_threads\": 0, \"security_params\": {\"use_test_ca\": true, \"server_host_override\": \"foo.test.google.fr\"}, \"server_type\": \"ASYNC_SERVER\"}, \"num_clients\": 1, \"client_config\": {\"client_type\": \"ASYNC_CLIENT\", \"security_params\": {\"use_test_ca\": true, \"server_host_override\": \"foo.test.google.fr\"}, \"payload_config\": {\"simple_params\": {\"resp_size\": 1048576, \"req_size\": 1048576}}, \"client_channels\": 1, \"async_client_threads\": 1, \"outstanding_rpcs_per_channel\": 1, \"rpc_type\": \"UNARY\", \"load_params\": {\"closed_loop\": {}}, \"histogram_params\": {\"max_possible\": 60000000000.0, \"resolution\": 0.01}}}]}" + "{\"scenarios\": [{\"name\": \"cpp_protobuf_async_unary_ping_pong_secure_1MB\", \"warmup_seconds\": 0, \"benchmark_seconds\": 1, \"num_servers\": 1, \"server_config\": {\"async_server_threads\": 0, \"security_params\": {\"use_test_ca\": true, \"server_host_override\": \"foo.test.google.fr\"}, \"server_type\": \"ASYNC_SERVER\"}, \"num_clients\": 1, \"client_config\": {\"client_type\": \"ASYNC_CLIENT\", \"security_params\": {\"use_test_ca\": true, \"server_host_override\": \"foo.test.google.fr\"}, \"payload_config\": {\"simple_params\": {\"resp_size\": 1048576, \"req_size\": 1048576}}, \"client_channels\": 1, \"async_client_threads\": 1, \"outstanding_rpcs_per_channel\": 1, \"rpc_type\": \"UNARY\", \"load_params\": {\"closed_loop\": {}}, \"histogram_params\": {\"max_possible\": 60000000000.0, \"resolution\": 0.01}}}]}" ], "boringssl": true, "ci_platforms": [ @@ -42765,7 +42765,7 @@ "platforms": [ "linux" ], - "shortname": "json_run_localhost:cpp_protobuf_async_unary_ping_pong_secure_1mb_low_thread_count", + "shortname": "json_run_localhost:cpp_protobuf_async_unary_ping_pong_secure_1MB_low_thread_count", "timeout_seconds": 360 }, { @@ -43589,7 +43589,7 @@ { "args": [ "--scenarios_json", - "{\"scenarios\": [{\"name\": \"cpp_protobuf_async_unary_ping_pong_insecure_1mb\", \"warmup_seconds\": 0, \"benchmark_seconds\": 1, \"num_servers\": 1, \"server_config\": {\"async_server_threads\": 0, \"security_params\": null, \"server_type\": \"ASYNC_SERVER\"}, \"num_clients\": 1, \"client_config\": {\"client_type\": \"ASYNC_CLIENT\", \"security_params\": null, \"payload_config\": {\"simple_params\": {\"resp_size\": 1048576, \"req_size\": 1048576}}, \"client_channels\": 1, \"async_client_threads\": 1, \"outstanding_rpcs_per_channel\": 1, \"rpc_type\": \"UNARY\", \"load_params\": {\"closed_loop\": {}}, \"histogram_params\": {\"max_possible\": 60000000000.0, \"resolution\": 0.01}}}]}" + "{\"scenarios\": [{\"name\": \"cpp_protobuf_async_unary_ping_pong_insecure_1MB\", \"warmup_seconds\": 0, \"benchmark_seconds\": 1, \"num_servers\": 1, \"server_config\": {\"async_server_threads\": 0, \"security_params\": null, \"server_type\": \"ASYNC_SERVER\"}, \"num_clients\": 1, \"client_config\": {\"client_type\": \"ASYNC_CLIENT\", \"security_params\": null, \"payload_config\": {\"simple_params\": {\"resp_size\": 1048576, \"req_size\": 1048576}}, \"client_channels\": 1, \"async_client_threads\": 1, \"outstanding_rpcs_per_channel\": 1, \"rpc_type\": \"UNARY\", \"load_params\": {\"closed_loop\": {}}, \"histogram_params\": {\"max_possible\": 60000000000.0, \"resolution\": 0.01}}}]}" ], "boringssl": true, "ci_platforms": [ @@ -43620,7 +43620,7 @@ "platforms": [ "linux" ], - "shortname": "json_run_localhost:cpp_protobuf_async_unary_ping_pong_insecure_1mb_low_thread_count", + "shortname": "json_run_localhost:cpp_protobuf_async_unary_ping_pong_insecure_1MB_low_thread_count", "timeout_seconds": 360 }, { diff --git a/tools/run_tests/performance/scenario_config.py b/tools/run_tests/performance/scenario_config.py index dca3fba0990..200da5e36db 100644 --- a/tools/run_tests/performance/scenario_config.py +++ b/tools/run_tests/performance/scenario_config.py @@ -304,11 +304,11 @@ class CXXLanguage: excluded_poll_engines = ['poll-cv']) yield _ping_pong_scenario( - 'cpp_protobuf_async_unary_ping_pong_%s_1mb' % secstr, rpc_type='UNARY', + 'cpp_protobuf_async_unary_ping_pong_%s_1MB' % secstr, rpc_type='UNARY', client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER', req_size=1024*1024, resp_size=1024*1024, secure=secure, - categories=smoketest_categories) + categories=smoketest_categories + [SCALABLE]) for rpc_type in ['unary', 'streaming']: for synchronicity in ['sync', 'async']: @@ -464,10 +464,10 @@ class CSharpLanguage: categories=[SCALABLE]) yield _ping_pong_scenario( - 'csharp_protobuf_async_unary_ping_pong_1mb', rpc_type='UNARY', + 'csharp_protobuf_async_unary_ping_pong_1MB', rpc_type='UNARY', client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER', req_size=1024*1024, resp_size=1024*1024, - categories=[SMOKETEST]) + categories=[SMOKETEST, SCALABLE]) def __str__(self): @@ -510,10 +510,10 @@ class NodeLanguage: client_language='c++') yield _ping_pong_scenario( - 'node_protobuf_async_unary_ping_pong_1mb', rpc_type='UNARY', + 'node_protobuf_unary_ping_pong_1MB', rpc_type='UNARY', client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER', req_size=1024*1024, resp_size=1024*1024, - categories=[SMOKETEST]) + categories=[SCALABLE, SMOKETEST]) # TODO(murgatroid99): fix bugs with this scenario and re-enable it # yield _ping_pong_scenario( @@ -596,10 +596,10 @@ class PythonLanguage: server_language='c++', async_server_threads=1) yield _ping_pong_scenario( - 'python_protobuf_sync_unary_ping_pong_1mb', rpc_type='UNARY', + 'python_protobuf_sync_unary_ping_pong_1MB', rpc_type='UNARY', client_type='SYNC_CLIENT', server_type='ASYNC_SERVER', req_size=1024*1024, resp_size=1024*1024, - categories=[SMOKETEST]) + categories=[SMOKETEST, SCALABLE]) def __str__(self): return 'python' @@ -648,10 +648,10 @@ class RubyLanguage: server_language='c++', async_server_threads=1) yield _ping_pong_scenario( - 'ruby_protobuf_async_unary_ping_pong_1mb', rpc_type='UNARY', + 'ruby_protobuf_unary_ping_pong_1MB', rpc_type='UNARY', client_type='SYNC_CLIENT', server_type='SYNC_SERVER', req_size=1024*1024, resp_size=1024*1024, - categories=[SMOKETEST]) + categories=[SMOKETEST, SCALABLE]) def __str__(self): return 'ruby' From ecc457b43fc864d84e8555705db978c2c1bbc339 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 7 Apr 2017 14:06:16 +0200 Subject: [PATCH 271/461] allow using gRPC as a cmake subproject --- CMakeLists.txt | 7 ++----- templates/CMakeLists.txt.template | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 96ece1fd600..f8b88645cb1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,9 +5,6 @@ # This file can be regenerated from the template by running # tools/buildgen/generate_projects.sh # -# Additionally, this is currently very experimental, and unsupported. -# Further work will happen on that file. -# # Copyright 2015, Google Inc. # All rights reserved. # @@ -308,7 +305,7 @@ function(protobuf_generate_grpc_cpp) foreach(FIL ${ARGN}) get_filename_component(ABS_FIL ${FIL} ABSOLUTE) get_filename_component(FIL_WE ${FIL} NAME_WE) - file(RELATIVE_PATH REL_FIL ${CMAKE_SOURCE_DIR} ${ABS_FIL}) + file(RELATIVE_PATH REL_FIL ${CMAKE_CURRENT_SOURCE_DIR} ${ABS_FIL}) get_filename_component(REL_DIR ${REL_FIL} DIRECTORY) set(RELFIL_WE "${REL_DIR}/${FIL_WE}") @@ -324,7 +321,7 @@ function(protobuf_generate_grpc_cpp) ${_protobuf_include_path} ${REL_FIL} DEPENDS ${ABS_FIL} ${_gRPC_PROTOBUF_PROTOC} grpc_cpp_plugin - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Running gRPC C++ protocol buffer compiler on ${FIL}" VERBATIM) diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index e2fc216bca7..1a41d807e97 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -7,9 +7,6 @@ # This file can be regenerated from the template by running # tools/buildgen/generate_projects.sh # - # Additionally, this is currently very experimental, and unsupported. - # Further work will happen on that file. - # # Copyright 2015, Google Inc. # All rights reserved. # @@ -353,7 +350,7 @@ foreach(FIL <%text>${ARGN}) get_filename_component(ABS_FIL <%text>${FIL} ABSOLUTE) get_filename_component(FIL_WE <%text>${FIL} NAME_WE) - file(RELATIVE_PATH REL_FIL <%text>${CMAKE_SOURCE_DIR} <%text>${ABS_FIL}) + file(RELATIVE_PATH REL_FIL <%text>${CMAKE_CURRENT_SOURCE_DIR} <%text>${ABS_FIL}) get_filename_component(REL_DIR <%text>${REL_FIL} DIRECTORY) set(RELFIL_WE "<%text>${REL_DIR}/${FIL_WE}") @@ -369,7 +366,7 @@ <%text>${_protobuf_include_path} <%text>${REL_FIL} DEPENDS <%text>${ABS_FIL} <%text>${_gRPC_PROTOBUF_PROTOC} grpc_cpp_plugin - WORKING_DIRECTORY <%text>${CMAKE_SOURCE_DIR} + WORKING_DIRECTORY <%text>${CMAKE_CURRENT_SOURCE_DIR} COMMENT "Running gRPC C++ protocol buffer compiler on <%text>${FIL}" VERBATIM) From d7a610bf545e03f49ef029f81b2b06a378869646 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 7 Apr 2017 09:46:43 -0700 Subject: [PATCH 272/461] clang-format and unban --- .../chttp2/transport/chttp2_transport.c | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index ed3f5e61925..65bd56477c8 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -528,10 +528,11 @@ static void destroy_transport_locked(grpc_exec_ctx *exec_ctx, void *tp, static void destroy_transport(grpc_exec_ctx *exec_ctx, grpc_transport *gt) { grpc_chttp2_transport *t = (grpc_chttp2_transport *)gt; - grpc_closure_sched(exec_ctx, grpc_closure_create( - destroy_transport_locked, t, - grpc_combiner_scheduler(t->combiner, false)), - GRPC_ERROR_NONE); + grpc_closure_sched( + exec_ctx, + grpc_closure_create(destroy_transport_locked, t, + grpc_combiner_scheduler(t->combiner, false)), + GRPC_ERROR_NONE); } static void close_transport_locked(grpc_exec_ctx *exec_ctx, @@ -709,8 +710,9 @@ static void destroy_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, s->destroy_stream_arg = then_schedule_closure; grpc_closure_sched( - exec_ctx, grpc_closure_init(&s->destroy_stream, destroy_stream_locked, s, - grpc_combiner_scheduler(t->combiner, false)), + exec_ctx, + grpc_closure_init(&s->destroy_stream, destroy_stream_locked, s, + grpc_combiner_scheduler(t->combiner, false)), GRPC_ERROR_NONE); GPR_TIMER_END("destroy_stream", 0); } @@ -1534,9 +1536,10 @@ static void perform_transport_op(grpc_exec_ctx *exec_ctx, grpc_transport *gt, op->handler_private.extra_arg = gt; GRPC_CHTTP2_REF_TRANSPORT(t, "transport_op"); grpc_closure_sched( - exec_ctx, grpc_closure_init(&op->handler_private.closure, - perform_transport_op_locked, op, - grpc_combiner_scheduler(t->combiner, false)), + exec_ctx, + grpc_closure_init(&op->handler_private.closure, + perform_transport_op_locked, op, + grpc_combiner_scheduler(t->combiner, false)), GRPC_ERROR_NONE); } @@ -1621,7 +1624,8 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx *exec_ctx, exec_ctx, &s->unprocessed_incoming_frames_buffer); } } - bool pending_data = s->pending_byte_stream || s->unprocessed_incoming_frames_buffer.length > 0; + bool pending_data = s->pending_byte_stream || + s->unprocessed_incoming_frames_buffer.length > 0; if (s->read_closed && s->frame_storage.length == 0 && (!pending_data || s->seen_error) && s->recv_trailing_metadata_finished != NULL) { @@ -2267,8 +2271,9 @@ static void keepalive_watchdog_fired_locked(grpc_exec_ctx *exec_ctx, void *arg, if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) { if (error == GRPC_ERROR_NONE) { t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DYING; - close_transport_locked(exec_ctx, t, GRPC_ERROR_CREATE_FROM_STATIC_STRING( - "keepalive watchdog timeout")); + close_transport_locked( + exec_ctx, t, + GRPC_ERROR_CREATE_FROM_STATIC_STRING("keepalive watchdog timeout")); } } else { /** The watchdog timer should have been cancelled by @@ -2500,7 +2505,7 @@ static grpc_error *deframe_unprocessed_incoming_frames( grpc_slice_buffer_undo_take_first( &s->unprocessed_incoming_frames_buffer, grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); - grpc_slice_unref(slice); + grpc_slice_unref_internal(exec_ctx, slice); return GRPC_ERROR_NONE; } } From 01499e051e3c55410ba09b39b9e6431de43f53b7 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 7 Apr 2017 09:48:03 -0700 Subject: [PATCH 273/461] Revert "Fix a bug in slice_buffer:maybe_embiggen" This reverts commit 9a0356b1e6d0f4fdd1e29a48596b91458b038f46. --- src/core/lib/slice/slice_buffer.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/core/lib/slice/slice_buffer.c b/src/core/lib/slice/slice_buffer.c index 451319c50d6..9176dc8a420 100644 --- a/src/core/lib/slice/slice_buffer.c +++ b/src/core/lib/slice/slice_buffer.c @@ -46,6 +46,11 @@ #define GROW(x) (3 * (x) / 2) static void maybe_embiggen(grpc_slice_buffer *sb) { + if (sb->base_slices != sb->slices) { + memmove(sb->base_slices, sb->slices, sb->count * sizeof(grpc_slice)); + sb->slices = sb->base_slices; + } + /* How far away from sb->base_slices is sb->slices pointer */ size_t slice_offset = (size_t)(sb->slices - sb->base_slices); size_t slice_count = sb->count + slice_offset; @@ -56,15 +61,12 @@ static void maybe_embiggen(grpc_slice_buffer *sb) { if (sb->base_slices == sb->inlined) { sb->base_slices = gpr_malloc(sb->capacity * sizeof(grpc_slice)); memcpy(sb->base_slices, sb->inlined, slice_count * sizeof(grpc_slice)); - sb->slices = sb->base_slices + slice_offset; } else { - if (sb->base_slices != sb->slices) { - memmove(sb->base_slices, sb->slices, sb->count * sizeof(grpc_slice)); - } sb->base_slices = gpr_realloc(sb->base_slices, sb->capacity * sizeof(grpc_slice)); - sb->slices = sb->base_slices; } + + sb->slices = sb->base_slices + slice_offset; } } From a78582bfc8719f6d850a107c9aa0cbe5510de408 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 7 Apr 2017 10:17:40 -0700 Subject: [PATCH 274/461] Ignore a couple of errors in the Node express benchmark --- .../performance/benchmark_client_express.js | 25 +++++++++++++------ .../performance/benchmark_server_express.js | 4 +-- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/node/performance/benchmark_client_express.js b/src/node/performance/benchmark_client_express.js index 675eb5f2884..e749956599d 100644 --- a/src/node/performance/benchmark_client_express.js +++ b/src/node/performance/benchmark_client_express.js @@ -93,7 +93,7 @@ function BenchmarkClient(server_targets, channels, histogram_params, for (var i = 0; i < channels; i++) { var host_port; - host_port = server_targets[i % server_targets.length].split(':') + host_port = server_targets[i % server_targets.length].split(':'); var new_options = _.assign({hostname: host_port[0], port: +host_port[1]}, options); new_options.agent = new protocol.Agent(new_options); this.client_options[i] = new_options; @@ -149,6 +149,17 @@ BenchmarkClient.prototype.startClosedLoop = function( if (self.running) { self.pending_calls++; var start_time = process.hrtime(); + function finishCall(success) { + if (success) { + var time_diff = process.hrtime(start_time); + self.histogram.add(timeDiffToNanos(time_diff)); + } + makeCall(client_options); + self.pending_calls--; + if ((!self.running) && self.pending_calls == 0) { + self.emit('finished'); + } + } var req = self.request(client_options, function(res) { var res_data = ''; res.on('data', function(data) { @@ -156,18 +167,16 @@ BenchmarkClient.prototype.startClosedLoop = function( }); res.on('end', function() { JSON.parse(res_data); - var time_diff = process.hrtime(start_time); - self.histogram.add(timeDiffToNanos(time_diff)); - makeCall(client_options); - self.pending_calls--; - if ((!self.running) && self.pending_calls == 0) { - self.emit('finished'); - } + finishCall(true); }); }); req.write(JSON.stringify(argument)); req.end(); req.on('error', function(error) { + if (error.code === 'ECONNRESET' || error.code === 'ETIMEDOUT') { + finishCall(false); + return; + } self.emit('error', new Error('Client error: ' + error.message)); self.running = false; }); diff --git a/src/node/performance/benchmark_server_express.js b/src/node/performance/benchmark_server_express.js index 065bcf660b6..4b695eb467d 100644 --- a/src/node/performance/benchmark_server_express.js +++ b/src/node/performance/benchmark_server_express.js @@ -46,7 +46,7 @@ var EventEmitter = require('events'); var util = require('util'); var express = require('express'); -var bodyParser = require('body-parser') +var bodyParser = require('body-parser'); function unaryCall(req, res) { var reqObj = req.body; @@ -56,7 +56,7 @@ function unaryCall(req, res) { function BenchmarkServer(host, port, tls, generic, response_size) { var app = express(); - app.use(bodyParser.json()) + app.use(bodyParser.json()); app.put('/serviceProto.BenchmarkService.service/unaryCall', unaryCall); this.input_host = host; this.input_port = port; From a3fda8fdc94aa7dcb3e0da0dfc28e3d85b5cf798 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 7 Apr 2017 10:34:33 -0700 Subject: [PATCH 275/461] Fix bm_chttp2_transport memory leak --- test/cpp/microbenchmarks/bm_chttp2_transport.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/cpp/microbenchmarks/bm_chttp2_transport.cc b/test/cpp/microbenchmarks/bm_chttp2_transport.cc index d3ca27a68e5..5456f69d505 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_transport.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_transport.cc @@ -574,7 +574,9 @@ static void BM_TransportStreamRecv(benchmark::State &state) { drain_continue.get()) && GRPC_ERROR_NONE == grpc_byte_stream_pull(exec_ctx, recv_stream, &recv_slice) && - (received += GRPC_SLICE_LENGTH(recv_slice), true)); + (received += GRPC_SLICE_LENGTH(recv_slice), + grpc_slice_unref_internal(exec_ctx, recv_slice), + true)); }); drain_continue = MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) { From 7cfa1bfb7378c4a55ec49867bb93895234b973c5 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 7 Apr 2017 10:41:21 -0700 Subject: [PATCH 276/461] Bump version to 1.2.3 --- BUILD | 2 +- CMakeLists.txt | 2 +- Makefile | 4 ++-- build.yaml | 2 +- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.json | 2 +- package.xml | 4 ++-- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Auth/project.json | 4 ++-- src/csharp/Grpc.Core.Testing/project.json | 4 ++-- src/csharp/Grpc.Core/VersionInfo.cs | 4 ++-- src/csharp/Grpc.Core/project.json | 2 +- src/csharp/Grpc.HealthCheck/project.json | 4 ++-- src/csharp/Grpc.Reflection/project.json | 4 ++-- src/csharp/build_packages_dotnetcli.bat | 2 +- src/csharp/build_packages_dotnetcli.sh | 4 ++-- src/node/health_check/package.json | 4 ++-- src/node/tools/package.json | 2 +- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/private/version.h | 2 +- src/php/composer.json | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- 33 files changed, 42 insertions(+), 42 deletions(-) diff --git a/BUILD b/BUILD index 0e8b058cb5f..680722ac66b 100644 --- a/BUILD +++ b/BUILD @@ -41,7 +41,7 @@ g_stands_for = "green" core_version = "3.0.0-dev" -version = "1.2.2" +version = "1.2.3" grpc_cc_library( name = "gpr", diff --git a/CMakeLists.txt b/CMakeLists.txt index 4496d37bd6a..e09f7297333 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,7 @@ cmake_minimum_required(VERSION 2.8) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.2.2") +set(PACKAGE_VERSION "1.2.3") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index 00a99ab964f..52e80b01879 100644 --- a/Makefile +++ b/Makefile @@ -412,8 +412,8 @@ Q = @ endif CORE_VERSION = 3.0.0-dev -CPP_VERSION = 1.2.2 -CSHARP_VERSION = 1.2.2 +CPP_VERSION = 1.2.3 +CSHARP_VERSION = 1.2.3 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/build.yaml b/build.yaml index 8df00f2c4bd..ac183a91b56 100644 --- a/build.yaml +++ b/build.yaml @@ -14,7 +14,7 @@ settings: '#10': See the expand_version.py for all the quirks here core_version: 3.0.0-dev g_stands_for: green - version: 1.2.2 + version: 1.2.3 filegroups: - name: census public_headers: diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 51e8fdfa02e..9e6218d031c 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -37,7 +37,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.2.2' + version = '1.2.3' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'http://www.grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 86c51819227..a4b56fe1054 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -36,7 +36,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.2.2' + version = '1.2.3' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'http://www.grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index ba365ceaa04..a567e6aa0f5 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -36,7 +36,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.2.2' + version = '1.2.3' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'http://www.grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index b51c4df5dae..891f9a5aebe 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -35,7 +35,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.2.2' + version = '1.2.3' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'http://www.grpc.io' diff --git a/package.json b/package.json index b4503d00dba..f2646c0d6d1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grpc", - "version": "1.2.2", + "version": "1.2.3", "author": "Google Inc.", "description": "gRPC Library for Node", "homepage": "http://www.grpc.io/", diff --git a/package.xml b/package.xml index 6ff9a9c9cc4..f120d57a6d1 100644 --- a/package.xml +++ b/package.xml @@ -13,8 +13,8 @@ 2017-03-01 - 1.2.2 - 1.2.2 + 1.2.3 + 1.2.3 beta diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index 6405fbcbd7d..cda07999244 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -37,5 +37,5 @@ #include namespace grpc { -grpc::string Version() { return "1.2.2"; } +grpc::string Version() { return "1.2.3"; } } diff --git a/src/csharp/Grpc.Auth/project.json b/src/csharp/Grpc.Auth/project.json index 31022e65bdf..45ee3a3112b 100644 --- a/src/csharp/Grpc.Auth/project.json +++ b/src/csharp/Grpc.Auth/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.2", + "version": "1.2.3", "title": "gRPC C# Auth", "authors": [ "Google Inc." ], "copyright": "Copyright 2015, Google Inc.", @@ -21,7 +21,7 @@ } }, "dependencies": { - "Grpc.Core": "1.2.2", + "Grpc.Core": "1.2.3", "Google.Apis.Auth": "1.21.0" }, "frameworks": { diff --git a/src/csharp/Grpc.Core.Testing/project.json b/src/csharp/Grpc.Core.Testing/project.json index 22d728fc159..40dc57ac76f 100644 --- a/src/csharp/Grpc.Core.Testing/project.json +++ b/src/csharp/Grpc.Core.Testing/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.2", + "version": "1.2.3", "title": "gRPC C# Core Testing", "authors": [ "Google Inc." ], "copyright": "Copyright 2017, Google Inc.", @@ -21,7 +21,7 @@ } }, "dependencies": { - "Grpc.Core": "1.2.2" + "Grpc.Core": "1.2.3" }, "frameworks": { "net45": { diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs index d46f863e173..c3339ce1a45 100644 --- a/src/csharp/Grpc.Core/VersionInfo.cs +++ b/src/csharp/Grpc.Core/VersionInfo.cs @@ -48,11 +48,11 @@ namespace Grpc.Core /// /// Current AssemblyFileVersion of gRPC C# assemblies /// - public const string CurrentAssemblyFileVersion = "1.2.2.0"; + public const string CurrentAssemblyFileVersion = "1.2.3.0"; /// /// Current version of gRPC C# /// - public const string CurrentVersion = "1.2.2"; + public const string CurrentVersion = "1.2.3"; } } diff --git a/src/csharp/Grpc.Core/project.json b/src/csharp/Grpc.Core/project.json index 0d56b55fe30..0381b04cf5c 100644 --- a/src/csharp/Grpc.Core/project.json +++ b/src/csharp/Grpc.Core/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.2", + "version": "1.2.3", "title": "gRPC C# Core", "authors": [ "Google Inc." ], "copyright": "Copyright 2015, Google Inc.", diff --git a/src/csharp/Grpc.HealthCheck/project.json b/src/csharp/Grpc.HealthCheck/project.json index 259d973ff62..4010d5566ab 100644 --- a/src/csharp/Grpc.HealthCheck/project.json +++ b/src/csharp/Grpc.HealthCheck/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.2", + "version": "1.2.3", "title": "gRPC C# Healthchecking", "authors": [ "Google Inc." ], "copyright": "Copyright 2015, Google Inc.", @@ -21,7 +21,7 @@ } }, "dependencies": { - "Grpc.Core": "1.2.2", + "Grpc.Core": "1.2.3", "Google.Protobuf": "3.2.0" }, "frameworks": { diff --git a/src/csharp/Grpc.Reflection/project.json b/src/csharp/Grpc.Reflection/project.json index b40945cad40..996aa51512f 100644 --- a/src/csharp/Grpc.Reflection/project.json +++ b/src/csharp/Grpc.Reflection/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.2", + "version": "1.2.3", "title": "gRPC C# Reflection", "authors": [ "Google Inc." ], "copyright": "Copyright 2016, Google Inc.", @@ -21,7 +21,7 @@ } }, "dependencies": { - "Grpc.Core": "1.2.2", + "Grpc.Core": "1.2.3", "Google.Protobuf": "3.2.0" }, "frameworks": { diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat index 51c87246bf0..aa47067d740 100755 --- a/src/csharp/build_packages_dotnetcli.bat +++ b/src/csharp/build_packages_dotnetcli.bat @@ -28,7 +28,7 @@ @rem OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @rem Current package versions -set VERSION=1.2.2 +set VERSION=1.2.3 set PROTOBUF_VERSION=3.0.0 @rem Adjust the location of nuget.exe diff --git a/src/csharp/build_packages_dotnetcli.sh b/src/csharp/build_packages_dotnetcli.sh index 7e7a029fcfd..b0432f4b18a 100755 --- a/src/csharp/build_packages_dotnetcli.sh +++ b/src/csharp/build_packages_dotnetcli.sh @@ -66,7 +66,7 @@ dotnet pack --configuration Release Grpc.Auth/project.json --output ../../artifa dotnet pack --configuration Release Grpc.HealthCheck/project.json --output ../../artifacts dotnet pack --configuration Release Grpc.Reflection/project.json --output ../../artifacts -nuget pack Grpc.nuspec -Version "1.2.2" -OutputDirectory ../../artifacts -nuget pack Grpc.Tools.nuspec -Version "1.2.2" -OutputDirectory ../../artifacts +nuget pack Grpc.nuspec -Version "1.2.3" -OutputDirectory ../../artifacts +nuget pack Grpc.Tools.nuspec -Version "1.2.3" -OutputDirectory ../../artifacts (cd ../../artifacts && zip csharp_nugets_dotnetcli.zip *.nupkg) diff --git a/src/node/health_check/package.json b/src/node/health_check/package.json index 61bb83f229a..5ad59e27e6a 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.2.2", + "version": "1.2.3", "author": "Google Inc.", "description": "Health check service for use with gRPC", "repository": { @@ -15,7 +15,7 @@ } ], "dependencies": { - "grpc": "^1.2.2", + "grpc": "^1.2.3", "lodash": "^3.9.3", "google-protobuf": "^3.0.0" }, diff --git a/src/node/tools/package.json b/src/node/tools/package.json index 460f2fc857a..e06775b5bb6 100644 --- a/src/node/tools/package.json +++ b/src/node/tools/package.json @@ -1,6 +1,6 @@ { "name": "grpc-tools", - "version": "1.2.2", + "version": "1.2.3", "author": "Google Inc.", "description": "Tools for developing with gRPC on Node.js", "homepage": "http://www.grpc.io/", diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index ca5ad7b2f56..f314d48c887 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.2.2' + v = '1.2.3' 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 d04f73d3188..69035cf8add 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -38,4 +38,4 @@ // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.2.2" +#define GRPC_OBJC_VERSION_STRING @"1.2.3" diff --git a/src/php/composer.json b/src/php/composer.json index fa4e3e5990f..a2f83ec1e00 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": "BSD-3-Clause", - "version": "1.2.2", + "version": "1.2.3", "require": { "php": ">=5.5.0", "google/protobuf": "^v3.1.0" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index caf940273e2..0fdb76072b3 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION='1.2.2' +VERSION='1.2.3' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index 7b7d95daacf..d3ac3aa3ef0 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION='1.2.2' +VERSION='1.2.3' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index dffabad634f..416910c6ab9 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION='1.2.2' +VERSION='1.2.3' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index d31ddd3c221..71495a1075f 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION='1.2.2' +VERSION='1.2.3' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index cc25ca10a0e..51f9ccace9e 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -29,5 +29,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.2.2' + VERSION = '1.2.3' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index 7c7eada243d..dd07b264d4b 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -29,6 +29,6 @@ module GRPC module Tools - VERSION = '1.2.2' + VERSION = '1.2.3' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index a28f2448d4d..32fad56ca4d 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION='1.2.2' +VERSION='1.2.3' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 70c7f6d5ae8..4bb1414e868 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.2.2 +PROJECT_NUMBER = 1.2.3 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 34d6a59be20..db987191b60 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.2.2 +PROJECT_NUMBER = 1.2.3 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a From 848073f77d3750ee587bb07624a213d293c9fc48 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 7 Apr 2017 10:53:15 -0700 Subject: [PATCH 277/461] Clean up unused variables and funcs --- .../chttp2/transport/chttp2_transport.c | 8 ----- .../transport/chttp2/transport/frame_data.c | 33 ------------------- .../ext/transport/chttp2/transport/internal.h | 5 --- .../microbenchmarks/bm_chttp2_transport.cc | 3 +- 4 files changed, 1 insertion(+), 48 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 79ff5e6e728..209d76c2712 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -2624,8 +2624,6 @@ static grpc_error *deframe_unprocessed_incoming_frames( static void incoming_byte_stream_unref(grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs) { if (gpr_unref(&bs->refs)) { - grpc_slice_buffer_destroy_internal(exec_ctx, &bs->slices); - gpr_mu_destroy(&bs->slice_mu); gpr_free(bs); } } @@ -2844,11 +2842,9 @@ grpc_error *grpc_chttp2_incoming_byte_stream_finished( grpc_chttp2_stream *s = bs->stream; if (error == GRPC_ERROR_NONE) { - gpr_mu_lock(&bs->slice_mu); if (bs->remaining_bytes != 0) { error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message"); } - gpr_mu_unlock(&bs->slice_mu); } if (error != GRPC_ERROR_NONE && reset_on_error) { grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error)); @@ -2869,15 +2865,11 @@ grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( incoming_byte_stream->base.next = incoming_byte_stream_next; incoming_byte_stream->base.pull = incoming_byte_stream_pull; incoming_byte_stream->base.destroy = incoming_byte_stream_destroy; - gpr_mu_init(&incoming_byte_stream->slice_mu); gpr_ref_init(&incoming_byte_stream->refs, 2); - incoming_byte_stream->next_message = NULL; incoming_byte_stream->transport = t; incoming_byte_stream->stream = s; - grpc_slice_buffer_init(&incoming_byte_stream->slices); incoming_byte_stream->is_tail = 1; s->byte_stream_error = GRPC_ERROR_NONE; - incoming_byte_stream->push_closed = false; return incoming_byte_stream; } diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c index 8b42d05c726..af754e1a779 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -84,39 +84,6 @@ grpc_error *grpc_chttp2_data_parser_begin_frame(grpc_chttp2_data_parser *parser, return GRPC_ERROR_NONE; } -void grpc_chttp2_incoming_frame_queue_merge( - grpc_chttp2_incoming_frame_queue *head_dst, - grpc_chttp2_incoming_frame_queue *tail_src) { - if (tail_src->head == NULL) { - return; - } - - if (head_dst->head == NULL) { - *head_dst = *tail_src; - memset(tail_src, 0, sizeof(*tail_src)); - return; - } - - head_dst->tail->next_message = tail_src->head; - head_dst->tail = tail_src->tail; - memset(tail_src, 0, sizeof(*tail_src)); -} - -grpc_byte_stream *grpc_chttp2_incoming_frame_queue_pop( - grpc_chttp2_incoming_frame_queue *q) { - grpc_byte_stream *out; - if (q->head == NULL) { - return NULL; - } - out = &q->head->base; - if (q->head == q->tail) { - memset(q, 0, sizeof(*q)); - } else { - q->head = q->head->next_message; - } - return out; -} - void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer *inbuf, uint32_t write_bytes, int is_eof, grpc_transport_one_way_stats *stats, diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 467c9353dd9..773f541e97a 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -195,16 +195,11 @@ typedef struct grpc_chttp2_write_cb { struct grpc_chttp2_incoming_byte_stream { grpc_byte_stream base; gpr_refcount refs; - struct grpc_chttp2_incoming_byte_stream - *next_message; /* unused; should be removed */ - bool push_closed; /* protected by slice_mu */ grpc_chttp2_transport *transport; /* immutable */ grpc_chttp2_stream *stream; /* immutable */ bool is_tail; /* immutable */ - gpr_mu slice_mu; - grpc_slice_buffer slices; /* unused; should be removed */ uint32_t remaining_bytes; /* guaranteed one thread access */ struct { diff --git a/test/cpp/microbenchmarks/bm_chttp2_transport.cc b/test/cpp/microbenchmarks/bm_chttp2_transport.cc index 5456f69d505..8c5413b5fda 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_transport.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_transport.cc @@ -575,8 +575,7 @@ static void BM_TransportStreamRecv(benchmark::State &state) { GRPC_ERROR_NONE == grpc_byte_stream_pull(exec_ctx, recv_stream, &recv_slice) && (received += GRPC_SLICE_LENGTH(recv_slice), - grpc_slice_unref_internal(exec_ctx, recv_slice), - true)); + grpc_slice_unref_internal(exec_ctx, recv_slice), true)); }); drain_continue = MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) { From 185d4133405c620953b008299ea233d8df20071b Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Fri, 7 Apr 2017 11:36:05 -0700 Subject: [PATCH 278/461] Fix the max idle timer --- src/core/ext/filters/max_age/max_age_filter.c | 3 +- test/core/end2end/tests/max_connection_idle.c | 137 ++++++++++++++++++ 2 files changed, 139 insertions(+), 1 deletion(-) diff --git a/src/core/ext/filters/max_age/max_age_filter.c b/src/core/ext/filters/max_age/max_age_filter.c index a045f0a421a..b9fde362860 100644 --- a/src/core/ext/filters/max_age/max_age_filter.c +++ b/src/core/ext/filters/max_age/max_age_filter.c @@ -167,8 +167,9 @@ static void start_max_age_grace_timer_after_goaway_op(grpc_exec_ctx* exec_ctx, static void close_max_idle_channel(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { channel_data* chand = arg; - gpr_atm_no_barrier_fetch_add(&chand->call_count, 1); if (error == GRPC_ERROR_NONE) { + /* Prevent the max idle timer from being set again */ + gpr_atm_no_barrier_fetch_add(&chand->call_count, 1); grpc_transport_op* op = grpc_make_transport_op(NULL); op->goaway_error = grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING("max_idle"), diff --git a/test/core/end2end/tests/max_connection_idle.c b/test/core/end2end/tests/max_connection_idle.c index c0984e4d14e..98bc08c6d5a 100644 --- a/test/core/end2end/tests/max_connection_idle.c +++ b/test/core/end2end/tests/max_connection_idle.c @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -48,6 +49,138 @@ static void *tag(intptr_t t) { return (void *)t; } +static void drain_cq(grpc_completion_queue *cq) { + grpc_event ev; + do { + ev = grpc_completion_queue_next(cq, grpc_timeout_seconds_to_deadline(5), + NULL); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); +} + +static void simple_request_body(grpc_end2end_test_config config, + grpc_end2end_test_fixture *f) { + grpc_call *c; + grpc_call *s; + cq_verifier *cqv = cq_verifier_create(f->cq); + grpc_op ops[6]; + grpc_op *op; + grpc_metadata_array initial_metadata_recv; + grpc_metadata_array trailing_metadata_recv; + grpc_metadata_array request_metadata_recv; + grpc_call_details call_details; + grpc_status_code status; + grpc_call_error error; + grpc_slice details; + int was_cancelled = 2; + char *peer; + + gpr_timespec deadline = grpc_timeout_seconds_to_deadline(5); + c = grpc_channel_create_call( + f->client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq, + grpc_slice_from_static_string("/foo"), + get_host_override_slice("foo.test.google.fr:1234", config), deadline, + NULL); + GPR_ASSERT(c); + + peer = grpc_call_get_peer(c); + GPR_ASSERT(peer != NULL); + gpr_log(GPR_DEBUG, "client_peer_before_call=%s", peer); + gpr_free(peer); + + grpc_metadata_array_init(&initial_metadata_recv); + grpc_metadata_array_init(&trailing_metadata_recv); + grpc_metadata_array_init(&request_metadata_recv); + grpc_call_details_init(&call_details); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_INITIAL_METADATA; + op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; + op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; + op->data.recv_status_on_client.status = &status; + op->data.recv_status_on_client.status_details = &details; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + error = + grpc_server_request_call(f->server, &s, &call_details, + &request_metadata_recv, f->cq, f->cq, tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); + CQ_EXPECT_COMPLETION(cqv, tag(101), 1); + cq_verify(cqv); + + peer = grpc_call_get_peer(s); + GPR_ASSERT(peer != NULL); + gpr_log(GPR_DEBUG, "server_peer=%s", peer); + gpr_free(peer); + peer = grpc_call_get_peer(c); + GPR_ASSERT(peer != NULL); + gpr_log(GPR_DEBUG, "client_peer=%s", peer); + gpr_free(peer); + + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; + op->data.send_status_from_server.trailing_metadata_count = 0; + op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; + grpc_slice status_details = grpc_slice_from_static_string("xyz"); + op->data.send_status_from_server.status_details = &status_details; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; + op->data.recv_close_on_server.cancelled = &was_cancelled; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + CQ_EXPECT_COMPLETION(cqv, tag(102), 1); + CQ_EXPECT_COMPLETION(cqv, tag(1), 1); + cq_verify(cqv); + + GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); + GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz")); + GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.method, "/foo")); + validate_host_override_string("foo.test.google.fr:1234", call_details.host, + config); + GPR_ASSERT(0 == call_details.flags); + GPR_ASSERT(was_cancelled == 1); + + grpc_slice_unref(details); + grpc_metadata_array_destroy(&initial_metadata_recv); + grpc_metadata_array_destroy(&trailing_metadata_recv); + grpc_metadata_array_destroy(&request_metadata_recv); + grpc_call_details_destroy(&call_details); + + grpc_call_destroy(c); + grpc_call_destroy(s); + + cq_verifier_destroy(cqv); +} + static void test_max_connection_idle(grpc_end2end_test_config config) { grpc_end2end_test_fixture f = config.create_fixture(NULL, NULL); grpc_connectivity_state state = GRPC_CHANNEL_IDLE; @@ -86,6 +219,9 @@ static void test_max_connection_idle(grpc_end2end_test_config config) { state == GRPC_CHANNEL_TRANSIENT_FAILURE); } + /* Use a simple request to cancel and reset the max idle timer */ + simple_request_body(config, &f); + /* wait for the channel to reach its maximum idle time */ grpc_channel_watch_connectivity_state( f.client, GRPC_CHANNEL_READY, @@ -104,6 +240,7 @@ static void test_max_connection_idle(grpc_end2end_test_config config) { grpc_server_destroy(f.server); grpc_channel_destroy(f.client); grpc_completion_queue_shutdown(f.cq); + drain_cq(f.cq); grpc_completion_queue_destroy(f.cq); config.tear_down_data(&f); From dc0b8a60d3af630518ed1a27699430a2e9364a70 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Fri, 7 Apr 2017 13:55:46 -0700 Subject: [PATCH 279/461] change cq_create to cq_create_for_next --- test/cpp/microbenchmarks/bm_cq_multiple_threads.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc index 967c226ac73..33b77368ad2 100644 --- a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc +++ b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc @@ -106,7 +106,7 @@ static void setup() { init_engine_vtable(); grpc_set_event_engine_test_only(&g_vtable); - g_cq = grpc_completion_queue_create(NULL); + g_cq = grpc_completion_queue_create_for_next(NULL); } static void BM_Cq_Throughput(benchmark::State& state) { From f4c8adddede470207fa46296d921592eda679cb1 Mon Sep 17 00:00:00 2001 From: yang-g Date: Fri, 7 Apr 2017 14:17:41 -0700 Subject: [PATCH 280/461] support C++ error_details --- include/grpc++/impl/codegen/call.h | 55 +++++++++++++++------- include/grpc++/impl/codegen/status.h | 22 ++++++--- src/proto/grpc/testing/echo_messages.proto | 9 ++++ test/cpp/end2end/end2end_test.cc | 33 +++++++++++++ test/cpp/end2end/test_service_impl.cc | 5 ++ 5 files changed, 100 insertions(+), 24 deletions(-) diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h index be6857c4829..dd63c21ff17 100644 --- a/include/grpc++/impl/codegen/call.h +++ b/include/grpc++/impl/codegen/call.h @@ -63,21 +63,31 @@ class CallHook; class CompletionQueue; extern CoreCodegenInterface* g_core_codegen_interface; +const char kBinaryErrorDetailsKey[] = "grpc-status-details-bin"; + // TODO(yangg) if the map is changed before we send, the pointers will be a // mess. Make sure it does not happen. inline grpc_metadata* FillMetadataArray( - const std::multimap& metadata) { - if (metadata.empty()) { + const std::multimap& metadata, + size_t* metadata_count, const grpc::string& optional_error_details) { + *metadata_count = metadata.size() + (optional_error_details.empty() ? 0 : 1); + if (*metadata_count == 0) { return nullptr; } grpc_metadata* metadata_array = (grpc_metadata*)(g_core_codegen_interface->gpr_malloc( - metadata.size() * sizeof(grpc_metadata))); + (*metadata_count) * sizeof(grpc_metadata))); size_t i = 0; for (auto iter = metadata.cbegin(); iter != metadata.cend(); ++iter, ++i) { metadata_array[i].key = SliceReferencingString(iter->first); metadata_array[i].value = SliceReferencingString(iter->second); } + if (!optional_error_details.empty()) { + metadata_array[i].key = + g_core_codegen_interface->grpc_slice_from_static_buffer( + kBinaryErrorDetailsKey, sizeof(kBinaryErrorDetailsKey) - 1); + metadata_array[i].value = SliceReferencingString(optional_error_details); + } return metadata_array; } @@ -216,8 +226,8 @@ class CallOpSendInitialMetadata { maybe_compression_level_.is_set = false; send_ = true; flags_ = flags; - initial_metadata_count_ = metadata.size(); - initial_metadata_ = FillMetadataArray(metadata); + initial_metadata_ = + FillMetadataArray(metadata, &initial_metadata_count_, ""); } void set_compression_level(grpc_compression_level level) { @@ -454,11 +464,12 @@ class CallOpServerSendStatus { void ServerSendStatus( const std::multimap& trailing_metadata, const Status& status) { - trailing_metadata_count_ = trailing_metadata.size(); - trailing_metadata_ = FillMetadataArray(trailing_metadata); + send_error_details_ = status.error_details(); + trailing_metadata_ = FillMetadataArray( + trailing_metadata, &trailing_metadata_count_, send_error_details_); send_status_available_ = true; send_status_code_ = static_cast(GetCanonicalCode(status)); - send_status_details_ = status.error_message(); + send_error_message_ = status.error_message(); } protected: @@ -470,9 +481,9 @@ class CallOpServerSendStatus { trailing_metadata_count_; op->data.send_status_from_server.trailing_metadata = trailing_metadata_; op->data.send_status_from_server.status = send_status_code_; - status_details_slice_ = SliceReferencingString(send_status_details_); + error_message_slice_ = SliceReferencingString(send_error_message_); op->data.send_status_from_server.status_details = - send_status_details_.empty() ? nullptr : &status_details_slice_; + send_error_message_.empty() ? nullptr : &error_message_slice_; op->flags = 0; op->reserved = NULL; } @@ -486,10 +497,11 @@ class CallOpServerSendStatus { private: bool send_status_available_; grpc_status_code send_status_code_; - grpc::string send_status_details_; + grpc::string send_error_details_; + grpc::string send_error_message_; size_t trailing_metadata_count_; grpc_metadata* trailing_metadata_; - grpc_slice status_details_slice_; + grpc_slice error_message_slice_; }; class CallOpRecvInitialMetadata { @@ -528,7 +540,7 @@ class CallOpClientRecvStatus { void ClientRecvStatus(ClientContext* context, Status* status) { metadata_map_ = &context->trailing_metadata_; recv_status_ = status; - status_details_ = g_core_codegen_interface->grpc_empty_slice(); + error_message_ = g_core_codegen_interface->grpc_empty_slice(); } protected: @@ -538,7 +550,7 @@ class CallOpClientRecvStatus { op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = metadata_map_->arr(); op->data.recv_status_on_client.status = &status_code_; - op->data.recv_status_on_client.status_details = &status_details_; + op->data.recv_status_on_client.status_details = &error_message_; op->flags = 0; op->reserved = NULL; } @@ -546,10 +558,17 @@ class CallOpClientRecvStatus { void FinishOp(bool* status) { if (recv_status_ == nullptr) return; metadata_map_->FillMap(); + grpc::string binary_error_details; + auto iter = metadata_map_->map()->find(kBinaryErrorDetailsKey); + if (iter != metadata_map_->map()->end()) { + binary_error_details = + grpc::string(iter->second.begin(), iter->second.length()); + } *recv_status_ = Status(static_cast(status_code_), - grpc::string(GRPC_SLICE_START_PTR(status_details_), - GRPC_SLICE_END_PTR(status_details_))); - g_core_codegen_interface->grpc_slice_unref(status_details_); + grpc::string(GRPC_SLICE_START_PTR(error_message_), + GRPC_SLICE_END_PTR(error_message_)), + binary_error_details); + g_core_codegen_interface->grpc_slice_unref(error_message_); recv_status_ = nullptr; } @@ -557,7 +576,7 @@ class CallOpClientRecvStatus { MetadataMap* metadata_map_; Status* recv_status_; grpc_status_code status_code_; - grpc_slice status_details_; + grpc_slice error_message_; }; /// An abstract collection of CallOpSet's, to be used whenever diff --git a/include/grpc++/impl/codegen/status.h b/include/grpc++/impl/codegen/status.h index a509d311d42..5cce3c1672e 100644 --- a/include/grpc++/impl/codegen/status.h +++ b/include/grpc++/impl/codegen/status.h @@ -47,10 +47,16 @@ class Status { /// Construct an OK instance. Status() : code_(StatusCode::OK) {} - /// Construct an instance with associated \a code and \a details (also - // referred to as "error_message"). - Status(StatusCode code, const grpc::string& details) - : code_(code), details_(details) {} + /// Construct an instance with associated \a code and \a error_message + Status(StatusCode code, const grpc::string& error_message) + : code_(code), error_message_(error_message) {} + + /// Construct an instance with \a code, \a error_message and \a error_details + Status(StatusCode code, const grpc::string& error_message, + const grpc::string error_details) + : code_(code), + error_message_(error_message), + binary_error_details_(error_details) {} // Pre-defined special status objects. /// An OK pre-defined instance. @@ -61,14 +67,18 @@ class Status { /// Return the instance's error code. StatusCode error_code() const { return code_; } /// Return the instance's error message. - grpc::string error_message() const { return details_; } + grpc::string error_message() const { return error_message_; } + /// Return the (binary) error details. + // Usually it contains a serialized google.rpc.Status proto. + grpc::string error_details() const { return binary_error_details_; } /// Is the status OK? bool ok() const { return code_ == StatusCode::OK; } private: StatusCode code_; - grpc::string details_; + grpc::string error_message_; + grpc::string binary_error_details_; }; } // namespace grpc diff --git a/src/proto/grpc/testing/echo_messages.proto b/src/proto/grpc/testing/echo_messages.proto index efb6f4d4935..b82e80d8e34 100644 --- a/src/proto/grpc/testing/echo_messages.proto +++ b/src/proto/grpc/testing/echo_messages.proto @@ -38,6 +38,13 @@ message DebugInfo { string detail = 2; } +// Error status client expects to see. +message ErrorStatus { + int32 code = 1; + string error_message = 2; + string binary_error_details = 3; +} + message RequestParams { bool echo_deadline = 1; int32 client_cancel_after_us = 2; @@ -51,6 +58,8 @@ message RequestParams { string expected_transport_security_type = 10; DebugInfo debug_info = 11; bool server_die = 12; // Server should not see a request with this set. + string binary_error_details = 13; + ErrorStatus expected_error = 14; } message EchoRequest { diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index d3a83b188f9..df71777e4bd 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -1130,6 +1130,39 @@ TEST_P(End2endTest, BinaryTrailerTest) { EXPECT_TRUE(returned_info.ParseFromString(ToString(iter->second))); } +TEST_P(End2endTest, ExpectErrorTest) { + ResetStub(); + + std::vector expected_status; + expected_status.emplace_back(); + expected_status.back().set_code(13); // INTERNAL + expected_status.back().set_error_message("text error message"); + expected_status.back().set_binary_error_details("text error details"); + expected_status.emplace_back(); + expected_status.back().set_code(13); // INTERNAL + expected_status.back().set_error_message("text error message"); + expected_status.back().set_binary_error_details( + "\x0\x1\x2\x3\x4\x5\x6\x8\x9\xA\xB"); + + for (auto iter = expected_status.begin(); iter != expected_status.end(); + ++iter) { + EchoRequest request; + EchoResponse response; + ClientContext context; + request.set_message("Hello"); + auto* error = request.mutable_param()->mutable_expected_error(); + error->set_code(iter->code()); + error->set_error_message(iter->error_message()); + error->set_binary_error_details(iter->binary_error_details()); + + Status s = stub_->Echo(&context, request, &response); + EXPECT_FALSE(s.ok()); + EXPECT_EQ(iter->code(), s.error_code()); + EXPECT_EQ(iter->error_message(), s.error_message()); + EXPECT_EQ(iter->binary_error_details(), s.error_details()); + } +} + ////////////////////////////////////////////////////////////////////////// // Test with and without a proxy. class ProxyEnd2endTest : public End2endTest { diff --git a/test/cpp/end2end/test_service_impl.cc b/test/cpp/end2end/test_service_impl.cc index 11729c425cd..b473dd1f52e 100644 --- a/test/cpp/end2end/test_service_impl.cc +++ b/test/cpp/end2end/test_service_impl.cc @@ -92,6 +92,11 @@ Status TestServiceImpl::Echo(ServerContext* context, const EchoRequest* request, gpr_log(GPR_ERROR, "The request should not reach application handler."); GPR_ASSERT(0); } + if (request->has_param() && request->param().has_expected_error()) { + const auto& error = request->param().expected_error(); + return Status(static_cast(error.code()), error.error_message(), + error.binary_error_details()); + } int server_try_cancel = GetIntValueFromMetadata( kServerTryCancelRequest, context->client_metadata(), DO_NOT_CANCEL); if (server_try_cancel > DO_NOT_CANCEL) { From 93b60e05a0a6d3eed569d0e2619aee8eae854c83 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Fri, 7 Apr 2017 18:50:32 -0700 Subject: [PATCH 281/461] Fix asan bug --- .../microbenchmarks/bm_cq_multiple_threads.cc | 38 ++++++++++++++----- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc index 967c226ac73..eccbd84d32b 100644 --- a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc +++ b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc @@ -51,11 +51,10 @@ struct grpc_pollset { namespace grpc { namespace testing { -static void* make_tag(int i) { return (void*)(intptr_t)i; } +static void* g_tag = (void*)(intptr_t)10; // Some random number static grpc_completion_queue* g_cq; static grpc_event_engine_vtable g_vtable; -static __thread int g_thread_idx; static __thread grpc_cq_completion g_cq_completion; static void pollset_shutdown(grpc_exec_ctx* exec_ctx, grpc_pollset* ps, @@ -83,8 +82,8 @@ static grpc_error* pollset_work(grpc_exec_ctx* exec_ctx, grpc_pollset* ps, grpc_pollset_worker** worker, gpr_timespec now, gpr_timespec deadline) { gpr_mu_unlock(&ps->mu); - grpc_cq_end_op(exec_ctx, g_cq, make_tag(g_thread_idx), GRPC_ERROR_NONE, - cq_done_cb, NULL, &g_cq_completion); + grpc_cq_end_op(exec_ctx, g_cq, g_tag, GRPC_ERROR_NONE, cq_done_cb, NULL, + &g_cq_completion); grpc_exec_ctx_flush(exec_ctx); gpr_mu_lock(&ps->mu); return GRPC_ERROR_NONE; @@ -109,26 +108,45 @@ static void setup() { g_cq = grpc_completion_queue_create(NULL); } +static void teardown() { + grpc_completion_queue_shutdown(g_cq); + grpc_completion_queue_destroy(g_cq); +} + +/* A few notes about Multi-theaded benchmarks: + + Setup: + The benchmark framework ensures that none of the threads proceed beyond the + state.KeepRunning() call unless all the threads have called state.keepRunning + atleast once. So it is safe to do the initialization in one of the threads + before state.KeepRunning() is called. + + Teardown: + The benchmark framework also ensures that no thread is running the benchmark + code (i.e the code between two successive calls of state.KeepRunning()) if + state.KeepRunning() returns false. So it is safe to do the teardown in one + of the threads after state.keepRunning() returns false. +*/ static void BM_Cq_Throughput(benchmark::State& state) { TrackCounters track_counters; - gpr_timespec deadline = gpr_inf_past(GPR_CLOCK_MONOTONIC); + gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); if (state.thread_index == 0) { setup(); } while (state.KeepRunning()) { - g_thread_idx = state.thread_index; - void* dummy_tag = make_tag(g_thread_idx); - grpc_cq_begin_op(g_cq, dummy_tag); + grpc_cq_begin_op(g_cq, g_tag); + + /* Note that the tag dequeued by the following might have been enqueued + by another thread. */ grpc_completion_queue_next(g_cq, deadline, NULL); } state.SetItemsProcessed(state.iterations()); if (state.thread_index == 0) { - grpc_completion_queue_shutdown(g_cq); - grpc_completion_queue_destroy(g_cq); + teardown(); } track_counters.Finish(state); From 2018a4060d7f4337eaeec84fa4701335ee87ceb8 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Thu, 6 Apr 2017 15:56:29 -0700 Subject: [PATCH 282/461] create a grpc client qps test logging reporter --- Makefile | 4 +-- src/proto/grpc/testing/BUILD | 6 ++++- src/proto/grpc/testing/services.proto | 6 +++++ test/cpp/qps/benchmark_config.cc | 15 ++++++++++++ test/cpp/qps/report.cc | 35 +++++++++++++++++++++++++++ test/cpp/qps/report.h | 18 ++++++++++++++ 6 files changed, 81 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 5ad05570f93..16834ebaf3e 100644 --- a/Makefile +++ b/Makefile @@ -2383,12 +2383,12 @@ ifeq ($(NO_PROTOC),true) $(GENDIR)/src/proto/grpc/testing/services.pb.cc: protoc_dep_error $(GENDIR)/src/proto/grpc/testing/services.grpc.pb.cc: protoc_dep_error else -$(GENDIR)/src/proto/grpc/testing/services.pb.cc: src/proto/grpc/testing/services.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/control.pb.cc +$(GENDIR)/src/proto/grpc/testing/services.pb.cc: src/proto/grpc/testing/services.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/control.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.pb.cc $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --cpp_out=$(GENDIR) $< -$(GENDIR)/src/proto/grpc/testing/services.grpc.pb.cc: src/proto/grpc/testing/services.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/control.pb.cc $(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc +$(GENDIR)/src/proto/grpc/testing/services.grpc.pb.cc: src/proto/grpc/testing/services.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(GENDIR)/src/proto/grpc/testing/messages.pb.cc $(GENDIR)/src/proto/grpc/testing/messages.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/control.pb.cc $(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.pb.cc $(GENDIR)/src/proto/grpc/testing/stats.grpc.pb.cc $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" $(Q) mkdir -p `dirname $@` $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $< diff --git a/src/proto/grpc/testing/BUILD b/src/proto/grpc/testing/BUILD index 23a16a7cfc3..6f3422e4d16 100644 --- a/src/proto/grpc/testing/BUILD +++ b/src/proto/grpc/testing/BUILD @@ -83,7 +83,11 @@ grpc_proto_library( grpc_proto_library( name = "services_proto", srcs = ["services.proto"], - deps = ["control_proto", "messages_proto"], + deps = [ + "control_proto", + "messages_proto", + "stats_proto", + ], ) grpc_proto_library( diff --git a/src/proto/grpc/testing/services.proto b/src/proto/grpc/testing/services.proto index f71dae34eed..969782d6561 100644 --- a/src/proto/grpc/testing/services.proto +++ b/src/proto/grpc/testing/services.proto @@ -33,6 +33,7 @@ syntax = "proto3"; import "src/proto/grpc/testing/messages.proto"; import "src/proto/grpc/testing/control.proto"; +import "src/proto/grpc/testing/stats.proto"; package grpc.testing; @@ -69,3 +70,8 @@ service WorkerService { // Quit this worker rpc QuitWorker(Void) returns (Void); } + +service ReportQpsScenarioService { + // Report results of a QPS test benchmark scenario. + rpc ReportScenario(ScenarioResult) returns (Void); +} diff --git a/test/cpp/qps/benchmark_config.cc b/test/cpp/qps/benchmark_config.cc index 98b8d0ba379..d33f3e9ae10 100644 --- a/test/cpp/qps/benchmark_config.cc +++ b/test/cpp/qps/benchmark_config.cc @@ -33,6 +33,9 @@ #include "test/cpp/qps/benchmark_config.h" #include +#include +#include +#include DEFINE_bool(enable_log_reporter, true, "Enable reporting of benchmark results through GprLog"); @@ -51,6 +54,11 @@ DEFINE_string(server_address, "localhost:50052", DEFINE_string(tag, "", "Optional tag for the test"); +DEFINE_string(rpc_reporter_server_address, "", + "Server address for rpc reporter to send results to"); + +DEFINE_bool(enable_rpc_reporter, false, "Enable use of RPC reporter"); + // In some distros, gflags is in the namespace google, and in some others, // in gflags. This hack is enabling us to find both. namespace google {} @@ -75,6 +83,13 @@ static std::shared_ptr InitBenchmarkReporters() { composite_reporter->add(std::unique_ptr( new JsonReporter("JsonReporter", FLAGS_scenario_result_file))); } + if (FLAGS_enable_rpc_reporter) { + GPR_ASSERT(!FLAGS_rpc_reporter_server_address.empty()); + composite_reporter->add(std::unique_ptr(new RpcReporter( + "RpcReporter", + grpc::CreateChannel(FLAGS_rpc_reporter_server_address, + grpc::InsecureChannelCredentials())))); + } return std::shared_ptr(composite_reporter); } diff --git a/test/cpp/qps/report.cc b/test/cpp/qps/report.cc index 7f848164219..a9130bf5d42 100644 --- a/test/cpp/qps/report.cc +++ b/test/cpp/qps/report.cc @@ -40,6 +40,9 @@ #include "test/cpp/qps/parse_json.h" #include "test/cpp/qps/stats.h" +#include +#include "src/proto/grpc/testing/services.grpc.pb.h" + namespace grpc { namespace testing { @@ -142,5 +145,37 @@ void JsonReporter::ReportCpuUsage(const ScenarioResult& result) { // NOP - all reporting is handled by ReportQPS. } +void RpcReporter::ReportQPS(const ScenarioResult& result) { + grpc::ClientContext context; + grpc::Status status; + Void dummy; + + gpr_log(GPR_INFO, "RPC reporter sending scenario result to server"); + status = stub_->ReportScenario(&context, result, &dummy); + + if (status.ok()) { + gpr_log(GPR_INFO, "RpcReporter report RPC success!"); + } else { + gpr_log(GPR_ERROR, "RpcReporter report RPC: code: %d. message: %s", + status.error_code(), status.error_message().c_str()); + } +} + +void RpcReporter::ReportQPSPerCore(const ScenarioResult& result) { + // NOP - all reporting is handled by ReportQPS. +} + +void RpcReporter::ReportLatency(const ScenarioResult& result) { + // NOP - all reporting is handled by ReportQPS. +} + +void RpcReporter::ReportTimes(const ScenarioResult& result) { + // NOP - all reporting is handled by ReportQPS. +} + +void RpcReporter::ReportCpuUsage(const ScenarioResult& result) { + // NOP - all reporting is handled by ReportQPS. +} + } // namespace testing } // namespace grpc diff --git a/test/cpp/qps/report.h b/test/cpp/qps/report.h index faf87ff060f..1749be98c6f 100644 --- a/test/cpp/qps/report.h +++ b/test/cpp/qps/report.h @@ -42,6 +42,9 @@ #include "test/cpp/qps/driver.h" +#include +#include "src/proto/grpc/testing/services.grpc.pb.h" + namespace grpc { namespace testing { @@ -124,6 +127,21 @@ class JsonReporter : public Reporter { const string report_file_; }; +class RpcReporter : public Reporter { + public: + RpcReporter(const string& name, std::shared_ptr channel) + : Reporter(name), stub_(ReportQpsScenarioService::NewStub(channel)) {} + + private: + void ReportQPS(const ScenarioResult& result) override; + void ReportQPSPerCore(const ScenarioResult& result) override; + void ReportLatency(const ScenarioResult& result) override; + void ReportTimes(const ScenarioResult& result) override; + void ReportCpuUsage(const ScenarioResult& result) override; + + std::unique_ptr stub_; +}; + } // namespace testing } // namespace grpc From 1f0c8271146b7fae637aa59a2429af137013fb8b Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Sat, 8 Apr 2017 16:25:58 -0700 Subject: [PATCH 283/461] Fix asan and tsan bugs. Simplify the code --- .../microbenchmarks/bm_cq_multiple_threads.cc | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc index eccbd84d32b..86274632042 100644 --- a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc +++ b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc @@ -36,6 +36,8 @@ #include #include +#include +#include #include "test/cpp/microbenchmarks/helpers.h" extern "C" { @@ -55,8 +57,6 @@ static void* g_tag = (void*)(intptr_t)10; // Some random number static grpc_completion_queue* g_cq; static grpc_event_engine_vtable g_vtable; -static __thread grpc_cq_completion g_cq_completion; - static void pollset_shutdown(grpc_exec_ctx* exec_ctx, grpc_pollset* ps, grpc_closure* closure) { grpc_closure_sched(exec_ctx, closure, GRPC_ERROR_NONE); @@ -75,15 +75,18 @@ static grpc_error* pollset_kick(grpc_pollset* p, grpc_pollset_worker* worker) { /* Callback when the tag is dequeued from the completion queue. Does nothing */ static void cq_done_cb(grpc_exec_ctx* exec_ctx, void* done_arg, - grpc_cq_completion* cq_completion) {} + grpc_cq_completion* cq_completion) { + gpr_free(cq_completion); +} /* Queues a completion tag. ZERO polling overhead */ static grpc_error* pollset_work(grpc_exec_ctx* exec_ctx, grpc_pollset* ps, grpc_pollset_worker** worker, gpr_timespec now, gpr_timespec deadline) { gpr_mu_unlock(&ps->mu); + grpc_cq_begin_op(g_cq, g_tag); grpc_cq_end_op(exec_ctx, g_cq, g_tag, GRPC_ERROR_NONE, cq_done_cb, NULL, - &g_cq_completion); + (grpc_cq_completion*)gpr_malloc(sizeof(grpc_cq_completion))); grpc_exec_ctx_flush(exec_ctx); gpr_mu_lock(&ps->mu); return GRPC_ERROR_NONE; @@ -113,7 +116,7 @@ static void teardown() { grpc_completion_queue_destroy(g_cq); } -/* A few notes about Multi-theaded benchmarks: +/* A few notes about Multi-threaded benchmarks: Setup: The benchmark framework ensures that none of the threads proceed beyond the @@ -136,11 +139,8 @@ static void BM_Cq_Throughput(benchmark::State& state) { } while (state.KeepRunning()) { - grpc_cq_begin_op(g_cq, g_tag); - - /* Note that the tag dequeued by the following might have been enqueued - by another thread. */ - grpc_completion_queue_next(g_cq, deadline, NULL); + GPR_ASSERT(grpc_completion_queue_next(g_cq, deadline, NULL).type == + GRPC_OP_COMPLETE); } state.SetItemsProcessed(state.iterations()); From 935d02ebd43abafb844942d5b89c3237642ed27b Mon Sep 17 00:00:00 2001 From: Julien Boeuf Date: Sun, 9 Apr 2017 00:07:09 -0700 Subject: [PATCH 284/461] Cleanup of tsi ssl handshaker factories. There is no reason why the client and server factories should be implementations from the same base. Doing the cleanup now so that implementation of the #10528 feature will be less noisy. Also, re-added tsi to clang-format which was dropped when moved from src/core/lib to src/core. --- .../lib/http/httpcli_security_connector.c | 6 +- .../security/transport/security_connector.c | 49 ++++---- src/core/tsi/ssl_transport_security.c | 113 ++++++------------ src/core/tsi/ssl_transport_security.h | 57 ++++++--- .../clang_format_all_the_things.sh | 2 +- 5 files changed, 104 insertions(+), 123 deletions(-) diff --git a/src/core/lib/http/httpcli_security_connector.c b/src/core/lib/http/httpcli_security_connector.c index fc338342e48..9eab1360a4a 100644 --- a/src/core/lib/http/httpcli_security_connector.c +++ b/src/core/lib/http/httpcli_security_connector.c @@ -47,7 +47,7 @@ typedef struct { grpc_channel_security_connector base; - tsi_ssl_handshaker_factory *handshaker_factory; + tsi_ssl_client_handshaker_factory *handshaker_factory; char *secure_peer_name; } grpc_httpcli_ssl_channel_security_connector; @@ -56,7 +56,7 @@ static void httpcli_ssl_destroy(grpc_exec_ctx *exec_ctx, grpc_httpcli_ssl_channel_security_connector *c = (grpc_httpcli_ssl_channel_security_connector *)sc; if (c->handshaker_factory != NULL) { - tsi_ssl_handshaker_factory_destroy(c->handshaker_factory); + tsi_ssl_client_handshaker_factory_destroy(c->handshaker_factory); } if (c->secure_peer_name != NULL) gpr_free(c->secure_peer_name); gpr_free(sc); @@ -69,7 +69,7 @@ static void httpcli_ssl_add_handshakers(grpc_exec_ctx *exec_ctx, (grpc_httpcli_ssl_channel_security_connector *)sc; tsi_handshaker *handshaker = NULL; if (c->handshaker_factory != NULL) { - tsi_result result = tsi_ssl_handshaker_factory_create_handshaker( + tsi_result result = tsi_ssl_client_handshaker_factory_create_handshaker( c->handshaker_factory, c->secure_peer_name, &handshaker); if (result != TSI_OK) { gpr_log(GPR_ERROR, "Handshaker creation failed with error %s.", diff --git a/src/core/lib/security/transport/security_connector.c b/src/core/lib/security/transport/security_connector.c index 2b517061611..dbe3263f92a 100644 --- a/src/core/lib/security/transport/security_connector.c +++ b/src/core/lib/security/transport/security_connector.c @@ -448,14 +448,14 @@ grpc_server_security_connector *grpc_fake_server_security_connector_create( typedef struct { grpc_channel_security_connector base; - tsi_ssl_handshaker_factory *handshaker_factory; + tsi_ssl_client_handshaker_factory *handshaker_factory; char *target_name; char *overridden_target_name; } grpc_ssl_channel_security_connector; typedef struct { grpc_server_security_connector base; - tsi_ssl_handshaker_factory *handshaker_factory; + tsi_ssl_server_handshaker_factory *handshaker_factory; } grpc_ssl_server_security_connector; static void ssl_channel_destroy(grpc_exec_ctx *exec_ctx, @@ -464,7 +464,7 @@ static void ssl_channel_destroy(grpc_exec_ctx *exec_ctx, (grpc_ssl_channel_security_connector *)sc; grpc_call_credentials_unref(exec_ctx, c->base.request_metadata_creds); if (c->handshaker_factory != NULL) { - tsi_ssl_handshaker_factory_destroy(c->handshaker_factory); + tsi_ssl_client_handshaker_factory_destroy(c->handshaker_factory); } if (c->target_name != NULL) gpr_free(c->target_name); if (c->overridden_target_name != NULL) gpr_free(c->overridden_target_name); @@ -476,26 +476,11 @@ static void ssl_server_destroy(grpc_exec_ctx *exec_ctx, grpc_ssl_server_security_connector *c = (grpc_ssl_server_security_connector *)sc; if (c->handshaker_factory != NULL) { - tsi_ssl_handshaker_factory_destroy(c->handshaker_factory); + tsi_ssl_server_handshaker_factory_destroy(c->handshaker_factory); } gpr_free(sc); } -static grpc_security_status ssl_create_handshaker( - tsi_ssl_handshaker_factory *handshaker_factory, bool is_client, - const char *peer_name, tsi_handshaker **handshaker) { - tsi_result result = TSI_OK; - if (handshaker_factory == NULL) return GRPC_SECURITY_ERROR; - result = tsi_ssl_handshaker_factory_create_handshaker( - handshaker_factory, is_client ? peer_name : NULL, handshaker); - if (result != TSI_OK) { - gpr_log(GPR_ERROR, "Handshaker creation failed with error %s.", - tsi_result_to_string(result)); - return GRPC_SECURITY_ERROR; - } - return GRPC_SECURITY_OK; -} - static void ssl_channel_add_handshakers(grpc_exec_ctx *exec_ctx, grpc_channel_security_connector *sc, grpc_handshake_manager *handshake_mgr) { @@ -503,11 +488,17 @@ static void ssl_channel_add_handshakers(grpc_exec_ctx *exec_ctx, (grpc_ssl_channel_security_connector *)sc; // Instantiate TSI handshaker. tsi_handshaker *tsi_hs = NULL; - ssl_create_handshaker(c->handshaker_factory, true /* is_client */, - c->overridden_target_name != NULL - ? c->overridden_target_name - : c->target_name, - &tsi_hs); + tsi_result result = tsi_ssl_client_handshaker_factory_create_handshaker( + c->handshaker_factory, + c->overridden_target_name != NULL ? c->overridden_target_name + : c->target_name, + &tsi_hs); + if (result != TSI_OK) { + gpr_log(GPR_ERROR, "Handshaker creation failed with error %s.", + tsi_result_to_string(result)); + return; + } + // Create handshakers. grpc_handshake_manager_add(handshake_mgr, grpc_security_handshaker_create( exec_ctx, tsi_hs, &sc->base)); @@ -520,8 +511,14 @@ static void ssl_server_add_handshakers(grpc_exec_ctx *exec_ctx, (grpc_ssl_server_security_connector *)sc; // Instantiate TSI handshaker. tsi_handshaker *tsi_hs = NULL; - ssl_create_handshaker(c->handshaker_factory, false /* is_client */, - NULL /* peer_name */, &tsi_hs); + tsi_result result = tsi_ssl_server_handshaker_factory_create_handshaker( + c->handshaker_factory, &tsi_hs); + if (result != TSI_OK) { + gpr_log(GPR_ERROR, "Handshaker creation failed with error %s.", + tsi_result_to_string(result)); + return; + } + // Create handshakers. grpc_handshake_manager_add(handshake_mgr, grpc_security_handshaker_create( exec_ctx, tsi_hs, &sc->base)); diff --git a/src/core/tsi/ssl_transport_security.c b/src/core/tsi/ssl_transport_security.c index a0325cc1835..984f745b01d 100644 --- a/src/core/tsi/ssl_transport_security.c +++ b/src/core/tsi/ssl_transport_security.c @@ -81,23 +81,13 @@ /* --- Structure definitions. ---*/ -struct tsi_ssl_handshaker_factory { - tsi_result (*create_handshaker)(tsi_ssl_handshaker_factory *self, - const char *server_name_indication, - tsi_handshaker **handshaker); - void (*destroy)(tsi_ssl_handshaker_factory *self); -}; - -typedef struct { - tsi_ssl_handshaker_factory base; +struct tsi_ssl_client_handshaker_factory { SSL_CTX *ssl_context; unsigned char *alpn_protocol_list; size_t alpn_protocol_list_length; -} tsi_ssl_client_handshaker_factory; - -typedef struct { - tsi_ssl_handshaker_factory base; +}; +struct tsi_ssl_server_handshaker_factory { /* Several contexts to support SNI. The tsi_peer array contains the subject names of the server certificates associated with the contexts at the same index. */ @@ -106,7 +96,7 @@ typedef struct { size_t ssl_context_count; unsigned char *alpn_protocol_list; size_t alpn_protocol_list_length; -} tsi_ssl_server_handshaker_factory; +}; typedef struct { tsi_handshaker base; @@ -1053,18 +1043,6 @@ static const tsi_handshaker_vtable handshaker_vtable = { /* --- tsi_ssl_handshaker_factory common methods. --- */ -tsi_result tsi_ssl_handshaker_factory_create_handshaker( - tsi_ssl_handshaker_factory *self, const char *server_name_indication, - tsi_handshaker **handshaker) { - if (self == NULL || handshaker == NULL) return TSI_INVALID_ARGUMENT; - return self->create_handshaker(self, server_name_indication, handshaker); -} - -void tsi_ssl_handshaker_factory_destroy(tsi_ssl_handshaker_factory *self) { - if (self == NULL) return; - self->destroy(self); -} - static tsi_result create_tsi_ssl_handshaker(SSL_CTX *ctx, int is_client, const char *server_name_indication, tsi_handshaker **handshaker) { @@ -1152,24 +1130,20 @@ static int select_protocol_list(const unsigned char **out, return SSL_TLSEXT_ERR_NOACK; } -/* --- tsi_ssl__client_handshaker_factory methods implementation. --- */ +/* --- tsi_ssl_client_handshaker_factory methods implementation. --- */ -static tsi_result ssl_client_handshaker_factory_create_handshaker( - tsi_ssl_handshaker_factory *self, const char *server_name_indication, +tsi_result tsi_ssl_client_handshaker_factory_create_handshaker( + tsi_ssl_client_handshaker_factory *self, const char *server_name_indication, tsi_handshaker **handshaker) { - tsi_ssl_client_handshaker_factory *impl = - (tsi_ssl_client_handshaker_factory *)self; - return create_tsi_ssl_handshaker(impl->ssl_context, 1, server_name_indication, + return create_tsi_ssl_handshaker(self->ssl_context, 1, server_name_indication, handshaker); } -static void ssl_client_handshaker_factory_destroy( - tsi_ssl_handshaker_factory *self) { - tsi_ssl_client_handshaker_factory *impl = - (tsi_ssl_client_handshaker_factory *)self; - if (impl->ssl_context != NULL) SSL_CTX_free(impl->ssl_context); - if (impl->alpn_protocol_list != NULL) gpr_free(impl->alpn_protocol_list); - gpr_free(impl); +void tsi_ssl_client_handshaker_factory_destroy( + tsi_ssl_client_handshaker_factory *self) { + if (self->ssl_context != NULL) SSL_CTX_free(self->ssl_context); + if (self->alpn_protocol_list != NULL) gpr_free(self->alpn_protocol_list); + gpr_free(self); } static int client_handshaker_factory_npn_callback(SSL *ssl, unsigned char **out, @@ -1186,36 +1160,29 @@ static int client_handshaker_factory_npn_callback(SSL *ssl, unsigned char **out, /* --- tsi_ssl_server_handshaker_factory methods implementation. --- */ -static tsi_result ssl_server_handshaker_factory_create_handshaker( - tsi_ssl_handshaker_factory *self, const char *server_name_indication, - tsi_handshaker **handshaker) { - tsi_ssl_server_handshaker_factory *impl = - (tsi_ssl_server_handshaker_factory *)self; - if (impl->ssl_context_count == 0 || server_name_indication != NULL) { - return TSI_INVALID_ARGUMENT; - } +tsi_result tsi_ssl_server_handshaker_factory_create_handshaker( + tsi_ssl_server_handshaker_factory *self, tsi_handshaker **handshaker) { + if (self->ssl_context_count == 0) return TSI_INVALID_ARGUMENT; /* Create the handshaker with the first context. We will switch if needed because of SNI in ssl_server_handshaker_factory_servername_callback. */ - return create_tsi_ssl_handshaker(impl->ssl_contexts[0], 0, NULL, handshaker); + return create_tsi_ssl_handshaker(self->ssl_contexts[0], 0, NULL, handshaker); } -static void ssl_server_handshaker_factory_destroy( - tsi_ssl_handshaker_factory *self) { - tsi_ssl_server_handshaker_factory *impl = - (tsi_ssl_server_handshaker_factory *)self; +void tsi_ssl_server_handshaker_factory_destroy( + tsi_ssl_server_handshaker_factory *self) { size_t i; - for (i = 0; i < impl->ssl_context_count; i++) { - if (impl->ssl_contexts[i] != NULL) { - SSL_CTX_free(impl->ssl_contexts[i]); - tsi_peer_destruct(&impl->ssl_context_x509_subject_names[i]); + for (i = 0; i < self->ssl_context_count; i++) { + if (self->ssl_contexts[i] != NULL) { + SSL_CTX_free(self->ssl_contexts[i]); + tsi_peer_destruct(&self->ssl_context_x509_subject_names[i]); } } - if (impl->ssl_contexts != NULL) gpr_free(impl->ssl_contexts); - if (impl->ssl_context_x509_subject_names != NULL) { - gpr_free(impl->ssl_context_x509_subject_names); + if (self->ssl_contexts != NULL) gpr_free(self->ssl_contexts); + if (self->ssl_context_x509_subject_names != NULL) { + gpr_free(self->ssl_context_x509_subject_names); } - if (impl->alpn_protocol_list != NULL) gpr_free(impl->alpn_protocol_list); - gpr_free(impl); + if (self->alpn_protocol_list != NULL) gpr_free(self->alpn_protocol_list); + gpr_free(self); } static int does_entry_match_name(const char *entry, size_t entry_length, @@ -1317,7 +1284,7 @@ tsi_result tsi_create_ssl_client_handshaker_factory( const unsigned char *pem_root_certs, size_t pem_root_certs_size, const char *cipher_list, const unsigned char **alpn_protocols, const unsigned char *alpn_protocols_lengths, uint16_t num_alpn_protocols, - tsi_ssl_handshaker_factory **factory) { + tsi_ssl_client_handshaker_factory **factory) { SSL_CTX *ssl_context = NULL; tsi_ssl_client_handshaker_factory *impl = NULL; tsi_result result = TSI_OK; @@ -1373,16 +1340,13 @@ tsi_result tsi_create_ssl_client_handshaker_factory( } } while (0); if (result != TSI_OK) { - ssl_client_handshaker_factory_destroy(&impl->base); + tsi_ssl_client_handshaker_factory_destroy(impl); return result; } SSL_CTX_set_verify(ssl_context, SSL_VERIFY_PEER, NULL); /* TODO(jboeuf): Add revocation verification. */ - impl->base.create_handshaker = - ssl_client_handshaker_factory_create_handshaker; - impl->base.destroy = ssl_client_handshaker_factory_destroy; - *factory = &impl->base; + *factory = impl; return TSI_OK; } @@ -1394,7 +1358,7 @@ tsi_result tsi_create_ssl_server_handshaker_factory( size_t pem_client_root_certs_size, int force_client_auth, const char *cipher_list, const unsigned char **alpn_protocols, const unsigned char *alpn_protocols_lengths, uint16_t num_alpn_protocols, - tsi_ssl_handshaker_factory **factory) { + tsi_ssl_server_handshaker_factory **factory) { return tsi_create_ssl_server_handshaker_factory_ex( pem_private_keys, pem_private_keys_sizes, pem_cert_chains, pem_cert_chains_sizes, key_cert_pair_count, pem_client_root_certs, @@ -1414,7 +1378,7 @@ tsi_result tsi_create_ssl_server_handshaker_factory_ex( tsi_client_certificate_request_type client_certificate_request, const char *cipher_list, const unsigned char **alpn_protocols, const unsigned char *alpn_protocols_lengths, uint16_t num_alpn_protocols, - tsi_ssl_handshaker_factory **factory) { + tsi_ssl_server_handshaker_factory **factory) { tsi_ssl_server_handshaker_factory *impl = NULL; tsi_result result = TSI_OK; size_t i = 0; @@ -1429,15 +1393,12 @@ tsi_result tsi_create_ssl_server_handshaker_factory_ex( } impl = gpr_zalloc(sizeof(*impl)); - impl->base.create_handshaker = - ssl_server_handshaker_factory_create_handshaker; - impl->base.destroy = ssl_server_handshaker_factory_destroy; impl->ssl_contexts = gpr_zalloc(key_cert_pair_count * sizeof(SSL_CTX *)); impl->ssl_context_x509_subject_names = gpr_zalloc(key_cert_pair_count * sizeof(tsi_peer)); if (impl->ssl_contexts == NULL || impl->ssl_context_x509_subject_names == NULL) { - tsi_ssl_handshaker_factory_destroy(&impl->base); + tsi_ssl_server_handshaker_factory_destroy(impl); return TSI_OUT_OF_RESOURCES; } impl->ssl_context_count = key_cert_pair_count; @@ -1447,7 +1408,7 @@ tsi_result tsi_create_ssl_server_handshaker_factory_ex( alpn_protocols, alpn_protocols_lengths, num_alpn_protocols, &impl->alpn_protocol_list, &impl->alpn_protocol_list_length); if (result != TSI_OK) { - tsi_ssl_handshaker_factory_destroy(&impl->base); + tsi_ssl_server_handshaker_factory_destroy(impl); return result; } } @@ -1520,11 +1481,11 @@ tsi_result tsi_create_ssl_server_handshaker_factory_ex( } while (0); if (result != TSI_OK) { - tsi_ssl_handshaker_factory_destroy(&impl->base); + tsi_ssl_server_handshaker_factory_destroy(impl); return result; } } - *factory = &impl->base; + *factory = impl; return TSI_OK; } diff --git a/src/core/tsi/ssl_transport_security.h b/src/core/tsi/ssl_transport_security.h index 0a527e9021f..48dcaec1212 100644 --- a/src/core/tsi/ssl_transport_security.h +++ b/src/core/tsi/ssl_transport_security.h @@ -52,12 +52,13 @@ extern "C" { #define TSI_SSL_ALPN_SELECTED_PROTOCOL "ssl_alpn_selected_protocol" -/* --- tsi_ssl_handshaker_factory object --- +/* --- tsi_ssl_client_handshaker_factory object --- - This object creates tsi_handshaker objects implemented in terms of the - TLS 1.2 specificiation. */ + This object creates a client tsi_handshaker objects implemented in terms of + the TLS 1.2 specificiation. */ -typedef struct tsi_ssl_handshaker_factory tsi_ssl_handshaker_factory; +typedef struct tsi_ssl_client_handshaker_factory + tsi_ssl_client_handshaker_factory; /* Creates a client handshaker factory. - pem_private_key is the buffer containing the PEM encoding of the client's @@ -92,7 +93,33 @@ tsi_result tsi_create_ssl_client_handshaker_factory( const unsigned char *pem_root_certs, size_t pem_root_certs_size, const char *cipher_suites, const unsigned char **alpn_protocols, const unsigned char *alpn_protocols_lengths, uint16_t num_alpn_protocols, - tsi_ssl_handshaker_factory **factory); + tsi_ssl_client_handshaker_factory **factory); + +/* Creates a client handshaker. + - self is the factory from which the handshaker will be created. + - server_name_indication indicates the name of the server the client is + trying to connect to which will be relayed to the server using the SNI + extension. + - handshaker is the address of the handshaker pointer to be created. + + - This method returns TSI_OK on success or TSI_INVALID_PARAMETER in the case + where a parameter is invalid. */ +tsi_result tsi_ssl_client_handshaker_factory_create_handshaker( + tsi_ssl_client_handshaker_factory *self, const char *server_name_indication, + tsi_handshaker **handshaker); + +/* Destroys the handshaker factory. WARNING: it is unsafe to destroy a factory + while handshakers created with this factory are still in use. */ +void tsi_ssl_client_handshaker_factory_destroy( + tsi_ssl_client_handshaker_factory *self); + +/* --- tsi_ssl_server_handshaker_factory object --- + + This object creates a client tsi_handshaker objects implemented in terms of + the TLS 1.2 specificiation. */ + +typedef struct tsi_ssl_server_handshaker_factory + tsi_ssl_server_handshaker_factory; /* Creates a server handshaker factory. - version indicates which version of the specification to use. @@ -140,7 +167,7 @@ tsi_result tsi_create_ssl_server_handshaker_factory( size_t pem_client_root_certs_size, int force_client_auth, const char *cipher_suites, const unsigned char **alpn_protocols, const unsigned char *alpn_protocols_lengths, uint16_t num_alpn_protocols, - tsi_ssl_handshaker_factory **factory); + tsi_ssl_server_handshaker_factory **factory); /* Same as tsi_create_ssl_server_handshaker_factory method except uses tsi_client_certificate_request_type to support more ways to handle client @@ -157,25 +184,21 @@ tsi_result tsi_create_ssl_server_handshaker_factory_ex( tsi_client_certificate_request_type client_certificate_request, const char *cipher_suites, const unsigned char **alpn_protocols, const unsigned char *alpn_protocols_lengths, uint16_t num_alpn_protocols, - tsi_ssl_handshaker_factory **factory); + tsi_ssl_server_handshaker_factory **factory); -/* Creates a handshaker. +/* Creates a server handshaker. - self is the factory from which the handshaker will be created. - - server_name_indication indicates the name of the server the client is - trying to connect to which will be relayed to the server using the SNI - extension. - This parameter must be NULL for a server handshaker factory. - - handhshaker is the address of the handshaker pointer to be created. + - handshaker is the address of the handshaker pointer to be created. - This method returns TSI_OK on success or TSI_INVALID_PARAMETER in the case where a parameter is invalid. */ -tsi_result tsi_ssl_handshaker_factory_create_handshaker( - tsi_ssl_handshaker_factory *self, const char *server_name_indication, - tsi_handshaker **handshaker); +tsi_result tsi_ssl_server_handshaker_factory_create_handshaker( + tsi_ssl_server_handshaker_factory *self, tsi_handshaker **handshaker); /* Destroys the handshaker factory. WARNING: it is unsafe to destroy a factory while handshakers created with this factory are still in use. */ -void tsi_ssl_handshaker_factory_destroy(tsi_ssl_handshaker_factory *self); +void tsi_ssl_server_handshaker_factory_destroy( + tsi_ssl_server_handshaker_factory *self); /* Util that checks that an ssl peer matches a specific name. Still TODO(jboeuf): diff --git a/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh b/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh index c6e4aabfe63..02e811f664b 100755 --- a/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh +++ b/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh @@ -31,7 +31,7 @@ set -e # directories to run against -DIRS="src/core/lib src/core/ext src/cpp test/core test/cpp include src/compiler" +DIRS="src/core/lib src/core/tsi src/core/ext src/cpp test/core test/cpp include src/compiler" # file matching patterns to check GLOB="*.h *.c *.cc" From c702a7a85f9756e94c04e011c11d47a96733ac95 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sun, 9 Apr 2017 13:18:55 -0700 Subject: [PATCH 285/461] clang-format --- .../chttp2/transport/chttp2_transport.c | 26 ++++++++----------- .../cronet/transport/cronet_transport.c | 10 ++++--- src/core/lib/channel/compress_filter.c | 15 ++++++----- src/core/lib/channel/http_client_filter.c | 15 ++++++----- 4 files changed, 36 insertions(+), 30 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 209d76c2712..c78c8def69e 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -575,11 +575,10 @@ static void destroy_transport_locked(grpc_exec_ctx *exec_ctx, void *tp, static void destroy_transport(grpc_exec_ctx *exec_ctx, grpc_transport *gt) { grpc_chttp2_transport *t = (grpc_chttp2_transport *)gt; - grpc_closure_sched( - exec_ctx, - grpc_closure_create(destroy_transport_locked, t, - grpc_combiner_scheduler(t->combiner, false)), - GRPC_ERROR_NONE); + grpc_closure_sched(exec_ctx, grpc_closure_create( + destroy_transport_locked, t, + grpc_combiner_scheduler(t->combiner, false)), + GRPC_ERROR_NONE); } static void close_transport_locked(grpc_exec_ctx *exec_ctx, @@ -757,9 +756,8 @@ static void destroy_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, s->destroy_stream_arg = then_schedule_closure; grpc_closure_sched( - exec_ctx, - grpc_closure_init(&s->destroy_stream, destroy_stream_locked, s, - grpc_combiner_scheduler(t->combiner, false)), + exec_ctx, grpc_closure_init(&s->destroy_stream, destroy_stream_locked, s, + grpc_combiner_scheduler(t->combiner, false)), GRPC_ERROR_NONE); GPR_TIMER_END("destroy_stream", 0); } @@ -1618,10 +1616,9 @@ static void perform_transport_op(grpc_exec_ctx *exec_ctx, grpc_transport *gt, op->handler_private.extra_arg = gt; GRPC_CHTTP2_REF_TRANSPORT(t, "transport_op"); grpc_closure_sched( - exec_ctx, - grpc_closure_init(&op->handler_private.closure, - perform_transport_op_locked, op, - grpc_combiner_scheduler(t->combiner, false)), + exec_ctx, grpc_closure_init(&op->handler_private.closure, + perform_transport_op_locked, op, + grpc_combiner_scheduler(t->combiner, false)), GRPC_ERROR_NONE); } @@ -2377,9 +2374,8 @@ static void keepalive_watchdog_fired_locked(grpc_exec_ctx *exec_ctx, void *arg, if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) { if (error == GRPC_ERROR_NONE) { t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DYING; - close_transport_locked( - exec_ctx, t, - GRPC_ERROR_CREATE_FROM_STATIC_STRING("keepalive watchdog timeout")); + close_transport_locked(exec_ctx, t, GRPC_ERROR_CREATE_FROM_STATIC_STRING( + "keepalive watchdog timeout")); } } else { /* The watchdog timer should have been cancelled by diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c index 0b55a5a3bb7..7f09936e931 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.c +++ b/src/core/ext/transport/cronet/transport/cronet_transport.c @@ -973,13 +973,17 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, grpc_slice_buffer write_slice_buffer; grpc_slice slice; grpc_slice_buffer_init(&write_slice_buffer); - if (1 != grpc_byte_stream_next(exec_ctx, stream_op->payload->send_message.send_message, - stream_op->payload->send_message.send_message->length, NULL)) { + if (1 != grpc_byte_stream_next( + exec_ctx, stream_op->payload->send_message.send_message, + stream_op->payload->send_message.send_message->length, + NULL)) { /* Should never reach here */ GPR_ASSERT(false); } if (GRPC_ERROR_NONE != - grpc_byte_stream_pull(exec_ctx, stream_op->payload->send_message.send_message, &slice)) { + grpc_byte_stream_pull(exec_ctx, + stream_op->payload->send_message.send_message, + &slice)) { /* Should never reach here */ GPR_ASSERT(false); } diff --git a/src/core/lib/channel/compress_filter.c b/src/core/lib/channel/compress_filter.c index a945639faea..764524b24d1 100644 --- a/src/core/lib/channel/compress_filter.c +++ b/src/core/lib/channel/compress_filter.c @@ -221,9 +221,10 @@ static void finish_send_message(grpc_exec_ctx *exec_ctx, static void got_slice(grpc_exec_ctx *exec_ctx, void *elemp, grpc_error *error) { grpc_call_element *elem = elemp; call_data *calld = elem->call_data; - if (GRPC_ERROR_NONE != grpc_byte_stream_pull(exec_ctx, - calld->send_op->payload->send_message.send_message, - &calld->incoming_slice)) { + if (GRPC_ERROR_NONE != + grpc_byte_stream_pull(exec_ctx, + calld->send_op->payload->send_message.send_message, + &calld->incoming_slice)) { /* Should never reach here */ abort(); } @@ -238,9 +239,11 @@ static void got_slice(grpc_exec_ctx *exec_ctx, void *elemp, grpc_error *error) { static void continue_send_message(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) { call_data *calld = elem->call_data; - while (grpc_byte_stream_next(exec_ctx, calld->send_op->payload->send_message.send_message, - ~(size_t)0, &calld->got_slice)) { - grpc_byte_stream_pull(exec_ctx, calld->send_op->payload->send_message.send_message, + while (grpc_byte_stream_next( + exec_ctx, calld->send_op->payload->send_message.send_message, ~(size_t)0, + &calld->got_slice)) { + grpc_byte_stream_pull(exec_ctx, + calld->send_op->payload->send_message.send_message, &calld->incoming_slice); grpc_slice_buffer_add(&calld->slices, calld->incoming_slice); if (calld->send_length == calld->slices.length) { diff --git a/src/core/lib/channel/http_client_filter.c b/src/core/lib/channel/http_client_filter.c index 57bbb98139d..151fb9885de 100644 --- a/src/core/lib/channel/http_client_filter.c +++ b/src/core/lib/channel/http_client_filter.c @@ -219,9 +219,11 @@ static void continue_send_message(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) { call_data *calld = elem->call_data; uint8_t *wrptr = calld->payload_bytes; - while (grpc_byte_stream_next(exec_ctx, calld->send_op->payload->send_message.send_message, - ~(size_t)0, &calld->got_slice)) { - grpc_byte_stream_pull(exec_ctx, calld->send_op->payload->send_message.send_message, + while (grpc_byte_stream_next( + exec_ctx, calld->send_op->payload->send_message.send_message, ~(size_t)0, + &calld->got_slice)) { + grpc_byte_stream_pull(exec_ctx, + calld->send_op->payload->send_message.send_message, &calld->incoming_slice); memcpy(wrptr, GRPC_SLICE_START_PTR(calld->incoming_slice), GRPC_SLICE_LENGTH(calld->incoming_slice)); @@ -238,9 +240,10 @@ static void got_slice(grpc_exec_ctx *exec_ctx, void *elemp, grpc_error *error) { grpc_call_element *elem = elemp; call_data *calld = elem->call_data; calld->send_message_blocked = false; - if (GRPC_ERROR_NONE != grpc_byte_stream_pull(exec_ctx, - calld->send_op->payload->send_message.send_message, - &calld->incoming_slice)) { + if (GRPC_ERROR_NONE != + grpc_byte_stream_pull(exec_ctx, + calld->send_op->payload->send_message.send_message, + &calld->incoming_slice)) { /* Should never reach here */ abort(); } From da2f0cf89242d83a3f3c3207d3554888bfebc5d7 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sun, 9 Apr 2017 15:34:28 -0700 Subject: [PATCH 286/461] Restore Cronet test accidentally removed --- src/objective-c/tests/InteropTests.m | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/objective-c/tests/InteropTests.m b/src/objective-c/tests/InteropTests.m index 91053568690..69968dcb609 100644 --- a/src/objective-c/tests/InteropTests.m +++ b/src/objective-c/tests/InteropTests.m @@ -100,6 +100,15 @@ return 0; } ++ (void)setUp { +#ifdef GRPC_COMPILE_WITH_CRONET + // Cronet setup + [Cronet setHttp2Enabled:YES]; + [Cronet start]; + [GRPCCall useCronetWithEngine:[Cronet getGlobalEngine]]; +#endif +} + - (void)setUp { self.continueAfterFailure = NO; From 300be7ece2fc7a0c893bd3cf7b34a8558b34726e Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Sun, 9 Apr 2017 15:44:19 -0700 Subject: [PATCH 287/461] Fix the cronet_transport error --- src/core/ext/transport/cronet/transport/cronet_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c index 0b9189558f8..3ca6b2fdf69 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.c +++ b/src/core/ext/transport/cronet/transport/cronet_transport.c @@ -1124,7 +1124,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, if (stream_state->rs.compressed) { stream_state->rs.sbs.base.flags |= GRPC_WRITE_INTERNAL_COMPRESS; } - *((grpc_byte_buffer **)stream_op->recv_message) = + *((grpc_byte_buffer **)stream_op->payload->recv_message.recv_message) = (grpc_byte_buffer *)&stream_state->rs.sbs; grpc_closure_sched( exec_ctx, stream_op->payload->recv_message.recv_message_ready, From 7f0d198e037b58ce6bee3e0d9d48fba757785091 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 10 Apr 2017 10:40:44 +0200 Subject: [PATCH 288/461] avoid boxing of IntPtr --- .../Grpc.Core/Internal/CompletionRegistry.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/csharp/Grpc.Core/Internal/CompletionRegistry.cs b/src/csharp/Grpc.Core/Internal/CompletionRegistry.cs index 7e2f0e9c6c9..a4aa8d3ffe4 100644 --- a/src/csharp/Grpc.Core/Internal/CompletionRegistry.cs +++ b/src/csharp/Grpc.Core/Internal/CompletionRegistry.cs @@ -51,7 +51,7 @@ namespace Grpc.Core.Internal static readonly ILogger Logger = GrpcEnvironment.Logger.ForType(); readonly GrpcEnvironment environment; - readonly ConcurrentDictionary dict = new ConcurrentDictionary(); + readonly ConcurrentDictionary dict = new ConcurrentDictionary(new IntPtrComparer()); public CompletionRegistry(GrpcEnvironment environment) { @@ -121,5 +121,21 @@ namespace Grpc.Core.Internal } } } + + /// + /// IntPtr doesn't implement IEquatable{IntPtr} so we need to use custom comparer to avoid boxing. + /// + private class IntPtrComparer : IEqualityComparer + { + public bool Equals(IntPtr x, IntPtr y) + { + return x == y; + } + + public int GetHashCode(IntPtr obj) + { + return obj.GetHashCode(); + } + } } } From 9b3a6cc3d2fb1d24932d1507d7f278bac34deaba Mon Sep 17 00:00:00 2001 From: Rajendra Talekar Date: Mon, 10 Apr 2017 15:07:02 +0530 Subject: [PATCH 289/461] Fixing is_a check for Channel php ```is_a``` function expects fully qualified class name to validate. --- src/php/lib/Grpc/BaseStub.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/php/lib/Grpc/BaseStub.php b/src/php/lib/Grpc/BaseStub.php index ed504f85a86..24934491b43 100644 --- a/src/php/lib/Grpc/BaseStub.php +++ b/src/php/lib/Grpc/BaseStub.php @@ -87,7 +87,7 @@ class BaseStub 'ChannelCredentials::create methods'); } if ($channel) { - if (!is_a($channel, 'Channel')) { + if (!is_a($channel, 'Grpc\Channel')) { throw new \Exception('The channel argument is not a'. 'Channel object'); } From f3d86a1a3ccd615f2d767c7734ba6293e4a36f7c Mon Sep 17 00:00:00 2001 From: Julien Boeuf Date: Mon, 10 Apr 2017 09:55:44 -0700 Subject: [PATCH 290/461] Updating roots from Mozilla. --- etc/roots.pem | 184 ++++++++++---------------------------------------- 1 file changed, 34 insertions(+), 150 deletions(-) diff --git a/etc/roots.pem b/etc/roots.pem index 66605675ef0..b2096fbc4d3 100644 --- a/etc/roots.pem +++ b/etc/roots.pem @@ -1617,42 +1617,6 @@ wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHN pGxlaKFJdlxDydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey -----END CERTIFICATE----- -# Issuer: CN=WellsSecure Public Root Certificate Authority O=Wells Fargo WellsSecure OU=Wells Fargo Bank NA -# Subject: CN=WellsSecure Public Root Certificate Authority O=Wells Fargo WellsSecure OU=Wells Fargo Bank NA -# Label: "WellsSecure Public Root Certificate Authority" -# Serial: 1 -# MD5 Fingerprint: 15:ac:a5:c2:92:2d:79:bc:e8:7f:cb:67:ed:02:cf:36 -# SHA1 Fingerprint: e7:b4:f6:9d:61:ec:90:69:db:7e:90:a7:40:1a:3c:f4:7d:4f:e8:ee -# SHA256 Fingerprint: a7:12:72:ae:aa:a3:cf:e8:72:7f:7f:b3:9f:0f:b3:d1:e5:42:6e:90:60:b0:6e:e6:f1:3e:9a:3c:58:33:cd:43 ------BEGIN CERTIFICATE----- -MIIEvTCCA6WgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMCVVMx -IDAeBgNVBAoMF1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxs -cyBGYXJnbyBCYW5rIE5BMTYwNAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9v -dCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDcxMjEzMTcwNzU0WhcNMjIxMjE0 -MDAwNzU0WjCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoMF1dlbGxzIEZhcmdvIFdl -bGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYDVQQD -DC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkw -ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDub7S9eeKPCCGeOARBJe+r -WxxTkqxtnt3CxC5FlAM1iGd0V+PfjLindo8796jE2yljDpFoNoqXjopxaAkH5OjU -Dk/41itMpBb570OYj7OeUt9tkTmPOL13i0Nj67eT/DBMHAGTthP796EfvyXhdDcs -HqRePGj4S78NuR4uNuip5Kf4D8uCdXw1LSLWwr8L87T8bJVhHlfXBIEyg1J55oNj -z7fLY4sR4r1e6/aN7ZVyKLSsEmLpSjPmgzKuBXWVvYSV2ypcm44uDLiBK0HmOFaf -SZtsdvqKXfcBeYF8wYNABf5x/Qw/zE5gCQ5lRxAvAcAFP4/4s0HvWkJ+We/Slwxl -AgMBAAGjggE0MIIBMDAPBgNVHRMBAf8EBTADAQH/MDkGA1UdHwQyMDAwLqAsoCqG -KGh0dHA6Ly9jcmwucGtpLndlbGxzZmFyZ28uY29tL3dzcHJjYS5jcmwwDgYDVR0P -AQH/BAQDAgHGMB0GA1UdDgQWBBQmlRkQ2eihl5H/3BnZtQQ+0nMKajCBsgYDVR0j -BIGqMIGngBQmlRkQ2eihl5H/3BnZtQQ+0nMKaqGBi6SBiDCBhTELMAkGA1UEBhMC -VVMxIDAeBgNVBAoMF1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNX -ZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMg -Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHmCAQEwDQYJKoZIhvcNAQEFBQADggEB -ALkVsUSRzCPIK0134/iaeycNzXK7mQDKfGYZUMbVmO2rvwNa5U3lHshPcZeG1eMd -/ZDJPHV3V3p9+N701NX3leZ0bh08rnyd2wIDBSxxSyU+B+NemvVmFymIGjifz6pB -A4SXa5M4esowRBskRDPQ5NHcKDj0E0M1NSljqHyita04pO2t/caaH/+Xc/77szWn -k4bGdpEA5qxRFsQnMlzbc9qlk1eOPm01JghZ1edE13YgY+esE2fDbbFwRnzVlhE9 -iW9dqKHrjQrawx0zbKPqZxmamX9LPYNRKh3KL4YMon4QLSvUFpULB6ouFJJJtylv -2G0xffX8oRAHh84vWdw+WNs= ------END CERTIFICATE----- - # Issuer: CN=COMODO ECC Certification Authority O=COMODO CA Limited # Subject: CN=COMODO ECC Certification Authority O=COMODO CA Limited # Label: "COMODO ECC Certification Authority" @@ -1738,57 +1702,6 @@ Fj4A4xylNoEYokxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ /L7fCg0= -----END CERTIFICATE----- -# Issuer: CN=Microsec e-Szigno Root CA O=Microsec Ltd. OU=e-Szigno CA -# Subject: CN=Microsec e-Szigno Root CA O=Microsec Ltd. OU=e-Szigno CA -# Label: "Microsec e-Szigno Root CA" -# Serial: 272122594155480254301341951808045322001 -# MD5 Fingerprint: f0:96:b6:2f:c5:10:d5:67:8e:83:25:32:e8:5e:2e:e5 -# SHA1 Fingerprint: 23:88:c9:d3:71:cc:9e:96:3d:ff:7d:3c:a7:ce:fc:d6:25:ec:19:0d -# SHA256 Fingerprint: 32:7a:3d:76:1a:ba:de:a0:34:eb:99:84:06:27:5c:b1:a4:77:6e:fd:ae:2f:df:6d:01:68:ea:1c:4f:55:67:d0 ------BEGIN CERTIFICATE----- -MIIHqDCCBpCgAwIBAgIRAMy4579OKRr9otxmpRwsDxEwDQYJKoZIhvcNAQEFBQAw -cjELMAkGA1UEBhMCSFUxETAPBgNVBAcTCEJ1ZGFwZXN0MRYwFAYDVQQKEw1NaWNy -b3NlYyBMdGQuMRQwEgYDVQQLEwtlLVN6aWdubyBDQTEiMCAGA1UEAxMZTWljcm9z -ZWMgZS1Temlnbm8gUm9vdCBDQTAeFw0wNTA0MDYxMjI4NDRaFw0xNzA0MDYxMjI4 -NDRaMHIxCzAJBgNVBAYTAkhVMREwDwYDVQQHEwhCdWRhcGVzdDEWMBQGA1UEChMN -TWljcm9zZWMgTHRkLjEUMBIGA1UECxMLZS1Temlnbm8gQ0ExIjAgBgNVBAMTGU1p -Y3Jvc2VjIGUtU3ppZ25vIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw -ggEKAoIBAQDtyADVgXvNOABHzNuEwSFpLHSQDCHZU4ftPkNEU6+r+ICbPHiN1I2u -uO/TEdyB5s87lozWbxXGd36hL+BfkrYn13aaHUM86tnsL+4582pnS4uCzyL4ZVX+ -LMsvfUh6PXX5qqAnu3jCBspRwn5mS6/NoqdNAoI/gqyFxuEPkEeZlApxcpMqyabA -vjxWTHOSJ/FrtfX9/DAFYJLG65Z+AZHCabEeHXtTRbjcQR/Ji3HWVBTji1R4P770 -Yjtb9aPs1ZJ04nQw7wHb4dSrmZsqa/i9phyGI0Jf7Enemotb9HI6QMVJPqW+jqpx -62z69Rrkav17fVVA71hu5tnVvCSrwe+3AgMBAAGjggQ3MIIEMzBnBggrBgEFBQcB -AQRbMFkwKAYIKwYBBQUHMAGGHGh0dHBzOi8vcmNhLmUtc3ppZ25vLmh1L29jc3Aw -LQYIKwYBBQUHMAKGIWh0dHA6Ly93d3cuZS1zemlnbm8uaHUvUm9vdENBLmNydDAP -BgNVHRMBAf8EBTADAQH/MIIBcwYDVR0gBIIBajCCAWYwggFiBgwrBgEEAYGoGAIB -AQEwggFQMCgGCCsGAQUFBwIBFhxodHRwOi8vd3d3LmUtc3ppZ25vLmh1L1NaU1ov -MIIBIgYIKwYBBQUHAgIwggEUHoIBEABBACAAdABhAG4A+gBzAO0AdAB2AOEAbgB5 -ACAA6QByAHQAZQBsAG0AZQB6AOkAcwDpAGgAZQB6ACAA6QBzACAAZQBsAGYAbwBn -AGEAZADhAHMA4QBoAG8AegAgAGEAIABTAHoAbwBsAGcA4QBsAHQAYQB0APMAIABT -AHoAbwBsAGcA4QBsAHQAYQB0AOEAcwBpACAAUwB6AGEAYgDhAGwAeQB6AGEAdABh -ACAAcwB6AGUAcgBpAG4AdAAgAGsAZQBsAGwAIABlAGwAagDhAHIAbgBpADoAIABo -AHQAdABwADoALwAvAHcAdwB3AC4AZQAtAHMAegBpAGcAbgBvAC4AaAB1AC8AUwBa -AFMAWgAvMIHIBgNVHR8EgcAwgb0wgbqggbeggbSGIWh0dHA6Ly93d3cuZS1zemln -bm8uaHUvUm9vdENBLmNybIaBjmxkYXA6Ly9sZGFwLmUtc3ppZ25vLmh1L0NOPU1p -Y3Jvc2VjJTIwZS1Temlnbm8lMjBSb290JTIwQ0EsT1U9ZS1Temlnbm8lMjBDQSxP -PU1pY3Jvc2VjJTIwTHRkLixMPUJ1ZGFwZXN0LEM9SFU/Y2VydGlmaWNhdGVSZXZv -Y2F0aW9uTGlzdDtiaW5hcnkwDgYDVR0PAQH/BAQDAgEGMIGWBgNVHREEgY4wgYuB -EGluZm9AZS1zemlnbm8uaHWkdzB1MSMwIQYDVQQDDBpNaWNyb3NlYyBlLVN6aWdu -w7MgUm9vdCBDQTEWMBQGA1UECwwNZS1TemlnbsOzIEhTWjEWMBQGA1UEChMNTWlj -cm9zZWMgS2Z0LjERMA8GA1UEBxMIQnVkYXBlc3QxCzAJBgNVBAYTAkhVMIGsBgNV -HSMEgaQwgaGAFMegSXUWYYTbMUuE0vE3QJDvTtz3oXakdDByMQswCQYDVQQGEwJI -VTERMA8GA1UEBxMIQnVkYXBlc3QxFjAUBgNVBAoTDU1pY3Jvc2VjIEx0ZC4xFDAS -BgNVBAsTC2UtU3ppZ25vIENBMSIwIAYDVQQDExlNaWNyb3NlYyBlLVN6aWdubyBS -b290IENBghEAzLjnv04pGv2i3GalHCwPETAdBgNVHQ4EFgQUx6BJdRZhhNsxS4TS -8TdAkO9O3PcwDQYJKoZIhvcNAQEFBQADggEBANMTnGZjWS7KXHAM/IO8VbH0jgds -ZifOwTsgqRy7RlRw7lrMoHfqaEQn6/Ip3Xep1fvj1KcExJW4C+FEaGAHQzAxQmHl -7tnlJNUb3+FKG6qfx1/4ehHqE5MAyopYse7tDk2016g2JnzgOsHVV4Lxdbb9iV/a -86g4nzUGCM4ilb7N1fy+W955a9x6qWVmvrElWl/tftOsRm1M9DKHtCAE4Gx4sHfR -hUZLphK3dehKyVZs15KrnfVJONJPU+NVkBHbmJbGSfI+9J8b4PeI3CVimUTYc78/ -MPMMNz7UwiiAc7EBt51alhQBS6kRnSlqLtBdgcDPsiBDxwPgN05dCtxZICU= ------END CERTIFICATE----- - # Issuer: CN=Certigna O=Dhimyotis # Subject: CN=Certigna O=Dhimyotis # Label: "Certigna" @@ -2014,36 +1927,6 @@ buXf6iFViZx9fX+Y9QCJ7uOEwFyWtcVG6kbghVW2G8kS1sHNzYDzAgE8yGnLRUhj 2JTQ7IUOO04RZfSCjKY9ri4ilAnIXOo8gV0WKgOXFlUJ24pBgp5mmxE= -----END CERTIFICATE----- -# Issuer: O=Japanese Government OU=ApplicationCA -# Subject: O=Japanese Government OU=ApplicationCA -# Label: "ApplicationCA - Japanese Government" -# Serial: 49 -# MD5 Fingerprint: 7e:23:4e:5b:a7:a5:b4:25:e9:00:07:74:11:62:ae:d6 -# SHA1 Fingerprint: 7f:8a:b0:cf:d0:51:87:6a:66:f3:36:0f:47:c8:8d:8c:d3:35:fc:74 -# SHA256 Fingerprint: 2d:47:43:7d:e1:79:51:21:5a:12:f3:c5:8e:51:c7:29:a5:80:26:ef:1f:cc:0a:5f:b3:d9:dc:01:2f:60:0d:19 ------BEGIN CERTIFICATE----- -MIIDoDCCAoigAwIBAgIBMTANBgkqhkiG9w0BAQUFADBDMQswCQYDVQQGEwJKUDEc -MBoGA1UEChMTSmFwYW5lc2UgR292ZXJubWVudDEWMBQGA1UECxMNQXBwbGljYXRp -b25DQTAeFw0wNzEyMTIxNTAwMDBaFw0xNzEyMTIxNTAwMDBaMEMxCzAJBgNVBAYT -AkpQMRwwGgYDVQQKExNKYXBhbmVzZSBHb3Zlcm5tZW50MRYwFAYDVQQLEw1BcHBs -aWNhdGlvbkNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAp23gdE6H -j6UG3mii24aZS2QNcfAKBZuOquHMLtJqO8F6tJdhjYq+xpqcBrSGUeQ3DnR4fl+K -f5Sk10cI/VBaVuRorChzoHvpfxiSQE8tnfWuREhzNgaeZCw7NCPbXCbkcXmP1G55 -IrmTwcrNwVbtiGrXoDkhBFcsovW8R0FPXjQilbUfKW1eSvNNcr5BViCH/OlQR9cw -FO5cjFW6WY2H/CPek9AEjP3vbb3QesmlOmpyM8ZKDQUXKi17safY1vC+9D/qDiht -QWEjdnjDuGWk81quzMKq2edY3rZ+nYVunyoKb58DKTCXKB28t89UKU5RMfkntigm -/qJj5kEW8DOYRwIDAQABo4GeMIGbMB0GA1UdDgQWBBRUWssmP3HMlEYNllPqa0jQ -k/5CdTAOBgNVHQ8BAf8EBAMCAQYwWQYDVR0RBFIwUKROMEwxCzAJBgNVBAYTAkpQ -MRgwFgYDVQQKDA/ml6XmnKzlm73mlL/lupwxIzAhBgNVBAsMGuOCouODl+ODquOC -seODvOOCt+ODp+ODs0NBMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQAD -ggEBADlqRHZ3ODrso2dGD/mLBqj7apAxzn7s2tGJfHrrLgy9mTLnsCTWw//1sogJ -hyzjVOGjprIIC8CFqMjSnHH2HZ9g/DgzE+Ge3Atf2hZQKXsvcJEPmbo0NI2VdMV+ -eKlmXb3KIXdCEKxmJj3ekav9FfBv7WxfEPjzFvYDio+nEhEMy/0/ecGc/WLuo89U -DNErXxc+4z6/wCs+CZv+iKZ+tJIX/COUgb1up8WMwusRRdv4QcmWdupwX3kSa+Sj -B1oF7ydJzyGfikwJcGapJsErEU4z0g781mzSDjJkaP+tBXhfAx2o45CsJOAPQKdL -rosot4LKGAfmt1t06SAZf7IbiVQ= ------END CERTIFICATE----- - # Issuer: CN=GeoTrust Primary Certification Authority - G3 O=GeoTrust Inc. OU=(c) 2008 GeoTrust Inc. - For authorized use only # Subject: CN=GeoTrust Primary Certification Authority - G3 O=GeoTrust Inc. OU=(c) 2008 GeoTrust Inc. - For authorized use only # Label: "GeoTrust Primary Certification Authority - G3" @@ -4720,39 +4603,6 @@ Yv4HAqGEVka+lgqaE9chTLd8B59OTj+RdPsnnRHM3eaxynFNExc5JsUpISuTKWqW +qtB4Uu2NQvAmxU= -----END CERTIFICATE----- -# Issuer: CN=TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H6 O=TÜRKTRUST Bilgi İletişim ve Bilişim Güvenliği Hizmetleri A.Ş. -# Subject: CN=TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H6 O=TÜRKTRUST Bilgi İletişim ve Bilişim Güvenliği Hizmetleri A.Ş. -# Label: "TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H6" -# Serial: 138134509972618 -# MD5 Fingerprint: f8:c5:ee:2a:6b:be:95:8d:08:f7:25:4a:ea:71:3e:46 -# SHA1 Fingerprint: 8a:5c:8c:ee:a5:03:e6:05:56:ba:d8:1b:d4:f6:c9:b0:ed:e5:2f:e0 -# SHA256 Fingerprint: 8d:e7:86:55:e1:be:7f:78:47:80:0b:93:f6:94:d2:1d:36:8c:c0:6e:03:3e:7f:ab:04:bb:5e:b9:9d:a6:b7:00 ------BEGIN CERTIFICATE----- -MIIEJjCCAw6gAwIBAgIGfaHyZeyKMA0GCSqGSIb3DQEBCwUAMIGxMQswCQYDVQQG -EwJUUjEPMA0GA1UEBwwGQW5rYXJhMU0wSwYDVQQKDERUw5xSS1RSVVNUIEJpbGdp -IMSwbGV0acWfaW0gdmUgQmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBB -LsWeLjFCMEAGA1UEAww5VMOcUktUUlVTVCBFbGVrdHJvbmlrIFNlcnRpZmlrYSBI -aXptZXQgU2HEn2xhecSxY8Sxc8SxIEg2MB4XDTEzMTIxODA5MDQxMFoXDTIzMTIx -NjA5MDQxMFowgbExCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmExTTBLBgNV -BAoMRFTDnFJLVFJVU1QgQmlsZ2kgxLBsZXRpxZ9pbSB2ZSBCaWxpxZ9pbSBHw7x2 -ZW5sacSfaSBIaXptZXRsZXJpIEEuxZ4uMUIwQAYDVQQDDDlUw5xSS1RSVVNUIEVs -ZWt0cm9uaWsgU2VydGlmaWthIEhpem1ldCBTYcSfbGF5xLFjxLFzxLEgSDYwggEi -MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCdsGjW6L0UlqMACprx9MfMkU1x -eHe59yEmFXNRFpQJRwXiM/VomjX/3EsvMsew7eKC5W/a2uqsxgbPJQ1BgfbBOCK9 -+bGlprMBvD9QFyv26WZV1DOzXPhDIHiTVRZwGTLmiddk671IUP320EEDwnS3/faA -z1vFq6TWlRKb55cTMgPp1KtDWxbtMyJkKbbSk60vbNg9tvYdDjTu0n2pVQ8g9P0p -u5FbHH3GQjhtQiht1AH7zYiXSX6484P4tZgvsycLSF5W506jM7NE1qXyGJTtHB6p -lVxiSvgNZ1GpryHV+DKdeboaX+UEVU0TRv/yz3THGmNtwx8XEsMeED5gCLMxAgMB -AAGjQjBAMB0GA1UdDgQWBBTdVRcT9qzoSCHK77Wv0QAy7Z6MtTAOBgNVHQ8BAf8E -BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAb1gNl0Oq -FlQ+v6nfkkU/hQu7VtMMUszIv3ZnXuaqs6fvuay0EBQNdH49ba3RfdCaqaXKGDsC -QC4qnFAUi/5XfldcEQlLNkVS9z2sFP1E34uXI9TDwe7UU5X+LEr+DXCqu4svLcsy -o4LyVN/Y8t3XSHLuSqMplsNEzm61kod2pLv0kmzOLBQJZo6NrRa1xxsJYTvjIKID -gI6tflEATseWhvtDmHd9KMeP2Cpu54Rvl0EpABZeTeIT6lnAY2c6RPuY/ATTMHKm -9ocJV612ph1jmv3XZch4gyt1O6VbuA1df74jrlZVlFjvH4GMKrLN5ptjnhi85WsG -tAuYSyher4hYyw== ------END CERTIFICATE----- - # Issuer: CN=Certinomis - Root CA O=Certinomis OU=0002 433998903 # Subject: CN=Certinomis - Root CA O=Certinomis OU=0002 433998903 # Label: "Certinomis - Root CA" @@ -5402,3 +5252,37 @@ LSoSOcbDWjLtR5EWDrw4wVDej8oqkDQc7kGUnF4ZLvhFSZl0kbAEb+MEWrGrKqv+ x9CWttrhSmQGbmBNvUJO/3jaJMobtNeWOWyu8Q6qp31IiyBMz2TWuJdGsE7RKlY6 oJO9r4Ak4Ap+58rVyuiFVdw2KuGUaJPHZnJED4AhMmwlxyOAgwrr -----END CERTIFICATE----- + +# Issuer: CN=TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1 O=Turkiye Bilimsel ve Teknolojik Arastirma Kurumu - TUBITAK OU=Kamu Sertifikasyon Merkezi - Kamu SM +# Subject: CN=TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1 O=Turkiye Bilimsel ve Teknolojik Arastirma Kurumu - TUBITAK OU=Kamu Sertifikasyon Merkezi - Kamu SM +# Label: "TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1" +# Serial: 1 +# MD5 Fingerprint: dc:00:81:dc:69:2f:3e:2f:b0:3b:f6:3d:5a:91:8e:49 +# SHA1 Fingerprint: 31:43:64:9b:ec:ce:27:ec:ed:3a:3f:0b:8f:0d:e4:e8:91:dd:ee:ca +# SHA256 Fingerprint: 46:ed:c3:68:90:46:d5:3a:45:3f:b3:10:4a:b8:0d:ca:ec:65:8b:26:60:ea:16:29:dd:7e:86:79:90:64:87:16 +-----BEGIN CERTIFICATE----- +MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIx +GDAWBgNVBAcTD0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxp +bXNlbCB2ZSBUZWtub2xvamlrIEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0w +KwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24gTWVya2V6aSAtIEthbXUgU00xNjA0 +BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRpZmlrYXNpIC0gU3Vy +dW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYDVQQG +EwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXll +IEJpbGltc2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklU +QUsxLTArBgNVBAsTJEthbXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBT +TTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11IFNNIFNTTCBLb2sgU2VydGlmaWthc2kg +LSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr3UwM6q7 +a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y86Ij5iySr +LqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INr +N3wcwv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2X +YacQuFWQfw4tJzh03+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/ +iSIzL+aFCr2lqBs23tPcLG07xxO9WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4f +AJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQUZT/HiobGPN08VFw1+DrtUgxH +V8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL +BQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh +AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPf +IPP54+M638yclNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4 +lzwDGrpDxpa5RXI4s6ehlj2Re37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c +8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0jq5Rm+K37DwhuJi1/FwcJsoz7UMCf +lo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM= +-----END CERTIFICATE----- From 790e38a3a5be11f9b2a725d5382d4525a1e07897 Mon Sep 17 00:00:00 2001 From: Matt Kwong Date: Mon, 10 Apr 2017 11:00:37 -0700 Subject: [PATCH 291/461] Run start_port_server.py in performance profiling --- tools/jenkins/run_performance_profile_hourly.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/jenkins/run_performance_profile_hourly.sh b/tools/jenkins/run_performance_profile_hourly.sh index dfcc2bb1163..c352a9f4acf 100755 --- a/tools/jenkins/run_performance_profile_hourly.sh +++ b/tools/jenkins/run_performance_profile_hourly.sh @@ -32,6 +32,8 @@ set -ex cd $(dirname $0)/../.. +./tools/run_tests/start_port_server.py || true + CPUS=`python -c 'import multiprocessing; print multiprocessing.cpu_count()'` make CONFIG=opt memory_profile_test memory_profile_client memory_profile_server -j $CPUS From fa9da3c2db764cd29fb0941267c514513448fde5 Mon Sep 17 00:00:00 2001 From: Matt Kwong Date: Mon, 10 Apr 2017 11:42:15 -0700 Subject: [PATCH 292/461] Fix C# Dockerfiles --- templates/tools/dockerfile/csharp_deps.include | 1 - tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile | 1 - .../dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile | 1 - .../dockerfile/stress_test/grpc_interop_stress_csharp/Dockerfile | 1 - tools/dockerfile/test/csharp_coreclr_x64/Dockerfile | 1 - tools/dockerfile/test/csharp_jessie_x64/Dockerfile | 1 - tools/dockerfile/test/multilang_jessie_x64/Dockerfile | 1 - 7 files changed, 7 deletions(-) diff --git a/templates/tools/dockerfile/csharp_deps.include b/templates/tools/dockerfile/csharp_deps.include index 7e89dec2cc2..612b119e1c9 100644 --- a/templates/tools/dockerfile/csharp_deps.include +++ b/templates/tools/dockerfile/csharp_deps.include @@ -6,7 +6,6 @@ RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14 RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list RUN echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list -RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list # Install dependencies RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y ${'\\'} diff --git a/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile index 14a2468abc7..545e1aefea4 100644 --- a/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile @@ -86,7 +86,6 @@ RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14 RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list RUN echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list -RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list # Install dependencies RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y \ diff --git a/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile index 2a59628b487..f9e709dccb1 100644 --- a/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile @@ -86,7 +86,6 @@ RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14 RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list RUN echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list -RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list # Install dependencies RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y \ diff --git a/tools/dockerfile/stress_test/grpc_interop_stress_csharp/Dockerfile b/tools/dockerfile/stress_test/grpc_interop_stress_csharp/Dockerfile index cd1e9343417..12d8d091848 100644 --- a/tools/dockerfile/stress_test/grpc_interop_stress_csharp/Dockerfile +++ b/tools/dockerfile/stress_test/grpc_interop_stress_csharp/Dockerfile @@ -103,7 +103,6 @@ RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14 RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list RUN echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list -RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list # Install dependencies RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y \ diff --git a/tools/dockerfile/test/csharp_coreclr_x64/Dockerfile b/tools/dockerfile/test/csharp_coreclr_x64/Dockerfile index 2a59628b487..f9e709dccb1 100644 --- a/tools/dockerfile/test/csharp_coreclr_x64/Dockerfile +++ b/tools/dockerfile/test/csharp_coreclr_x64/Dockerfile @@ -86,7 +86,6 @@ RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14 RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list RUN echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list -RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list # Install dependencies RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y \ diff --git a/tools/dockerfile/test/csharp_jessie_x64/Dockerfile b/tools/dockerfile/test/csharp_jessie_x64/Dockerfile index 14a2468abc7..545e1aefea4 100644 --- a/tools/dockerfile/test/csharp_jessie_x64/Dockerfile +++ b/tools/dockerfile/test/csharp_jessie_x64/Dockerfile @@ -86,7 +86,6 @@ RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14 RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list RUN echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list -RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list # Install dependencies RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y \ diff --git a/tools/dockerfile/test/multilang_jessie_x64/Dockerfile b/tools/dockerfile/test/multilang_jessie_x64/Dockerfile index ea57d88c870..c1cce0a1417 100644 --- a/tools/dockerfile/test/multilang_jessie_x64/Dockerfile +++ b/tools/dockerfile/test/multilang_jessie_x64/Dockerfile @@ -71,7 +71,6 @@ RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14 RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list RUN echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list -RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list # Install dependencies RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y \ From 025f110ed26afe600c10a4af9648bd6933174168 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 10 Apr 2017 13:07:37 -0700 Subject: [PATCH 293/461] Node: fix Windows warning in binding.gyp for Win10 console --- binding.gyp | 5 +++-- templates/binding.gyp.template | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/binding.gyp b/binding.gyp index 3444fa53dba..17a86335581 100644 --- a/binding.gyp +++ b/binding.gyp @@ -519,9 +519,10 @@ # the OpenSSL headers, from the downloaded Node development package, # which is typically located in `.node-gyp` in your home directory. 'target_name': 'WINDOWS_BUILD_WARNING', - 'actions': [ + 'rules': [ { - 'action_name': 'WINDOWS_BUILD_WARNING', + 'rule_name': 'WINDOWS_BUILD_WARNING', + 'extension': 'S', 'inputs': [ 'package.json' ], diff --git a/templates/binding.gyp.template b/templates/binding.gyp.template index aeeb56b9a6a..55a91c5b93d 100644 --- a/templates/binding.gyp.template +++ b/templates/binding.gyp.template @@ -217,9 +217,10 @@ # the OpenSSL headers, from the downloaded Node development package, # which is typically located in `.node-gyp` in your home directory. 'target_name': 'WINDOWS_BUILD_WARNING', - 'actions': [ + 'rules': [ { - 'action_name': 'WINDOWS_BUILD_WARNING', + 'rule_name': 'WINDOWS_BUILD_WARNING', + 'extension': 'S', 'inputs': [ 'package.json' ], From 5101b3f7cf87c9b2f9e6c5c4bb4c1023dcb999b2 Mon Sep 17 00:00:00 2001 From: Matt Kwong Date: Mon, 10 Apr 2017 14:34:39 -0700 Subject: [PATCH 294/461] Pin Bazel version to 0.4.4 in Dockerfile --- tools/dockerfile/test/bazel/Dockerfile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/dockerfile/test/bazel/Dockerfile b/tools/dockerfile/test/bazel/Dockerfile index cc413848337..6ea8ef316c6 100644 --- a/tools/dockerfile/test/bazel/Dockerfile +++ b/tools/dockerfile/test/bazel/Dockerfile @@ -72,6 +72,13 @@ RUN curl https://bazel.build/bazel-release.pub.gpg | apt-key add - RUN apt-get -y update RUN apt-get -y install bazel +# Pin Bazel to 0.4.4 +# Installing Bazel via apt-get first is required before installing 0.4.4 to +# allow gRPC to build without errors. See https://github.com/grpc/grpc/issues/10553 +RUN curl -fSsL -O https://github.com/bazelbuild/bazel/releases/download/0.4.4/bazel-0.4.4-installer-linux-x86_64.sh +RUN chmod +x ./bazel-0.4.4-installer-linux-x86_64.sh +RUN ./bazel-0.4.4-installer-linux-x86_64.sh + RUN mkdir -p /var/local/jenkins # Define the default command. From 79962f33c71e248276486122097e33b038e537df Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 10 Apr 2017 14:37:43 -0700 Subject: [PATCH 295/461] Refactor tag completion handling into one function --- src/node/ext/call.cc | 32 ++++++++++----------- src/node/ext/call.h | 6 +--- src/node/ext/completion_queue_threadpool.cc | 9 ++---- src/node/ext/completion_queue_uv.cc | 12 +++----- 4 files changed, 22 insertions(+), 37 deletions(-) diff --git a/src/node/ext/call.cc b/src/node/ext/call.cc index 5d573110dac..8d5e2ced6ab 100644 --- a/src/node/ext/call.cc +++ b/src/node/ext/call.cc @@ -499,25 +499,23 @@ tag::~tag() { delete ops; } -Local GetTagNodeValue(void *tag) { - EscapableHandleScope scope; +void CompleteTag(void *tag, const char *error_message) { + HandleScope scope; struct tag *tag_struct = reinterpret_cast(tag); - Local tag_obj = Nan::New(); - for (vector >::iterator it = tag_struct->ops->begin(); - it != tag_struct->ops->end(); ++it) { - Op *op_ptr = it->get(); - Nan::Set(tag_obj, op_ptr->GetOpType(), op_ptr->GetNodeValue()); + Callback *callback = tag_struct->callback; + if (error_message == NULL) { + Local tag_obj = Nan::New(); + for (vector >::iterator it = tag_struct->ops->begin(); + it != tag_struct->ops->end(); ++it) { + Op *op_ptr = it->get(); + Nan::Set(tag_obj, op_ptr->GetOpType(), op_ptr->GetNodeValue()); + } + Local argv[] = {Nan::Null(), tag_obj}; + callback->Call(2, argv); + } else { + Local argv[] = {Nan::Error(error_message)}; + callback->Call(1, argv); } - return scope.Escape(tag_obj); -} - -Callback *GetTagCallback(void *tag) { - struct tag *tag_struct = reinterpret_cast(tag); - return tag_struct->callback; -} - -void CompleteTag(void *tag) { - struct tag *tag_struct = reinterpret_cast(tag); bool is_final_op = false; if (tag_struct->call == NULL) { return; diff --git a/src/node/ext/call.h b/src/node/ext/call.h index 53a5e4ab679..4316e9ed881 100644 --- a/src/node/ext/call.h +++ b/src/node/ext/call.h @@ -123,13 +123,9 @@ struct tag { call_persist; }; -v8::Local GetTagNodeValue(void *tag); - -Nan::Callback *GetTagCallback(void *tag); - void DestroyTag(void *tag); -void CompleteTag(void *tag); +void CompleteTag(void *tag, const char *error_message); } // namespace node } // namespace grpc diff --git a/src/node/ext/completion_queue_threadpool.cc b/src/node/ext/completion_queue_threadpool.cc index 1917074dc2d..7b1bdda0334 100644 --- a/src/node/ext/completion_queue_threadpool.cc +++ b/src/node/ext/completion_queue_threadpool.cc @@ -148,9 +148,7 @@ void CompletionQueueAsyncWorker::HandleOKCallback() { Nan::HandleScope scope; current_threads -= 1; TryAddWorker(); - Nan::Callback *callback = GetTagCallback(result.tag); - Local argv[] = {Nan::Null(), GetTagNodeValue(result.tag)}; - callback->Call(2, argv); + CompleteTag(result.tag, NULL); DestroyTag(result.tag); } @@ -159,10 +157,7 @@ void CompletionQueueAsyncWorker::HandleErrorCallback() { Nan::HandleScope scope; current_threads -= 1; TryAddWorker(); - Nan::Callback *callback = GetTagCallback(result.tag); - Local argv[] = {Nan::Error(ErrorMessage())}; - - callback->Call(1, argv); + CompleteTag(result.tag, ErrorMessage()); DestroyTag(result.tag); } diff --git a/src/node/ext/completion_queue_uv.cc b/src/node/ext/completion_queue_uv.cc index 615973a6c9b..0f6f7da4607 100644 --- a/src/node/ext/completion_queue_uv.cc +++ b/src/node/ext/completion_queue_uv.cc @@ -61,17 +61,13 @@ void drain_completion_queue(uv_prepare_t *handle) { queue, gpr_inf_past(GPR_CLOCK_MONOTONIC), NULL); if (event.type == GRPC_OP_COMPLETE) { - Nan::Callback *callback = grpc::node::GetTagCallback(event.tag); + const char *error_message; if (event.success) { - Local argv[] = {Nan::Null(), - grpc::node::GetTagNodeValue(event.tag)}; - callback->Call(2, argv); + error_message = NULL; } else { - Local argv[] = {Nan::Error( - "The async function encountered an error")}; - callback->Call(1, argv); + error_message = "The async function encountered an error"; } - grpc::node::CompleteTag(event.tag); + CompleteTag(event.tag, error_message); grpc::node::DestroyTag(event.tag); pending_batches--; if (pending_batches == 0) { From 42cfaa99bd3490bb0849fd66aa56016e763a56a8 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Mon, 10 Apr 2017 15:43:09 -0700 Subject: [PATCH 296/461] Add native tag completion callbacks, dispose of server after tryShutdown succeeds --- src/node/ext/call.cc | 23 ++++++++++++++++++++--- src/node/ext/call.h | 1 + src/node/ext/server.cc | 37 +++++++++++++++++++++++++++++++++++++ src/node/ext/server.h | 2 ++ src/node/ext/server_uv.cc | 3 +++ 5 files changed, 63 insertions(+), 3 deletions(-) diff --git a/src/node/ext/call.cc b/src/node/ext/call.cc index 8d5e2ced6ab..bb11cfb83ad 100644 --- a/src/node/ext/call.cc +++ b/src/node/ext/call.cc @@ -217,6 +217,8 @@ class SendMetadataOp : public Op { bool IsFinalOp() { return false; } + void OnComplete() { + } protected: std::string GetTypeString() const { return "send_metadata"; @@ -260,6 +262,8 @@ class SendMessageOp : public Op { bool IsFinalOp() { return false; } + void OnComplete() { + } protected: std::string GetTypeString() const { return "send_message"; @@ -280,6 +284,8 @@ class SendClientCloseOp : public Op { bool IsFinalOp() { return false; } + void OnComplete() { + } protected: std::string GetTypeString() const { return "client_close"; @@ -349,6 +355,8 @@ class SendServerStatusOp : public Op { bool IsFinalOp() { return true; } + void OnComplete() { + } protected: std::string GetTypeString() const { return "send_status"; @@ -381,6 +389,8 @@ class GetMetadataOp : public Op { bool IsFinalOp() { return false; } + void OnComplete() { + } protected: std::string GetTypeString() const { @@ -413,6 +423,8 @@ class ReadMessageOp : public Op { bool IsFinalOp() { return false; } + void OnComplete() { + } protected: std::string GetTypeString() const { @@ -454,6 +466,8 @@ class ClientStatusOp : public Op { bool IsFinalOp() { return true; } + void OnComplete() { + } protected: std::string GetTypeString() const { return "status"; @@ -478,6 +492,8 @@ class ServerCloseResponseOp : public Op { bool IsFinalOp() { return false; } + void OnComplete() { + } protected: std::string GetTypeString() const { @@ -517,16 +533,17 @@ void CompleteTag(void *tag, const char *error_message) { callback->Call(1, argv); } bool is_final_op = false; - if (tag_struct->call == NULL) { - return; - } for (vector >::iterator it = tag_struct->ops->begin(); it != tag_struct->ops->end(); ++it) { Op *op_ptr = it->get(); + op_ptr->OnComplete(); if (op_ptr->IsFinalOp()) { is_final_op = true; } } + if (tag_struct->call == NULL) { + return; + } tag_struct->call->CompleteBatch(is_final_op); } diff --git a/src/node/ext/call.h b/src/node/ext/call.h index 4316e9ed881..b38f50060c4 100644 --- a/src/node/ext/call.h +++ b/src/node/ext/call.h @@ -106,6 +106,7 @@ class Op { virtual ~Op(); v8::Local GetOpType() const; virtual bool IsFinalOp() = 0; + virtual void OnComplete() = 0; protected: virtual std::string GetTypeString() const = 0; diff --git a/src/node/ext/server.cc b/src/node/ext/server.cc index f0920c842a3..22c89c58624 100644 --- a/src/node/ext/server.cc +++ b/src/node/ext/server.cc @@ -117,6 +117,8 @@ class NewCallOp : public Op { bool IsFinalOp() { return false; } + void OnComplete() { + } grpc_call *call; grpc_call_details details; @@ -126,6 +128,32 @@ class NewCallOp : public Op { std::string GetTypeString() const { return "new_call"; } }; +class TryShutdownOp: public Op { + public: + TryShutdownOp(Server *server, Local server_value) : server(server) { + server_persist.Reset(server_value); + } + Local GetNodeValue() const { + EscapableHandleScope scope; + return scope.Escape(Nan::New(server_persist)); + } + bool ParseOp(Local value, grpc_op *out) { + return true; + } + bool IsFinalOp() { + return false; + } + void OnComplete() { + server->DestroyWrappedServer(); + } + protected: + std::string GetTypeString() const { return "try_shutdown"; } + private: + Server *server; + Nan::Persistent> + server_persist; +}; + void Server::Init(Local exports) { HandleScope scope; Local tpl = Nan::New(New); @@ -147,6 +175,13 @@ bool Server::HasInstance(Local val) { return Nan::New(fun_tpl)->HasInstance(val); } +void Server::DestroyWrappedServer() { + if (this->wrapped_server != NULL) { + grpc_server_destroy(this->wrapped_server); + this->wrapped_server = NULL; + } +} + NAN_METHOD(Server::New) { /* If this is not a constructor call, make a constructor call and return the result */ @@ -242,7 +277,9 @@ NAN_METHOD(Server::TryShutdown) { return Nan::ThrowTypeError("tryShutdown can only be called on a Server"); } Server *server = ObjectWrap::Unwrap(info.This()); + TryShutdownOp *op = new TryShutdownOp(server, info.This()); unique_ptr ops(new OpVec()); + ops->push_back(unique_ptr(op)); grpc_server_shutdown_and_notify( server->wrapped_server, GetCompletionQueue(), new struct tag(new Nan::Callback(info[0].As()), ops.release(), diff --git a/src/node/ext/server.h b/src/node/ext/server.h index ab5fc210e8a..c0f2e86554b 100644 --- a/src/node/ext/server.h +++ b/src/node/ext/server.h @@ -53,6 +53,8 @@ class Server : public Nan::ObjectWrap { JavaScript constructor */ static bool HasInstance(v8::Local val); + void DestroyWrappedServer(); + private: explicit Server(grpc_server *server); ~Server(); diff --git a/src/node/ext/server_uv.cc b/src/node/ext/server_uv.cc index 82e7589fc87..bf402e1961f 100644 --- a/src/node/ext/server_uv.cc +++ b/src/node/ext/server_uv.cc @@ -76,6 +76,8 @@ class ServerShutdownOp : public Op { bool IsFinalOp() { return false; } + void OnComplete() { + } grpc_server *server; @@ -104,6 +106,7 @@ NAN_METHOD(ServerShutdownCallback) { } void Server::ShutdownServer() { + Nan::HandleScope scope; if (this->wrapped_server != NULL) { if (shutdown_callback == NULL) { Localcallback_tpl = From d6dd46a1d9558c32ed17f1e9ce1726b272b06404 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Mon, 10 Apr 2017 16:45:02 -0700 Subject: [PATCH 297/461] fix flakey race in ruby tests --- src/ruby/spec/generic/rpc_server_pool_spec.rb | 41 +++++++++++-------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/src/ruby/spec/generic/rpc_server_pool_spec.rb b/src/ruby/spec/generic/rpc_server_pool_spec.rb index 69e8222cb97..75b40225680 100644 --- a/src/ruby/spec/generic/rpc_server_pool_spec.rb +++ b/src/ruby/spec/generic/rpc_server_pool_spec.rb @@ -52,27 +52,36 @@ describe GRPC::Pool do expect(p.ready_for_work?).to be(false) end - it 'it stops being ready after all workers jobs waiting or running' do + it 'it stops being ready after all workers are busy, ' \ + 'and it becomes ready again after jobs complete' do p = Pool.new(5) p.start - job = proc { sleep(3) } # sleep so workers busy when done scheduling - 5.times do - expect(p.ready_for_work?).to be(true) - p.schedule(&job) + + wait_mu = Mutex.new + wait_cv = ConditionVariable.new + wait = true + + job = proc do + wait_mu.synchronize do + wait_cv.wait(wait_mu) while wait + end end - expect(p.ready_for_work?).to be(false) - end - it 'it becomes ready again after jobs complete' do - p = Pool.new(5) - p.start - job = proc {} 5.times do expect(p.ready_for_work?).to be(true) p.schedule(&job) end + expect(p.ready_for_work?).to be(false) - sleep 5 # give the pool time do get at least one task done + + wait_mu.synchronize do + wait = false + wait_cv.broadcast + end + + # There's a potential race here but it shouldn't ever be + # reached with a 5 second sleep. + sleep 5 expect(p.ready_for_work?).to be(true) end end @@ -105,13 +114,13 @@ describe GRPC::Pool do it 'stops jobs when there are long running jobs' do p = Pool.new(1) p.start - o, q = Object.new, Queue.new + job_running = Queue.new job = proc do - sleep(5) # long running - q.push(o) + job_running.push(Object.new) + sleep(5000) end p.schedule(&job) - sleep(1) # should ensure the long job gets scheduled + job_running.pop expect { p.stop }.not_to raise_error end end From 48cba2adb45bc3a60b9fc6234757bcd9a84c5697 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 10 Apr 2017 17:08:01 -0700 Subject: [PATCH 298/461] Send content-type on trailer-only responses --- .../chttp2/transport/chttp2_transport.c | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index e2816b0e045..7323f4cb2e4 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1890,6 +1890,7 @@ static void close_from_api(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_slice hdr; grpc_slice status_hdr; grpc_slice http_status_hdr; + grpc_slice content_type_hdr; grpc_slice message_pfx; uint8_t *p; uint32_t len = 0; @@ -1923,6 +1924,42 @@ static void close_from_api(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, *p++ = '0'; GPR_ASSERT(p == GRPC_SLICE_END_PTR(http_status_hdr)); len += (uint32_t)GRPC_SLICE_LENGTH(http_status_hdr); + + content_type_hdr = grpc_slice_malloc(31); + p = GRPC_SLICE_START_PTR(content_type_hdr); + *p++ = 0x00; + *p++ = 12; + *p++ = 'c'; + *p++ = 'o'; + *p++ = 'n'; + *p++ = 't'; + *p++ = 'e'; + *p++ = 'n'; + *p++ = 't'; + *p++ = '-'; + *p++ = 't'; + *p++ = 'y'; + *p++ = 'p'; + *p++ = 'e'; + *p++ = 16; + *p++ = 'a'; + *p++ = 'p'; + *p++ = 'p'; + *p++ = 'l'; + *p++ = 'i'; + *p++ = 'c'; + *p++ = 'a'; + *p++ = 't'; + *p++ = 'i'; + *p++ = 'o'; + *p++ = 'n'; + *p++ = '/'; + *p++ = 'g'; + *p++ = 'r'; + *p++ = 'p'; + *p++ = 'c'; + GPR_ASSERT(p == GRPC_SLICE_END_PTR(content_type_hdr)); + len += (uint32_t)GRPC_SLICE_LENGTH(content_type_hdr); } status_hdr = grpc_slice_malloc(15 + (grpc_status >= 10)); @@ -1992,6 +2029,7 @@ static void close_from_api(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_slice_buffer_add(&t->qbuf, hdr); if (!s->sent_initial_metadata) { grpc_slice_buffer_add(&t->qbuf, http_status_hdr); + grpc_slice_buffer_add(&t->qbuf, content_type_hdr); } grpc_slice_buffer_add(&t->qbuf, status_hdr); grpc_slice_buffer_add(&t->qbuf, message_pfx); From e899e32710ba6742d986a3c7725a2358d1081f83 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 10 Apr 2017 18:14:49 -0700 Subject: [PATCH 299/461] Move deframe_unprocessed_incoming_frames to frame_data.c --- .../chttp2/transport/chttp2_transport.c | 181 +----------------- .../transport/chttp2/transport/frame_data.c | 178 +++++++++++++++++ .../transport/chttp2/transport/frame_data.h | 7 + 3 files changed, 186 insertions(+), 180 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index c78c8def69e..093370d11a9 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -44,6 +44,7 @@ #include #include +#include "src/core/ext/transport/chttp2/transport/frame_data.h" #include "src/core/ext/transport/chttp2/transport/internal.h" #include "src/core/ext/transport/chttp2/transport/varint.h" #include "src/core/lib/channel/channel_args.h" @@ -179,10 +180,6 @@ static void finish_keepalive_ping_locked(grpc_exec_ctx *exec_ctx, void *arg, static void keepalive_watchdog_fired_locked(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error); -static grpc_error *deframe_unprocessed_incoming_frames( - grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *p, grpc_chttp2_stream *s, - grpc_slice_buffer *slices, grpc_slice *slice_out, - grpc_byte_stream **stream_out); static void reset_byte_stream(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error); @@ -2441,182 +2438,6 @@ static void reset_byte_stream(grpc_exec_ctx *exec_ctx, void *arg, } } -static grpc_error *deframe_unprocessed_incoming_frames( - grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *p, grpc_chttp2_stream *s, - grpc_slice_buffer *slices, grpc_slice *slice_out, - grpc_byte_stream **stream_out) { - grpc_error *error = GRPC_ERROR_NONE; - grpc_chttp2_transport *t = s->t; - - while (slices->count > 0) { - uint8_t *beg = NULL; - uint8_t *end = NULL; - uint8_t *cur = NULL; - - grpc_slice slice = grpc_slice_buffer_take_first(slices); - - beg = GRPC_SLICE_START_PTR(slice); - end = GRPC_SLICE_END_PTR(slice); - cur = beg; - uint32_t message_flags; - char *msg; - - if (cur == end) { - grpc_slice_unref_internal(exec_ctx, slice); - continue; - } - - switch (p->state) { - case GRPC_CHTTP2_DATA_ERROR: - p->state = GRPC_CHTTP2_DATA_ERROR; - grpc_slice_unref_internal(exec_ctx, slice); - return GRPC_ERROR_REF(p->error); - case GRPC_CHTTP2_DATA_FH_0: - p->frame_type = *cur; - switch (p->frame_type) { - case 0: - p->is_frame_compressed = 0; /* GPR_FALSE */ - break; - case 1: - p->is_frame_compressed = 1; /* GPR_TRUE */ - break; - default: - gpr_asprintf(&msg, "Bad GRPC frame type 0x%02x", p->frame_type); - p->error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg); - p->error = grpc_error_set_int(p->error, GRPC_ERROR_INT_STREAM_ID, - (intptr_t)s->id); - gpr_free(msg); - msg = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); - p->error = grpc_error_set_str(p->error, GRPC_ERROR_STR_RAW_BYTES, - grpc_slice_from_copied_string(msg)); - gpr_free(msg); - p->error = - grpc_error_set_int(p->error, GRPC_ERROR_INT_OFFSET, cur - beg); - p->state = GRPC_CHTTP2_DATA_ERROR; - grpc_slice_unref_internal(exec_ctx, slice); - return GRPC_ERROR_REF(p->error); - } - if (++cur == end) { - p->state = GRPC_CHTTP2_DATA_FH_1; - grpc_slice_unref_internal(exec_ctx, slice); - continue; - } - /* fallthrough */ - case GRPC_CHTTP2_DATA_FH_1: - p->frame_size = ((uint32_t)*cur) << 24; - if (++cur == end) { - p->state = GRPC_CHTTP2_DATA_FH_2; - grpc_slice_unref_internal(exec_ctx, slice); - continue; - } - /* fallthrough */ - case GRPC_CHTTP2_DATA_FH_2: - p->frame_size |= ((uint32_t)*cur) << 16; - if (++cur == end) { - p->state = GRPC_CHTTP2_DATA_FH_3; - grpc_slice_unref_internal(exec_ctx, slice); - continue; - } - /* fallthrough */ - case GRPC_CHTTP2_DATA_FH_3: - p->frame_size |= ((uint32_t)*cur) << 8; - if (++cur == end) { - p->state = GRPC_CHTTP2_DATA_FH_4; - grpc_slice_unref_internal(exec_ctx, slice); - continue; - } - /* fallthrough */ - case GRPC_CHTTP2_DATA_FH_4: - GPR_ASSERT(stream_out != NULL); - GPR_ASSERT(p->parsing_frame == NULL); - p->frame_size |= ((uint32_t)*cur); - p->state = GRPC_CHTTP2_DATA_FRAME; - ++cur; - message_flags = 0; - if (p->is_frame_compressed) { - message_flags |= GRPC_WRITE_INTERNAL_COMPRESS; - } - p->parsing_frame = grpc_chttp2_incoming_byte_stream_create( - exec_ctx, t, s, p->frame_size, message_flags); - *stream_out = &p->parsing_frame->base; - if (p->parsing_frame->remaining_bytes == 0) { - grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, - GRPC_ERROR_NONE, 1); - p->parsing_frame = NULL; - p->state = GRPC_CHTTP2_DATA_FH_0; - } - s->pending_byte_stream = true; - - if (cur != end) { - grpc_slice_buffer_undo_take_first( - &s->unprocessed_incoming_frames_buffer, - grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); - } - grpc_slice_unref_internal(exec_ctx, slice); - return GRPC_ERROR_NONE; - case GRPC_CHTTP2_DATA_FRAME: { - GPR_ASSERT(p->parsing_frame != NULL); - GPR_ASSERT(slice_out != NULL); - if (cur == end) { - grpc_slice_unref_internal(exec_ctx, slice); - continue; - } - uint32_t remaining = (uint32_t)(end - cur); - if (remaining == p->frame_size) { - if (GRPC_ERROR_NONE != (error = grpc_chttp2_incoming_byte_stream_push( - exec_ctx, p->parsing_frame, - grpc_slice_sub(slice, (size_t)(cur - beg), - (size_t)(end - beg)), - slice_out))) { - grpc_slice_unref_internal(exec_ctx, slice); - return error; - } - grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, - GRPC_ERROR_NONE, 1); - p->parsing_frame = NULL; - p->state = GRPC_CHTTP2_DATA_FH_0; - grpc_slice_unref_internal(exec_ctx, slice); - return GRPC_ERROR_NONE; - } else if (remaining < p->frame_size) { - if (GRPC_ERROR_NONE != (error = grpc_chttp2_incoming_byte_stream_push( - exec_ctx, p->parsing_frame, - grpc_slice_sub(slice, (size_t)(cur - beg), - (size_t)(end - beg)), - slice_out))) { - return error; - } - p->frame_size -= remaining; - grpc_slice_unref_internal(exec_ctx, slice); - return GRPC_ERROR_NONE; - } else { - GPR_ASSERT(remaining > p->frame_size); - if (GRPC_ERROR_NONE != - (grpc_chttp2_incoming_byte_stream_push( - exec_ctx, p->parsing_frame, - grpc_slice_sub(slice, (size_t)(cur - beg), - (size_t)(cur + p->frame_size - beg)), - slice_out))) { - grpc_slice_unref_internal(exec_ctx, slice); - return error; - } - grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, - GRPC_ERROR_NONE, 1); - p->parsing_frame = NULL; - p->state = GRPC_CHTTP2_DATA_FH_0; - cur += p->frame_size; - grpc_slice_buffer_undo_take_first( - &s->unprocessed_incoming_frames_buffer, - grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); - grpc_slice_unref_internal(exec_ctx, slice); - return GRPC_ERROR_NONE; - } - } - } - } - - return GRPC_ERROR_NONE; -} - static void incoming_byte_stream_unref(grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs) { if (gpr_unref(&bs->refs)) { diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c index af754e1a779..4aa61ae68ea 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -112,6 +112,184 @@ void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer *inbuf, stats->data_bytes += write_bytes; } +grpc_error *deframe_unprocessed_incoming_frames(grpc_exec_ctx *exec_ctx, + grpc_chttp2_data_parser *p, + grpc_chttp2_stream *s, + grpc_slice_buffer *slices, + grpc_slice *slice_out, + grpc_byte_stream **stream_out) { + grpc_error *error = GRPC_ERROR_NONE; + grpc_chttp2_transport *t = s->t; + + while (slices->count > 0) { + uint8_t *beg = NULL; + uint8_t *end = NULL; + uint8_t *cur = NULL; + + grpc_slice slice = grpc_slice_buffer_take_first(slices); + + beg = GRPC_SLICE_START_PTR(slice); + end = GRPC_SLICE_END_PTR(slice); + cur = beg; + uint32_t message_flags; + char *msg; + + if (cur == end) { + grpc_slice_unref_internal(exec_ctx, slice); + continue; + } + + switch (p->state) { + case GRPC_CHTTP2_DATA_ERROR: + p->state = GRPC_CHTTP2_DATA_ERROR; + grpc_slice_unref_internal(exec_ctx, slice); + return GRPC_ERROR_REF(p->error); + case GRPC_CHTTP2_DATA_FH_0: + p->frame_type = *cur; + switch (p->frame_type) { + case 0: + p->is_frame_compressed = 0; /* GPR_FALSE */ + break; + case 1: + p->is_frame_compressed = 1; /* GPR_TRUE */ + break; + default: + gpr_asprintf(&msg, "Bad GRPC frame type 0x%02x", p->frame_type); + p->error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg); + p->error = grpc_error_set_int(p->error, GRPC_ERROR_INT_STREAM_ID, + (intptr_t)s->id); + gpr_free(msg); + msg = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); + p->error = grpc_error_set_str(p->error, GRPC_ERROR_STR_RAW_BYTES, + grpc_slice_from_copied_string(msg)); + gpr_free(msg); + p->error = + grpc_error_set_int(p->error, GRPC_ERROR_INT_OFFSET, cur - beg); + p->state = GRPC_CHTTP2_DATA_ERROR; + grpc_slice_unref_internal(exec_ctx, slice); + return GRPC_ERROR_REF(p->error); + } + if (++cur == end) { + p->state = GRPC_CHTTP2_DATA_FH_1; + grpc_slice_unref_internal(exec_ctx, slice); + continue; + } + /* fallthrough */ + case GRPC_CHTTP2_DATA_FH_1: + p->frame_size = ((uint32_t)*cur) << 24; + if (++cur == end) { + p->state = GRPC_CHTTP2_DATA_FH_2; + grpc_slice_unref_internal(exec_ctx, slice); + continue; + } + /* fallthrough */ + case GRPC_CHTTP2_DATA_FH_2: + p->frame_size |= ((uint32_t)*cur) << 16; + if (++cur == end) { + p->state = GRPC_CHTTP2_DATA_FH_3; + grpc_slice_unref_internal(exec_ctx, slice); + continue; + } + /* fallthrough */ + case GRPC_CHTTP2_DATA_FH_3: + p->frame_size |= ((uint32_t)*cur) << 8; + if (++cur == end) { + p->state = GRPC_CHTTP2_DATA_FH_4; + grpc_slice_unref_internal(exec_ctx, slice); + continue; + } + /* fallthrough */ + case GRPC_CHTTP2_DATA_FH_4: + GPR_ASSERT(stream_out != NULL); + GPR_ASSERT(p->parsing_frame == NULL); + p->frame_size |= ((uint32_t)*cur); + p->state = GRPC_CHTTP2_DATA_FRAME; + ++cur; + message_flags = 0; + if (p->is_frame_compressed) { + message_flags |= GRPC_WRITE_INTERNAL_COMPRESS; + } + p->parsing_frame = grpc_chttp2_incoming_byte_stream_create( + exec_ctx, t, s, p->frame_size, message_flags); + *stream_out = &p->parsing_frame->base; + if (p->parsing_frame->remaining_bytes == 0) { + grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, + GRPC_ERROR_NONE, 1); + p->parsing_frame = NULL; + p->state = GRPC_CHTTP2_DATA_FH_0; + } + s->pending_byte_stream = true; + + if (cur != end) { + grpc_slice_buffer_undo_take_first( + &s->unprocessed_incoming_frames_buffer, + grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + } + grpc_slice_unref_internal(exec_ctx, slice); + return GRPC_ERROR_NONE; + case GRPC_CHTTP2_DATA_FRAME: { + GPR_ASSERT(p->parsing_frame != NULL); + GPR_ASSERT(slice_out != NULL); + if (cur == end) { + grpc_slice_unref_internal(exec_ctx, slice); + continue; + } + uint32_t remaining = (uint32_t)(end - cur); + if (remaining == p->frame_size) { + if (GRPC_ERROR_NONE != (error = grpc_chttp2_incoming_byte_stream_push( + exec_ctx, p->parsing_frame, + grpc_slice_sub(slice, (size_t)(cur - beg), + (size_t)(end - beg)), + slice_out))) { + grpc_slice_unref_internal(exec_ctx, slice); + return error; + } + grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, + GRPC_ERROR_NONE, 1); + p->parsing_frame = NULL; + p->state = GRPC_CHTTP2_DATA_FH_0; + grpc_slice_unref_internal(exec_ctx, slice); + return GRPC_ERROR_NONE; + } else if (remaining < p->frame_size) { + if (GRPC_ERROR_NONE != (error = grpc_chttp2_incoming_byte_stream_push( + exec_ctx, p->parsing_frame, + grpc_slice_sub(slice, (size_t)(cur - beg), + (size_t)(end - beg)), + slice_out))) { + return error; + } + p->frame_size -= remaining; + grpc_slice_unref_internal(exec_ctx, slice); + return GRPC_ERROR_NONE; + } else { + GPR_ASSERT(remaining > p->frame_size); + if (GRPC_ERROR_NONE != + (grpc_chttp2_incoming_byte_stream_push( + exec_ctx, p->parsing_frame, + grpc_slice_sub(slice, (size_t)(cur - beg), + (size_t)(cur + p->frame_size - beg)), + slice_out))) { + grpc_slice_unref_internal(exec_ctx, slice); + return error; + } + grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, + GRPC_ERROR_NONE, 1); + p->parsing_frame = NULL; + p->state = GRPC_CHTTP2_DATA_FH_0; + cur += p->frame_size; + grpc_slice_buffer_undo_take_first( + &s->unprocessed_incoming_frames_buffer, + grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + grpc_slice_unref_internal(exec_ctx, slice); + return GRPC_ERROR_NONE; + } + } + } + } + + return GRPC_ERROR_NONE; +} + grpc_error *grpc_chttp2_data_parser_parse(grpc_exec_ctx *exec_ctx, void *parser, grpc_chttp2_transport *t, grpc_chttp2_stream *s, diff --git a/src/core/ext/transport/chttp2/transport/frame_data.h b/src/core/ext/transport/chttp2/transport/frame_data.h index e7e459c79fa..5783f447b53 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.h +++ b/src/core/ext/transport/chttp2/transport/frame_data.h @@ -101,4 +101,11 @@ void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer *inbuf, grpc_transport_one_way_stats *stats, grpc_slice_buffer *outbuf); +grpc_error *deframe_unprocessed_incoming_frames(grpc_exec_ctx *exec_ctx, + grpc_chttp2_data_parser *p, + grpc_chttp2_stream *s, + grpc_slice_buffer *slices, + grpc_slice *slice_out, + grpc_byte_stream **stream_out); + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_DATA_H */ From c248f5b45073850bcb6c05b55870a689dad2ff11 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 10 Apr 2017 18:15:42 -0700 Subject: [PATCH 300/461] int -> bool --- src/core/ext/transport/chttp2/transport/frame_data.c | 4 ++-- src/core/ext/transport/chttp2/transport/frame_data.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c index 4aa61ae68ea..d2193cdb321 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -148,10 +148,10 @@ grpc_error *deframe_unprocessed_incoming_frames(grpc_exec_ctx *exec_ctx, p->frame_type = *cur; switch (p->frame_type) { case 0: - p->is_frame_compressed = 0; /* GPR_FALSE */ + p->is_frame_compressed = false; /* GPR_FALSE */ break; case 1: - p->is_frame_compressed = 1; /* GPR_TRUE */ + p->is_frame_compressed = true; /* GPR_TRUE */ break; default: gpr_asprintf(&msg, "Bad GRPC frame type 0x%02x", p->frame_type); diff --git a/src/core/ext/transport/chttp2/transport/frame_data.h b/src/core/ext/transport/chttp2/transport/frame_data.h index 5783f447b53..17cc8d20736 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.h +++ b/src/core/ext/transport/chttp2/transport/frame_data.h @@ -67,7 +67,7 @@ typedef struct { uint32_t frame_size; grpc_error *error; - int is_frame_compressed; + bool is_frame_compressed; grpc_chttp2_incoming_byte_stream *parsing_frame; } grpc_chttp2_data_parser; From afdad3e8bb40f1f771e24cd6dded81e91603a971 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 10 Apr 2017 18:22:05 -0700 Subject: [PATCH 301/461] clean up unused code --- src/core/ext/transport/chttp2/transport/frame_data.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/frame_data.h b/src/core/ext/transport/chttp2/transport/frame_data.h index 17cc8d20736..2fb8983c38e 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.h +++ b/src/core/ext/transport/chttp2/transport/frame_data.h @@ -56,11 +56,6 @@ typedef enum { typedef struct grpc_chttp2_incoming_byte_stream grpc_chttp2_incoming_byte_stream; -typedef struct grpc_chttp2_incoming_frame_queue { - grpc_chttp2_incoming_byte_stream *head; - grpc_chttp2_incoming_byte_stream *tail; -} grpc_chttp2_incoming_frame_queue; - typedef struct { grpc_chttp2_stream_state state; uint8_t frame_type; @@ -71,12 +66,6 @@ typedef struct { grpc_chttp2_incoming_byte_stream *parsing_frame; } grpc_chttp2_data_parser; -void grpc_chttp2_incoming_frame_queue_merge( - grpc_chttp2_incoming_frame_queue *head_dst, - grpc_chttp2_incoming_frame_queue *tail_src); -grpc_byte_stream *grpc_chttp2_incoming_frame_queue_pop( - grpc_chttp2_incoming_frame_queue *q); - /* initialize per-stream state for data frame parsing */ grpc_error *grpc_chttp2_data_parser_init(grpc_chttp2_data_parser *parser); From 02646c3f62d6e5b07b62ffbdacfb64ae7946b721 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 10 Apr 2017 18:28:23 -0700 Subject: [PATCH 302/461] int -> bool --- .../transport/chttp2/transport/chttp2_transport.c | 12 ++++++------ src/core/lib/transport/byte_stream.c | 10 +++++----- src/core/lib/transport/byte_stream.h | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 093370d11a9..a0bce1e0775 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -2536,16 +2536,16 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx *exec_ctx, incoming_byte_stream_unref(exec_ctx, bs); } -static int incoming_byte_stream_next(grpc_exec_ctx *exec_ctx, - grpc_byte_stream *byte_stream, - size_t max_size_hint, - grpc_closure *on_complete) { +static bool incoming_byte_stream_next(grpc_exec_ctx *exec_ctx, + grpc_byte_stream *byte_stream, + size_t max_size_hint, + grpc_closure *on_complete) { GPR_TIMER_BEGIN("incoming_byte_stream_next", 0); grpc_chttp2_incoming_byte_stream *bs = (grpc_chttp2_incoming_byte_stream *)byte_stream; grpc_chttp2_stream *s = bs->stream; if (s->unprocessed_incoming_frames_buffer.length > 0) { - return 1; + return true; } else { gpr_ref(&bs->refs); bs->next_action.max_size_hint = max_size_hint; @@ -2557,7 +2557,7 @@ static int incoming_byte_stream_next(grpc_exec_ctx *exec_ctx, grpc_combiner_scheduler(bs->transport->combiner, false)), GRPC_ERROR_NONE); GPR_TIMER_END("incoming_byte_stream_next", 0); - return 0; + return false; } } diff --git a/src/core/lib/transport/byte_stream.c b/src/core/lib/transport/byte_stream.c index 79801c4b465..5800c70ef44 100644 --- a/src/core/lib/transport/byte_stream.c +++ b/src/core/lib/transport/byte_stream.c @@ -58,13 +58,13 @@ void grpc_byte_stream_destroy(grpc_exec_ctx *exec_ctx, /* slice_buffer_stream */ -static int slice_buffer_stream_next(grpc_exec_ctx *exec_ctx, - grpc_byte_stream *byte_stream, - size_t max_size_hint, - grpc_closure *on_complete) { +static bool slice_buffer_stream_next(grpc_exec_ctx *exec_ctx, + grpc_byte_stream *byte_stream, + size_t max_size_hint, + grpc_closure *on_complete) { grpc_slice_buffer_stream *stream = (grpc_slice_buffer_stream *)byte_stream; GPR_ASSERT(stream->cursor < stream->backing_buffer->count); - return 1; + return true; } static grpc_error *slice_buffer_stream_pull(grpc_exec_ctx *exec_ctx, diff --git a/src/core/lib/transport/byte_stream.h b/src/core/lib/transport/byte_stream.h index 800e2341f9e..381c65fb044 100644 --- a/src/core/lib/transport/byte_stream.h +++ b/src/core/lib/transport/byte_stream.h @@ -49,8 +49,8 @@ typedef struct grpc_byte_stream grpc_byte_stream; struct grpc_byte_stream { uint32_t length; uint32_t flags; - int (*next)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, - size_t max_size_hint, grpc_closure *on_complete); + bool (*next)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, + size_t max_size_hint, grpc_closure *on_complete); grpc_error *(*pull)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, grpc_slice *slice); void (*destroy)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream); From 6cc2a993a4f6dac641c7de640876775e22f2aac2 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 10 Apr 2017 18:30:53 -0700 Subject: [PATCH 303/461] Remove redundant assignment --- src/core/ext/transport/chttp2/transport/chttp2_transport.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index a0bce1e0775..1cbd0782113 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -2626,10 +2626,9 @@ static void incoming_byte_stream_publish_error( grpc_closure_sched(exec_ctx, s->on_next, GRPC_ERROR_REF(error)); s->on_next = NULL; GRPC_ERROR_UNREF(s->byte_stream_error); - s->byte_stream_error = GRPC_ERROR_NONE; + s->byte_stream_error = GRPC_ERROR_REF(error); grpc_chttp2_cancel_stream(exec_ctx, bs->transport, bs->stream, GRPC_ERROR_REF(error)); - s->byte_stream_error = GRPC_ERROR_REF(error); } grpc_error *grpc_chttp2_incoming_byte_stream_push( From 9da7b95c27843136e3ca92ac71b141978344339a Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 10 Apr 2017 18:33:01 -0700 Subject: [PATCH 304/461] int -> bool --- .../ext/transport/chttp2/transport/chttp2_transport.c | 2 +- src/core/ext/transport/chttp2/transport/frame_data.c | 8 ++++---- src/core/ext/transport/chttp2/transport/internal.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 1cbd0782113..4146701af6e 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -2654,7 +2654,7 @@ grpc_error *grpc_chttp2_incoming_byte_stream_push( grpc_error *grpc_chttp2_incoming_byte_stream_finished( grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, - grpc_error *error, int reset_on_error) { + grpc_error *error, bool reset_on_error) { grpc_chttp2_stream *s = bs->stream; if (error == GRPC_ERROR_NONE) { diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c index d2193cdb321..1f51e0cd6fc 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -56,7 +56,7 @@ void grpc_chttp2_data_parser_destroy(grpc_exec_ctx *exec_ctx, if (parser->parsing_frame != NULL) { grpc_chttp2_incoming_byte_stream_finished( exec_ctx, parser->parsing_frame, - GRPC_ERROR_CREATE_FROM_STATIC_STRING("Parser destroyed"), 0); + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Parser destroyed"), false); } GRPC_ERROR_UNREF(parser->error); } @@ -214,7 +214,7 @@ grpc_error *deframe_unprocessed_incoming_frames(grpc_exec_ctx *exec_ctx, *stream_out = &p->parsing_frame->base; if (p->parsing_frame->remaining_bytes == 0) { grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, - GRPC_ERROR_NONE, 1); + GRPC_ERROR_NONE, true); p->parsing_frame = NULL; p->state = GRPC_CHTTP2_DATA_FH_0; } @@ -245,7 +245,7 @@ grpc_error *deframe_unprocessed_incoming_frames(grpc_exec_ctx *exec_ctx, return error; } grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, - GRPC_ERROR_NONE, 1); + GRPC_ERROR_NONE, true); p->parsing_frame = NULL; p->state = GRPC_CHTTP2_DATA_FH_0; grpc_slice_unref_internal(exec_ctx, slice); @@ -273,7 +273,7 @@ grpc_error *deframe_unprocessed_incoming_frames(grpc_exec_ctx *exec_ctx, return error; } grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, - GRPC_ERROR_NONE, 1); + GRPC_ERROR_NONE, true); p->parsing_frame = NULL; p->state = GRPC_CHTTP2_DATA_FH_0; cur += p->frame_size; diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 773f541e97a..d5767c8d8da 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -792,7 +792,7 @@ grpc_error *grpc_chttp2_incoming_byte_stream_push( grpc_slice slice, grpc_slice *slice_out); grpc_error *grpc_chttp2_incoming_byte_stream_finished( grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, - grpc_error *error, int reset_on_error); + grpc_error *error, bool reset_on_error); void grpc_chttp2_incoming_byte_stream_notify( grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, grpc_error *error); From 2c01070bc3119d1f5e0dce33b72928fb87a55505 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 10 Apr 2017 19:20:58 -0700 Subject: [PATCH 305/461] Work with error refs --- .../chttp2/transport/chttp2_transport.c | 1 - .../transport/chttp2/transport/frame_data.c | 24 ++++++++++++------- src/core/lib/surface/call.c | 8 +++++++ 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 4146701af6e..0002253dfee 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -2665,7 +2665,6 @@ grpc_error *grpc_chttp2_incoming_byte_stream_finished( if (error != GRPC_ERROR_NONE && reset_on_error) { grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error)); } - GRPC_ERROR_UNREF(error); incoming_byte_stream_unref(exec_ctx, bs); return error; } diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c index 1f51e0cd6fc..5d382d80a8b 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -54,9 +54,9 @@ grpc_error *grpc_chttp2_data_parser_init(grpc_chttp2_data_parser *parser) { void grpc_chttp2_data_parser_destroy(grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *parser) { if (parser->parsing_frame != NULL) { - grpc_chttp2_incoming_byte_stream_finished( + GRPC_ERROR_UNREF(grpc_chttp2_incoming_byte_stream_finished( exec_ctx, parser->parsing_frame, - GRPC_ERROR_CREATE_FROM_STATIC_STRING("Parser destroyed"), false); + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Parser destroyed"), false)); } GRPC_ERROR_UNREF(parser->error); } @@ -213,8 +213,8 @@ grpc_error *deframe_unprocessed_incoming_frames(grpc_exec_ctx *exec_ctx, exec_ctx, t, s, p->frame_size, message_flags); *stream_out = &p->parsing_frame->base; if (p->parsing_frame->remaining_bytes == 0) { - grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, - GRPC_ERROR_NONE, true); + GRPC_ERROR_UNREF(grpc_chttp2_incoming_byte_stream_finished( + exec_ctx, p->parsing_frame, GRPC_ERROR_NONE, true)); p->parsing_frame = NULL; p->state = GRPC_CHTTP2_DATA_FH_0; } @@ -244,8 +244,12 @@ grpc_error *deframe_unprocessed_incoming_frames(grpc_exec_ctx *exec_ctx, grpc_slice_unref_internal(exec_ctx, slice); return error; } - grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, - GRPC_ERROR_NONE, true); + if (GRPC_ERROR_NONE != + (error = grpc_chttp2_incoming_byte_stream_finished( + exec_ctx, p->parsing_frame, GRPC_ERROR_NONE, true))) { + grpc_slice_unref_internal(exec_ctx, slice); + return error; + } p->parsing_frame = NULL; p->state = GRPC_CHTTP2_DATA_FH_0; grpc_slice_unref_internal(exec_ctx, slice); @@ -272,8 +276,12 @@ grpc_error *deframe_unprocessed_incoming_frames(grpc_exec_ctx *exec_ctx, grpc_slice_unref_internal(exec_ctx, slice); return error; } - grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, - GRPC_ERROR_NONE, true); + if (GRPC_ERROR_NONE != + (error = grpc_chttp2_incoming_byte_stream_finished( + exec_ctx, p->parsing_frame, GRPC_ERROR_NONE, true))) { + grpc_slice_unref_internal(exec_ctx, slice); + return error; + } p->parsing_frame = NULL; p->state = GRPC_CHTTP2_DATA_FH_0; cur += p->frame_size; diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index b1cb7f7fb1c..3e96d097985 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -1226,6 +1226,7 @@ static void receiving_slice_ready(grpc_exec_ctx *exec_ctx, void *bctlp, batch_control *bctl = bctlp; grpc_call *call = bctl->call; grpc_byte_stream *bs = call->receiving_stream; + bool release_error = false; if (error == GRPC_ERROR_NONE) { grpc_slice slice; @@ -1234,6 +1235,10 @@ static void receiving_slice_ready(grpc_exec_ctx *exec_ctx, void *bctlp, grpc_slice_buffer_add(&(*call->receiving_buffer)->data.raw.slice_buffer, slice); continue_receiving_slices(exec_ctx, bctl); + } else { + /* Error returned by grpc_byte_stream_pull needs to be released manually + */ + release_error = true; } } @@ -1247,6 +1252,9 @@ static void receiving_slice_ready(grpc_exec_ctx *exec_ctx, void *bctlp, *call->receiving_buffer = NULL; call->receiving_message = 0; finish_batch_step(exec_ctx, bctl); + if (release_error) { + GRPC_ERROR_UNREF(error); + } } } From 9396914c1430e9974e5315065d93eb634302fa06 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 10 Apr 2017 19:28:34 -0700 Subject: [PATCH 306/461] Work with error refs --- src/core/ext/transport/chttp2/transport/chttp2_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 0002253dfee..1e9a460628e 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1671,7 +1671,6 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, &s->frame_storage); grpc_slice_buffer_reset_and_unref_internal( exec_ctx, &s->unprocessed_incoming_frames_buffer); - GRPC_ERROR_UNREF(error); break; } else if (*s->recv_message != NULL) { break; @@ -1684,6 +1683,7 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, *s->recv_message = NULL; null_then_run_closure(exec_ctx, &s->recv_message_ready, GRPC_ERROR_NONE); } + GRPC_ERROR_UNREF(error); } } From 3ce4d9c715274d46fb1ca6e6e99dd29ffb183b8f Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 10 Apr 2017 19:36:37 -0700 Subject: [PATCH 307/461] Remove unused variable --- src/core/ext/transport/chttp2/transport/chttp2_transport.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 1e9a460628e..54c0252fb99 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -2683,7 +2683,6 @@ grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( gpr_ref_init(&incoming_byte_stream->refs, 2); incoming_byte_stream->transport = t; incoming_byte_stream->stream = s; - incoming_byte_stream->is_tail = 1; s->byte_stream_error = GRPC_ERROR_NONE; return incoming_byte_stream; } From 62f91a43cd7a7d518807c553be4dc6145fb842ae Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 10 Apr 2017 19:37:19 -0700 Subject: [PATCH 308/461] Update comments on variables thread safety --- .../ext/transport/chttp2/transport/internal.h | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index d5767c8d8da..cc904178cfa 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -198,15 +198,20 @@ struct grpc_chttp2_incoming_byte_stream { grpc_chttp2_transport *transport; /* immutable */ grpc_chttp2_stream *stream; /* immutable */ - bool is_tail; /* immutable */ - uint32_t remaining_bytes; /* guaranteed one thread access */ + /* Accessed only by transport thread when stream->pending_byte_stream == false + * Accessed only by application thread when stream->pending_byte_stream == + * true */ + uint32_t remaining_bytes; + /* Accessed only by transport thread when stream->pending_byte_stream == false + * Accessed only by application thread when stream->pending_byte_stream == + * true */ struct { grpc_closure closure; size_t max_size_hint; grpc_closure *on_complete; - } next_action; /* guaranteed one thread access */ + } next_action; grpc_closure destroy_action; grpc_closure finished_action; }; @@ -490,13 +495,16 @@ struct grpc_chttp2_stream { grpc_chttp2_incoming_metadata_buffer metadata_buffer[2]; grpc_slice_buffer frame_storage; /* protected by t combiner */ - grpc_slice_buffer - unprocessed_incoming_frames_buffer; /* guaranteed one thread access */ + + /* Accessed only by transport thread when stream->pending_byte_stream == false + * Accessed only by application thread when stream->pending_byte_stream == + * true */ + grpc_slice_buffer unprocessed_incoming_frames_buffer; grpc_closure *on_next; /* protected by t combiner */ bool pending_byte_stream; /* protected by t combiner */ grpc_closure reset_byte_stream; grpc_error *byte_stream_error; /* protected by t combiner */ - bool received_last_frame; /* proected by t combiner */ + bool received_last_frame; /* protected by t combiner */ gpr_timespec deadline; @@ -509,7 +517,10 @@ struct grpc_chttp2_stream { * incoming_window = incoming_window_delta + transport.initial_window_size */ int64_t incoming_window_delta; /** parsing state for data frames */ - grpc_chttp2_data_parser data_parser; /* guaranteed one thread access */ + /* Accessed only by transport thread when stream->pending_byte_stream == false + * Accessed only by application thread when stream->pending_byte_stream == + * true */ + grpc_chttp2_data_parser data_parser; /** number of bytes received - reset at end of parse thread execution */ int64_t received_bytes; From 64657762f09939f77a6ed6cd635947ab94c6dae0 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Mon, 10 Apr 2017 22:54:14 -0700 Subject: [PATCH 309/461] Generate projects --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fcd2d01310..7ef7311627e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8981,7 +8981,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(bm_cq_multiple_threads test/cpp/microbenchmarks/bm_cq_multiple_threads.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -8998,8 +8998,8 @@ target_include_directories(bm_cq_multiple_threads PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) From 78cb931afd9bf4ae33ecaf26dbd498cff41d6b52 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 11 Apr 2017 11:04:42 +0200 Subject: [PATCH 310/461] address review comments --- tools/run_tests/helper_scripts/build_csharp.sh | 10 ++++------ tools/run_tests/helper_scripts/pre_build_csharp.bat | 3 +-- tools/run_tests/run_tests.py | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/tools/run_tests/helper_scripts/build_csharp.sh b/tools/run_tests/helper_scripts/build_csharp.sh index 00897ecbe6c..a7562a7f4a3 100755 --- a/tools/run_tests/helper_scripts/build_csharp.sh +++ b/tools/run_tests/helper_scripts/build_csharp.sh @@ -32,12 +32,10 @@ set -ex cd $(dirname $0)/../../../src/csharp -OVERRIDE_NATIVELIB_MAYBE="" if [ "$CONFIG" == "gcov" ] then - # overriding NativeDependenciesConfigurationUnix makes C# project pick up - # the gcov flavor of grpc_csharp_ext - OVERRIDE_NATIVELIB_MAYBE="/p:NativeDependenciesConfigurationUnix=$CONFIG" + # overriding NativeDependenciesConfigurationUnix makes C# project pick up the gcov flavor of grpc_csharp_ext + dotnet build --configuration $MSBUILD_CONFIG /p:NativeDependenciesConfigurationUnix=gcov Grpc.sln +else + dotnet build --configuration $MSBUILD_CONFIG Grpc.sln fi - -dotnet build --configuration $MSBUILD_CONFIG $OVERRIDE_NATIVELIB_MAYBE Grpc.sln diff --git a/tools/run_tests/helper_scripts/pre_build_csharp.bat b/tools/run_tests/helper_scripts/pre_build_csharp.bat index c7684f538e3..e59dac4edce 100644 --- a/tools/run_tests/helper_scripts/pre_build_csharp.bat +++ b/tools/run_tests/helper_scripts/pre_build_csharp.bat @@ -44,9 +44,8 @@ mkdir %ARCHITECTURE% cd %ARCHITECTURE% @rem TODO(jtattermusch): Stop hardcoding path to yasm once Jenkins workers can locate yasm correctly cmake -G "Visual Studio 14 2015" -A %ARCHITECTURE% -DgRPC_BUILD_TESTS=OFF -DgRPC_MSVC_STATIC_RUNTIME=ON -DCMAKE_ASM_NASM_COMPILER="C:/Program Files (x86)/yasm/yasm.exe" ../../.. || goto :error -cd ..\..\.. -cd src/csharp +cd ..\..\..\src\csharp dotnet restore Grpc.sln || goto :error diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 9fa7cca14e3..23abda376b5 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -763,7 +763,7 @@ class CSharpLanguage(object): tests_by_assembly = json.load(f) msbuild_config = _MSBUILD_CONFIG[self.config.build_config] - nunit_args = ['--labels=All','--noresult', '--workers=1'] + nunit_args = ['--labels=All', '--noresult', '--workers=1'] assembly_subdir = 'bin/%s' % msbuild_config assembly_extension = '.exe' From a002b2413dac2b8c4304349d549c7f30a9f4aff0 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 11 Apr 2017 09:19:42 -0700 Subject: [PATCH 311/461] clang-format --- src/core/ext/transport/chttp2/transport/internal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index cc904178cfa..a10e3886ea1 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -500,8 +500,8 @@ struct grpc_chttp2_stream { * Accessed only by application thread when stream->pending_byte_stream == * true */ grpc_slice_buffer unprocessed_incoming_frames_buffer; - grpc_closure *on_next; /* protected by t combiner */ - bool pending_byte_stream; /* protected by t combiner */ + grpc_closure *on_next; /* protected by t combiner */ + bool pending_byte_stream; /* protected by t combiner */ grpc_closure reset_byte_stream; grpc_error *byte_stream_error; /* protected by t combiner */ bool received_last_frame; /* protected by t combiner */ From 50858f51c1146f02c24145d033f10b8b1eaa3e45 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 11 Apr 2017 09:25:36 -0700 Subject: [PATCH 312/461] generate_project --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fcd2d01310..7ef7311627e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8981,7 +8981,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(bm_cq_multiple_threads test/cpp/microbenchmarks/bm_cq_multiple_threads.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -8998,8 +8998,8 @@ target_include_directories(bm_cq_multiple_threads PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) From 108a109c02ae38d2253673edde592b17c54fb49c Mon Sep 17 00:00:00 2001 From: Chris Trimble Date: Wed, 11 Jan 2017 18:05:08 -0800 Subject: [PATCH 313/461] Google Compute Metadata hostname fix From within containers (or possibly other scenarios), the metadata hostname might not resolve on GCP. Setting this to the full path guarantees it will resolve. --- src/core/lib/security/credentials/credentials.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/lib/security/credentials/credentials.h b/src/core/lib/security/credentials/credentials.h index 510b79552a3..89b8e3c0b38 100644 --- a/src/core/lib/security/credentials/credentials.h +++ b/src/core/lib/security/credentials/credentials.h @@ -71,7 +71,7 @@ typedef enum { #define GRPC_SECURE_TOKEN_REFRESH_THRESHOLD_SECS 60 -#define GRPC_COMPUTE_ENGINE_METADATA_HOST "metadata" +#define GRPC_COMPUTE_ENGINE_METADATA_HOST "metadata.google.internal" #define GRPC_COMPUTE_ENGINE_METADATA_TOKEN_PATH \ "/computeMetadata/v1/instance/service-accounts/default/token" From 82d8b28036a5f222b21f38d739f3b6965346f04d Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 11 Apr 2017 10:08:07 -0700 Subject: [PATCH 314/461] generate_project --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4356fcbb4b2..2b94f861f84 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8988,7 +8988,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(bm_cq_multiple_threads test/cpp/microbenchmarks/bm_cq_multiple_threads.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -9005,8 +9005,8 @@ target_include_directories(bm_cq_multiple_threads PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) From 95a15a137c67acf8ea2ed9bfd133acbede522714 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 11 Apr 2017 10:13:41 -0700 Subject: [PATCH 315/461] Deal with initial_metadata/send_message ordering issues in message_compress_filter --- .../message_compress_filter.c | 80 +++++++++++++++---- 1 file changed, 64 insertions(+), 16 deletions(-) diff --git a/src/core/ext/filters/http/message_compress/message_compress_filter.c b/src/core/ext/filters/http/message_compress/message_compress_filter.c index 1cbc8526865..23b100d8ee6 100644 --- a/src/core/ext/filters/http/message_compress/message_compress_filter.c +++ b/src/core/ext/filters/http/message_compress/message_compress_filter.c @@ -51,6 +51,10 @@ int grpc_compression_trace = 0; +#define INITIAL_METADATA_UNSEEN 0 +#define HAS_COMPRESSION_ALGORITHM 1 +#define NO_COMPRESSION_ALGORITHM 2 + typedef struct call_data { grpc_slice_buffer slices; /**< Buffers up input slices to be compressed */ grpc_linked_mdelem compression_algorithm_storage; @@ -59,8 +63,16 @@ typedef struct call_data { /** Compression algorithm we'll try to use. It may be given by incoming * metadata, or by the channel's default compression settings. */ grpc_compression_algorithm compression_algorithm; - /** If true, contents of \a compression_algorithm are authoritative */ - int has_compression_algorithm; + + /* Atomic recording the state of initial metadata; allowed values: + INITIAL_METADATA_UNSEEN - initial metadata op not seen + HAS_COMPRESSION_ALGORITHM - initial metadata seen; compression algorithm + set + NO_COMPRESSION_ALGORITHM - initial metadata seen; no compression algorithm + set + pointer - a stalled op containing a send_message that's waiting on initial + metadata */ + gpr_atm send_initial_metadata_state; grpc_transport_stream_op_batch *send_op; uint32_t send_length; @@ -81,14 +93,15 @@ typedef struct channel_data { uint32_t supported_compression_algorithms; } channel_data; -static int skip_compression(grpc_call_element *elem, uint32_t flags) { +static bool skip_compression(grpc_call_element *elem, uint32_t flags, + bool has_compression_algorithm) { call_data *calld = elem->call_data; channel_data *channeld = elem->channel_data; if (flags & (GRPC_WRITE_NO_COMPRESS | GRPC_WRITE_INTERNAL_COMPRESS)) { return 1; } - if (calld->has_compression_algorithm) { + if (has_compression_algorithm) { if (calld->compression_algorithm == GRPC_COMPRESS_NONE) { return 1; } @@ -101,12 +114,14 @@ static int skip_compression(grpc_call_element *elem, uint32_t flags) { /** Filter initial metadata */ static grpc_error *process_send_initial_metadata( grpc_exec_ctx *exec_ctx, grpc_call_element *elem, - grpc_metadata_batch *initial_metadata) GRPC_MUST_USE_RESULT; + grpc_metadata_batch *initial_metadata, + bool *has_compression_algorithm) GRPC_MUST_USE_RESULT; static grpc_error *process_send_initial_metadata( grpc_exec_ctx *exec_ctx, grpc_call_element *elem, - grpc_metadata_batch *initial_metadata) { + grpc_metadata_batch *initial_metadata, bool *has_compression_algorithm) { call_data *calld = elem->call_data; channel_data *channeld = elem->channel_data; + *has_compression_algorithm = false; /* Parse incoming request for compression. If any, it'll be available * at calld->compression_algorithm */ if (initial_metadata->idx.named.grpc_internal_encoding_request != NULL) { @@ -130,7 +145,7 @@ static grpc_error *process_send_initial_metadata( gpr_free(val); calld->compression_algorithm = GRPC_COMPRESS_NONE; } - calld->has_compression_algorithm = 1; + *has_compression_algorithm = true; grpc_metadata_batch_remove( exec_ctx, initial_metadata, @@ -140,7 +155,7 @@ static grpc_error *process_send_initial_metadata( * exceptionally skipping compression, fall back to the channel * default */ calld->compression_algorithm = channeld->default_compression_algorithm; - calld->has_compression_algorithm = 1; /* GPR_TRUE */ + *has_compression_algorithm = true; } grpc_error *error = GRPC_ERROR_NONE; @@ -251,20 +266,54 @@ static void compress_start_transport_stream_op_batch( GPR_TIMER_BEGIN("compress_start_transport_stream_op_batch", 0); if (op->send_initial_metadata) { + bool has_compression_algorithm; grpc_error *error = process_send_initial_metadata( exec_ctx, elem, - op->payload->send_initial_metadata.send_initial_metadata); + op->payload->send_initial_metadata.send_initial_metadata, + &has_compression_algorithm); if (error != GRPC_ERROR_NONE) { grpc_transport_stream_op_batch_finish_with_failure(exec_ctx, op, error); return; } + gpr_atm cur = gpr_atm_acq_load(&calld->send_initial_metadata_state); + GPR_ASSERT(cur != HAS_COMPRESSION_ALGORITHM && + cur != NO_COMPRESSION_ALGORITHM); + gpr_atm_rel_store(&calld->send_initial_metadata_state, + has_compression_algorithm ? HAS_COMPRESSION_ALGORITHM + : NO_COMPRESSION_ALGORITHM); + if (cur != INITIAL_METADATA_UNSEEN) { + grpc_call_next_op(exec_ctx, elem, (grpc_transport_stream_op_batch *)op); + } } - if (op->send_message && - !skip_compression(elem, op->payload->send_message.send_message->flags)) { - calld->send_op = op; - calld->send_length = op->payload->send_message.send_message->length; - calld->send_flags = op->payload->send_message.send_message->flags; - continue_send_message(exec_ctx, elem); + if (op->send_message) { + gpr_atm cur; + retry_send: + cur = gpr_atm_acq_load(&calld->send_initial_metadata_state); + switch (cur) { + case INITIAL_METADATA_UNSEEN: + if (!gpr_atm_rel_cas(&calld->send_initial_metadata_state, cur, + (gpr_atm)op)) { + goto retry_send; + } + break; + case HAS_COMPRESSION_ALGORITHM: + case NO_COMPRESSION_ALGORITHM: + if (!skip_compression(elem, + op->payload->send_message.send_message->flags, + cur == HAS_COMPRESSION_ALGORITHM)) { + calld->send_op = op; + calld->send_length = op->payload->send_message.send_message->length; + calld->send_flags = op->payload->send_message.send_message->flags; + continue_send_message(exec_ctx, elem); + } else { + /* pass control down the stack */ + grpc_call_next_op(exec_ctx, elem, op); + } + break; + default: + /* >1 send_message concurrently */ + GPR_UNREACHABLE_CODE(break); + } } else { /* pass control down the stack */ grpc_call_next_op(exec_ctx, elem, op); @@ -282,7 +331,6 @@ static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx, /* initialize members */ grpc_slice_buffer_init(&calld->slices); - calld->has_compression_algorithm = 0; grpc_closure_init(&calld->got_slice, got_slice, elem, grpc_schedule_on_exec_ctx); grpc_closure_init(&calld->send_done, send_done, elem, From 9b020019497f5fb9fb035027d55d350450fb4ed0 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Tue, 11 Apr 2017 10:14:13 -0700 Subject: [PATCH 316/461] get rid of racey sleep 5 and use a cv to wait forever --- src/ruby/spec/generic/rpc_server_pool_spec.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/ruby/spec/generic/rpc_server_pool_spec.rb b/src/ruby/spec/generic/rpc_server_pool_spec.rb index 75b40225680..0803ca74ed6 100644 --- a/src/ruby/spec/generic/rpc_server_pool_spec.rb +++ b/src/ruby/spec/generic/rpc_server_pool_spec.rb @@ -52,8 +52,7 @@ describe GRPC::Pool do expect(p.ready_for_work?).to be(false) end - it 'it stops being ready after all workers are busy, ' \ - 'and it becomes ready again after jobs complete' do + it 'it stops being ready after all workers are busy' do p = Pool.new(5) p.start @@ -78,11 +77,6 @@ describe GRPC::Pool do wait = false wait_cv.broadcast end - - # There's a potential race here but it shouldn't ever be - # reached with a 5 second sleep. - sleep 5 - expect(p.ready_for_work?).to be(true) end end @@ -114,10 +108,17 @@ describe GRPC::Pool do it 'stops jobs when there are long running jobs' do p = Pool.new(1) p.start + + wait_forever_mu = Mutex.new + wait_forever_cv = ConditionVariable.new + wait_forever = true + job_running = Queue.new job = proc do job_running.push(Object.new) - sleep(5000) + wait_forever_mu.synchronize do + wait_forever_cv.wait while wait_forever + end end p.schedule(&job) job_running.pop From 19b1f5edc98cd2d86629c1af226e2d1ccddf4752 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 11 Apr 2017 10:17:10 -0700 Subject: [PATCH 317/461] Allow unlimited size messages --- src/core/ext/filters/message_size/message_size_filter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/ext/filters/message_size/message_size_filter.c b/src/core/ext/filters/message_size/message_size_filter.c index 94184065cbb..455958d5750 100644 --- a/src/core/ext/filters/message_size/message_size_filter.c +++ b/src/core/ext/filters/message_size/message_size_filter.c @@ -223,13 +223,13 @@ message_size_limits get_message_size_limits( for (size_t i = 0; i < channel_args->num_args; ++i) { if (strcmp(channel_args->args[i].key, GRPC_ARG_MAX_SEND_MESSAGE_LENGTH) == 0) { - const grpc_integer_options options = {lim.max_send_size, 0, INT_MAX}; + const grpc_integer_options options = {lim.max_send_size, -1, INT_MAX}; lim.max_send_size = grpc_channel_arg_get_integer(&channel_args->args[i], options); } if (strcmp(channel_args->args[i].key, GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH) == 0) { - const grpc_integer_options options = {lim.max_recv_size, 0, INT_MAX}; + const grpc_integer_options options = {lim.max_recv_size, -1, INT_MAX}; lim.max_recv_size = grpc_channel_arg_get_integer(&channel_args->args[i], options); } From 1abba9df60d338e66ee52ad2a27d5eda4ffc0a86 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 11 Apr 2017 11:09:25 -0700 Subject: [PATCH 318/461] Fix lower bound on max message size channel arguments --- src/core/lib/channel/message_size_filter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/lib/channel/message_size_filter.c b/src/core/lib/channel/message_size_filter.c index b424c0d2acb..dd173c5b663 100644 --- a/src/core/lib/channel/message_size_filter.c +++ b/src/core/lib/channel/message_size_filter.c @@ -214,14 +214,14 @@ static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx, if (strcmp(args->channel_args->args[i].key, GRPC_ARG_MAX_SEND_MESSAGE_LENGTH) == 0) { const grpc_integer_options options = { - GRPC_DEFAULT_MAX_SEND_MESSAGE_LENGTH, 0, INT_MAX}; + GRPC_DEFAULT_MAX_SEND_MESSAGE_LENGTH, -1, INT_MAX}; chand->max_send_size = grpc_channel_arg_get_integer(&args->channel_args->args[i], options); } if (strcmp(args->channel_args->args[i].key, GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH) == 0) { const grpc_integer_options options = { - GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH, 0, INT_MAX}; + GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH, -1, INT_MAX}; chand->max_recv_size = grpc_channel_arg_get_integer(&args->channel_args->args[i], options); } From c22d62f54e342b40d5352ed565c1629943a667db Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 11 Apr 2017 11:39:32 -0700 Subject: [PATCH 319/461] Move ForceShutdown completion handling to new OnComplete method --- src/node/ext/server_uv.cc | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/node/ext/server_uv.cc b/src/node/ext/server_uv.cc index bf402e1961f..6a31b892490 100644 --- a/src/node/ext/server_uv.cc +++ b/src/node/ext/server_uv.cc @@ -67,7 +67,7 @@ class ServerShutdownOp : public Op { } Local GetNodeValue() const { - return Nan::New(reinterpret_cast(server)); + return Nan::Null(); } bool ParseOp(Local value, grpc_op *out) { @@ -77,6 +77,7 @@ class ServerShutdownOp : public Op { return false; } void OnComplete() { + grpc_server_destroy(server); } grpc_server *server; @@ -96,13 +97,6 @@ NAN_METHOD(ServerShutdownCallback) { if (!info[0]->IsNull()) { return Nan::ThrowError("forceShutdown failed somehow"); } - MaybeLocal maybe_result = Nan::To(info[1]); - Local result = maybe_result.ToLocalChecked(); - Local server_val = Nan::Get( - result, Nan::New("shutdown").ToLocalChecked()).ToLocalChecked(); - Local server_extern = server_val.As(); - grpc_server *server = reinterpret_cast(server_extern->Value()); - grpc_server_destroy(server); } void Server::ShutdownServer() { From 803392e9f14baeedfe37308cf0ff47978bf3f5e6 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 11 Apr 2017 12:13:08 -0700 Subject: [PATCH 320/461] Node server: add NULL check to tryShutdown --- src/node/ext/server.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/node/ext/server.cc b/src/node/ext/server.cc index 22c89c58624..2d017dd0483 100644 --- a/src/node/ext/server.cc +++ b/src/node/ext/server.cc @@ -277,6 +277,12 @@ NAN_METHOD(Server::TryShutdown) { return Nan::ThrowTypeError("tryShutdown can only be called on a Server"); } Server *server = ObjectWrap::Unwrap(info.This()); + if (server->wrapped_server == NULL) { + // Server is already shut down. Call callback immediately. + Nan::Callback callback(info[0].As()); + callback.Call(0, {}); + return; + } TryShutdownOp *op = new TryShutdownOp(server, info.This()); unique_ptr ops(new OpVec()); ops->push_back(unique_ptr(op)); From 3e1f562a2b5f33ce781485fa90f92c0406718876 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 11 Apr 2017 14:05:28 -0700 Subject: [PATCH 321/461] clang-format --- src/core/ext/transport/cronet/transport/cronet_transport.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c index 3ca6b2fdf69..88335ecd0be 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.c +++ b/src/core/ext/transport/cronet/transport/cronet_transport.c @@ -1124,7 +1124,8 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, if (stream_state->rs.compressed) { stream_state->rs.sbs.base.flags |= GRPC_WRITE_INTERNAL_COMPRESS; } - *((grpc_byte_buffer **)stream_op->payload->recv_message.recv_message) = + *((grpc_byte_buffer **) + stream_op->payload->recv_message.recv_message) = (grpc_byte_buffer *)&stream_state->rs.sbs; grpc_closure_sched( exec_ctx, stream_op->payload->recv_message.recv_message_ready, From f597c7ccdd1b808e131862094b3ef175202f088c Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 11 Apr 2017 14:39:32 -0700 Subject: [PATCH 322/461] Tighter threshold --- tools/profiling/microbenchmarks/speedup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/profiling/microbenchmarks/speedup.py b/tools/profiling/microbenchmarks/speedup.py index 35d392a57db..8f9023d2c89 100644 --- a/tools/profiling/microbenchmarks/speedup.py +++ b/tools/profiling/microbenchmarks/speedup.py @@ -30,7 +30,7 @@ from scipy import stats import math -_THRESHOLD = 0.001 +_THRESHOLD = 0.0001 def scale(a, mul): return [x*mul for x in a] From 9d9313cfc650e79b44f95d9b7fd9e75e2dc38111 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 11 Apr 2017 15:05:46 -0700 Subject: [PATCH 323/461] Threading robustness Move server startup to a separate thread. Where there is no opportunity for failure, do not return bool. --- .../grpc++/impl/codegen/server_interface.h | 2 +- include/grpc++/server.h | 2 +- src/core/lib/surface/server.c | 19 ++++++++++++++----- src/cpp/server/server_builder.cc | 5 +---- src/cpp/server/server_cc.cc | 4 +--- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/include/grpc++/impl/codegen/server_interface.h b/include/grpc++/impl/codegen/server_interface.h index bd1b36e8839..79750117047 100644 --- a/include/grpc++/impl/codegen/server_interface.h +++ b/include/grpc++/impl/codegen/server_interface.h @@ -124,7 +124,7 @@ class ServerInterface : public CallHook { /// \param num_cqs How many completion queues does \a cqs hold. /// /// \return true on a successful shutdown. - virtual bool Start(ServerCompletionQueue** cqs, size_t num_cqs) = 0; + virtual void Start(ServerCompletionQueue** cqs, size_t num_cqs) = 0; virtual void ShutdownInternal(gpr_timespec deadline) = 0; diff --git a/include/grpc++/server.h b/include/grpc++/server.h index 489937712ec..af90a5c70b7 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -179,7 +179,7 @@ class Server final : public ServerInterface, private GrpcLibraryCodegen { /// \param num_cqs How many completion queues does \a cqs hold. /// /// \return true on a successful shutdown. - bool Start(ServerCompletionQueue** cqs, size_t num_cqs) override; + void Start(ServerCompletionQueue** cqs, size_t num_cqs) override; void PerformOpsOnCall(CallOpSetInterface* ops, Call* call) override; diff --git a/src/core/lib/surface/server.c b/src/core/lib/surface/server.c index 191ee75252d..6ac3181482a 100644 --- a/src/core/lib/surface/server.c +++ b/src/core/lib/surface/server.c @@ -44,6 +44,7 @@ #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/connected_channel.h" +#include "src/core/lib/iomgr/executor.h" #include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/support/stack_lockfree.h" @@ -1077,8 +1078,16 @@ void *grpc_server_register_method( return m; } +static void start_listeners(grpc_exec_ctx *exec_ctx, void *s, + grpc_error *error) { + grpc_server *server = s; + for (listener *l = server->listeners; l; l = l->next) { + l->start(exec_ctx, server, l->arg, server->pollsets, server->pollset_count); + } + server_unref(exec_ctx, server); +} + void grpc_server_start(grpc_server *server) { - listener *l; size_t i; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -1112,10 +1121,10 @@ void grpc_server_start(grpc_server *server) { (size_t)server->max_requested_calls_per_cq, server); } - for (l = server->listeners; l; l = l->next) { - l->start(&exec_ctx, server, l->arg, server->pollsets, - server->pollset_count); - } + server_ref(server); + grpc_closure_sched(&exec_ctx, grpc_closure_create(start_listeners, server, + grpc_executor_scheduler), + GRPC_ERROR_NONE); grpc_exec_ctx_finish(&exec_ctx); } diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index 4eb4b5a1b21..3a15afc49e5 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -337,10 +337,7 @@ std::unique_ptr ServerBuilder::BuildAndStart() { } auto cqs_data = cqs_.empty() ? nullptr : &cqs_[0]; - if (!server->Start(cqs_data, cqs_.size())) { - if (added_port) server->Shutdown(); - return nullptr; - } + server->Start(cqs_data, cqs_.size()); for (auto plugin = plugins_.begin(); plugin != plugins_.end(); plugin++) { (*plugin)->Finish(initializer); diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index ce173a1ee2d..43e9531f17f 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -494,7 +494,7 @@ int Server::AddListeningPort(const grpc::string& addr, return port; } -bool Server::Start(ServerCompletionQueue** cqs, size_t num_cqs) { +void Server::Start(ServerCompletionQueue** cqs, size_t num_cqs) { GPR_ASSERT(!started_); global_callbacks_->PreServerStart(this); started_ = true; @@ -530,8 +530,6 @@ bool Server::Start(ServerCompletionQueue** cqs, size_t num_cqs) { for (auto it = sync_req_mgrs_.begin(); it != sync_req_mgrs_.end(); it++) { (*it)->Start(); } - - return true; } void Server::ShutdownInternal(gpr_timespec deadline) { From 654c367cb667f9125c3c101beb115c13274c182f Mon Sep 17 00:00:00 2001 From: Matt Kwong Date: Tue, 11 Apr 2017 14:31:39 -0700 Subject: [PATCH 324/461] Update VM creation scripts to update Linux kernel --- tools/gce/linux_performance_worker_init.sh | 23 +++++++++++++++++----- tools/gce/linux_worker_init.sh | 12 +++++++++-- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/tools/gce/linux_performance_worker_init.sh b/tools/gce/linux_performance_worker_init.sh index 641271214ee..17f36fb4ff8 100755 --- a/tools/gce/linux_performance_worker_init.sh +++ b/tools/gce/linux_performance_worker_init.sh @@ -40,11 +40,6 @@ sudo apt-get update sudo apt-get install -y openjdk-8-jdk sudo apt-get install -y unzip lsof -# Add pubkey of jenkins@grpc-jenkins-master to authorized keys of jenkins@ -# This needs to happen as the last step to prevent Jenkins master from connecting -# to a machine that hasn't been properly setup yet. -cat jenkins_master.pub | sudo tee --append ~jenkins/.ssh/authorized_keys - sudo apt-get install -y \ autoconf \ autotools-dev \ @@ -169,3 +164,21 @@ git clone -v https://github.com/brendangregg/FlameGraph ~/FlameGraph # Install scipy and numpy for benchmarking scripts sudo apt-get install python-scipy python-numpy + +# Update Linux kernel to 4.9 +wget \ + kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.20/linux-headers-4.9.20-040920_4.9.20-040920.201703310531_all.deb \ + kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.20/linux-headers-4.9.20-040920-generic_4.9.20-040920.201703310531_amd64.deb \ + kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.20/linux-image-4.9.20-040920-generic_4.9.20-040920.201703310531_amd64.deb +sudo dpkg -i linux-headers-4.9*.deb linux-image-4.9*.deb +rm linux-* + +# Add pubkey of jenkins@grpc-jenkins-master to authorized keys of jenkins@ +# This needs to happen as the last step to prevent Jenkins master from connecting +# to a machine that hasn't been properly setup yet. +cat jenkins_master.pub | sudo tee --append ~jenkins/.ssh/authorized_keys + +# Restart for VM to pick up kernel update +echo 'Successfully initialized the linux worker, going for reboot in 10 seconds' +sleep 10 +sudo reboot diff --git a/tools/gce/linux_worker_init.sh b/tools/gce/linux_worker_init.sh index 9230acdca6d..d552343bde6 100755 --- a/tools/gce/linux_worker_init.sh +++ b/tools/gce/linux_worker_init.sh @@ -59,19 +59,27 @@ sudo usermod -aG docker jenkins # Use "overlay" storage driver for docker # see https://github.com/grpc/grpc/issues/4988 -echo 'DOCKER_OPTS="${DOCKER_OPTS} --storage-driver=overlay"' | sudo tee --append /etc/default/docker +printf "{\n\t\"storage-driver\": \"overlay\"\n}" | sudo tee /etc/docker/daemon.json # Install RVM # TODO(jtattermusch): why is RVM needed? gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 curl -sSL https://get.rvm.io | bash -s stable --ruby +# Upgrade Linux kernel to 4.9 +wget \ + kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.20/linux-headers-4.9.20-040920_4.9.20-040920.201703310531_all.deb \ + kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.20/linux-headers-4.9.20-040920-generic_4.9.20-040920.201703310531_amd64.deb \ + kernel.ubuntu.com/~kernel-ppa/mainline/v4.9.20/linux-image-4.9.20-040920-generic_4.9.20-040920.201703310531_amd64.deb +sudo dpkg -i linux-headers-4.9*.deb linux-image-4.9*.deb +rm linux-* + # Add pubkey of jenkins@grpc-jenkins-master to authorized keys of jenkins@ # This needs to happen as the last step to prevent Jenkins master from connecting # to a machine that hasn't been properly setup yet. cat jenkins_master.pub | sudo tee --append ~jenkins/.ssh/authorized_keys -# Restart for docker to pickup the config changes. +# Restart for docker to pick up the config changes. echo 'Successfully initialized the linux worker, going for reboot in 10 seconds' sleep 10 From eceec8eaf6f38766364b203e92ccb6b25028b89b Mon Sep 17 00:00:00 2001 From: yang-g Date: Mon, 10 Apr 2017 11:58:44 -0700 Subject: [PATCH 325/461] Add helper function to supply and parse error_details from Status. --- BUILD | 16 ++ CMakeLists.txt | 109 ++++++++++ Makefile | 159 +++++++++++++- build.yaml | 22 ++ include/grpc++/impl/codegen/status.h | 2 +- include/grpc++/support/error_details.h | 61 ++++++ src/cpp/util/error_details.cc | 62 ++++++ src/proto/grpc/status/BUILD | 43 ++++ src/proto/grpc/status/README | 2 + src/proto/grpc/status/status.proto | 92 ++++++++ test/cpp/util/BUILD | 15 +- test/cpp/util/error_details_test.cc | 120 +++++++++++ .../generated/sources_and_headers.json | 37 ++++ tools/run_tests/generated/tests.json | 22 ++ vsprojects/grpc.sln | 24 +++ .../grpc++_error_details.vcxproj | 178 +++++++++++++++ .../grpc++_error_details.vcxproj.filters | 47 ++++ .../error_details_test.vcxproj | 203 ++++++++++++++++++ .../error_details_test.vcxproj.filters | 36 ++++ 19 files changed, 1246 insertions(+), 4 deletions(-) create mode 100644 include/grpc++/support/error_details.h create mode 100644 src/cpp/util/error_details.cc create mode 100644 src/proto/grpc/status/BUILD create mode 100644 src/proto/grpc/status/README create mode 100644 src/proto/grpc/status/status.proto create mode 100644 test/cpp/util/error_details_test.cc create mode 100644 vsprojects/vcxproj/grpc++_error_details/grpc++_error_details.vcxproj create mode 100644 vsprojects/vcxproj/grpc++_error_details/grpc++_error_details.vcxproj.filters create mode 100644 vsprojects/vcxproj/test/error_details_test/error_details_test.vcxproj create mode 100644 vsprojects/vcxproj/test/error_details_test/error_details_test.vcxproj.filters diff --git a/BUILD b/BUILD index ab4c1cff17f..7890a89df8f 100644 --- a/BUILD +++ b/BUILD @@ -164,6 +164,22 @@ grpc_cc_library( ], ) +grpc_cc_library( + name = "grpc++_error_details", + srcs = [ + "src/cpp/util/error_details.cc", + ], + hdrs = [ + "include/grpc++/support/error_details.h", + ], + language = "c++", + standalone = True, + deps = [ + "grpc++", + "//src/proto/grpc/status:status_proto", + ], +) + grpc_cc_library( name = "grpc_plugin_support", srcs = [ diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b94f861f84..08bf646c823 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -661,6 +661,7 @@ add_dependencies(buildtests_cxx cxx_slice_test) add_dependencies(buildtests_cxx cxx_string_ref_test) add_dependencies(buildtests_cxx cxx_time_test) add_dependencies(buildtests_cxx end2end_test) +add_dependencies(buildtests_cxx error_details_test) add_dependencies(buildtests_cxx filter_end2end_test) add_dependencies(buildtests_cxx generic_end2end_test) add_dependencies(buildtests_cxx golden_file_test) @@ -2900,6 +2901,72 @@ if (gRPC_INSTALL) ) endif() + +add_library(grpc++_error_details + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/status/status.pb.cc + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/status/status.grpc.pb.cc + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/status/status.pb.h + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/status/status.grpc.pb.h + src/cpp/util/error_details.cc +) + +if(WIN32 AND MSVC) + set_target_properties(grpc++_error_details PROPERTIES COMPILE_PDB_NAME "grpc++_error_details" + COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" + ) + if (gRPC_INSTALL) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/grpc++_error_details.pdb + DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL + ) + endif() +endif() + +protobuf_generate_grpc_cpp( + src/proto/grpc/status/status.proto +) + +target_include_directories(grpc++_error_details + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${BORINGSSL_ROOT_DIR}/include + PRIVATE ${PROTOBUF_ROOT_DIR}/src + PRIVATE ${ZLIB_INCLUDE_DIR} + PRIVATE ${BENCHMARK}/include + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CARES_BUILD_INCLUDE_DIR} + PRIVATE ${CARES_INCLUDE_DIR} + PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE ${_gRPC_PROTO_GENS_DIR} +) + +target_link_libraries(grpc++_error_details + ${_gRPC_BASELIB_LIBRARIES} + ${_gRPC_PROTOBUF_LIBRARIES} + ${_gRPC_ALLTARGETS_LIBRARIES} + grpc++ +) + +foreach(_hdr + include/grpc++/support/error_details.h +) + string(REPLACE "include/" "" _path ${_hdr}) + get_filename_component(_path ${_path} PATH) + install(FILES ${_hdr} + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_path}" + ) +endforeach() + + +if (gRPC_INSTALL) + install(TARGETS grpc++_error_details EXPORT gRPCTargets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) +endif() + if (gRPC_BUILD_TESTS) add_library(grpc++_proto_reflection_desc_db @@ -9884,6 +9951,48 @@ target_link_libraries(end2end_test endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) +add_executable(error_details_test + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo_messages.pb.cc + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo_messages.grpc.pb.cc + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo_messages.pb.h + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/echo_messages.grpc.pb.h + test/cpp/util/error_details_test.cc + third_party/googletest/googletest/src/gtest-all.cc +) + +protobuf_generate_grpc_cpp( + src/proto/grpc/testing/echo_messages.proto +) + +target_include_directories(error_details_test + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${BORINGSSL_ROOT_DIR}/include + PRIVATE ${PROTOBUF_ROOT_DIR}/src + PRIVATE ${BENCHMARK_ROOT_DIR}/include + PRIVATE ${ZLIB_ROOT_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CARES_BUILD_INCLUDE_DIR} + PRIVATE ${CARES_INCLUDE_DIR} + PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest + PRIVATE ${_gRPC_PROTO_GENS_DIR} +) + +target_link_libraries(error_details_test + ${_gRPC_PROTOBUF_LIBRARIES} + ${_gRPC_ALLTARGETS_LIBRARIES} + grpc++_error_details + grpc++ + ${_gRPC_GFLAGS_LIBRARIES} +) + +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + add_executable(filter_end2end_test test/cpp/end2end/filter_end2end_test.cc third_party/googletest/googletest/src/gtest-all.cc diff --git a/Makefile b/Makefile index 1fb0ad16dc3..5868664d879 100644 --- a/Makefile +++ b/Makefile @@ -1126,6 +1126,7 @@ cxx_slice_test: $(BINDIR)/$(CONFIG)/cxx_slice_test cxx_string_ref_test: $(BINDIR)/$(CONFIG)/cxx_string_ref_test cxx_time_test: $(BINDIR)/$(CONFIG)/cxx_time_test end2end_test: $(BINDIR)/$(CONFIG)/end2end_test +error_details_test: $(BINDIR)/$(CONFIG)/error_details_test filter_end2end_test: $(BINDIR)/$(CONFIG)/filter_end2end_test generic_end2end_test: $(BINDIR)/$(CONFIG)/generic_end2end_test golden_file_test: $(BINDIR)/$(CONFIG)/golden_file_test @@ -1305,12 +1306,12 @@ static: static_c static_cxx static_c: pc_c pc_c_unsecure cache.mk $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgrpc_cronet.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a -static_cxx: pc_cxx pc_cxx_unsecure cache.mk $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc++_cronet.a $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a +static_cxx: pc_cxx pc_cxx_unsecure cache.mk $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc++_cronet.a $(LIBDIR)/$(CONFIG)/libgrpc++_error_details.a $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a shared: shared_c shared_cxx shared_c: pc_c pc_c_unsecure cache.mk $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)gpr$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE) -shared_cxx: pc_cxx pc_cxx_unsecure cache.mk $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) +shared_cxx: pc_cxx pc_cxx_unsecure cache.mk $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) shared_csharp: shared_c $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP) grpc_csharp_ext: shared_csharp @@ -1552,6 +1553,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/cxx_string_ref_test \ $(BINDIR)/$(CONFIG)/cxx_time_test \ $(BINDIR)/$(CONFIG)/end2end_test \ + $(BINDIR)/$(CONFIG)/error_details_test \ $(BINDIR)/$(CONFIG)/filter_end2end_test \ $(BINDIR)/$(CONFIG)/generic_end2end_test \ $(BINDIR)/$(CONFIG)/golden_file_test \ @@ -1671,6 +1673,7 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/cxx_string_ref_test \ $(BINDIR)/$(CONFIG)/cxx_time_test \ $(BINDIR)/$(CONFIG)/end2end_test \ + $(BINDIR)/$(CONFIG)/error_details_test \ $(BINDIR)/$(CONFIG)/filter_end2end_test \ $(BINDIR)/$(CONFIG)/generic_end2end_test \ $(BINDIR)/$(CONFIG)/golden_file_test \ @@ -2040,6 +2043,8 @@ test_cxx: buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/cxx_time_test || ( echo test cxx_time_test failed ; exit 1 ) $(E) "[RUN] Testing end2end_test" $(Q) $(BINDIR)/$(CONFIG)/end2end_test || ( echo test end2end_test failed ; exit 1 ) + $(E) "[RUN] Testing error_details_test" + $(Q) $(BINDIR)/$(CONFIG)/error_details_test || ( echo test error_details_test failed ; exit 1 ) $(E) "[RUN] Testing filter_end2end_test" $(Q) $(BINDIR)/$(CONFIG)/filter_end2end_test || ( echo test filter_end2end_test failed ; exit 1 ) $(E) "[RUN] Testing generic_end2end_test" @@ -2144,6 +2149,8 @@ ifeq ($(CONFIG),opt) $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgrpc++.a $(E) "[STRIP] Stripping libgrpc++_cronet.a" $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgrpc++_cronet.a + $(E) "[STRIP] Stripping libgrpc++_error_details.a" + $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgrpc++_error_details.a $(E) "[STRIP] Stripping libgrpc++_reflection.a" $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(E) "[STRIP] Stripping libgrpc++_unsecure.a" @@ -2168,6 +2175,8 @@ ifeq ($(CONFIG),opt) $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(E) "[STRIP] Stripping $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) + $(E) "[STRIP] Stripping $(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" + $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(E) "[STRIP] Stripping $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(E) "[STRIP] Stripping $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" @@ -2249,6 +2258,21 @@ $(GENDIR)/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.cc: src/proto/grp $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $< endif +ifeq ($(NO_PROTOC),true) +$(GENDIR)/src/proto/grpc/status/status.pb.cc: protoc_dep_error +$(GENDIR)/src/proto/grpc/status/status.grpc.pb.cc: protoc_dep_error +else +$(GENDIR)/src/proto/grpc/status/status.pb.cc: src/proto/grpc/status/status.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) + $(E) "[PROTOC] Generating protobuf CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --cpp_out=$(GENDIR) $< + +$(GENDIR)/src/proto/grpc/status/status.grpc.pb.cc: src/proto/grpc/status/status.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) + $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" + $(Q) mkdir -p `dirname $@` + $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(PROTOC_PLUGINS_DIR)/grpc_cpp_plugin$(EXECUTABLE_SUFFIX) $< +endif + ifeq ($(NO_PROTOC),true) $(GENDIR)/src/proto/grpc/testing/compiler_test.pb.cc: protoc_dep_error $(GENDIR)/src/proto/grpc/testing/compiler_test.grpc.pb.cc: protoc_dep_error @@ -2507,6 +2531,9 @@ install-static_cxx: static_cxx strip-static_cxx install-pkg-config_cxx $(E) "[INSTALL] Installing libgrpc++_cronet.a" $(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_cronet.a $(prefix)/lib/libgrpc++_cronet.a + $(E) "[INSTALL] Installing libgrpc++_error_details.a" + $(Q) $(INSTALL) -d $(prefix)/lib + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_error_details.a $(prefix)/lib/libgrpc++_error_details.a $(E) "[INSTALL] Installing libgrpc++_reflection.a" $(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(prefix)/lib/libgrpc++_reflection.a @@ -2578,6 +2605,15 @@ ifeq ($(SYSTEM),MINGW32) else ifneq ($(SYSTEM),Darwin) $(Q) ln -sf $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_cronet.so.3 $(Q) ln -sf $(SHARED_PREFIX)grpc++_cronet$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_cronet.so +endif + $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" + $(Q) $(INSTALL) -d $(prefix)/lib + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/$(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) +ifeq ($(SYSTEM),MINGW32) + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_error_details$(SHARED_VERSION_CPP)-dll.a $(prefix)/lib/libgrpc++_error_details.a +else ifneq ($(SYSTEM),Darwin) + $(Q) ln -sf $(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_error_details.so.3 + $(Q) ln -sf $(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(prefix)/lib/libgrpc++_error_details.so endif $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)" $(Q) $(INSTALL) -d $(prefix)/lib @@ -4770,6 +4806,77 @@ endif endif +LIBGRPC++_ERROR_DETAILS_SRC = \ + $(GENDIR)/src/proto/grpc/status/status.pb.cc $(GENDIR)/src/proto/grpc/status/status.grpc.pb.cc \ + src/cpp/util/error_details.cc \ + +PUBLIC_HEADERS_CXX += \ + include/grpc++/support/error_details.h \ + +LIBGRPC++_ERROR_DETAILS_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC++_ERROR_DETAILS_SRC)))) + + +ifeq ($(NO_SECURE),true) + +# You can't build secure libraries if you don't have OpenSSL. + +$(LIBDIR)/$(CONFIG)/libgrpc++_error_details.a: openssl_dep_error + +$(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): openssl_dep_error + +else + +ifeq ($(NO_PROTOBUF),true) + +# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. + +$(LIBDIR)/$(CONFIG)/libgrpc++_error_details.a: protobuf_dep_error + +$(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): protobuf_dep_error + +else + +$(LIBDIR)/$(CONFIG)/libgrpc++_error_details.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBGRPC++_ERROR_DETAILS_OBJS) $(LIBGPR_OBJS) $(ZLIB_MERGE_OBJS) $(CARES_MERGE_OBJS) + $(E) "[AR] Creating $@" + $(Q) mkdir -p `dirname $@` + $(Q) rm -f $(LIBDIR)/$(CONFIG)/libgrpc++_error_details.a + $(Q) $(AR) $(AROPTS) $(LIBDIR)/$(CONFIG)/libgrpc++_error_details.a $(LIBGRPC++_ERROR_DETAILS_OBJS) $(LIBGPR_OBJS) $(ZLIB_MERGE_OBJS) $(CARES_MERGE_OBJS) +ifeq ($(SYSTEM),Darwin) + $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/libgrpc++_error_details.a +endif + + + +ifeq ($(SYSTEM),MINGW32) +$(LIBDIR)/$(CONFIG)/grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC++_ERROR_DETAILS_OBJS) $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/grpc++$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(OPENSSL_DEP) + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc++_error_details$(SHARED_VERSION_CPP).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc++_error_details$(SHARED_VERSION_CPP)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_ERROR_DETAILS_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgrpc++$(SHARED_VERSION_CPP)-dll +else +$(LIBDIR)/$(CONFIG)/libgrpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP): $(LIBGRPC++_ERROR_DETAILS_OBJS) $(ZLIB_DEP) $(CARES_DEP) $(PROTOBUF_DEP) $(LIBDIR)/$(CONFIG)/libgrpc++.$(SHARED_EXT_CPP) $(OPENSSL_DEP) + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` +ifeq ($(SYSTEM),Darwin) + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_ERROR_DETAILS_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgrpc++ +else + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_error_details.so.3 -o $(LIBDIR)/$(CONFIG)/libgrpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBGRPC++_ERROR_DETAILS_OBJS) $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) -lgrpc++ + $(Q) ln -sf $(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_error_details$(SHARED_VERSION_CPP).so.1 + $(Q) ln -sf $(SHARED_PREFIX)grpc++_error_details$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP) $(LIBDIR)/$(CONFIG)/libgrpc++_error_details$(SHARED_VERSION_CPP).so +endif +endif + +endif + +endif + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(LIBGRPC++_ERROR_DETAILS_OBJS:.o=.dep) +endif +endif +$(OBJDIR)/$(CONFIG)/src/cpp/util/error_details.o: $(GENDIR)/src/proto/grpc/status/status.pb.cc $(GENDIR)/src/proto/grpc/status/status.grpc.pb.cc + + LIBGRPC++_PROTO_REFLECTION_DESC_DB_SRC = \ test/cpp/util/proto_reflection_descriptor_database.cc \ $(GENDIR)/src/proto/grpc/reflection/v1alpha/reflection.pb.cc $(GENDIR)/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.cc \ @@ -14319,6 +14426,53 @@ endif endif +ERROR_DETAILS_TEST_SRC = \ + $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc \ + test/cpp/util/error_details_test.cc \ + +ERROR_DETAILS_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(ERROR_DETAILS_TEST_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/error_details_test: openssl_dep_error + +else + + + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. + +$(BINDIR)/$(CONFIG)/error_details_test: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/error_details_test: $(PROTOBUF_DEP) $(ERROR_DETAILS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_error_details.a $(LIBDIR)/$(CONFIG)/libgrpc++.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(ERROR_DETAILS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_error_details.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/error_details_test + +endif + +endif + +$(OBJDIR)/$(CONFIG)/src/proto/grpc/testing/echo_messages.o: $(LIBDIR)/$(CONFIG)/libgrpc++_error_details.a $(LIBDIR)/$(CONFIG)/libgrpc++.a + +$(OBJDIR)/$(CONFIG)/test/cpp/util/error_details_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_error_details.a $(LIBDIR)/$(CONFIG)/libgrpc++.a + +deps_error_details_test: $(ERROR_DETAILS_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(ERROR_DETAILS_TEST_OBJS:.o=.dep) +endif +endif +$(OBJDIR)/$(CONFIG)/test/cpp/util/error_details_test.o: $(GENDIR)/src/proto/grpc/testing/echo_messages.pb.cc $(GENDIR)/src/proto/grpc/testing/echo_messages.grpc.pb.cc + + FILTER_END2END_TEST_SRC = \ test/cpp/end2end/filter_end2end_test.cc \ @@ -19273,6 +19427,7 @@ src/cpp/common/secure_create_auth_context.cc: $(OPENSSL_DEP) src/cpp/ext/proto_server_reflection.cc: $(OPENSSL_DEP) src/cpp/ext/proto_server_reflection_plugin.cc: $(OPENSSL_DEP) src/cpp/server/secure_server_credentials.cc: $(OPENSSL_DEP) +src/cpp/util/error_details.cc: $(OPENSSL_DEP) src/csharp/ext/grpc_csharp_ext.c: $(OPENSSL_DEP) test/core/bad_client/bad_client.c: $(OPENSSL_DEP) test/core/bad_ssl/server_common.c: $(OPENSSL_DEP) diff --git a/build.yaml b/build.yaml index 2dca6526a67..1b3cd7e8d13 100644 --- a/build.yaml +++ b/build.yaml @@ -1175,6 +1175,18 @@ libs: platforms: - linux secure: true +- name: grpc++_error_details + build: all + language: c++ + public_headers: + - include/grpc++/support/error_details.h + src: + - src/proto/grpc/status/status.proto + - src/cpp/util/error_details.cc + deps: + - grpc++ + baselib: true + vs_project_guid: '{9F58AD72-49E1-4D10-B826-9E190AB0AAC0}' - name: grpc++_proto_reflection_desc_db build: private language: c++ @@ -3567,6 +3579,16 @@ targets: - grpc - gpr_test_util - gpr +- name: error_details_test + gtest: true + build: test + language: c++ + src: + - src/proto/grpc/testing/echo_messages.proto + - test/cpp/util/error_details_test.cc + deps: + - grpc++_error_details + - grpc++ - name: filter_end2end_test gtest: true build: test diff --git a/include/grpc++/impl/codegen/status.h b/include/grpc++/impl/codegen/status.h index 5cce3c1672e..31fd6cdbe78 100644 --- a/include/grpc++/impl/codegen/status.h +++ b/include/grpc++/impl/codegen/status.h @@ -53,7 +53,7 @@ class Status { /// Construct an instance with \a code, \a error_message and \a error_details Status(StatusCode code, const grpc::string& error_message, - const grpc::string error_details) + const grpc::string& error_details) : code_(code), error_message_(error_message), binary_error_details_(error_details) {} diff --git a/include/grpc++/support/error_details.h b/include/grpc++/support/error_details.h new file mode 100644 index 00000000000..411175fb46c --- /dev/null +++ b/include/grpc++/support/error_details.h @@ -0,0 +1,61 @@ +/* + * + * Copyright 2017, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPCXX_SUPPORT_ERROR_DETAILS_H +#define GRPCXX_SUPPORT_ERROR_DETAILS_H + +#include + +namespace google { +namespace rpc { +class Status; +} // namespace rpc +} // namespace google + +namespace grpc { + +// Maps a grpc::Status to a google::rpc::Status. +// The given \a to object will be cleared. +// On success, returns status with OK. +// Returns status with INVALID_ARGUMENT, if failed to deserialize. +// Returns status with FAILED_PRECONDITION, if \a to is nullptr. +Status ExtractErrorDetails(const Status& from, ::google::rpc::Status* to); + +// Maps google::rpc::Status to a grpc::Status. +// Returns OK on success. +// Returns status with FAILED_PRECONDITION if \a to is nullptr. +Status SetErrorDetails(const ::google::rpc::Status& from, Status* to); + +} // namespace grpc + +#endif // GRPCXX_SUPPORT_ERROR_DETAILS_H diff --git a/src/cpp/util/error_details.cc b/src/cpp/util/error_details.cc new file mode 100644 index 00000000000..8bba05ac7d6 --- /dev/null +++ b/src/cpp/util/error_details.cc @@ -0,0 +1,62 @@ +/* + * + * Copyright 2017, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include "src/proto/grpc/status/status.pb.h" + +namespace grpc { + +Status ExtractErrorDetails(const Status& from, ::google::rpc::Status* to) { + if (to == nullptr) { + return Status(StatusCode::FAILED_PRECONDITION, ""); + } + if (!to->ParseFromString(from.error_details())) { + return Status(StatusCode::INVALID_ARGUMENT, ""); + } + return Status::OK; +} + +Status SetErrorDetails(const ::google::rpc::Status& from, Status* to) { + if (to == nullptr) { + return Status(StatusCode::FAILED_PRECONDITION, ""); + } + StatusCode code = StatusCode::UNKNOWN; + if (from.code() >= StatusCode::OK && from.code() <= StatusCode::DATA_LOSS) { + code = static_cast(from.code()); + } + *to = Status(code, from.message(), from.SerializeAsString()); + return Status::OK; +} + +} // namespace grpc diff --git a/src/proto/grpc/status/BUILD b/src/proto/grpc/status/BUILD new file mode 100644 index 00000000000..c17f87eb3de --- /dev/null +++ b/src/proto/grpc/status/BUILD @@ -0,0 +1,43 @@ +# Copyright 2017, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +licenses(["notice"]) # 3-clause BSD + +package(default_visibility = ["//visibility:public"]) + +load("//bazel:grpc_build_system.bzl", "grpc_proto_library") + +grpc_proto_library( + name = "status_proto", + srcs = ["status.proto"], + has_services = False, + well_known_protos = "@submodule_protobuf//:well_known_protos", +) + + diff --git a/src/proto/grpc/status/README b/src/proto/grpc/status/README new file mode 100644 index 00000000000..34e588efac9 --- /dev/null +++ b/src/proto/grpc/status/README @@ -0,0 +1,2 @@ +The status.proto file is copied from +https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto. diff --git a/src/proto/grpc/status/status.proto b/src/proto/grpc/status/status.proto new file mode 100644 index 00000000000..bc6097b29fb --- /dev/null +++ b/src/proto/grpc/status/status.proto @@ -0,0 +1,92 @@ +// Copyright 2016 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.rpc; + +import "google/protobuf/any.proto"; + +option go_package = "google.golang.org/genproto/googleapis/rpc/status;status"; +option java_multiple_files = true; +option java_outer_classname = "StatusProto"; +option java_package = "com.google.rpc"; +option objc_class_prefix = "RPC"; + + +// The `Status` type defines a logical error model that is suitable for different +// programming environments, including REST APIs and RPC APIs. It is used by +// [gRPC](https://github.com/grpc). The error model is designed to be: +// +// - Simple to use and understand for most users +// - Flexible enough to meet unexpected needs +// +// # Overview +// +// The `Status` message contains three pieces of data: error code, error message, +// and error details. The error code should be an enum value of +// [google.rpc.Code][google.rpc.Code], but it may accept additional error codes if needed. The +// error message should be a developer-facing English message that helps +// developers *understand* and *resolve* the error. If a localized user-facing +// error message is needed, put the localized message in the error details or +// localize it in the client. The optional error details may contain arbitrary +// information about the error. There is a predefined set of error detail types +// in the package `google.rpc` which can be used for common error conditions. +// +// # Language mapping +// +// The `Status` message is the logical representation of the error model, but it +// is not necessarily the actual wire format. When the `Status` message is +// exposed in different client libraries and different wire protocols, it can be +// mapped differently. For example, it will likely be mapped to some exceptions +// in Java, but more likely mapped to some error codes in C. +// +// # Other uses +// +// The error model and the `Status` message can be used in a variety of +// environments, either with or without APIs, to provide a +// consistent developer experience across different environments. +// +// Example uses of this error model include: +// +// - Partial errors. If a service needs to return partial errors to the client, +// it may embed the `Status` in the normal response to indicate the partial +// errors. +// +// - Workflow errors. A typical workflow has multiple steps. Each step may +// have a `Status` message for error reporting purpose. +// +// - Batch operations. If a client uses batch request and batch response, the +// `Status` message should be used directly inside batch response, one for +// each error sub-response. +// +// - Asynchronous operations. If an API call embeds asynchronous operation +// results in its response, the status of those operations should be +// represented directly using the `Status` message. +// +// - Logging. If some API errors are stored in logs, the message `Status` could +// be used directly after any stripping needed for security/privacy reasons. +message Status { + // The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. + int32 code = 1; + + // A developer-facing error message, which should be in English. Any + // user-facing error message should be localized and sent in the + // [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. + string message = 2; + + // A list of messages that carry the error details. There will be a + // common set of message types for APIs to use. + repeated google.protobuf.Any details = 3; +} diff --git a/test/cpp/util/BUILD b/test/cpp/util/BUILD index dc90a4e172c..7471ce75dd3 100644 --- a/test/cpp/util/BUILD +++ b/test/cpp/util/BUILD @@ -62,7 +62,6 @@ cc_library( cc_library( name = "test_util", srcs = [ - # "test/cpp/end2end/test_service_impl.cc", "byte_buffer_proto_helper.cc", "create_test_channel.cc", "string_ref_helper.cc", @@ -83,3 +82,17 @@ cc_library( "//test/core/util:gpr_test_util", ], ) + +cc_test( + name = "error_details_test", + srcs = [ + "error_details_test.cc", + ], + deps = [ + "//external:gtest", + "//:grpc++_error_details", + ], +) + + + diff --git a/test/cpp/util/error_details_test.cc b/test/cpp/util/error_details_test.cc new file mode 100644 index 00000000000..d01fd3b0870 --- /dev/null +++ b/test/cpp/util/error_details_test.cc @@ -0,0 +1,120 @@ +/* + * + * Copyright 2017, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include + +#include "src/proto/grpc/status/status.pb.h" +#include "src/proto/grpc/testing/echo_messages.pb.h" + +namespace grpc { +namespace { + +TEST(ExtractTest, Success) { + google::rpc::Status expected; + expected.set_code(13); // INTERNAL + expected.set_message("I am an error message"); + testing::EchoRequest expected_details; + expected_details.set_message(grpc::string(100, '\0')); + expected.add_details()->PackFrom(expected_details); + + google::rpc::Status to; + grpc::string error_details = expected.SerializeAsString(); + Status from(static_cast(expected.code()), expected.message(), + error_details); + EXPECT_TRUE(ExtractErrorDetails(from, &to).ok()); + EXPECT_EQ(expected.code(), to.code()); + EXPECT_EQ(expected.message(), to.message()); + EXPECT_EQ(1, to.details_size()); + testing::EchoRequest details; + to.details(0).UnpackTo(&details); + EXPECT_EQ(expected_details.message(), details.message()); +} + +TEST(ExtractTest, NullInput) { + EXPECT_EQ(StatusCode::FAILED_PRECONDITION, + ExtractErrorDetails(Status(), nullptr).error_code()); +} + +TEST(ExtractTest, Unparsable) { + grpc::string error_details("I am not a status object"); + Status from(StatusCode::INTERNAL, "", error_details); + google::rpc::Status to; + EXPECT_EQ(StatusCode::INVALID_ARGUMENT, + ExtractErrorDetails(from, &to).error_code()); +} + +TEST(SetTest, Success) { + google::rpc::Status expected; + expected.set_code(13); // INTERNAL + expected.set_message("I am an error message"); + testing::EchoRequest expected_details; + expected_details.set_message(grpc::string(100, '\0')); + expected.add_details()->PackFrom(expected_details); + + Status to; + Status s = SetErrorDetails(expected, &to); + EXPECT_TRUE(s.ok()); + EXPECT_EQ(expected.code(), to.error_code()); + EXPECT_EQ(expected.message(), to.error_message()); + EXPECT_EQ(expected.SerializeAsString(), to.error_details()); +} + +TEST(SetTest, NullInput) { + EXPECT_EQ(StatusCode::FAILED_PRECONDITION, + SetErrorDetails(google::rpc::Status(), nullptr).error_code()); +} + +TEST(SetTest, OutOfScopeErrorCode) { + google::rpc::Status expected; + expected.set_code(20); // Out of scope (DATA_LOSS is 15). + expected.set_message("I am an error message"); + testing::EchoRequest expected_details; + expected_details.set_message(grpc::string(100, '\0')); + expected.add_details()->PackFrom(expected_details); + + Status to; + Status s = SetErrorDetails(expected, &to); + EXPECT_TRUE(s.ok()); + EXPECT_EQ(StatusCode::UNKNOWN, to.error_code()); + EXPECT_EQ(expected.message(), to.error_message()); + EXPECT_EQ(expected.SerializeAsString(), to.error_details()); +} + +} // namespace +} // namespace grpc + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 5ee5d0be90a..35e82409822 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -2967,6 +2967,24 @@ "third_party": false, "type": "target" }, + { + "deps": [ + "grpc++", + "grpc++_error_details" + ], + "headers": [ + "src/proto/grpc/testing/echo_messages.grpc.pb.h", + "src/proto/grpc/testing/echo_messages.pb.h" + ], + "is_filegroup": false, + "language": "c++", + "name": "error_details_test", + "src": [ + "test/cpp/util/error_details_test.cc" + ], + "third_party": false, + "type": "target" + }, { "deps": [ "gpr", @@ -5818,6 +5836,25 @@ "third_party": false, "type": "lib" }, + { + "deps": [ + "grpc++" + ], + "headers": [ + "include/grpc++/support/error_details.h", + "src/proto/grpc/status/status.grpc.pb.h", + "src/proto/grpc/status/status.pb.h" + ], + "is_filegroup": false, + "language": "c++", + "name": "grpc++_error_details", + "src": [ + "include/grpc++/support/error_details.h", + "src/cpp/util/error_details.cc" + ], + "third_party": false, + "type": "lib" + }, { "deps": [ "grpc++", diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 12d48f219d7..530cd2d6b56 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -3195,6 +3195,28 @@ "windows" ] }, + { + "args": [], + "ci_platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "gtest": true, + "language": "c++", + "name": "error_details_test", + "platforms": [ + "linux", + "mac", + "posix", + "windows" + ] + }, { "args": [], "ci_platforms": [ diff --git a/vsprojects/grpc.sln b/vsprojects/grpc.sln index fbb19c2de6e..97378e0a0f8 100644 --- a/vsprojects/grpc.sln +++ b/vsprojects/grpc.sln @@ -57,6 +57,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc++", "vcxproj\.\grpc++\ {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc++_error_details", "vcxproj\.\grpc++_error_details\grpc++_error_details.vcxproj", "{9F58AD72-49E1-4D10-B826-9E190AB0AAC0}" + ProjectSection(myProperties) = preProject + lib = "True" + EndProjectSection + ProjectSection(ProjectDependencies) = postProject + {C187A093-A0FE-489D-A40A-6E33DE0F9FEB} = {C187A093-A0FE-489D-A40A-6E33DE0F9FEB} + EndProjectSection +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc++_unsecure", "vcxproj\.\grpc++_unsecure\grpc++_unsecure.vcxproj", "{6EE56155-DF7C-4F6E-BFC4-F6F776BEB211}" ProjectSection(myProperties) = preProject lib = "True" @@ -294,6 +302,22 @@ Global {C187A093-A0FE-489D-A40A-6E33DE0F9FEB}.Release-DLL|Win32.Build.0 = Release-DLL|Win32 {C187A093-A0FE-489D-A40A-6E33DE0F9FEB}.Release-DLL|x64.ActiveCfg = Release-DLL|x64 {C187A093-A0FE-489D-A40A-6E33DE0F9FEB}.Release-DLL|x64.Build.0 = Release-DLL|x64 + {9F58AD72-49E1-4D10-B826-9E190AB0AAC0}.Debug|Win32.ActiveCfg = Debug|Win32 + {9F58AD72-49E1-4D10-B826-9E190AB0AAC0}.Debug|x64.ActiveCfg = Debug|x64 + {9F58AD72-49E1-4D10-B826-9E190AB0AAC0}.Release|Win32.ActiveCfg = Release|Win32 + {9F58AD72-49E1-4D10-B826-9E190AB0AAC0}.Release|x64.ActiveCfg = Release|x64 + {9F58AD72-49E1-4D10-B826-9E190AB0AAC0}.Debug|Win32.Build.0 = Debug|Win32 + {9F58AD72-49E1-4D10-B826-9E190AB0AAC0}.Debug|x64.Build.0 = Debug|x64 + {9F58AD72-49E1-4D10-B826-9E190AB0AAC0}.Release|Win32.Build.0 = Release|Win32 + {9F58AD72-49E1-4D10-B826-9E190AB0AAC0}.Release|x64.Build.0 = Release|x64 + {9F58AD72-49E1-4D10-B826-9E190AB0AAC0}.Debug-DLL|Win32.ActiveCfg = Debug|Win32 + {9F58AD72-49E1-4D10-B826-9E190AB0AAC0}.Debug-DLL|Win32.Build.0 = Debug|Win32 + {9F58AD72-49E1-4D10-B826-9E190AB0AAC0}.Debug-DLL|x64.ActiveCfg = Debug|x64 + {9F58AD72-49E1-4D10-B826-9E190AB0AAC0}.Debug-DLL|x64.Build.0 = Debug|x64 + {9F58AD72-49E1-4D10-B826-9E190AB0AAC0}.Release-DLL|Win32.ActiveCfg = Release|Win32 + {9F58AD72-49E1-4D10-B826-9E190AB0AAC0}.Release-DLL|Win32.Build.0 = Release|Win32 + {9F58AD72-49E1-4D10-B826-9E190AB0AAC0}.Release-DLL|x64.ActiveCfg = Release|x64 + {9F58AD72-49E1-4D10-B826-9E190AB0AAC0}.Release-DLL|x64.Build.0 = Release|x64 {6EE56155-DF7C-4F6E-BFC4-F6F776BEB211}.Debug|Win32.ActiveCfg = Debug|Win32 {6EE56155-DF7C-4F6E-BFC4-F6F776BEB211}.Debug|x64.ActiveCfg = Debug|x64 {6EE56155-DF7C-4F6E-BFC4-F6F776BEB211}.Release|Win32.ActiveCfg = Release|Win32 diff --git a/vsprojects/vcxproj/grpc++_error_details/grpc++_error_details.vcxproj b/vsprojects/vcxproj/grpc++_error_details/grpc++_error_details.vcxproj new file mode 100644 index 00000000000..6bb3d4783a6 --- /dev/null +++ b/vsprojects/vcxproj/grpc++_error_details/grpc++_error_details.vcxproj @@ -0,0 +1,178 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {9F58AD72-49E1-4D10-B826-9E190AB0AAC0} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + StaticLibrary + true + Unicode + + + StaticLibrary + false + true + Unicode + + + + + + + + + + + + grpc++_error_details + + + grpc++_error_details + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Windows + true + false + + + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Windows + true + false + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Windows + true + false + true + true + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Windows + true + false + true + true + + + + + + + + + + + + + + + + + + + + + {C187A093-A0FE-489D-A40A-6E33DE0F9FEB} + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + diff --git a/vsprojects/vcxproj/grpc++_error_details/grpc++_error_details.vcxproj.filters b/vsprojects/vcxproj/grpc++_error_details/grpc++_error_details.vcxproj.filters new file mode 100644 index 00000000000..e1814eeceac --- /dev/null +++ b/vsprojects/vcxproj/grpc++_error_details/grpc++_error_details.vcxproj.filters @@ -0,0 +1,47 @@ + + + + + src\proto\grpc\status + + + src\cpp\util + + + + + include\grpc++\support + + + + + + {013272b5-4742-ba38-7cb6-25ff3484ac1d} + + + {f589296d-1ee4-913f-0345-7d8bf51f657b} + + + {3455fa30-ad44-8790-9dc2-ff4ac7dd9e6c} + + + {cf07aafe-1d45-af88-81fb-0bbd5afd247f} + + + {00726556-da02-06d8-bb32-902f55133c6b} + + + {fd90d13e-cc1f-e8cc-56ee-650231b08f56} + + + {ec6be373-4683-335e-03d9-dc636e34d7ef} + + + {8200edf2-9498-6cd9-d8f3-81ad881ca82c} + + + {79c5c1ea-19a8-bf5a-5e0a-3de6ad3a0465} + + + + diff --git a/vsprojects/vcxproj/test/error_details_test/error_details_test.vcxproj b/vsprojects/vcxproj/test/error_details_test/error_details_test.vcxproj new file mode 100644 index 00000000000..e146d9c8d21 --- /dev/null +++ b/vsprojects/vcxproj/test/error_details_test/error_details_test.vcxproj @@ -0,0 +1,203 @@ + + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {2DE1AE9E-D53C-5854-9122-317E34F90C31} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + + + error_details_test + static + Debug + static + Debug + + + error_details_test + static + Release + static + Release + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Console + true + false + true + true + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Console + true + false + true + true + + + + + + + + + + + + + + + + + + {9F58AD72-49E1-4D10-B826-9E190AB0AAC0} + + + {C187A093-A0FE-489D-A40A-6E33DE0F9FEB} + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + diff --git a/vsprojects/vcxproj/test/error_details_test/error_details_test.vcxproj.filters b/vsprojects/vcxproj/test/error_details_test/error_details_test.vcxproj.filters new file mode 100644 index 00000000000..c83e0ae0d76 --- /dev/null +++ b/vsprojects/vcxproj/test/error_details_test/error_details_test.vcxproj.filters @@ -0,0 +1,36 @@ + + + + + src\proto\grpc\testing + + + test\cpp\util + + + + + + {35c957dd-436b-c57a-791d-2737bc179e41} + + + {c8721123-0390-f97d-5aad-0dd4979d5030} + + + {6dbad4a6-6b97-b25a-4f89-6edb20a1e7e0} + + + {5f343032-7701-4924-a1d2-06f46d52d1b3} + + + {688e4f7d-b9aa-342c-ffa7-2ee3ca51cd42} + + + {a4e0ed0a-c1bb-60d6-003b-91c3989f6e6e} + + + {60a99fd3-4904-d29f-b456-7f601092d055} + + + + From a03d204dd73621f87043b0f63ab646ba92169a8d Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 11 Apr 2017 16:09:31 -0700 Subject: [PATCH 326/461] Update credentials test after #9328 --- test/core/security/credentials_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c index c0933c64a68..9bdce71ba0c 100644 --- a/test/core/security/credentials_test.c +++ b/test/core/security/credentials_test.c @@ -582,7 +582,7 @@ static void on_oauth2_creds_get_metadata_failure( static void validate_compute_engine_http_request( const grpc_httpcli_request *request) { GPR_ASSERT(request->handshaker != &grpc_httpcli_ssl); - GPR_ASSERT(strcmp(request->host, "metadata") == 0); + GPR_ASSERT(strcmp(request->host, "metadata.google.internal") == 0); GPR_ASSERT( strcmp(request->http.path, "/computeMetadata/v1/instance/service-accounts/default/token") == From 017a335d2b1170dafe4731c69c4fec9fad42a4ba Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 11 Apr 2017 14:34:04 -0700 Subject: [PATCH 327/461] Only delete core-level server if shutdown was successful --- src/node/ext/call.cc | 19 ++++++++++--------- src/node/ext/call.h | 2 +- src/node/ext/server.cc | 8 +++++--- src/node/ext/server_uv.cc | 4 +++- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/node/ext/call.cc b/src/node/ext/call.cc index bb11cfb83ad..bd60775aad9 100644 --- a/src/node/ext/call.cc +++ b/src/node/ext/call.cc @@ -217,7 +217,7 @@ class SendMetadataOp : public Op { bool IsFinalOp() { return false; } - void OnComplete() { + void OnComplete(bool success) { } protected: std::string GetTypeString() const { @@ -262,7 +262,7 @@ class SendMessageOp : public Op { bool IsFinalOp() { return false; } - void OnComplete() { + void OnComplete(bool success) { } protected: std::string GetTypeString() const { @@ -284,7 +284,7 @@ class SendClientCloseOp : public Op { bool IsFinalOp() { return false; } - void OnComplete() { + void OnComplete(bool success) { } protected: std::string GetTypeString() const { @@ -355,7 +355,7 @@ class SendServerStatusOp : public Op { bool IsFinalOp() { return true; } - void OnComplete() { + void OnComplete(bool success) { } protected: std::string GetTypeString() const { @@ -389,7 +389,7 @@ class GetMetadataOp : public Op { bool IsFinalOp() { return false; } - void OnComplete() { + void OnComplete(bool success) { } protected: @@ -423,7 +423,7 @@ class ReadMessageOp : public Op { bool IsFinalOp() { return false; } - void OnComplete() { + void OnComplete(bool success) { } protected: @@ -466,7 +466,7 @@ class ClientStatusOp : public Op { bool IsFinalOp() { return true; } - void OnComplete() { + void OnComplete(bool success) { } protected: std::string GetTypeString() const { @@ -492,7 +492,7 @@ class ServerCloseResponseOp : public Op { bool IsFinalOp() { return false; } - void OnComplete() { + void OnComplete(bool success) { } protected: @@ -532,11 +532,12 @@ void CompleteTag(void *tag, const char *error_message) { Local argv[] = {Nan::Error(error_message)}; callback->Call(1, argv); } + bool success = (error_message == NULL); bool is_final_op = false; for (vector >::iterator it = tag_struct->ops->begin(); it != tag_struct->ops->end(); ++it) { Op *op_ptr = it->get(); - op_ptr->OnComplete(); + op_ptr->OnComplete(success); if (op_ptr->IsFinalOp()) { is_final_op = true; } diff --git a/src/node/ext/call.h b/src/node/ext/call.h index b38f50060c4..340e32682b9 100644 --- a/src/node/ext/call.h +++ b/src/node/ext/call.h @@ -106,7 +106,7 @@ class Op { virtual ~Op(); v8::Local GetOpType() const; virtual bool IsFinalOp() = 0; - virtual void OnComplete() = 0; + virtual void OnComplete(bool success) = 0; protected: virtual std::string GetTypeString() const = 0; diff --git a/src/node/ext/server.cc b/src/node/ext/server.cc index 2d017dd0483..5384305631d 100644 --- a/src/node/ext/server.cc +++ b/src/node/ext/server.cc @@ -117,7 +117,7 @@ class NewCallOp : public Op { bool IsFinalOp() { return false; } - void OnComplete() { + void OnComplete(bool success) { } grpc_call *call; @@ -143,8 +143,10 @@ class TryShutdownOp: public Op { bool IsFinalOp() { return false; } - void OnComplete() { - server->DestroyWrappedServer(); + void OnComplete(bool success) { + if (success) { + server->DestroyWrappedServer(); + } } protected: std::string GetTypeString() const { return "try_shutdown"; } diff --git a/src/node/ext/server_uv.cc b/src/node/ext/server_uv.cc index 6a31b892490..789938318eb 100644 --- a/src/node/ext/server_uv.cc +++ b/src/node/ext/server_uv.cc @@ -76,7 +76,9 @@ class ServerShutdownOp : public Op { bool IsFinalOp() { return false; } - void OnComplete() { + void OnComplete(bool success) { + /* Because cancel_all_calls was called, we assume that shutdown_and_notify + completes successfully */ grpc_server_destroy(server); } From e1b238458feb5ca7fabfa8f1a06bde8e6d1d0294 Mon Sep 17 00:00:00 2001 From: Makarand Dharmapurikar Date: Tue, 11 Apr 2017 16:18:40 -0700 Subject: [PATCH 328/461] modified caching test added logic to test that cached response is specific to request payload. Removed trailing '\0' from query parameter --- src/core/lib/channel/http_client_filter.c | 4 +--- test/cpp/interop/interop_client.cc | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/core/lib/channel/http_client_filter.c b/src/core/lib/channel/http_client_filter.c index 4e47c5c658f..917a769f8a6 100644 --- a/src/core/lib/channel/http_client_filter.c +++ b/src/core/lib/channel/http_client_filter.c @@ -332,10 +332,8 @@ static grpc_error *hc_mutate_op(grpc_exec_ctx *exec_ctx, */ char *t = (char *)GRPC_SLICE_START_PTR(path_with_query_slice); /* safe to use strlen since base64_encode will always add '\0' */ - size_t path_length = strlen(t) + 1; - *(t + path_length) = '\0'; path_with_query_slice = - grpc_slice_sub(path_with_query_slice, 0, path_length); + grpc_slice_sub(path_with_query_slice, 0, strlen(t)); /* substitute previous path with the new path+query */ grpc_mdelem mdelem_path_and_query = grpc_mdelem_from_slices( diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc index 55ba324cc7d..0e79c5e4b44 100644 --- a/test/cpp/interop/interop_client.cc +++ b/test/cpp/interop/interop_client.cc @@ -918,6 +918,26 @@ bool InteropClient::DoCacheableUnary() { // second response is a cached copy of the first response GPR_ASSERT(response2.payload().body() == response1.payload().body()); + // Request 3 + // Modify the request body so it will not get a cache hit + ts = gpr_now(GPR_CLOCK_PRECISE); + timestamp = std::to_string((long long unsigned)ts.tv_nsec); + SimpleRequest request1; + request1.mutable_payload()->set_body(timestamp.c_str(), timestamp.size()); + ClientContext context3; + SimpleResponse response3; + context3.set_cacheable(true); + context3.AddMetadata("x-user-ip", "1.2.3.4"); + Status s3 = + serviceStub_.Get()->CacheableUnaryCall(&context3, request1, &response3); + if (!AssertStatusOk(s3)) { + return false; + } + gpr_log(GPR_DEBUG, "response 3 payload: %s", + response3.payload().body().c_str()); + + // Check that the response is different from the previous response. + GPR_ASSERT(response3.payload().body() != response1.payload().body()); return true; } From 220bc643f9b4bd8c87f080fd618c9460e55566be Mon Sep 17 00:00:00 2001 From: Makarand Dharmapurikar Date: Tue, 11 Apr 2017 16:24:17 -0700 Subject: [PATCH 329/461] enable cacheable_unary test --- test/cpp/interop/client.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index 369413e6a1d..ea27f2827de 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -163,8 +163,8 @@ int main(int argc, char** argv) { std::bind(&grpc::testing::InteropClient::DoUnimplementedMethod, &client); actions["unimplemented_service"] = std::bind(&grpc::testing::InteropClient::DoUnimplementedService, &client); - // actions["cacheable_unary"] = - // std::bind(&grpc::testing::InteropClient::DoCacheableUnary, &client); + actions["cacheable_unary"] = + std::bind(&grpc::testing::InteropClient::DoCacheableUnary, &client); UpdateActions(&actions); From 95909bb3930136f31fd0493c9911234e766fc5cc Mon Sep 17 00:00:00 2001 From: Matt Kwong Date: Tue, 11 Apr 2017 12:44:46 -0700 Subject: [PATCH 330/461] Add individual sanitizer suites to Kokoro --- tools/internal_ci/README.md | 2 +- tools/internal_ci/linux/grpc_portability.cfg | 2 +- .../grpc_c_asan.cfg} | 2 +- .../grpc_c_asan.sh} | 4 +- .../linux/sanitizer/grpc_c_msan.cfg | 39 ++++++++++++++++++ .../linux/sanitizer/grpc_c_msan.sh | 40 +++++++++++++++++++ .../linux/sanitizer/grpc_c_tsan.cfg | 39 ++++++++++++++++++ .../linux/sanitizer/grpc_c_tsan.sh | 40 +++++++++++++++++++ .../linux/sanitizer/grpc_cpp_asan.cfg | 39 ++++++++++++++++++ .../linux/sanitizer/grpc_cpp_asan.sh | 40 +++++++++++++++++++ .../linux/sanitizer/grpc_cpp_tsan.cfg | 39 ++++++++++++++++++ .../linux/sanitizer/grpc_cpp_tsan.sh | 40 +++++++++++++++++++ 12 files changed, 321 insertions(+), 5 deletions(-) rename tools/internal_ci/linux/{grpc_master_sanitizers.cfg => sanitizer/grpc_c_asan.cfg} (96%) rename tools/internal_ci/linux/{grpc_master_sanitizers.sh => sanitizer/grpc_c_asan.sh} (95%) create mode 100644 tools/internal_ci/linux/sanitizer/grpc_c_msan.cfg create mode 100755 tools/internal_ci/linux/sanitizer/grpc_c_msan.sh create mode 100644 tools/internal_ci/linux/sanitizer/grpc_c_tsan.cfg create mode 100755 tools/internal_ci/linux/sanitizer/grpc_c_tsan.sh create mode 100644 tools/internal_ci/linux/sanitizer/grpc_cpp_asan.cfg create mode 100755 tools/internal_ci/linux/sanitizer/grpc_cpp_asan.sh create mode 100644 tools/internal_ci/linux/sanitizer/grpc_cpp_tsan.cfg create mode 100755 tools/internal_ci/linux/sanitizer/grpc_cpp_tsan.sh diff --git a/tools/internal_ci/README.md b/tools/internal_ci/README.md index 8bed6ca782b..e80e342dcd3 100644 --- a/tools/internal_ci/README.md +++ b/tools/internal_ci/README.md @@ -1,4 +1,4 @@ -#Internal continuous integration +# Internal continuous integration gRPC's externally facing testing is managed by Jenkins CI (see `tools/jenkins` directory). Nevertheless, some of the tests are better suited for being run diff --git a/tools/internal_ci/linux/grpc_portability.cfg b/tools/internal_ci/linux/grpc_portability.cfg index 5cc49f10462..92efda80ff6 100644 --- a/tools/internal_ci/linux/grpc_portability.cfg +++ b/tools/internal_ci/linux/grpc_portability.cfg @@ -31,7 +31,7 @@ # Location of the continuous shell script in repository. build_file: "grpc/tools/internal_ci/linux/grpc_portability.sh" -timeout_mins: 720 +timeout_mins: 1440 action { define_artifacts { regex: "**/*sponge_log.xml" diff --git a/tools/internal_ci/linux/grpc_master_sanitizers.cfg b/tools/internal_ci/linux/sanitizer/grpc_c_asan.cfg similarity index 96% rename from tools/internal_ci/linux/grpc_master_sanitizers.cfg rename to tools/internal_ci/linux/sanitizer/grpc_c_asan.cfg index a2a9407128b..8f2be8b59c6 100644 --- a/tools/internal_ci/linux/grpc_master_sanitizers.cfg +++ b/tools/internal_ci/linux/sanitizer/grpc_c_asan.cfg @@ -30,7 +30,7 @@ # Config file for the internal CI (in protobuf text format) # Location of the continuous shell script in repository. -build_file: "grpc/tools/internal_ci/linux/grpc_master_sanitizers.sh" +build_file: "grpc/tools/internal_ci/linux/sanitizer/grpc_c_asan.sh" timeout_mins: 1440 action { define_artifacts { diff --git a/tools/internal_ci/linux/grpc_master_sanitizers.sh b/tools/internal_ci/linux/sanitizer/grpc_c_asan.sh similarity index 95% rename from tools/internal_ci/linux/grpc_master_sanitizers.sh rename to tools/internal_ci/linux/sanitizer/grpc_c_asan.sh index d22387fb203..335d47af85f 100755 --- a/tools/internal_ci/linux/grpc_master_sanitizers.sh +++ b/tools/internal_ci/linux/sanitizer/grpc_c_asan.sh @@ -31,10 +31,10 @@ set -ex # change to grpc repo root -cd $(dirname $0)/../../.. +cd $(dirname $0)/../../../.. git submodule update --init # download docker images from dockerhub export DOCKERHUB_ORGANIZATION=grpctesting -tools/run_tests/run_tests_matrix.py -f sanitizers linux +tools/run_tests/run_tests_matrix.py -f c asan diff --git a/tools/internal_ci/linux/sanitizer/grpc_c_msan.cfg b/tools/internal_ci/linux/sanitizer/grpc_c_msan.cfg new file mode 100644 index 00000000000..2fd19974843 --- /dev/null +++ b/tools/internal_ci/linux/sanitizer/grpc_c_msan.cfg @@ -0,0 +1,39 @@ +# Copyright 2017, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Config file for the internal CI (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc/tools/internal_ci/linux/sanitizer/grpc_c_msan.sh" +timeout_mins: 1440 +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} diff --git a/tools/internal_ci/linux/sanitizer/grpc_c_msan.sh b/tools/internal_ci/linux/sanitizer/grpc_c_msan.sh new file mode 100755 index 00000000000..fe9565ecbdd --- /dev/null +++ b/tools/internal_ci/linux/sanitizer/grpc_c_msan.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Copyright 2017, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set -ex + +# change to grpc repo root +cd $(dirname $0)/../../../.. + +git submodule update --init + +# download docker images from dockerhub +export DOCKERHUB_ORGANIZATION=grpctesting +tools/run_tests/run_tests_matrix.py -f c msan diff --git a/tools/internal_ci/linux/sanitizer/grpc_c_tsan.cfg b/tools/internal_ci/linux/sanitizer/grpc_c_tsan.cfg new file mode 100644 index 00000000000..1ba01211b9f --- /dev/null +++ b/tools/internal_ci/linux/sanitizer/grpc_c_tsan.cfg @@ -0,0 +1,39 @@ +# Copyright 2017, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Config file for the internal CI (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc/tools/internal_ci/linux/sanitizer/grpc_c_tsan.sh" +timeout_mins: 1440 +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} diff --git a/tools/internal_ci/linux/sanitizer/grpc_c_tsan.sh b/tools/internal_ci/linux/sanitizer/grpc_c_tsan.sh new file mode 100755 index 00000000000..49bbbee8594 --- /dev/null +++ b/tools/internal_ci/linux/sanitizer/grpc_c_tsan.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Copyright 2017, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set -ex + +# change to grpc repo root +cd $(dirname $0)/../../../.. + +git submodule update --init + +# download docker images from dockerhub +export DOCKERHUB_ORGANIZATION=grpctesting +tools/run_tests/run_tests_matrix.py -f c tsan diff --git a/tools/internal_ci/linux/sanitizer/grpc_cpp_asan.cfg b/tools/internal_ci/linux/sanitizer/grpc_cpp_asan.cfg new file mode 100644 index 00000000000..49b7f123195 --- /dev/null +++ b/tools/internal_ci/linux/sanitizer/grpc_cpp_asan.cfg @@ -0,0 +1,39 @@ +# Copyright 2017, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Config file for the internal CI (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc/tools/internal_ci/linux/sanitizer/grpc_cpp_asan.sh" +timeout_mins: 1440 +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} diff --git a/tools/internal_ci/linux/sanitizer/grpc_cpp_asan.sh b/tools/internal_ci/linux/sanitizer/grpc_cpp_asan.sh new file mode 100755 index 00000000000..c3bf79b1fb5 --- /dev/null +++ b/tools/internal_ci/linux/sanitizer/grpc_cpp_asan.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Copyright 2017, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set -ex + +# change to grpc repo root +cd $(dirname $0)/../../../.. + +git submodule update --init + +# download docker images from dockerhub +export DOCKERHUB_ORGANIZATION=grpctesting +tools/run_tests/run_tests_matrix.py -f cpp asan diff --git a/tools/internal_ci/linux/sanitizer/grpc_cpp_tsan.cfg b/tools/internal_ci/linux/sanitizer/grpc_cpp_tsan.cfg new file mode 100644 index 00000000000..97c818b5571 --- /dev/null +++ b/tools/internal_ci/linux/sanitizer/grpc_cpp_tsan.cfg @@ -0,0 +1,39 @@ +# Copyright 2017, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Config file for the internal CI (in protobuf text format) + +# Location of the continuous shell script in repository. +build_file: "grpc/tools/internal_ci/linux/sanitizer/grpc_cpp_tsan.sh" +timeout_mins: 1440 +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} diff --git a/tools/internal_ci/linux/sanitizer/grpc_cpp_tsan.sh b/tools/internal_ci/linux/sanitizer/grpc_cpp_tsan.sh new file mode 100755 index 00000000000..c72a106c91a --- /dev/null +++ b/tools/internal_ci/linux/sanitizer/grpc_cpp_tsan.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Copyright 2017, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set -ex + +# change to grpc repo root +cd $(dirname $0)/../../../.. + +git submodule update --init + +# download docker images from dockerhub +export DOCKERHUB_ORGANIZATION=grpctesting +tools/run_tests/run_tests_matrix.py -f cpp tsan From 2ad8a9b654606488b8c1d8453a5a855e1b5555b9 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 11 Apr 2017 20:59:14 -0700 Subject: [PATCH 331/461] Handle cancellation --- .../message_compress_filter.c | 39 ++++++++++++++++--- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/src/core/ext/filters/http/message_compress/message_compress_filter.c b/src/core/ext/filters/http/message_compress/message_compress_filter.c index 23b100d8ee6..61ab3d26d8c 100644 --- a/src/core/ext/filters/http/message_compress/message_compress_filter.c +++ b/src/core/ext/filters/http/message_compress/message_compress_filter.c @@ -54,6 +54,7 @@ int grpc_compression_trace = 0; #define INITIAL_METADATA_UNSEEN 0 #define HAS_COMPRESSION_ALGORITHM 1 #define NO_COMPRESSION_ALGORITHM 2 +#define CANCELLED 3 typedef struct call_data { grpc_slice_buffer slices; /**< Buffers up input slices to be compressed */ @@ -70,6 +71,7 @@ typedef struct call_data { set NO_COMPRESSION_ALGORITHM - initial metadata seen; no compression algorithm set + CANCELLED - request was cancelled pointer - a stalled op containing a send_message that's waiting on initial metadata */ gpr_atm send_initial_metadata_state; @@ -265,6 +267,26 @@ static void compress_start_transport_stream_op_batch( GPR_TIMER_BEGIN("compress_start_transport_stream_op_batch", 0); + if (op->cancel_stream) { + gpr_atm cur; + do { + cur = gpr_atm_acq_load(&calld->send_initial_metadata_state); + } while ( + !gpr_atm_rel_cas(&calld->send_initial_metadata_state, cur, CANCELLED)); + switch (cur) { + case HAS_COMPRESSION_ALGORITHM: + case NO_COMPRESSION_ALGORITHM: + case INITIAL_METADATA_UNSEEN: + case CANCELLED: + break; + default: + grpc_transport_stream_op_batch_finish_with_failure( + exec_ctx, (grpc_transport_stream_op_batch *)cur, + GRPC_ERROR_CANCELLED); + break; + } + } + if (op->send_initial_metadata) { bool has_compression_algorithm; grpc_error *error = process_send_initial_metadata( @@ -278,11 +300,14 @@ static void compress_start_transport_stream_op_batch( gpr_atm cur = gpr_atm_acq_load(&calld->send_initial_metadata_state); GPR_ASSERT(cur != HAS_COMPRESSION_ALGORITHM && cur != NO_COMPRESSION_ALGORITHM); - gpr_atm_rel_store(&calld->send_initial_metadata_state, - has_compression_algorithm ? HAS_COMPRESSION_ALGORITHM - : NO_COMPRESSION_ALGORITHM); - if (cur != INITIAL_METADATA_UNSEEN) { - grpc_call_next_op(exec_ctx, elem, (grpc_transport_stream_op_batch *)op); + if (cur != CANCELLED) { + gpr_atm_rel_store(&calld->send_initial_metadata_state, + has_compression_algorithm ? HAS_COMPRESSION_ALGORITHM + : NO_COMPRESSION_ALGORITHM); + if (cur != INITIAL_METADATA_UNSEEN) { + grpc_call_next_op(exec_ctx, elem, + (grpc_transport_stream_op_batch *)cur); + } } } if (op->send_message) { @@ -296,6 +321,10 @@ static void compress_start_transport_stream_op_batch( goto retry_send; } break; + case CANCELLED: + grpc_transport_stream_op_batch_finish_with_failure( + exec_ctx, op, GRPC_ERROR_CANCELLED); + break; case HAS_COMPRESSION_ALGORITHM: case NO_COMPRESSION_ALGORITHM: if (!skip_compression(elem, From 2d7d5be813a53fc32046f338709b8c32d6bdd1fe Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 12 Apr 2017 06:54:40 -0700 Subject: [PATCH 332/461] Increase threshold --- tools/profiling/microbenchmarks/bm_diff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index e4ef8df91c7..c3738605194 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -174,7 +174,7 @@ class Benchmark: mdn_diff = abs(median(new) - median(old)) print '%s: new=%r old=%r mdn_diff=%r' % (f, new, old, mdn_diff) s = speedup.speedup(new, old) - if s and mdn_diff > 0.5: + if s and mdn_diff > 0.5 and abs(s) >= 10: self.final[f] = '%+d%%' % s return self.final.keys() From feb77ef996b946371c4abb77fdf86f53ee968809 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 12 Apr 2017 07:10:22 -0700 Subject: [PATCH 333/461] Get cancel error right --- .../message_compress_filter.c | 46 +++++++++++-------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/src/core/ext/filters/http/message_compress/message_compress_filter.c b/src/core/ext/filters/http/message_compress/message_compress_filter.c index 61ab3d26d8c..978dbd61d48 100644 --- a/src/core/ext/filters/http/message_compress/message_compress_filter.c +++ b/src/core/ext/filters/http/message_compress/message_compress_filter.c @@ -52,9 +52,10 @@ int grpc_compression_trace = 0; #define INITIAL_METADATA_UNSEEN 0 -#define HAS_COMPRESSION_ALGORITHM 1 -#define NO_COMPRESSION_ALGORITHM 2 -#define CANCELLED 3 +#define HAS_COMPRESSION_ALGORITHM 2 +#define NO_COMPRESSION_ALGORITHM 4 + +#define CANCELLED_BIT ((gpr_atm)1) typedef struct call_data { grpc_slice_buffer slices; /**< Buffers up input slices to be compressed */ @@ -71,9 +72,9 @@ typedef struct call_data { set NO_COMPRESSION_ALGORITHM - initial metadata seen; no compression algorithm set - CANCELLED - request was cancelled pointer - a stalled op containing a send_message that's waiting on initial - metadata */ + metadata + pointer | CANCELLED_BIT - request was cancelled with error pointed to */ gpr_atm send_initial_metadata_state; grpc_transport_stream_op_batch *send_op; @@ -269,20 +270,23 @@ static void compress_start_transport_stream_op_batch( if (op->cancel_stream) { gpr_atm cur; + GRPC_ERROR_REF(op->payload->cancel_stream.cancel_error); do { cur = gpr_atm_acq_load(&calld->send_initial_metadata_state); - } while ( - !gpr_atm_rel_cas(&calld->send_initial_metadata_state, cur, CANCELLED)); + } while (!gpr_atm_rel_cas( + &calld->send_initial_metadata_state, cur, + CANCELLED_BIT | (gpr_atm)op->payload->cancel_stream.cancel_error)); switch (cur) { case HAS_COMPRESSION_ALGORITHM: case NO_COMPRESSION_ALGORITHM: case INITIAL_METADATA_UNSEEN: - case CANCELLED: break; default: - grpc_transport_stream_op_batch_finish_with_failure( - exec_ctx, (grpc_transport_stream_op_batch *)cur, - GRPC_ERROR_CANCELLED); + if ((cur & CANCELLED_BIT) == 0) { + grpc_transport_stream_op_batch_finish_with_failure( + exec_ctx, (grpc_transport_stream_op_batch *)cur, + op->payload->cancel_stream.cancel_error); + } break; } } @@ -300,7 +304,7 @@ static void compress_start_transport_stream_op_batch( gpr_atm cur = gpr_atm_acq_load(&calld->send_initial_metadata_state); GPR_ASSERT(cur != HAS_COMPRESSION_ALGORITHM && cur != NO_COMPRESSION_ALGORITHM); - if (cur != CANCELLED) { + if ((cur & CANCELLED_BIT) == 0) { gpr_atm_rel_store(&calld->send_initial_metadata_state, has_compression_algorithm ? HAS_COMPRESSION_ALGORITHM : NO_COMPRESSION_ALGORITHM); @@ -321,10 +325,6 @@ static void compress_start_transport_stream_op_batch( goto retry_send; } break; - case CANCELLED: - grpc_transport_stream_op_batch_finish_with_failure( - exec_ctx, op, GRPC_ERROR_CANCELLED); - break; case HAS_COMPRESSION_ALGORITHM: case NO_COMPRESSION_ALGORITHM: if (!skip_compression(elem, @@ -340,8 +340,13 @@ static void compress_start_transport_stream_op_batch( } break; default: - /* >1 send_message concurrently */ - GPR_UNREACHABLE_CODE(break); + if (cur & CANCELLED_BIT) { + grpc_transport_stream_op_batch_finish_with_failure( + exec_ctx, op, (grpc_error *)(cur & ~CANCELLED_BIT)); + } else { + /* >1 send_message concurrently */ + GPR_UNREACHABLE_CODE(break); + } } } else { /* pass control down the stack */ @@ -375,6 +380,11 @@ static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, /* grab pointers to our data from the call element */ call_data *calld = elem->call_data; grpc_slice_buffer_destroy_internal(exec_ctx, &calld->slices); + gpr_atm imstate = + gpr_atm_no_barrier_load(&calld->send_initial_metadata_state); + if (imstate & CANCELLED_BIT) { + GRPC_ERROR_UNREF((grpc_error *)(imstate & ~CANCELLED_BIT)); + } } /* Constructor for channel_data */ From bd3cc405290c8f4d4e1ea42b15652e172b34410f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 12 Apr 2017 08:06:44 -0700 Subject: [PATCH 334/461] Add synchronization so startup completes before shutdown begins --- src/core/lib/surface/server.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/core/lib/surface/server.c b/src/core/lib/surface/server.c index 6ac3181482a..da4dd703d58 100644 --- a/src/core/lib/surface/server.c +++ b/src/core/lib/surface/server.c @@ -212,6 +212,11 @@ struct grpc_server { gpr_mu mu_global; /* mutex for server and channel state */ gpr_mu mu_call; /* mutex for call-specific state */ + /* startup synchronization: flag is protected by mu_global, signals whether + we are doing the listener start routine or not */ + bool starting; + gpr_cv starting_cv; + registered_method *registered_methods; /** one request matcher for unregistered methods */ request_matcher unregistered_request_matcher; @@ -389,6 +394,7 @@ static void server_delete(grpc_exec_ctx *exec_ctx, grpc_server *server) { grpc_channel_args_destroy(exec_ctx, server->channel_args); gpr_mu_destroy(&server->mu_global); gpr_mu_destroy(&server->mu_call); + gpr_cv_destroy(&server->starting_cv); while ((rm = server->registered_methods) != NULL) { server->registered_methods = rm->next; if (server->started) { @@ -1022,6 +1028,7 @@ grpc_server *grpc_server_create(const grpc_channel_args *args, void *reserved) { gpr_mu_init(&server->mu_global); gpr_mu_init(&server->mu_call); + gpr_cv_init(&server->starting_cv); /* decremented by grpc_server_destroy */ gpr_ref_init(&server->internal_refcount, 1); @@ -1084,6 +1091,12 @@ static void start_listeners(grpc_exec_ctx *exec_ctx, void *s, for (listener *l = server->listeners; l; l = l->next) { l->start(exec_ctx, server, l->arg, server->pollsets, server->pollset_count); } + + gpr_mu_lock(&server->mu_global); + server->starting = false; + gpr_cv_signal(&server->starting_cv); + gpr_mu_unlock(&server->mu_global); + server_unref(exec_ctx, server); } @@ -1122,6 +1135,7 @@ void grpc_server_start(grpc_server *server) { } server_ref(server); + server->starting = true; grpc_closure_sched(&exec_ctx, grpc_closure_create(start_listeners, server, grpc_executor_scheduler), GRPC_ERROR_NONE); @@ -1258,8 +1272,14 @@ void grpc_server_shutdown_and_notify(grpc_server *server, GRPC_API_TRACE("grpc_server_shutdown_and_notify(server=%p, cq=%p, tag=%p)", 3, (server, cq, tag)); - /* lock, and gather up some stuff to do */ + /* wait for startup to be finished: locks mu_global */ gpr_mu_lock(&server->mu_global); + while (server->starting) { + gpr_cv_wait(&server->starting_cv, &server->mu_global, + gpr_inf_future(GPR_CLOCK_REALTIME)); + } + + /* stay locked, and gather up some stuff to do */ grpc_cq_begin_op(cq, tag); if (server->shutdown_published) { grpc_cq_end_op(&exec_ctx, cq, tag, GRPC_ERROR_NONE, done_published_shutdown, From 8be866eed78b28d59c3f61d54a907b0b11b31d1c Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 12 Apr 2017 08:43:18 -0700 Subject: [PATCH 335/461] fix test --- test/core/transport/chttp2/hpack_encoder_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/core/transport/chttp2/hpack_encoder_test.c b/test/core/transport/chttp2/hpack_encoder_test.c index 701d663cbbc..f4ccc71b395 100644 --- a/test/core/transport/chttp2/hpack_encoder_test.c +++ b/test/core/transport/chttp2/hpack_encoder_test.c @@ -106,7 +106,7 @@ static void verify(grpc_exec_ctx *exec_ctx, size_t window_available, bool eof, grpc_encode_header_options hopt = { .stream_id = 0xdeadbeef, .is_eof = eof, - .use_true_binary_metadata = false, + .use_true_binary_metadata = use_true_binary_metadata, .max_frame_size = 16384, .stats = &stats, }; From 08aea10d02adc49041d6fb1c6ea31553c97af72d Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 12 Apr 2017 08:45:36 -0700 Subject: [PATCH 336/461] document --- include/grpc/impl/codegen/grpc_types.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index 4380aceaf13..8fa76fc0328 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -217,7 +217,8 @@ typedef struct { /** How much data are we willing to queue up per stream if GRPC_WRITE_BUFFER_HINT is set? This is an upper bound */ #define GRPC_ARG_HTTP2_WRITE_BUFFER_SIZE "grpc.http2.write_buffer_size" -/** Should we allow receipt of true-binary data on http2 connections? */ +/** Should we allow receipt of true-binary data on http2 connections? + Defaults to on (1) */ #define GRPC_ARG_HTTP2_ENABLE_TRUE_BINARY "grpc.http2.true_binary" /** After a duration of this time the client/server pings its peer to see if the transport is still alive. Int valued, milliseconds. */ From 12d716c88ce3b4f81d1d4c7a8fdbcddf65134b62 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 12 Apr 2017 09:00:41 -0700 Subject: [PATCH 337/461] add nl --- src/core/ext/transport/chttp2/transport/http2_settings.c | 1 + tools/codegen/core/gen_settings_ids.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/http2_settings.c b/src/core/ext/transport/chttp2/transport/http2_settings.c index bca3834b55f..d4905107efe 100644 --- a/src/core/ext/transport/chttp2/transport/http2_settings.c +++ b/src/core/ext/transport/chttp2/transport/http2_settings.c @@ -54,6 +54,7 @@ bool grpc_wire_id_to_setting_id(uint32_t wire_id, grpc_chttp2_setting_id *out) { return h < GPR_ARRAY_SIZE(grpc_setting_id_to_wire_id) && grpc_setting_id_to_wire_id[h] == wire_id; } + const grpc_chttp2_setting_parameters grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS] = { {"HEADER_TABLE_SIZE", 4096u, 0u, 4294967295u, diff --git a/tools/codegen/core/gen_settings_ids.py b/tools/codegen/core/gen_settings_ids.py index 29c67956c70..a9861383371 100755 --- a/tools/codegen/core/gen_settings_ids.py +++ b/tools/codegen/core/gen_settings_ids.py @@ -140,7 +140,8 @@ print >>C, """ } *out = (grpc_chttp2_setting_id)h; return h < GPR_ARRAY_SIZE(grpc_setting_id_to_wire_id) && grpc_setting_id_to_wire_id[h] == wire_id; -}""" % cgargs +} +""" % cgargs print >>H, """ typedef enum { @@ -156,8 +157,9 @@ typedef struct { grpc_chttp2_invalid_value_behavior invalid_value_behavior; uint32_t error_value; } grpc_chttp2_setting_parameters; + +extern const grpc_chttp2_setting_parameters grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS]; """ -print >>H, "extern const grpc_chttp2_setting_parameters grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS];" print >>C, "const grpc_chttp2_setting_parameters grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS] = {" i = 0 for decorated_setting in sorted(decorated_settings): From dc3806c672ab8cd4ec0e03add1cf138c69cfd444 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 12 Apr 2017 09:08:31 -0700 Subject: [PATCH 338/461] Fix a noise creating bug in bm_json (for bm_diff) --- tools/profiling/microbenchmarks/bm_json.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/profiling/microbenchmarks/bm_json.py b/tools/profiling/microbenchmarks/bm_json.py index e885444f410..917269823d0 100644 --- a/tools/profiling/microbenchmarks/bm_json.py +++ b/tools/profiling/microbenchmarks/bm_json.py @@ -203,4 +203,5 @@ def expand_json(js, js2 = None): row['real_time'] = bm2['real_time'] row['iterations'] = bm2['iterations'] bm2['already_used'] = True + break yield row From d835aa39d3f5a9ad247ea4dafa28da493f8352be Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 12 Apr 2017 09:09:17 -0700 Subject: [PATCH 339/461] Cleanup output: omit unnecessary columns --- tools/profiling/microbenchmarks/bm_diff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index 2337f2b282e..35a79593b41 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -226,7 +226,7 @@ really_interesting = set() for name, bm in benchmarks.items(): print name really_interesting.update(bm.process()) -fields = [f for f in args.track if f in args.track] +fields = [f for f in args.track if f in really_interesting] headers = ['Benchmark'] + fields rows = [] From 161e4baf74eaf760cd028a833a5a05d3e51796ae Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 12 Apr 2017 09:14:26 -0700 Subject: [PATCH 340/461] Fix memory leak --- .../ext/filters/http/message_compress/message_compress_filter.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/ext/filters/http/message_compress/message_compress_filter.c b/src/core/ext/filters/http/message_compress/message_compress_filter.c index 978dbd61d48..00bd271dd57 100644 --- a/src/core/ext/filters/http/message_compress/message_compress_filter.c +++ b/src/core/ext/filters/http/message_compress/message_compress_filter.c @@ -286,6 +286,8 @@ static void compress_start_transport_stream_op_batch( grpc_transport_stream_op_batch_finish_with_failure( exec_ctx, (grpc_transport_stream_op_batch *)cur, op->payload->cancel_stream.cancel_error); + } else { + GRPC_ERROR_UNREF((grpc_error*)(cur & ~CANCELLED_BIT)); } break; } From ca3b32f67d2dcce8cf09612a24fee93aa69c5a7f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 12 Apr 2017 09:36:40 -0700 Subject: [PATCH 341/461] Handle div0 --- src/core/lib/transport/pid_controller.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/lib/transport/pid_controller.c b/src/core/lib/transport/pid_controller.c index 19cb1c0b367..c851564201f 100644 --- a/src/core/lib/transport/pid_controller.c +++ b/src/core/lib/transport/pid_controller.c @@ -49,6 +49,7 @@ void grpc_pid_controller_reset(grpc_pid_controller *pid_controller) { double grpc_pid_controller_update(grpc_pid_controller *pid_controller, double error, double dt) { + if (dt == 0) return pid_controller->last_control_value; /* integrate error using the trapezoid rule */ pid_controller->error_integral += dt * (pid_controller->last_error + error) * 0.5; From 9f99c303d01c706306eb54a5cfd0a23e1e76c6e3 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 12 Apr 2017 09:37:47 -0700 Subject: [PATCH 342/461] Handle 0-length --- src/core/lib/slice/slice.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/lib/slice/slice.c b/src/core/lib/slice/slice.c index 1cddf062cd4..da5dc3e52af 100644 --- a/src/core/lib/slice/slice.c +++ b/src/core/lib/slice/slice.c @@ -197,6 +197,7 @@ grpc_slice grpc_slice_new_with_len(void *p, size_t len, } grpc_slice grpc_slice_from_copied_buffer(const char *source, size_t length) { + if (length == 0) return grpc_empty_slice(); grpc_slice slice = grpc_slice_malloc(length); memcpy(GRPC_SLICE_START_PTR(slice), source, length); return slice; From 7fea75125846a0326dfa907c5a310f62d5f8e567 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 12 Apr 2017 09:43:34 -0700 Subject: [PATCH 343/461] ubsan fixes --- src/core/lib/iomgr/sockaddr_utils.c | 4 +++- src/core/lib/slice/slice.c | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/core/lib/iomgr/sockaddr_utils.c b/src/core/lib/iomgr/sockaddr_utils.c index 9d2732666b2..a6a4cac3e29 100644 --- a/src/core/lib/iomgr/sockaddr_utils.c +++ b/src/core/lib/iomgr/sockaddr_utils.c @@ -55,7 +55,9 @@ int grpc_sockaddr_is_v4mapped(const grpc_resolved_address *resolved_addr, GPR_ASSERT(resolved_addr != resolved_addr4_out); const struct sockaddr *addr = (const struct sockaddr *)resolved_addr->addr; struct sockaddr_in *addr4_out = - (struct sockaddr_in *)resolved_addr4_out->addr; + resolved_addr4_out == NULL + ? NULL + : (struct sockaddr_in *)resolved_addr4_out->addr; if (addr->sa_family == AF_INET6) { const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6 *)addr; if (memcmp(addr6->sin6_addr.s6_addr, kV4MappedPrefix, diff --git a/src/core/lib/slice/slice.c b/src/core/lib/slice/slice.c index da5dc3e52af..a2fcbbdbdf5 100644 --- a/src/core/lib/slice/slice.c +++ b/src/core/lib/slice/slice.c @@ -383,8 +383,9 @@ grpc_slice grpc_slice_split_head(grpc_slice *source, size_t split) { } int grpc_slice_default_eq_impl(grpc_slice a, grpc_slice b) { - return GRPC_SLICE_LENGTH(a) == GRPC_SLICE_LENGTH(b) && - 0 == memcmp(GRPC_SLICE_START_PTR(a), GRPC_SLICE_START_PTR(b), + if (GRPC_SLICE_LENGTH(a) != GRPC_SLICE_LENGTH(b)) return false; + if (GRPC_SLICE_LENGTH(a) == 0) return true; + return 0 == memcmp(GRPC_SLICE_START_PTR(a), GRPC_SLICE_START_PTR(b), GRPC_SLICE_LENGTH(a)); } From 66d40c63f7bf004623dcc4dbafda96b69fc46094 Mon Sep 17 00:00:00 2001 From: yang-g Date: Wed, 12 Apr 2017 10:18:10 -0700 Subject: [PATCH 344/461] Fix BUILD dependency, copyright and cmake --- CMakeLists.txt | 4 +++- templates/CMakeLists.txt.template | 4 +++- test/cpp/util/BUILD | 3 ++- tools/distrib/check_copyright.py | 2 ++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 08bf646c823..0869c3a8c30 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -167,6 +167,7 @@ if("${gRPC_PROTOBUF_PROVIDER}" STREQUAL "module") if(NOT PROTOBUF_ROOT_DIR) set(PROTOBUF_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/protobuf) endif() + set(PROTOBUF_WELLKNOWN_IMPORT_DIR ${PROTOBUF_ROOT_DIR}/src) if(EXISTS "${PROTOBUF_ROOT_DIR}/cmake/CMakeLists.txt") set(protobuf_MSVC_STATIC_RUNTIME OFF CACHE BOOL "Link static runtime libraries") add_subdirectory(${PROTOBUF_ROOT_DIR}/cmake third_party/protobuf) @@ -199,6 +200,7 @@ elseif("${gRPC_PROTOBUF_PROVIDER}" STREQUAL "package") find_package(Protobuf MODULE) set(_gRPC_FIND_PROTOBUF "if(NOT Protobuf_FOUND)\n find_package(Protobuf)\nendif()") endif() + set(PROTOBUF_WELLKNOWN_IMPORT_DIR /usr/local/include) endif() if("${gRPC_SSL_PROVIDER}" STREQUAL "module") @@ -301,7 +303,7 @@ function(protobuf_generate_grpc_cpp) return() endif() - set(_protobuf_include_path -I .) + set(_protobuf_include_path -I . -I ${PROTOBUF_WELLKNOWN_IMPORT_DIR}) foreach(FIL ${ARGN}) get_filename_component(ABS_FIL ${FIL} ABSOLUTE) get_filename_component(FIL_WE ${FIL} NAME_WE) diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index cf69f0cc06f..c647ea57072 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -212,6 +212,7 @@ if(NOT PROTOBUF_ROOT_DIR) set(PROTOBUF_ROOT_DIR <%text>${CMAKE_CURRENT_SOURCE_DIR}/third_party/protobuf) endif() + set(PROTOBUF_WELLKNOWN_IMPORT_DIR <%text>${PROTOBUF_ROOT_DIR}/src) if(EXISTS "<%text>${PROTOBUF_ROOT_DIR}/cmake/CMakeLists.txt") set(protobuf_MSVC_STATIC_RUNTIME OFF CACHE BOOL "Link static runtime libraries") add_subdirectory(<%text>${PROTOBUF_ROOT_DIR}/cmake third_party/protobuf) @@ -244,6 +245,7 @@ find_package(Protobuf MODULE) set(_gRPC_FIND_PROTOBUF "if(NOT Protobuf_FOUND)\n find_package(Protobuf)\nendif()") endif() + set(PROTOBUF_WELLKNOWN_IMPORT_DIR /usr/local/include) endif() if("<%text>${gRPC_SSL_PROVIDER}" STREQUAL "module") @@ -346,7 +348,7 @@ return() endif() - set(_protobuf_include_path -I .) + set(_protobuf_include_path -I . -I <%text>${PROTOBUF_WELLKNOWN_IMPORT_DIR}) foreach(FIL <%text>${ARGN}) get_filename_component(ABS_FIL <%text>${FIL} ABSOLUTE) get_filename_component(FIL_WE <%text>${FIL} NAME_WE) diff --git a/test/cpp/util/BUILD b/test/cpp/util/BUILD index 7471ce75dd3..38f804ffd40 100644 --- a/test/cpp/util/BUILD +++ b/test/cpp/util/BUILD @@ -89,8 +89,9 @@ cc_test( "error_details_test.cc", ], deps = [ - "//external:gtest", "//:grpc++_error_details", + "//external:gtest", + "//src/proto/grpc/testing:echo_messages_proto", ], ) diff --git a/tools/distrib/check_copyright.py b/tools/distrib/check_copyright.py index 42005e3bd3a..0a58adf2f0a 100755 --- a/tools/distrib/check_copyright.py +++ b/tools/distrib/check_copyright.py @@ -113,6 +113,8 @@ _EXEMPT = frozenset(( 'src/php/tests/bootstrap.php', # census.proto copied from github 'tools/grpcz/census.proto', + # status.proto copied from googleapis + 'src/proto/grpc/status/status.proto', )) From 70a2a4b01ae451d746d314cb18dcc372d094cf3e Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 12 Apr 2017 10:23:35 -0700 Subject: [PATCH 345/461] Bump version to 1.2.4 --- BUILD | 2 +- CMakeLists.txt | 2 +- Makefile | 4 ++-- build.yaml | 2 +- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.json | 2 +- package.xml | 4 ++-- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Auth/project.json | 4 ++-- src/csharp/Grpc.Core.Testing/project.json | 4 ++-- src/csharp/Grpc.Core/VersionInfo.cs | 4 ++-- src/csharp/Grpc.Core/project.json | 2 +- src/csharp/Grpc.HealthCheck/project.json | 4 ++-- src/csharp/Grpc.Reflection/project.json | 4 ++-- src/csharp/build_packages_dotnetcli.bat | 2 +- src/csharp/build_packages_dotnetcli.sh | 4 ++-- src/node/health_check/package.json | 4 ++-- src/node/tools/package.json | 2 +- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/private/version.h | 2 +- src/php/composer.json | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- 33 files changed, 42 insertions(+), 42 deletions(-) diff --git a/BUILD b/BUILD index 680722ac66b..0893b81c9b7 100644 --- a/BUILD +++ b/BUILD @@ -41,7 +41,7 @@ g_stands_for = "green" core_version = "3.0.0-dev" -version = "1.2.3" +version = "1.2.4" grpc_cc_library( name = "gpr", diff --git a/CMakeLists.txt b/CMakeLists.txt index e09f7297333..725c2db0e18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,7 @@ cmake_minimum_required(VERSION 2.8) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.2.3") +set(PACKAGE_VERSION "1.2.4") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index 7f9e203c957..41b803fe0b6 100644 --- a/Makefile +++ b/Makefile @@ -412,8 +412,8 @@ Q = @ endif CORE_VERSION = 3.0.0-dev -CPP_VERSION = 1.2.3 -CSHARP_VERSION = 1.2.3 +CPP_VERSION = 1.2.4 +CSHARP_VERSION = 1.2.4 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/build.yaml b/build.yaml index ac183a91b56..1a9c07e1ade 100644 --- a/build.yaml +++ b/build.yaml @@ -14,7 +14,7 @@ settings: '#10': See the expand_version.py for all the quirks here core_version: 3.0.0-dev g_stands_for: green - version: 1.2.3 + version: 1.2.4 filegroups: - name: census public_headers: diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 9e6218d031c..3f75650c99a 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -37,7 +37,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.2.3' + version = '1.2.4' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'http://www.grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index a4b56fe1054..c1eaa721bd9 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -36,7 +36,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.2.3' + version = '1.2.4' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'http://www.grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index a567e6aa0f5..15234ea8cca 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -36,7 +36,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.2.3' + version = '1.2.4' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'http://www.grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index 891f9a5aebe..a79c28ea5ae 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -35,7 +35,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.2.3' + version = '1.2.4' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'http://www.grpc.io' diff --git a/package.json b/package.json index f2646c0d6d1..bc29b84cfe2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grpc", - "version": "1.2.3", + "version": "1.2.4", "author": "Google Inc.", "description": "gRPC Library for Node", "homepage": "http://www.grpc.io/", diff --git a/package.xml b/package.xml index f120d57a6d1..fdda050447a 100644 --- a/package.xml +++ b/package.xml @@ -13,8 +13,8 @@ 2017-03-01 - 1.2.3 - 1.2.3 + 1.2.4 + 1.2.4 beta diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index cda07999244..8f3f8e01f56 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -37,5 +37,5 @@ #include namespace grpc { -grpc::string Version() { return "1.2.3"; } +grpc::string Version() { return "1.2.4"; } } diff --git a/src/csharp/Grpc.Auth/project.json b/src/csharp/Grpc.Auth/project.json index 45ee3a3112b..fbfe29e8b7b 100644 --- a/src/csharp/Grpc.Auth/project.json +++ b/src/csharp/Grpc.Auth/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.3", + "version": "1.2.4", "title": "gRPC C# Auth", "authors": [ "Google Inc." ], "copyright": "Copyright 2015, Google Inc.", @@ -21,7 +21,7 @@ } }, "dependencies": { - "Grpc.Core": "1.2.3", + "Grpc.Core": "1.2.4", "Google.Apis.Auth": "1.21.0" }, "frameworks": { diff --git a/src/csharp/Grpc.Core.Testing/project.json b/src/csharp/Grpc.Core.Testing/project.json index 40dc57ac76f..c174e8bf535 100644 --- a/src/csharp/Grpc.Core.Testing/project.json +++ b/src/csharp/Grpc.Core.Testing/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.3", + "version": "1.2.4", "title": "gRPC C# Core Testing", "authors": [ "Google Inc." ], "copyright": "Copyright 2017, Google Inc.", @@ -21,7 +21,7 @@ } }, "dependencies": { - "Grpc.Core": "1.2.3" + "Grpc.Core": "1.2.4" }, "frameworks": { "net45": { diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs index c3339ce1a45..d324963d1a0 100644 --- a/src/csharp/Grpc.Core/VersionInfo.cs +++ b/src/csharp/Grpc.Core/VersionInfo.cs @@ -48,11 +48,11 @@ namespace Grpc.Core /// /// Current AssemblyFileVersion of gRPC C# assemblies /// - public const string CurrentAssemblyFileVersion = "1.2.3.0"; + public const string CurrentAssemblyFileVersion = "1.2.4.0"; /// /// Current version of gRPC C# /// - public const string CurrentVersion = "1.2.3"; + public const string CurrentVersion = "1.2.4"; } } diff --git a/src/csharp/Grpc.Core/project.json b/src/csharp/Grpc.Core/project.json index 0381b04cf5c..793258da707 100644 --- a/src/csharp/Grpc.Core/project.json +++ b/src/csharp/Grpc.Core/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.3", + "version": "1.2.4", "title": "gRPC C# Core", "authors": [ "Google Inc." ], "copyright": "Copyright 2015, Google Inc.", diff --git a/src/csharp/Grpc.HealthCheck/project.json b/src/csharp/Grpc.HealthCheck/project.json index 4010d5566ab..50d6f202b1c 100644 --- a/src/csharp/Grpc.HealthCheck/project.json +++ b/src/csharp/Grpc.HealthCheck/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.3", + "version": "1.2.4", "title": "gRPC C# Healthchecking", "authors": [ "Google Inc." ], "copyright": "Copyright 2015, Google Inc.", @@ -21,7 +21,7 @@ } }, "dependencies": { - "Grpc.Core": "1.2.3", + "Grpc.Core": "1.2.4", "Google.Protobuf": "3.2.0" }, "frameworks": { diff --git a/src/csharp/Grpc.Reflection/project.json b/src/csharp/Grpc.Reflection/project.json index 996aa51512f..6f48fa5aa43 100644 --- a/src/csharp/Grpc.Reflection/project.json +++ b/src/csharp/Grpc.Reflection/project.json @@ -1,5 +1,5 @@ { - "version": "1.2.3", + "version": "1.2.4", "title": "gRPC C# Reflection", "authors": [ "Google Inc." ], "copyright": "Copyright 2016, Google Inc.", @@ -21,7 +21,7 @@ } }, "dependencies": { - "Grpc.Core": "1.2.3", + "Grpc.Core": "1.2.4", "Google.Protobuf": "3.2.0" }, "frameworks": { diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat index aa47067d740..f1e44dac8c2 100755 --- a/src/csharp/build_packages_dotnetcli.bat +++ b/src/csharp/build_packages_dotnetcli.bat @@ -28,7 +28,7 @@ @rem OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @rem Current package versions -set VERSION=1.2.3 +set VERSION=1.2.4 set PROTOBUF_VERSION=3.0.0 @rem Adjust the location of nuget.exe diff --git a/src/csharp/build_packages_dotnetcli.sh b/src/csharp/build_packages_dotnetcli.sh index b0432f4b18a..b703d879d4c 100755 --- a/src/csharp/build_packages_dotnetcli.sh +++ b/src/csharp/build_packages_dotnetcli.sh @@ -66,7 +66,7 @@ dotnet pack --configuration Release Grpc.Auth/project.json --output ../../artifa dotnet pack --configuration Release Grpc.HealthCheck/project.json --output ../../artifacts dotnet pack --configuration Release Grpc.Reflection/project.json --output ../../artifacts -nuget pack Grpc.nuspec -Version "1.2.3" -OutputDirectory ../../artifacts -nuget pack Grpc.Tools.nuspec -Version "1.2.3" -OutputDirectory ../../artifacts +nuget pack Grpc.nuspec -Version "1.2.4" -OutputDirectory ../../artifacts +nuget pack Grpc.Tools.nuspec -Version "1.2.4" -OutputDirectory ../../artifacts (cd ../../artifacts && zip csharp_nugets_dotnetcli.zip *.nupkg) diff --git a/src/node/health_check/package.json b/src/node/health_check/package.json index 5ad59e27e6a..fb1ad77704f 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.2.3", + "version": "1.2.4", "author": "Google Inc.", "description": "Health check service for use with gRPC", "repository": { @@ -15,7 +15,7 @@ } ], "dependencies": { - "grpc": "^1.2.3", + "grpc": "^1.2.4", "lodash": "^3.9.3", "google-protobuf": "^3.0.0" }, diff --git a/src/node/tools/package.json b/src/node/tools/package.json index e06775b5bb6..b552c4297a9 100644 --- a/src/node/tools/package.json +++ b/src/node/tools/package.json @@ -1,6 +1,6 @@ { "name": "grpc-tools", - "version": "1.2.3", + "version": "1.2.4", "author": "Google Inc.", "description": "Tools for developing with gRPC on Node.js", "homepage": "http://www.grpc.io/", diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index f314d48c887..876fa1ce05b 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.2.3' + v = '1.2.4' 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 69035cf8add..f02b2693adf 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -38,4 +38,4 @@ // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.2.3" +#define GRPC_OBJC_VERSION_STRING @"1.2.4" diff --git a/src/php/composer.json b/src/php/composer.json index a2f83ec1e00..7061f417bc8 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": "BSD-3-Clause", - "version": "1.2.3", + "version": "1.2.4", "require": { "php": ">=5.5.0", "google/protobuf": "^v3.1.0" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index 0fdb76072b3..c1f101f08bd 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION='1.2.3' +VERSION='1.2.4' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index d3ac3aa3ef0..99b9f80c67d 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION='1.2.3' +VERSION='1.2.4' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index 416910c6ab9..bd25f0466b7 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION='1.2.3' +VERSION='1.2.4' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index 71495a1075f..b46ba3c9bee 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION='1.2.3' +VERSION='1.2.4' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index 51f9ccace9e..6a31b125677 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -29,5 +29,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.2.3' + VERSION = '1.2.4' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index dd07b264d4b..641ffdc79a6 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -29,6 +29,6 @@ module GRPC module Tools - VERSION = '1.2.3' + VERSION = '1.2.4' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index 32fad56ca4d..ce560e156bd 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION='1.2.3' +VERSION='1.2.4' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 4bb1414e868..9fc757eb5df 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.2.3 +PROJECT_NUMBER = 1.2.4 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index db987191b60..1cf44358a24 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.2.3 +PROJECT_NUMBER = 1.2.4 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a From b4e97270cc13849bb5a4585c88bc6385872d643b Mon Sep 17 00:00:00 2001 From: Makarand Dharmapurikar Date: Wed, 12 Apr 2017 12:16:28 -0700 Subject: [PATCH 346/461] replaced hardcoded server path with cmdline arg The host and port of the remote server can be specified via command line argument to xcodebuild. --- src/objective-c/tests/InteropTestsLocalCleartext.m | 6 +++++- src/objective-c/tests/InteropTestsLocalSSL.m | 7 +++++-- src/objective-c/tests/InteropTestsRemote.m | 6 +++++- .../InteropTestsRemoteWithCronet.m | 7 ++++++- src/objective-c/tests/Tests.xcodeproj/project.pbxproj | 1 + src/objective-c/tests/run_tests.sh | 4 ++++ 6 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/objective-c/tests/InteropTestsLocalCleartext.m b/src/objective-c/tests/InteropTestsLocalCleartext.m index 94cdf859653..cdcdd8a88c7 100644 --- a/src/objective-c/tests/InteropTestsLocalCleartext.m +++ b/src/objective-c/tests/InteropTestsLocalCleartext.m @@ -36,7 +36,11 @@ #import "InteropTests.h" -static NSString * const kLocalCleartextHost = @"localhost:5050"; +// The server address is derived from preprocessor macro, which is +// in turn derived from environment variable of the same name. +#define NSStringize_helper(x) #x +#define NSStringize(x) @NSStringize_helper(x) +static NSString * const kLocalCleartextHost = NSStringize(HOST_PORT_LOCAL); // The Protocol Buffers encoding overhead of local interop server. Acquired // by experiment. Adjust this when server's proto file changes. diff --git a/src/objective-c/tests/InteropTestsLocalSSL.m b/src/objective-c/tests/InteropTestsLocalSSL.m index 3c78b65ede9..45e62d29b9a 100644 --- a/src/objective-c/tests/InteropTestsLocalSSL.m +++ b/src/objective-c/tests/InteropTestsLocalSSL.m @@ -35,8 +35,11 @@ #import #import "InteropTests.h" - -static NSString * const kLocalSSLHost = @"localhost:5051"; +// The server address is derived from preprocessor macro, which is +// in turn derived from environment variable of the same name. +#define NSStringize_helper(x) #x +#define NSStringize(x) @NSStringize_helper(x) +static NSString * const kLocalSSLHost = NSStringize(HOST_PORT_LOCALSSL); // The Protocol Buffers encoding overhead of local interop server. Acquired // by experiment. Adjust this when server's proto file changes. diff --git a/src/objective-c/tests/InteropTestsRemote.m b/src/objective-c/tests/InteropTestsRemote.m index ff1193302b0..5260fe4570b 100644 --- a/src/objective-c/tests/InteropTestsRemote.m +++ b/src/objective-c/tests/InteropTestsRemote.m @@ -36,7 +36,11 @@ #import "InteropTests.h" -static NSString * const kRemoteSSLHost = @"grpc-test.sandbox.googleapis.com"; +// The server address is derived from preprocessor macro, which is +// in turn derived from environment variable of the same name. +#define NSStringize_helper(x) #x +#define NSStringize(x) @NSStringize_helper(x) +static NSString * const kRemoteSSLHost = NSStringize(HOST_PORT_REMOTE); // The Protocol Buffers encoding overhead of remote interop server. Acquired // by experiment. Adjust this when server's proto file changes. diff --git a/src/objective-c/tests/InteropTestsRemoteWithCronet/InteropTestsRemoteWithCronet.m b/src/objective-c/tests/InteropTestsRemoteWithCronet/InteropTestsRemoteWithCronet.m index 9edfbc2639d..a7f190d2b4a 100644 --- a/src/objective-c/tests/InteropTestsRemoteWithCronet/InteropTestsRemoteWithCronet.m +++ b/src/objective-c/tests/InteropTestsRemoteWithCronet/InteropTestsRemoteWithCronet.m @@ -39,7 +39,12 @@ #import "InteropTests.h" -static NSString * const kRemoteSSLHost = @"grpc-test.sandbox.googleapis.com"; +// The server address is derived from preprocessor macro, which is +// in turn derived from environment variable of the same name. +#define NSStringize_helper(x) #x +#define NSStringize(x) @NSStringize_helper(x) +static NSString * const kRemoteSSLHost = NSStringize(HOST_PORT_REMOTE); + // The Protocol Buffers encoding overhead of remote interop server. Acquired // by experiment. Adjust this when server's proto file changes. diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj index 97de723a22a..eee4897ca80 100644 --- a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj +++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj @@ -1282,6 +1282,7 @@ GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", + "HOST_PORT=$(HOST_PORT)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_TREAT_WARNINGS_AS_ERRORS = YES; diff --git a/src/objective-c/tests/run_tests.sh b/src/objective-c/tests/run_tests.sh index 0e82bcaa44a..2432209f4f1 100755 --- a/src/objective-c/tests/run_tests.sh +++ b/src/objective-c/tests/run_tests.sh @@ -59,6 +59,9 @@ xcodebuild \ -workspace Tests.xcworkspace \ -scheme AllTests \ -destination name="iPhone 6" \ + HOST_PORT_LOCALSSL=localhost:5051 \ + HOST_PORT_LOCAL=localhost:5050 \ + HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com \ test | xcpretty echo "TIME: $(date)" @@ -84,4 +87,5 @@ xcodebuild \ -workspace Tests.xcworkspace \ -scheme InteropTestsRemoteWithCronet \ -destination name="iPhone 6" \ + HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com \ test | xcpretty From 9ee816e6ef4f98afd076a22ecc631e2d0266ba7b Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Wed, 12 Apr 2017 12:52:20 -0700 Subject: [PATCH 347/461] Fix message_size_filter to use RESOURCE_EXHAUSTED status code. --- src/core/lib/channel/message_size_filter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/lib/channel/message_size_filter.c b/src/core/lib/channel/message_size_filter.c index 57726c8476c..28a4f6eb189 100644 --- a/src/core/lib/channel/message_size_filter.c +++ b/src/core/lib/channel/message_size_filter.c @@ -122,7 +122,7 @@ static void recv_message_ready(grpc_exec_ctx* exec_ctx, void* user_data, (*calld->recv_message)->length, calld->max_recv_size); grpc_error* new_error = grpc_error_set_int( GRPC_ERROR_CREATE_FROM_COPIED_STRING(message_string), - GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_INVALID_ARGUMENT); + GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_RESOURCE_EXHAUSTED); if (error == GRPC_ERROR_NONE) { error = new_error; } else { @@ -152,7 +152,7 @@ static void start_transport_stream_op_batch( exec_ctx, op, grpc_error_set_int(GRPC_ERROR_CREATE_FROM_COPIED_STRING(message_string), GRPC_ERROR_INT_GRPC_STATUS, - GRPC_STATUS_INVALID_ARGUMENT)); + GRPC_STATUS_RESOURCE_EXHAUSTED)); gpr_free(message_string); return; } From 2a86d3f39902f9256260b4452f22e75cc79bc8ff Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Wed, 12 Apr 2017 12:52:47 -0700 Subject: [PATCH 348/461] Update status codes doc. --- doc/statuscodes.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/doc/statuscodes.md b/doc/statuscodes.md index 1cd72df30ad..f2df9e00dec 100644 --- a/doc/statuscodes.md +++ b/doc/statuscodes.md @@ -1,9 +1,20 @@ # Status codes and their use in gRPC -gRPC uses a set of well defined status codes as part of the RPC API. All RPCs started at a client return a `status` object composed of an integer `code` and a string `message`. The server-side can choose the status it returns for a given RPC. +gRPC uses a set of well defined status codes as part of the RPC API. All +RPCs started at a client return a `status` object composed of an integer +`code` and a string `message`. The server-side can choose the status it +returns for a given RPC. -The gRPC client and server-side implementations may also generate and return `status` on their own when errors happen. -Only a subset of the pre-defined status codes are generated by the gRPC libraries. The following table lists these codes and summarizes the situations in which they are generated, either by the client or the server-side library implementation. +The gRPC client and server-side implementations may also generate and +return `status` on their own when errors happen. Only a subset of +the pre-defined status codes are generated by the gRPC libraries. This +allows applications to be sure that any other code it sees was actually +returned by the application (although it is also possible for the +server-side to return one of the codes generated by the gRPC libraries). + +The following table lists the codes that may be returned by the gRPC +libraries (on either the client-side or server-side) and summarizes the +situations in which they are generated. | Case | Code | Generated at Client or Server | | ------------- |:-------------| :-----:| @@ -26,7 +37,7 @@ Only a subset of the pre-defined status codes are generated by the gRPC librarie | Response cardinality violation (method requires exactly one response but server sent some other number of responses) | UNIMPLEMENTED | Client| | Error parsing response proto | INTERNAL | Client| | Error parsing request proto | INTERNAL | Server| - +| Sent or received message was larger than configured limit | RESOURCE_EXHAUSTED | Both | The following status codes are never generated by the library: - INVALID_ARGUMENT From f70b9ee3d43c0786fb1eef16b7f50ab7f74173d7 Mon Sep 17 00:00:00 2001 From: Makarand Dharmapurikar Date: Wed, 12 Apr 2017 13:21:34 -0700 Subject: [PATCH 349/461] added correct preprocessor defines to xcodeproj --- src/objective-c/tests/Tests.xcodeproj/project.pbxproj | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj index eee4897ca80..f838f4c2214 100644 --- a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj +++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj @@ -1282,7 +1282,9 @@ GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", - "HOST_PORT=$(HOST_PORT)", + "HOST_PORT_LOCALSSL=$(HOST_PORT_LOCALSSL)", + "HOST_PORT_LOCAL=$(HOST_PORT_LOCAL)", + "HOST_PORT_REMOTE=$(HOST_PORT_REMOTE)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_TREAT_WARNINGS_AS_ERRORS = YES; From dd1ec7f9cdf7598ed874bfe942ad837686a03ac7 Mon Sep 17 00:00:00 2001 From: Makarand Dharmapurikar Date: Wed, 12 Apr 2017 13:52:18 -0700 Subject: [PATCH 350/461] fixed asan buffer overflow --- src/core/lib/channel/http_server_filter.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/lib/channel/http_server_filter.c b/src/core/lib/channel/http_server_filter.c index c1e49ffacc8..45dcc26f9a3 100644 --- a/src/core/lib/channel/http_server_filter.c +++ b/src/core/lib/channel/http_server_filter.c @@ -228,6 +228,8 @@ static grpc_error *server_filter_incoming_metadata(grpc_exec_ctx *exec_ctx, if (offset < path_length) { grpc_slice query_slice = grpc_slice_sub(path_slice, offset + 1, path_length); + /* add a trailing '\0' before decoding */ + const char *b64_data = grpc_slice_to_c_string(query_slice); /* substitute path metadata with just the path (not query) */ grpc_mdelem mdelem_path_without_query = grpc_mdelem_from_slices( @@ -238,14 +240,12 @@ static grpc_error *server_filter_incoming_metadata(grpc_exec_ctx *exec_ctx, /* decode payload from query and add to the slice buffer to be returned */ const int k_url_safe = 1; - grpc_slice_buffer_add( - &calld->read_slice_buffer, - grpc_base64_decode(exec_ctx, - (const char *)GRPC_SLICE_START_PTR(query_slice), - k_url_safe)); + grpc_slice_buffer_add(&calld->read_slice_buffer, + grpc_base64_decode(exec_ctx, b64_data, k_url_safe)); grpc_slice_buffer_stream_init(&calld->read_stream, &calld->read_slice_buffer, 0); calld->seen_path_with_query = true; + gpr_free((void *)b64_data); grpc_slice_unref_internal(exec_ctx, query_slice); } else { gpr_log(GPR_ERROR, "GET request without QUERY"); From e7a8f41fd01007b9990f908d9697a7e8a73b9f53 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Wed, 12 Apr 2017 14:04:44 -0700 Subject: [PATCH 351/461] Create f->shutdown_cq in the fixture --- .../tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m | 1 + 1 file changed, 1 insertion(+) diff --git a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m index 8a7c4a70d6a..3dd264718cb 100644 --- a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m +++ b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m @@ -80,6 +80,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( f.fixture_data = ffd; f.cq = grpc_completion_queue_create_for_next(NULL); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); return f; } From 66db5a70851049465c00df6e55b6b2e7dc7c1db4 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Wed, 12 Apr 2017 14:31:31 -0700 Subject: [PATCH 352/461] remove src/csharp/global.json --- src/csharp/global.json | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 src/csharp/global.json diff --git a/src/csharp/global.json b/src/csharp/global.json deleted file mode 100644 index f3c33cef6a5..00000000000 --- a/src/csharp/global.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "sdk": { - "version": "1.0.0-preview2-003131" - } -} \ No newline at end of file From 37daca3feb5bcbac48e33a03c8a934cec1599e55 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 12 Apr 2017 14:58:54 -0700 Subject: [PATCH 353/461] add missing refs --- .../http/message_compress/message_compress_filter.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/ext/filters/http/message_compress/message_compress_filter.c b/src/core/ext/filters/http/message_compress/message_compress_filter.c index e1267294ec4..f414a60eee4 100644 --- a/src/core/ext/filters/http/message_compress/message_compress_filter.c +++ b/src/core/ext/filters/http/message_compress/message_compress_filter.c @@ -295,9 +295,9 @@ static void compress_start_transport_stream_op_batch( if ((cur & CANCELLED_BIT) == 0) { grpc_transport_stream_op_batch_finish_with_failure( exec_ctx, (grpc_transport_stream_op_batch *)cur, - op->payload->cancel_stream.cancel_error); + GRPC_ERROR_REF(op->payload->cancel_stream.cancel_error)); } else { - GRPC_ERROR_UNREF((grpc_error*)(cur & ~CANCELLED_BIT)); + GRPC_ERROR_UNREF((grpc_error *)(cur & ~CANCELLED_BIT)); } break; } @@ -354,7 +354,8 @@ static void compress_start_transport_stream_op_batch( default: if (cur & CANCELLED_BIT) { grpc_transport_stream_op_batch_finish_with_failure( - exec_ctx, op, (grpc_error *)(cur & ~CANCELLED_BIT)); + exec_ctx, op, + GRPC_ERROR_REF((grpc_error *)(cur & ~CANCELLED_BIT))); } else { /* >1 send_message concurrently */ GPR_UNREACHABLE_CODE(break); From f3d9b4808a5645ad2ff5d0fee4085bb06cb83419 Mon Sep 17 00:00:00 2001 From: yang-g Date: Wed, 12 Apr 2017 15:21:56 -0700 Subject: [PATCH 354/461] Fix buffer overflow https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=973 --- src/core/lib/channel/http_server_filter.c | 6 ++--- .../clusterfuzz-testcase-5595941564317696 | Bin 0 -> 92 bytes tools/run_tests/generated/tests.json | 23 ++++++++++++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/clusterfuzz-testcase-5595941564317696 diff --git a/src/core/lib/channel/http_server_filter.c b/src/core/lib/channel/http_server_filter.c index c1e49ffacc8..ebcde5315fe 100644 --- a/src/core/lib/channel/http_server_filter.c +++ b/src/core/lib/channel/http_server_filter.c @@ -240,9 +240,9 @@ static grpc_error *server_filter_incoming_metadata(grpc_exec_ctx *exec_ctx, const int k_url_safe = 1; grpc_slice_buffer_add( &calld->read_slice_buffer, - grpc_base64_decode(exec_ctx, - (const char *)GRPC_SLICE_START_PTR(query_slice), - k_url_safe)); + grpc_base64_decode_with_len( + exec_ctx, (const char *)GRPC_SLICE_START_PTR(query_slice), + GRPC_SLICE_LENGTH(query_slice), k_url_safe)); grpc_slice_buffer_stream_init(&calld->read_stream, &calld->read_slice_buffer, 0); calld->seen_path_with_query = true; diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/clusterfuzz-testcase-5595941564317696 b/test/core/end2end/fuzzers/server_fuzzer_corpus/clusterfuzz-testcase-5595941564317696 new file mode 100644 index 0000000000000000000000000000000000000000..335ce87196fbdab771bab219b3d0e42d497ca59a GIT binary patch literal 92 zcmWFt@>I}L@CXSB&^OXE;N{}w3ibt&3=BLh3}C+>Sxsy1GCe3@i#j0tC1~LR Date: Wed, 12 Apr 2017 15:49:39 -0700 Subject: [PATCH 355/461] Revert "Implement lazy deframe" --- .../chttp2/transport/chttp2_transport.c | 338 ++++++---------- .../transport/chttp2/transport/frame_data.c | 365 ++++++++---------- .../transport/chttp2/transport/frame_data.h | 24 +- .../ext/transport/chttp2/transport/internal.h | 51 +-- .../ext/transport/chttp2/transport/parsing.c | 5 +- .../cronet/transport/cronet_transport.c | 17 +- src/core/lib/channel/compress_filter.c | 14 +- src/core/lib/channel/http_client_filter.c | 14 +- src/core/lib/surface/call.c | 44 +-- src/core/lib/transport/byte_stream.c | 32 +- src/core/lib/transport/byte_stream.h | 21 +- .../microbenchmarks/bm_chttp2_transport.cc | 9 +- 12 files changed, 350 insertions(+), 584 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 29ed4bf90e5..a7d047d6e7a 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -44,7 +44,6 @@ #include #include -#include "src/core/ext/transport/chttp2/transport/frame_data.h" #include "src/core/ext/transport/chttp2/transport/internal.h" #include "src/core/ext/transport/chttp2/transport/varint.h" #include "src/core/lib/channel/channel_args.h" @@ -130,11 +129,6 @@ static void incoming_byte_stream_update_flow_control(grpc_exec_ctx *exec_ctx, static void incoming_byte_stream_destroy_locked(grpc_exec_ctx *exec_ctx, void *byte_stream, grpc_error *error_ignored); -static void incoming_byte_stream_publish_error( - grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, - grpc_error *error); -static void incoming_byte_stream_unref(grpc_exec_ctx *exec_ctx, - grpc_chttp2_incoming_byte_stream *bs); static void benign_reclaimer_locked(grpc_exec_ctx *exec_ctx, void *t, grpc_error *error); @@ -180,9 +174,6 @@ static void finish_keepalive_ping_locked(grpc_exec_ctx *exec_ctx, void *arg, static void keepalive_watchdog_fired_locked(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error); -static void reset_byte_stream(grpc_exec_ctx *exec_ctx, void *arg, - grpc_error *error); - /******************************************************************************* * CONSTRUCTION/DESTRUCTION/REFCOUNTING */ @@ -664,6 +655,7 @@ static int init_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, /* We reserve one 'active stream' that's dropped when the stream is read-closed. The others are for incoming_byte_streams that are actively reading */ + gpr_ref_init(&s->active_streams, 1); GRPC_CHTTP2_STREAM_REF(s, "chttp2"); grpc_chttp2_incoming_metadata_buffer_init(&s->metadata_buffer[0], arena); @@ -673,11 +665,6 @@ static int init_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, s->deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); grpc_closure_init(&s->complete_fetch_locked, complete_fetch_locked, s, grpc_schedule_on_exec_ctx); - grpc_slice_buffer_init(&s->unprocessed_incoming_frames_buffer); - grpc_slice_buffer_init(&s->frame_storage); - s->pending_byte_stream = false; - grpc_closure_init(&s->reset_byte_stream, reset_byte_stream, s, - grpc_combiner_scheduler(t->combiner, false)); GRPC_CHTTP2_REF_TRANSPORT(t, "stream"); @@ -695,6 +682,7 @@ static int init_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, static void destroy_stream_locked(grpc_exec_ctx *exec_ctx, void *sp, grpc_error *error) { + grpc_byte_stream *bs; grpc_chttp2_stream *s = sp; grpc_chttp2_transport *t = s->t; @@ -705,9 +693,9 @@ static void destroy_stream_locked(grpc_exec_ctx *exec_ctx, void *sp, GPR_ASSERT(grpc_chttp2_stream_map_find(&t->stream_map, s->id) == NULL); } - grpc_slice_buffer_destroy_internal(exec_ctx, - &s->unprocessed_incoming_frames_buffer); - grpc_slice_buffer_destroy_internal(exec_ctx, &s->frame_storage); + while ((bs = grpc_chttp2_incoming_frame_queue_pop(&s->incoming_frames))) { + incoming_byte_stream_destroy_locked(exec_ctx, bs, GRPC_ERROR_NONE); + } grpc_chttp2_list_remove_stalled_by_transport(t, s); grpc_chttp2_list_remove_stalled_by_stream(t, s); @@ -734,7 +722,6 @@ static void destroy_stream_locked(grpc_exec_ctx *exec_ctx, void *sp, grpc_slice_buffer_destroy_internal(exec_ctx, &s->flow_controlled_buffer); GRPC_ERROR_UNREF(s->read_closed_error); GRPC_ERROR_UNREF(s->write_closed_error); - GRPC_ERROR_UNREF(s->byte_stream_error); if (s->incoming_window_delta > 0) { GRPC_CHTTP2_FLOW_DEBIT_STREAM_INCOMING_WINDOW_DELTA( @@ -1188,9 +1175,8 @@ static void continue_fetching_send_locked(grpc_exec_ctx *exec_ctx, s->fetching_send_message = NULL; return; /* early out */ } else if (grpc_byte_stream_next(exec_ctx, s->fetching_send_message, - UINT32_MAX, &s->complete_fetch_locked)) { - grpc_byte_stream_pull(exec_ctx, s->fetching_send_message, - &s->fetching_slice); + &s->fetching_slice, UINT32_MAX, + &s->complete_fetch_locked)) { add_fetched_slice_locked(exec_ctx, t, s); } } @@ -1201,15 +1187,9 @@ static void complete_fetch_locked(grpc_exec_ctx *exec_ctx, void *gs, grpc_chttp2_stream *s = gs; grpc_chttp2_transport *t = s->t; if (error == GRPC_ERROR_NONE) { - error = grpc_byte_stream_pull(exec_ctx, s->fetching_send_message, - &s->fetching_slice); - if (error == GRPC_ERROR_NONE) { - add_fetched_slice_locked(exec_ctx, t, s); - continue_fetching_send_locked(exec_ctx, t, s); - } - } - - if (error != GRPC_ERROR_NONE) { + add_fetched_slice_locked(exec_ctx, t, s); + continue_fetching_send_locked(exec_ctx, t, s); + } else { /* TODO(ctiller): what to do here */ abort(); } @@ -1444,7 +1424,8 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op, GPR_ASSERT(s->recv_message_ready == NULL); s->recv_message_ready = op_payload->recv_message.recv_message_ready; s->recv_message = op_payload->recv_message.recv_message; - if (s->id != 0 && s->frame_storage.length == 0) { + if (s->id != 0 && + (s->incoming_frames.head == NULL || s->incoming_frames.head->is_tail)) { incoming_byte_stream_update_flow_control(exec_ctx, t, s, 5, 0); } grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); @@ -1633,13 +1614,13 @@ static void perform_transport_op(grpc_exec_ctx *exec_ctx, grpc_transport *gt, void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s) { + grpc_byte_stream *bs; if (s->recv_initial_metadata_ready != NULL && s->published_metadata[0] != GRPC_METADATA_NOT_PUBLISHED) { if (s->seen_error) { - grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->frame_storage); - if (!s->pending_byte_stream) { - grpc_slice_buffer_reset_and_unref_internal( - exec_ctx, &s->unprocessed_incoming_frames_buffer); + while ((bs = grpc_chttp2_incoming_frame_queue_pop(&s->incoming_frames)) != + NULL) { + incoming_byte_stream_destroy_locked(exec_ctx, bs, GRPC_ERROR_NONE); } } grpc_chttp2_incoming_metadata_buffer_publish( @@ -1652,65 +1633,39 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_exec_ctx *exec_ctx, void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s) { - grpc_error *error = GRPC_ERROR_NONE; + grpc_byte_stream *bs; if (s->recv_message_ready != NULL) { - *s->recv_message = NULL; - if (s->final_metadata_requested && s->seen_error) { - grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->frame_storage); - if (!s->pending_byte_stream) { - grpc_slice_buffer_reset_and_unref_internal( - exec_ctx, &s->unprocessed_incoming_frames_buffer); - } + while (s->final_metadata_requested && s->seen_error && + (bs = grpc_chttp2_incoming_frame_queue_pop(&s->incoming_frames)) != + NULL) { + incoming_byte_stream_destroy_locked(exec_ctx, bs, GRPC_ERROR_NONE); } - if (!s->pending_byte_stream) { - while (s->unprocessed_incoming_frames_buffer.length > 0 || - s->frame_storage.length > 0) { - if (s->unprocessed_incoming_frames_buffer.length == 0) { - grpc_slice_buffer_swap(&s->unprocessed_incoming_frames_buffer, - &s->frame_storage); - } - error = deframe_unprocessed_incoming_frames( - exec_ctx, &s->data_parser, s, - &s->unprocessed_incoming_frames_buffer, NULL, s->recv_message); - if (error != GRPC_ERROR_NONE) { - s->seen_error = true; - grpc_slice_buffer_reset_and_unref_internal(exec_ctx, - &s->frame_storage); - grpc_slice_buffer_reset_and_unref_internal( - exec_ctx, &s->unprocessed_incoming_frames_buffer); - break; - } else if (*s->recv_message != NULL) { - break; - } - } - } - if (error == GRPC_ERROR_NONE && *s->recv_message != NULL) { + if (s->incoming_frames.head != NULL) { + *s->recv_message = + grpc_chttp2_incoming_frame_queue_pop(&s->incoming_frames); + GPR_ASSERT(*s->recv_message != NULL); null_then_run_closure(exec_ctx, &s->recv_message_ready, GRPC_ERROR_NONE); } else if (s->published_metadata[1] != GRPC_METADATA_NOT_PUBLISHED) { *s->recv_message = NULL; null_then_run_closure(exec_ctx, &s->recv_message_ready, GRPC_ERROR_NONE); } - GRPC_ERROR_UNREF(error); } } void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s) { + grpc_byte_stream *bs; grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); if (s->recv_trailing_metadata_finished != NULL && s->read_closed && s->write_closed) { if (s->seen_error) { - grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->frame_storage); - if (!s->pending_byte_stream) { - grpc_slice_buffer_reset_and_unref_internal( - exec_ctx, &s->unprocessed_incoming_frames_buffer); + while ((bs = grpc_chttp2_incoming_frame_queue_pop(&s->incoming_frames)) != + NULL) { + incoming_byte_stream_destroy_locked(exec_ctx, bs, GRPC_ERROR_NONE); } } - bool pending_data = s->pending_byte_stream || - s->unprocessed_incoming_frames_buffer.length > 0; - if (s->read_closed && s->frame_storage.length == 0 && - (!pending_data || s->seen_error) && + if (s->all_incoming_byte_streams_finished && s->recv_trailing_metadata_finished != NULL) { grpc_chttp2_incoming_metadata_buffer_publish( exec_ctx, &s->metadata_buffer[1], s->recv_trailing_metadata); @@ -1721,6 +1676,14 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx *exec_ctx, } } +static void decrement_active_streams_locked(grpc_exec_ctx *exec_ctx, + grpc_chttp2_transport *t, + grpc_chttp2_stream *s) { + if ((s->all_incoming_byte_streams_finished = gpr_unref(&s->active_streams))) { + grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, t, s); + } +} + static void remove_stream(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, uint32_t id, grpc_error *error) { grpc_chttp2_stream *s = grpc_chttp2_stream_map_delete(&t->stream_map, id); @@ -1729,19 +1692,10 @@ static void remove_stream(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, t->incoming_stream = NULL; grpc_chttp2_parsing_become_skip_parser(exec_ctx, t); } - if (s->pending_byte_stream) { - if (s->on_next != NULL) { - grpc_chttp2_incoming_byte_stream *bs = s->data_parser.parsing_frame; - if (error == GRPC_ERROR_NONE) { - error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message"); - } - incoming_byte_stream_publish_error(exec_ctx, bs, error); - incoming_byte_stream_unref(exec_ctx, bs); - s->data_parser.parsing_frame = NULL; - } else { - GRPC_ERROR_UNREF(s->byte_stream_error); - s->byte_stream_error = GRPC_ERROR_REF(error); - } + if (s->data_parser.parsing_frame != NULL) { + grpc_chttp2_incoming_byte_stream_finished( + exec_ctx, s->data_parser.parsing_frame, GRPC_ERROR_REF(error)); + s->data_parser.parsing_frame = NULL; } if (grpc_chttp2_stream_map_size(&t->stream_map) == 0) { @@ -1927,6 +1881,7 @@ void grpc_chttp2_mark_stream_closed(grpc_exec_ctx *exec_ctx, s->published_metadata[i] = GPRC_METADATA_PUBLISHED_AT_CLOSE; } } + decrement_active_streams_locked(exec_ctx, t, s); grpc_chttp2_maybe_complete_recv_initial_metadata(exec_ctx, t, s); grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); } @@ -2464,28 +2419,12 @@ static void set_pollset_set(grpc_exec_ctx *exec_ctx, grpc_transport *gt, * BYTE STREAM */ -static void reset_byte_stream(grpc_exec_ctx *exec_ctx, void *arg, - grpc_error *error) { - grpc_chttp2_stream *s = (grpc_chttp2_stream *)arg; - - s->pending_byte_stream = false; - if (error == GRPC_ERROR_NONE) { - grpc_chttp2_maybe_complete_recv_message(exec_ctx, s->t, s); - grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, s->t, s); - } else { - GPR_ASSERT(error != GRPC_ERROR_NONE); - grpc_closure_sched(exec_ctx, s->on_next, GRPC_ERROR_REF(error)); - s->on_next = NULL; - GRPC_ERROR_UNREF(s->byte_stream_error); - s->byte_stream_error = GRPC_ERROR_NONE; - grpc_chttp2_cancel_stream(exec_ctx, s->t, s, GRPC_ERROR_REF(error)); - s->byte_stream_error = error; - } -} - static void incoming_byte_stream_unref(grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs) { if (gpr_unref(&bs->refs)) { + GRPC_ERROR_UNREF(bs->error); + grpc_slice_buffer_destroy_internal(exec_ctx, &bs->slices); + gpr_mu_destroy(&bs->slice_mu); gpr_free(bs); } } @@ -2545,90 +2484,47 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t = bs->transport; grpc_chttp2_stream *s = bs->stream; - size_t cur_length = s->frame_storage.length; - incoming_byte_stream_update_flow_control( - exec_ctx, t, s, bs->next_action.max_size_hint, cur_length); - - GPR_ASSERT(s->unprocessed_incoming_frames_buffer.length == 0); - if (s->frame_storage.length > 0) { - grpc_slice_buffer_swap(&s->frame_storage, - &s->unprocessed_incoming_frames_buffer); - grpc_closure_sched(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_NONE); - } else if (s->byte_stream_error != GRPC_ERROR_NONE) { - grpc_closure_sched(exec_ctx, bs->next_action.on_complete, - GRPC_ERROR_REF(s->byte_stream_error)); - if (s->data_parser.parsing_frame != NULL) { - incoming_byte_stream_unref(exec_ctx, s->data_parser.parsing_frame); - s->data_parser.parsing_frame = NULL; - } - } else if (s->read_closed) { - if (bs->remaining_bytes != 0) { - s->byte_stream_error = - GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message"); - grpc_closure_sched(exec_ctx, bs->next_action.on_complete, - GRPC_ERROR_REF(s->byte_stream_error)); - if (s->data_parser.parsing_frame != NULL) { - incoming_byte_stream_unref(exec_ctx, s->data_parser.parsing_frame); - s->data_parser.parsing_frame = NULL; - } - } else { - /* Should never reach here. */ - GPR_ASSERT(false); - } + if (bs->is_tail) { + gpr_mu_lock(&bs->slice_mu); + size_t cur_length = bs->slices.length; + gpr_mu_unlock(&bs->slice_mu); + incoming_byte_stream_update_flow_control( + exec_ctx, t, s, bs->next_action.max_size_hint, cur_length); + } + gpr_mu_lock(&bs->slice_mu); + if (bs->slices.count > 0) { + *bs->next_action.slice = grpc_slice_buffer_take_first(&bs->slices); + grpc_closure_run(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_NONE); + } else if (bs->error != GRPC_ERROR_NONE) { + grpc_closure_run(exec_ctx, bs->next_action.on_complete, + GRPC_ERROR_REF(bs->error)); } else { - s->on_next = bs->next_action.on_complete; + bs->on_next = bs->next_action.on_complete; + bs->next = bs->next_action.slice; } + gpr_mu_unlock(&bs->slice_mu); incoming_byte_stream_unref(exec_ctx, bs); } -static bool incoming_byte_stream_next(grpc_exec_ctx *exec_ctx, - grpc_byte_stream *byte_stream, - size_t max_size_hint, - grpc_closure *on_complete) { +static int incoming_byte_stream_next(grpc_exec_ctx *exec_ctx, + grpc_byte_stream *byte_stream, + grpc_slice *slice, size_t max_size_hint, + grpc_closure *on_complete) { GPR_TIMER_BEGIN("incoming_byte_stream_next", 0); grpc_chttp2_incoming_byte_stream *bs = (grpc_chttp2_incoming_byte_stream *)byte_stream; - grpc_chttp2_stream *s = bs->stream; - if (s->unprocessed_incoming_frames_buffer.length > 0) { - return true; - } else { - gpr_ref(&bs->refs); - bs->next_action.max_size_hint = max_size_hint; - bs->next_action.on_complete = on_complete; - grpc_closure_sched( - exec_ctx, - grpc_closure_init( - &bs->next_action.closure, incoming_byte_stream_next_locked, bs, - grpc_combiner_scheduler(bs->transport->combiner, false)), - GRPC_ERROR_NONE); - GPR_TIMER_END("incoming_byte_stream_next", 0); - return false; - } -} - -static grpc_error *incoming_byte_stream_pull(grpc_exec_ctx *exec_ctx, - grpc_byte_stream *byte_stream, - grpc_slice *slice) { - GPR_TIMER_BEGIN("incoming_byte_stream_pull", 0); - grpc_chttp2_incoming_byte_stream *bs = - (grpc_chttp2_incoming_byte_stream *)byte_stream; - grpc_chttp2_stream *s = bs->stream; - - if (s->unprocessed_incoming_frames_buffer.length > 0) { - grpc_error *error = deframe_unprocessed_incoming_frames( - exec_ctx, &s->data_parser, s, &s->unprocessed_incoming_frames_buffer, - slice, NULL); - if (error != GRPC_ERROR_NONE) { - return error; - } - } else { - grpc_error *error = - GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message"); - grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error)); - return error; - } - GPR_TIMER_END("incoming_byte_stream_pull", 0); - return GRPC_ERROR_NONE; + gpr_ref(&bs->refs); + bs->next_action.slice = slice; + bs->next_action.max_size_hint = max_size_hint; + bs->next_action.on_complete = on_complete; + grpc_closure_sched( + exec_ctx, + grpc_closure_init( + &bs->next_action.closure, incoming_byte_stream_next_locked, bs, + grpc_combiner_scheduler(bs->transport->combiner, false)), + GRPC_ERROR_NONE); + GPR_TIMER_END("incoming_byte_stream_next", 0); + return 0; } static void incoming_byte_stream_destroy(grpc_exec_ctx *exec_ctx, @@ -2638,14 +2534,9 @@ static void incoming_byte_stream_destroy_locked(grpc_exec_ctx *exec_ctx, void *byte_stream, grpc_error *error_ignored) { grpc_chttp2_incoming_byte_stream *bs = byte_stream; - grpc_chttp2_stream *s = bs->stream; - grpc_chttp2_transport *t = s->t; - GPR_ASSERT(bs->base.destroy == incoming_byte_stream_destroy); + decrement_active_streams_locked(exec_ctx, bs->transport, bs->stream); incoming_byte_stream_unref(exec_ctx, bs); - s->pending_byte_stream = false; - grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); - grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, t, s); } static void incoming_byte_stream_destroy(grpc_exec_ctx *exec_ctx, @@ -2665,53 +2556,50 @@ static void incoming_byte_stream_destroy(grpc_exec_ctx *exec_ctx, static void incoming_byte_stream_publish_error( grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, grpc_error *error) { - grpc_chttp2_stream *s = bs->stream; - GPR_ASSERT(error != GRPC_ERROR_NONE); - grpc_closure_sched(exec_ctx, s->on_next, GRPC_ERROR_REF(error)); - s->on_next = NULL; - GRPC_ERROR_UNREF(s->byte_stream_error); - s->byte_stream_error = GRPC_ERROR_REF(error); + grpc_closure_sched(exec_ctx, bs->on_next, GRPC_ERROR_REF(error)); + bs->on_next = NULL; + GRPC_ERROR_UNREF(bs->error); grpc_chttp2_cancel_stream(exec_ctx, bs->transport, bs->stream, GRPC_ERROR_REF(error)); + bs->error = error; } -grpc_error *grpc_chttp2_incoming_byte_stream_push( - grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, - grpc_slice slice, grpc_slice *slice_out) { - grpc_chttp2_stream *s = bs->stream; - +void grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, + grpc_chttp2_incoming_byte_stream *bs, + grpc_slice slice) { + gpr_mu_lock(&bs->slice_mu); if (bs->remaining_bytes < GRPC_SLICE_LENGTH(slice)) { - grpc_error *error = - GRPC_ERROR_CREATE_FROM_STATIC_STRING("Too many bytes in stream"); - - grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error)); - grpc_slice_unref_internal(exec_ctx, slice); - return error; + incoming_byte_stream_publish_error( + exec_ctx, bs, + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Too many bytes in stream")); } else { bs->remaining_bytes -= (uint32_t)GRPC_SLICE_LENGTH(slice); - if (slice_out != NULL) { - *slice_out = slice; + if (bs->on_next != NULL) { + *bs->next = slice; + grpc_closure_sched(exec_ctx, bs->on_next, GRPC_ERROR_NONE); + bs->on_next = NULL; + } else { + grpc_slice_buffer_add(&bs->slices, slice); } - return GRPC_ERROR_NONE; } + gpr_mu_unlock(&bs->slice_mu); } -grpc_error *grpc_chttp2_incoming_byte_stream_finished( +void grpc_chttp2_incoming_byte_stream_finished( grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, - grpc_error *error, bool reset_on_error) { - grpc_chttp2_stream *s = bs->stream; - + grpc_error *error) { if (error == GRPC_ERROR_NONE) { + gpr_mu_lock(&bs->slice_mu); if (bs->remaining_bytes != 0) { error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message"); } + gpr_mu_unlock(&bs->slice_mu); } - if (error != GRPC_ERROR_NONE && reset_on_error) { - grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error)); + if (error != GRPC_ERROR_NONE) { + incoming_byte_stream_publish_error(exec_ctx, bs, error); } incoming_byte_stream_unref(exec_ctx, bs); - return error; } grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( @@ -2723,12 +2611,26 @@ grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( incoming_byte_stream->remaining_bytes = frame_size; incoming_byte_stream->base.flags = flags; incoming_byte_stream->base.next = incoming_byte_stream_next; - incoming_byte_stream->base.pull = incoming_byte_stream_pull; incoming_byte_stream->base.destroy = incoming_byte_stream_destroy; + gpr_mu_init(&incoming_byte_stream->slice_mu); gpr_ref_init(&incoming_byte_stream->refs, 2); + incoming_byte_stream->next_message = NULL; incoming_byte_stream->transport = t; incoming_byte_stream->stream = s; - s->byte_stream_error = GRPC_ERROR_NONE; + gpr_ref(&incoming_byte_stream->stream->active_streams); + grpc_slice_buffer_init(&incoming_byte_stream->slices); + incoming_byte_stream->on_next = NULL; + incoming_byte_stream->is_tail = 1; + incoming_byte_stream->error = GRPC_ERROR_NONE; + grpc_chttp2_incoming_frame_queue *q = &s->incoming_frames; + if (q->head == NULL) { + q->head = incoming_byte_stream; + } else { + q->tail->is_tail = 0; + q->tail->next_message = incoming_byte_stream; + } + q->tail = incoming_byte_stream; + grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); return incoming_byte_stream; } diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c index 5d382d80a8b..6e9258ee7ee 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -40,7 +40,6 @@ #include #include #include "src/core/ext/transport/chttp2/transport/internal.h" -#include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/slice/slice_string_helpers.h" #include "src/core/lib/support/string.h" #include "src/core/lib/transport/transport.h" @@ -54,17 +53,16 @@ grpc_error *grpc_chttp2_data_parser_init(grpc_chttp2_data_parser *parser) { void grpc_chttp2_data_parser_destroy(grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *parser) { if (parser->parsing_frame != NULL) { - GRPC_ERROR_UNREF(grpc_chttp2_incoming_byte_stream_finished( + grpc_chttp2_incoming_byte_stream_finished( exec_ctx, parser->parsing_frame, - GRPC_ERROR_CREATE_FROM_STATIC_STRING("Parser destroyed"), false)); + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Parser destroyed")); } GRPC_ERROR_UNREF(parser->error); } grpc_error *grpc_chttp2_data_parser_begin_frame(grpc_chttp2_data_parser *parser, uint8_t flags, - uint32_t stream_id, - grpc_chttp2_stream *s) { + uint32_t stream_id) { if (flags & ~GRPC_CHTTP2_DATA_FLAG_END_STREAM) { char *msg; gpr_asprintf(&msg, "unsupported data flags: 0x%02x", flags); @@ -76,14 +74,47 @@ grpc_error *grpc_chttp2_data_parser_begin_frame(grpc_chttp2_data_parser *parser, } if (flags & GRPC_CHTTP2_DATA_FLAG_END_STREAM) { - s->received_last_frame = true; + parser->is_last_frame = 1; } else { - s->received_last_frame = false; + parser->is_last_frame = 0; } return GRPC_ERROR_NONE; } +void grpc_chttp2_incoming_frame_queue_merge( + grpc_chttp2_incoming_frame_queue *head_dst, + grpc_chttp2_incoming_frame_queue *tail_src) { + if (tail_src->head == NULL) { + return; + } + + if (head_dst->head == NULL) { + *head_dst = *tail_src; + memset(tail_src, 0, sizeof(*tail_src)); + return; + } + + head_dst->tail->next_message = tail_src->head; + head_dst->tail = tail_src->tail; + memset(tail_src, 0, sizeof(*tail_src)); +} + +grpc_byte_stream *grpc_chttp2_incoming_frame_queue_pop( + grpc_chttp2_incoming_frame_queue *q) { + grpc_byte_stream *out; + if (q->head == NULL) { + return NULL; + } + out = &q->head->base; + if (q->head == q->tail) { + memset(q, 0, sizeof(*q)); + } else { + q->head = q->head->next_message; + } + return out; +} + void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer *inbuf, uint32_t write_bytes, int is_eof, grpc_transport_one_way_stats *stats, @@ -112,217 +143,145 @@ void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer *inbuf, stats->data_bytes += write_bytes; } -grpc_error *deframe_unprocessed_incoming_frames(grpc_exec_ctx *exec_ctx, - grpc_chttp2_data_parser *p, - grpc_chttp2_stream *s, - grpc_slice_buffer *slices, - grpc_slice *slice_out, - grpc_byte_stream **stream_out) { - grpc_error *error = GRPC_ERROR_NONE; - grpc_chttp2_transport *t = s->t; - - while (slices->count > 0) { - uint8_t *beg = NULL; - uint8_t *end = NULL; - uint8_t *cur = NULL; - - grpc_slice slice = grpc_slice_buffer_take_first(slices); +static grpc_error *parse_inner(grpc_exec_ctx *exec_ctx, + grpc_chttp2_data_parser *p, + grpc_chttp2_transport *t, grpc_chttp2_stream *s, + grpc_slice slice) { + uint8_t *const beg = GRPC_SLICE_START_PTR(slice); + uint8_t *const end = GRPC_SLICE_END_PTR(slice); + uint8_t *cur = beg; + uint32_t message_flags; + grpc_chttp2_incoming_byte_stream *incoming_byte_stream; + char *msg; - beg = GRPC_SLICE_START_PTR(slice); - end = GRPC_SLICE_END_PTR(slice); - cur = beg; - uint32_t message_flags; - char *msg; - - if (cur == end) { - grpc_slice_unref_internal(exec_ctx, slice); - continue; - } - - switch (p->state) { - case GRPC_CHTTP2_DATA_ERROR: - p->state = GRPC_CHTTP2_DATA_ERROR; - grpc_slice_unref_internal(exec_ctx, slice); - return GRPC_ERROR_REF(p->error); - case GRPC_CHTTP2_DATA_FH_0: - p->frame_type = *cur; - switch (p->frame_type) { - case 0: - p->is_frame_compressed = false; /* GPR_FALSE */ - break; - case 1: - p->is_frame_compressed = true; /* GPR_TRUE */ - break; - default: - gpr_asprintf(&msg, "Bad GRPC frame type 0x%02x", p->frame_type); - p->error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg); - p->error = grpc_error_set_int(p->error, GRPC_ERROR_INT_STREAM_ID, - (intptr_t)s->id); - gpr_free(msg); - msg = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); - p->error = grpc_error_set_str(p->error, GRPC_ERROR_STR_RAW_BYTES, - grpc_slice_from_copied_string(msg)); - gpr_free(msg); - p->error = - grpc_error_set_int(p->error, GRPC_ERROR_INT_OFFSET, cur - beg); - p->state = GRPC_CHTTP2_DATA_ERROR; - grpc_slice_unref_internal(exec_ctx, slice); - return GRPC_ERROR_REF(p->error); - } - if (++cur == end) { - p->state = GRPC_CHTTP2_DATA_FH_1; - grpc_slice_unref_internal(exec_ctx, slice); - continue; - } - /* fallthrough */ - case GRPC_CHTTP2_DATA_FH_1: - p->frame_size = ((uint32_t)*cur) << 24; - if (++cur == end) { - p->state = GRPC_CHTTP2_DATA_FH_2; - grpc_slice_unref_internal(exec_ctx, slice); - continue; - } - /* fallthrough */ - case GRPC_CHTTP2_DATA_FH_2: - p->frame_size |= ((uint32_t)*cur) << 16; - if (++cur == end) { - p->state = GRPC_CHTTP2_DATA_FH_3; - grpc_slice_unref_internal(exec_ctx, slice); - continue; - } - /* fallthrough */ - case GRPC_CHTTP2_DATA_FH_3: - p->frame_size |= ((uint32_t)*cur) << 8; - if (++cur == end) { - p->state = GRPC_CHTTP2_DATA_FH_4; - grpc_slice_unref_internal(exec_ctx, slice); - continue; - } - /* fallthrough */ - case GRPC_CHTTP2_DATA_FH_4: - GPR_ASSERT(stream_out != NULL); - GPR_ASSERT(p->parsing_frame == NULL); - p->frame_size |= ((uint32_t)*cur); - p->state = GRPC_CHTTP2_DATA_FRAME; - ++cur; - message_flags = 0; - if (p->is_frame_compressed) { - message_flags |= GRPC_WRITE_INTERNAL_COMPRESS; - } - p->parsing_frame = grpc_chttp2_incoming_byte_stream_create( - exec_ctx, t, s, p->frame_size, message_flags); - *stream_out = &p->parsing_frame->base; - if (p->parsing_frame->remaining_bytes == 0) { - GRPC_ERROR_UNREF(grpc_chttp2_incoming_byte_stream_finished( - exec_ctx, p->parsing_frame, GRPC_ERROR_NONE, true)); - p->parsing_frame = NULL; - p->state = GRPC_CHTTP2_DATA_FH_0; - } - s->pending_byte_stream = true; + if (cur == end) { + return GRPC_ERROR_NONE; + } - if (cur != end) { - grpc_slice_buffer_undo_take_first( - &s->unprocessed_incoming_frames_buffer, - grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); - } - grpc_slice_unref_internal(exec_ctx, slice); + switch (p->state) { + case GRPC_CHTTP2_DATA_ERROR: + p->state = GRPC_CHTTP2_DATA_ERROR; + return GRPC_ERROR_REF(p->error); + fh_0: + case GRPC_CHTTP2_DATA_FH_0: + s->stats.incoming.framing_bytes++; + p->frame_type = *cur; + switch (p->frame_type) { + case 0: + p->is_frame_compressed = 0; /* GPR_FALSE */ + break; + case 1: + p->is_frame_compressed = 1; /* GPR_TRUE */ + break; + default: + gpr_asprintf(&msg, "Bad GRPC frame type 0x%02x", p->frame_type); + p->error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg); + p->error = grpc_error_set_int(p->error, GRPC_ERROR_INT_STREAM_ID, + (intptr_t)s->id); + gpr_free(msg); + msg = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); + p->error = grpc_error_set_str(p->error, GRPC_ERROR_STR_RAW_BYTES, + grpc_slice_from_copied_string(msg)); + gpr_free(msg); + p->error = + grpc_error_set_int(p->error, GRPC_ERROR_INT_OFFSET, cur - beg); + p->state = GRPC_CHTTP2_DATA_ERROR; + return GRPC_ERROR_REF(p->error); + } + if (++cur == end) { + p->state = GRPC_CHTTP2_DATA_FH_1; + return GRPC_ERROR_NONE; + } + /* fallthrough */ + case GRPC_CHTTP2_DATA_FH_1: + s->stats.incoming.framing_bytes++; + p->frame_size = ((uint32_t)*cur) << 24; + if (++cur == end) { + p->state = GRPC_CHTTP2_DATA_FH_2; + return GRPC_ERROR_NONE; + } + /* fallthrough */ + case GRPC_CHTTP2_DATA_FH_2: + s->stats.incoming.framing_bytes++; + p->frame_size |= ((uint32_t)*cur) << 16; + if (++cur == end) { + p->state = GRPC_CHTTP2_DATA_FH_3; + return GRPC_ERROR_NONE; + } + /* fallthrough */ + case GRPC_CHTTP2_DATA_FH_3: + s->stats.incoming.framing_bytes++; + p->frame_size |= ((uint32_t)*cur) << 8; + if (++cur == end) { + p->state = GRPC_CHTTP2_DATA_FH_4; + return GRPC_ERROR_NONE; + } + /* fallthrough */ + case GRPC_CHTTP2_DATA_FH_4: + s->stats.incoming.framing_bytes++; + p->frame_size |= ((uint32_t)*cur); + p->state = GRPC_CHTTP2_DATA_FRAME; + ++cur; + message_flags = 0; + if (p->is_frame_compressed) { + message_flags |= GRPC_WRITE_INTERNAL_COMPRESS; + } + p->parsing_frame = incoming_byte_stream = + grpc_chttp2_incoming_byte_stream_create(exec_ctx, t, s, p->frame_size, + message_flags); + /* fallthrough */ + case GRPC_CHTTP2_DATA_FRAME: + if (cur == end) { + return GRPC_ERROR_NONE; + } + uint32_t remaining = (uint32_t)(end - cur); + if (remaining == p->frame_size) { + s->stats.incoming.data_bytes += p->frame_size; + grpc_chttp2_incoming_byte_stream_push( + exec_ctx, p->parsing_frame, + grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, + GRPC_ERROR_NONE); + p->parsing_frame = NULL; + p->state = GRPC_CHTTP2_DATA_FH_0; + return GRPC_ERROR_NONE; + } else if (remaining > p->frame_size) { + s->stats.incoming.data_bytes += p->frame_size; + grpc_chttp2_incoming_byte_stream_push( + exec_ctx, p->parsing_frame, + grpc_slice_sub(slice, (size_t)(cur - beg), + (size_t)(cur + p->frame_size - beg))); + grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, + GRPC_ERROR_NONE); + p->parsing_frame = NULL; + cur += p->frame_size; + goto fh_0; /* loop */ + } else { + GPR_ASSERT(remaining <= p->frame_size); + grpc_chttp2_incoming_byte_stream_push( + exec_ctx, p->parsing_frame, + grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + p->frame_size -= remaining; + s->stats.incoming.data_bytes += remaining; return GRPC_ERROR_NONE; - case GRPC_CHTTP2_DATA_FRAME: { - GPR_ASSERT(p->parsing_frame != NULL); - GPR_ASSERT(slice_out != NULL); - if (cur == end) { - grpc_slice_unref_internal(exec_ctx, slice); - continue; - } - uint32_t remaining = (uint32_t)(end - cur); - if (remaining == p->frame_size) { - if (GRPC_ERROR_NONE != (error = grpc_chttp2_incoming_byte_stream_push( - exec_ctx, p->parsing_frame, - grpc_slice_sub(slice, (size_t)(cur - beg), - (size_t)(end - beg)), - slice_out))) { - grpc_slice_unref_internal(exec_ctx, slice); - return error; - } - if (GRPC_ERROR_NONE != - (error = grpc_chttp2_incoming_byte_stream_finished( - exec_ctx, p->parsing_frame, GRPC_ERROR_NONE, true))) { - grpc_slice_unref_internal(exec_ctx, slice); - return error; - } - p->parsing_frame = NULL; - p->state = GRPC_CHTTP2_DATA_FH_0; - grpc_slice_unref_internal(exec_ctx, slice); - return GRPC_ERROR_NONE; - } else if (remaining < p->frame_size) { - if (GRPC_ERROR_NONE != (error = grpc_chttp2_incoming_byte_stream_push( - exec_ctx, p->parsing_frame, - grpc_slice_sub(slice, (size_t)(cur - beg), - (size_t)(end - beg)), - slice_out))) { - return error; - } - p->frame_size -= remaining; - grpc_slice_unref_internal(exec_ctx, slice); - return GRPC_ERROR_NONE; - } else { - GPR_ASSERT(remaining > p->frame_size); - if (GRPC_ERROR_NONE != - (grpc_chttp2_incoming_byte_stream_push( - exec_ctx, p->parsing_frame, - grpc_slice_sub(slice, (size_t)(cur - beg), - (size_t)(cur + p->frame_size - beg)), - slice_out))) { - grpc_slice_unref_internal(exec_ctx, slice); - return error; - } - if (GRPC_ERROR_NONE != - (error = grpc_chttp2_incoming_byte_stream_finished( - exec_ctx, p->parsing_frame, GRPC_ERROR_NONE, true))) { - grpc_slice_unref_internal(exec_ctx, slice); - return error; - } - p->parsing_frame = NULL; - p->state = GRPC_CHTTP2_DATA_FH_0; - cur += p->frame_size; - grpc_slice_buffer_undo_take_first( - &s->unprocessed_incoming_frames_buffer, - grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); - grpc_slice_unref_internal(exec_ctx, slice); - return GRPC_ERROR_NONE; - } } - } } - return GRPC_ERROR_NONE; + GPR_UNREACHABLE_CODE( + return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Should never reach here")); } grpc_error *grpc_chttp2_data_parser_parse(grpc_exec_ctx *exec_ctx, void *parser, grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_slice slice, int is_last) { - /* grpc_error *error = parse_inner_buffer(exec_ctx, p, t, s, slice); */ - s->stats.incoming.framing_bytes += GRPC_SLICE_LENGTH(slice); - if (!s->pending_byte_stream) { - grpc_slice_ref_internal(slice); - grpc_slice_buffer_add(&s->frame_storage, slice); - grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); - } else if (s->on_next) { - GPR_ASSERT(s->frame_storage.length == 0); - grpc_slice_ref_internal(slice); - grpc_slice_buffer_add(&s->unprocessed_incoming_frames_buffer, slice); - grpc_closure_sched(exec_ctx, s->on_next, GRPC_ERROR_NONE); - s->on_next = NULL; - } else { - grpc_slice_ref_internal(slice); - grpc_slice_buffer_add(&s->frame_storage, slice); - } + grpc_chttp2_data_parser *p = parser; + grpc_error *error = parse_inner(exec_ctx, p, t, s, slice); - if (is_last && s->received_last_frame) { + if (is_last && p->is_last_frame) { grpc_chttp2_mark_stream_closed(exec_ctx, t, s, true, false, GRPC_ERROR_NONE); } - return GRPC_ERROR_NONE; + return error; } diff --git a/src/core/ext/transport/chttp2/transport/frame_data.h b/src/core/ext/transport/chttp2/transport/frame_data.h index 2fb8983c38e..264ad146085 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.h +++ b/src/core/ext/transport/chttp2/transport/frame_data.h @@ -56,16 +56,28 @@ typedef enum { typedef struct grpc_chttp2_incoming_byte_stream grpc_chttp2_incoming_byte_stream; +typedef struct grpc_chttp2_incoming_frame_queue { + grpc_chttp2_incoming_byte_stream *head; + grpc_chttp2_incoming_byte_stream *tail; +} grpc_chttp2_incoming_frame_queue; + typedef struct { grpc_chttp2_stream_state state; + uint8_t is_last_frame; uint8_t frame_type; uint32_t frame_size; grpc_error *error; - bool is_frame_compressed; + int is_frame_compressed; grpc_chttp2_incoming_byte_stream *parsing_frame; } grpc_chttp2_data_parser; +void grpc_chttp2_incoming_frame_queue_merge( + grpc_chttp2_incoming_frame_queue *head_dst, + grpc_chttp2_incoming_frame_queue *tail_src); +grpc_byte_stream *grpc_chttp2_incoming_frame_queue_pop( + grpc_chttp2_incoming_frame_queue *q); + /* initialize per-stream state for data frame parsing */ grpc_error *grpc_chttp2_data_parser_init(grpc_chttp2_data_parser *parser); @@ -75,8 +87,7 @@ void grpc_chttp2_data_parser_destroy(grpc_exec_ctx *exec_ctx, /* start processing a new data frame */ grpc_error *grpc_chttp2_data_parser_begin_frame(grpc_chttp2_data_parser *parser, uint8_t flags, - uint32_t stream_id, - grpc_chttp2_stream *s); + uint32_t stream_id); /* handle a slice of a data frame - is_last indicates the last slice of a frame */ @@ -90,11 +101,4 @@ void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer *inbuf, grpc_transport_one_way_stats *stats, grpc_slice_buffer *outbuf); -grpc_error *deframe_unprocessed_incoming_frames(grpc_exec_ctx *exec_ctx, - grpc_chttp2_data_parser *p, - grpc_chttp2_stream *s, - grpc_slice_buffer *slices, - grpc_slice *slice_out, - grpc_byte_stream **stream_out); - #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_DATA_H */ diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index a10e3886ea1..6eb848b8d77 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -195,20 +195,22 @@ typedef struct grpc_chttp2_write_cb { struct grpc_chttp2_incoming_byte_stream { grpc_byte_stream base; gpr_refcount refs; + struct grpc_chttp2_incoming_byte_stream *next_message; + grpc_error *error; - grpc_chttp2_transport *transport; /* immutable */ - grpc_chttp2_stream *stream; /* immutable */ + grpc_chttp2_transport *transport; + grpc_chttp2_stream *stream; + bool is_tail; - /* Accessed only by transport thread when stream->pending_byte_stream == false - * Accessed only by application thread when stream->pending_byte_stream == - * true */ + gpr_mu slice_mu; // protects slices, on_next + grpc_slice_buffer slices; + grpc_closure *on_next; + grpc_slice *next; uint32_t remaining_bytes; - /* Accessed only by transport thread when stream->pending_byte_stream == false - * Accessed only by application thread when stream->pending_byte_stream == - * true */ struct { grpc_closure closure; + grpc_slice *slice; size_t max_size_hint; grpc_closure *on_complete; } next_action; @@ -443,8 +445,8 @@ struct grpc_chttp2_stream { uint32_t id; /** window available for us to send to peer, over or under the initial window - * size of the transport... ie: - * outgoing_window = outgoing_window_delta + transport.initial_window_size */ + * size of the transport... ie: + * outgoing_window = outgoing_window_delta + transport.initial_window_size */ int64_t outgoing_window_delta; /** things the upper layers would like to send */ grpc_metadata_batch *send_initial_metadata; @@ -471,6 +473,9 @@ struct grpc_chttp2_stream { grpc_transport_stream_stats *collecting_stats; grpc_transport_stream_stats stats; + /** number of streams that are currently being read */ + gpr_refcount active_streams; + /** Is this stream closed for writing. */ bool write_closed; /** Is this stream reading half-closed. */ @@ -494,17 +499,7 @@ struct grpc_chttp2_stream { grpc_chttp2_incoming_metadata_buffer metadata_buffer[2]; - grpc_slice_buffer frame_storage; /* protected by t combiner */ - - /* Accessed only by transport thread when stream->pending_byte_stream == false - * Accessed only by application thread when stream->pending_byte_stream == - * true */ - grpc_slice_buffer unprocessed_incoming_frames_buffer; - grpc_closure *on_next; /* protected by t combiner */ - bool pending_byte_stream; /* protected by t combiner */ - grpc_closure reset_byte_stream; - grpc_error *byte_stream_error; /* protected by t combiner */ - bool received_last_frame; /* protected by t combiner */ + grpc_chttp2_incoming_frame_queue incoming_frames; gpr_timespec deadline; @@ -517,9 +512,6 @@ struct grpc_chttp2_stream { * incoming_window = incoming_window_delta + transport.initial_window_size */ int64_t incoming_window_delta; /** parsing state for data frames */ - /* Accessed only by transport thread when stream->pending_byte_stream == false - * Accessed only by application thread when stream->pending_byte_stream == - * true */ grpc_chttp2_data_parser data_parser; /** number of bytes received - reset at end of parse thread execution */ int64_t received_bytes; @@ -798,13 +790,10 @@ void grpc_chttp2_ref_transport(grpc_chttp2_transport *t); grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s, uint32_t frame_size, uint32_t flags); -grpc_error *grpc_chttp2_incoming_byte_stream_push( - grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, - grpc_slice slice, grpc_slice *slice_out); -grpc_error *grpc_chttp2_incoming_byte_stream_finished( - grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, - grpc_error *error, bool reset_on_error); -void grpc_chttp2_incoming_byte_stream_notify( +void grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, + grpc_chttp2_incoming_byte_stream *bs, + grpc_slice slice); +void grpc_chttp2_incoming_byte_stream_finished( grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, grpc_error *error); diff --git a/src/core/ext/transport/chttp2/transport/parsing.c b/src/core/ext/transport/chttp2/transport/parsing.c index 638b137316f..7e457ced270 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.c +++ b/src/core/ext/transport/chttp2/transport/parsing.c @@ -458,13 +458,12 @@ static grpc_error *init_data_frame_parser(grpc_exec_ctx *exec_ctx, return init_skip_frame_parser(exec_ctx, t, 0); } if (err == GRPC_ERROR_NONE) { - err = grpc_chttp2_data_parser_begin_frame( - &s->data_parser, t->incoming_frame_flags, s->id, s); + err = grpc_chttp2_data_parser_begin_frame(&s->data_parser, + t->incoming_frame_flags, s->id); } error_handler: if (err == GRPC_ERROR_NONE) { t->incoming_stream = s; - /* t->parser = grpc_chttp2_data_parser_parse;*/ t->parser = grpc_chttp2_data_parser_parse; t->parser_data = &s->data_parser; return GRPC_ERROR_NONE; diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c index 7896c70f9eb..88335ecd0be 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.c +++ b/src/core/ext/transport/cronet/transport/cronet_transport.c @@ -973,20 +973,9 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, grpc_slice_buffer write_slice_buffer; grpc_slice slice; grpc_slice_buffer_init(&write_slice_buffer); - if (1 != grpc_byte_stream_next( - exec_ctx, stream_op->payload->send_message.send_message, - stream_op->payload->send_message.send_message->length, - NULL)) { - /* Should never reach here */ - GPR_ASSERT(false); - } - if (GRPC_ERROR_NONE != - grpc_byte_stream_pull(exec_ctx, - stream_op->payload->send_message.send_message, - &slice)) { - /* Should never reach here */ - GPR_ASSERT(false); - } + grpc_byte_stream_next( + NULL, stream_op->payload->send_message.send_message, &slice, + stream_op->payload->send_message.send_message->length, NULL); grpc_slice_buffer_add(&write_slice_buffer, slice); if (write_slice_buffer.count != 1) { /* Empty request not handled yet */ diff --git a/src/core/lib/channel/compress_filter.c b/src/core/lib/channel/compress_filter.c index 764524b24d1..4625cba0d25 100644 --- a/src/core/lib/channel/compress_filter.c +++ b/src/core/lib/channel/compress_filter.c @@ -221,13 +221,6 @@ static void finish_send_message(grpc_exec_ctx *exec_ctx, static void got_slice(grpc_exec_ctx *exec_ctx, void *elemp, grpc_error *error) { grpc_call_element *elem = elemp; call_data *calld = elem->call_data; - if (GRPC_ERROR_NONE != - grpc_byte_stream_pull(exec_ctx, - calld->send_op->payload->send_message.send_message, - &calld->incoming_slice)) { - /* Should never reach here */ - abort(); - } grpc_slice_buffer_add(&calld->slices, calld->incoming_slice); if (calld->send_length == calld->slices.length) { finish_send_message(exec_ctx, elem); @@ -240,11 +233,8 @@ static void continue_send_message(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) { call_data *calld = elem->call_data; while (grpc_byte_stream_next( - exec_ctx, calld->send_op->payload->send_message.send_message, ~(size_t)0, - &calld->got_slice)) { - grpc_byte_stream_pull(exec_ctx, - calld->send_op->payload->send_message.send_message, - &calld->incoming_slice); + exec_ctx, calld->send_op->payload->send_message.send_message, + &calld->incoming_slice, ~(size_t)0, &calld->got_slice)) { grpc_slice_buffer_add(&calld->slices, calld->incoming_slice); if (calld->send_length == calld->slices.length) { finish_send_message(exec_ctx, elem); diff --git a/src/core/lib/channel/http_client_filter.c b/src/core/lib/channel/http_client_filter.c index 151fb9885de..4e47c5c658f 100644 --- a/src/core/lib/channel/http_client_filter.c +++ b/src/core/lib/channel/http_client_filter.c @@ -220,11 +220,8 @@ static void continue_send_message(grpc_exec_ctx *exec_ctx, call_data *calld = elem->call_data; uint8_t *wrptr = calld->payload_bytes; while (grpc_byte_stream_next( - exec_ctx, calld->send_op->payload->send_message.send_message, ~(size_t)0, - &calld->got_slice)) { - grpc_byte_stream_pull(exec_ctx, - calld->send_op->payload->send_message.send_message, - &calld->incoming_slice); + exec_ctx, calld->send_op->payload->send_message.send_message, + &calld->incoming_slice, ~(size_t)0, &calld->got_slice)) { memcpy(wrptr, GRPC_SLICE_START_PTR(calld->incoming_slice), GRPC_SLICE_LENGTH(calld->incoming_slice)); wrptr += GRPC_SLICE_LENGTH(calld->incoming_slice); @@ -240,13 +237,6 @@ static void got_slice(grpc_exec_ctx *exec_ctx, void *elemp, grpc_error *error) { grpc_call_element *elem = elemp; call_data *calld = elem->call_data; calld->send_message_blocked = false; - if (GRPC_ERROR_NONE != - grpc_byte_stream_pull(exec_ctx, - calld->send_op->payload->send_message.send_message, - &calld->incoming_slice)) { - /* Should never reach here */ - abort(); - } grpc_slice_buffer_add(&calld->slices, calld->incoming_slice); if (calld->send_length == calld->slices.length) { /* Pass down the original send_message op that was blocked.*/ diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 3e96d097985..97d50a91be5 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -1187,7 +1187,6 @@ static void finish_batch_step(grpc_exec_ctx *exec_ctx, batch_control *bctl) { static void continue_receiving_slices(grpc_exec_ctx *exec_ctx, batch_control *bctl) { - grpc_error *error; grpc_call *call = bctl->call; for (;;) { size_t remaining = call->receiving_stream->length - @@ -1199,22 +1198,11 @@ static void continue_receiving_slices(grpc_exec_ctx *exec_ctx, finish_batch_step(exec_ctx, bctl); return; } - if (grpc_byte_stream_next(exec_ctx, call->receiving_stream, remaining, + if (grpc_byte_stream_next(exec_ctx, call->receiving_stream, + &call->receiving_slice, remaining, &call->receiving_slice_ready)) { - error = grpc_byte_stream_pull(exec_ctx, call->receiving_stream, - &call->receiving_slice); - if (error == GRPC_ERROR_NONE) { - grpc_slice_buffer_add(&(*call->receiving_buffer)->data.raw.slice_buffer, - call->receiving_slice); - } else { - grpc_byte_stream_destroy(exec_ctx, call->receiving_stream); - call->receiving_stream = NULL; - grpc_byte_buffer_destroy(*call->receiving_buffer); - *call->receiving_buffer = NULL; - call->receiving_message = 0; - finish_batch_step(exec_ctx, bctl); - return; - } + grpc_slice_buffer_add(&(*call->receiving_buffer)->data.raw.slice_buffer, + call->receiving_slice); } else { return; } @@ -1225,24 +1213,12 @@ static void receiving_slice_ready(grpc_exec_ctx *exec_ctx, void *bctlp, grpc_error *error) { batch_control *bctl = bctlp; grpc_call *call = bctl->call; - grpc_byte_stream *bs = call->receiving_stream; - bool release_error = false; if (error == GRPC_ERROR_NONE) { - grpc_slice slice; - error = grpc_byte_stream_pull(exec_ctx, bs, &slice); - if (error == GRPC_ERROR_NONE) { - grpc_slice_buffer_add(&(*call->receiving_buffer)->data.raw.slice_buffer, - slice); - continue_receiving_slices(exec_ctx, bctl); - } else { - /* Error returned by grpc_byte_stream_pull needs to be released manually - */ - release_error = true; - } - } - - if (error != GRPC_ERROR_NONE) { + grpc_slice_buffer_add(&(*call->receiving_buffer)->data.raw.slice_buffer, + call->receiving_slice); + continue_receiving_slices(exec_ctx, bctl); + } else { if (grpc_trace_operation_failures) { GRPC_LOG_IF_ERROR("receiving_slice_ready", GRPC_ERROR_REF(error)); } @@ -1250,11 +1226,7 @@ static void receiving_slice_ready(grpc_exec_ctx *exec_ctx, void *bctlp, call->receiving_stream = NULL; grpc_byte_buffer_destroy(*call->receiving_buffer); *call->receiving_buffer = NULL; - call->receiving_message = 0; finish_batch_step(exec_ctx, bctl); - if (release_error) { - GRPC_ERROR_UNREF(error); - } } } diff --git a/src/core/lib/transport/byte_stream.c b/src/core/lib/transport/byte_stream.c index 5800c70ef44..4d4206189e7 100644 --- a/src/core/lib/transport/byte_stream.c +++ b/src/core/lib/transport/byte_stream.c @@ -40,15 +40,10 @@ #include "src/core/lib/slice/slice_internal.h" int grpc_byte_stream_next(grpc_exec_ctx *exec_ctx, - grpc_byte_stream *byte_stream, size_t max_size_hint, - grpc_closure *on_complete) { - return byte_stream->next(exec_ctx, byte_stream, max_size_hint, on_complete); -} - -grpc_error *grpc_byte_stream_pull(grpc_exec_ctx *exec_ctx, - grpc_byte_stream *byte_stream, - grpc_slice *slice) { - return byte_stream->pull(exec_ctx, byte_stream, slice); + grpc_byte_stream *byte_stream, grpc_slice *slice, + size_t max_size_hint, grpc_closure *on_complete) { + return byte_stream->next(exec_ctx, byte_stream, slice, max_size_hint, + on_complete); } void grpc_byte_stream_destroy(grpc_exec_ctx *exec_ctx, @@ -58,24 +53,16 @@ void grpc_byte_stream_destroy(grpc_exec_ctx *exec_ctx, /* slice_buffer_stream */ -static bool slice_buffer_stream_next(grpc_exec_ctx *exec_ctx, - grpc_byte_stream *byte_stream, - size_t max_size_hint, - grpc_closure *on_complete) { - grpc_slice_buffer_stream *stream = (grpc_slice_buffer_stream *)byte_stream; - GPR_ASSERT(stream->cursor < stream->backing_buffer->count); - return true; -} - -static grpc_error *slice_buffer_stream_pull(grpc_exec_ctx *exec_ctx, - grpc_byte_stream *byte_stream, - grpc_slice *slice) { +static int slice_buffer_stream_next(grpc_exec_ctx *exec_ctx, + grpc_byte_stream *byte_stream, + grpc_slice *slice, size_t max_size_hint, + grpc_closure *on_complete) { grpc_slice_buffer_stream *stream = (grpc_slice_buffer_stream *)byte_stream; GPR_ASSERT(stream->cursor < stream->backing_buffer->count); *slice = grpc_slice_ref_internal(stream->backing_buffer->slices[stream->cursor]); stream->cursor++; - return GRPC_ERROR_NONE; + return 1; } static void slice_buffer_stream_destroy(grpc_exec_ctx *exec_ctx, @@ -88,7 +75,6 @@ void grpc_slice_buffer_stream_init(grpc_slice_buffer_stream *stream, stream->base.length = (uint32_t)slice_buffer->length; stream->base.flags = flags; stream->base.next = slice_buffer_stream_next; - stream->base.pull = slice_buffer_stream_pull; stream->base.destroy = slice_buffer_stream_destroy; stream->backing_buffer = slice_buffer; stream->cursor = 0; diff --git a/src/core/lib/transport/byte_stream.h b/src/core/lib/transport/byte_stream.h index 381c65fb044..1fdd5b4d775 100644 --- a/src/core/lib/transport/byte_stream.h +++ b/src/core/lib/transport/byte_stream.h @@ -49,10 +49,9 @@ typedef struct grpc_byte_stream grpc_byte_stream; struct grpc_byte_stream { uint32_t length; uint32_t flags; - bool (*next)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, - size_t max_size_hint, grpc_closure *on_complete); - grpc_error *(*pull)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, - grpc_slice *slice); + int (*next)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, + grpc_slice *slice, size_t max_size_hint, + grpc_closure *on_complete); void (*destroy)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream); }; @@ -62,20 +61,12 @@ struct grpc_byte_stream { * * max_size_hint can be set as a hint as to the maximum number * of bytes that would be acceptable to read. - */ -int grpc_byte_stream_next(grpc_exec_ctx *exec_ctx, - grpc_byte_stream *byte_stream, size_t max_size_hint, - grpc_closure *on_complete); - -/* returns the next slice in the byte stream when it is ready (indicated by - * either grpc_byte_stream_next returning 1 or on_complete passed to - * grpc_byte_stream_next is called). * * once a slice is returned into *slice, it is owned by the caller. */ -grpc_error *grpc_byte_stream_pull(grpc_exec_ctx *exec_ctx, - grpc_byte_stream *byte_stream, - grpc_slice *slice); +int grpc_byte_stream_next(grpc_exec_ctx *exec_ctx, + grpc_byte_stream *byte_stream, grpc_slice *slice, + size_t max_size_hint, grpc_closure *on_complete); void grpc_byte_stream_destroy(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream); diff --git a/test/cpp/microbenchmarks/bm_chttp2_transport.cc b/test/cpp/microbenchmarks/bm_chttp2_transport.cc index 8c5413b5fda..c89f349ca7f 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_transport.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_transport.cc @@ -569,17 +569,12 @@ static void BM_TransportStreamRecv(benchmark::State &state) { grpc_closure_sched(exec_ctx, c.get(), GRPC_ERROR_NONE); return; } - } while (grpc_byte_stream_next(exec_ctx, recv_stream, + } while (grpc_byte_stream_next(exec_ctx, recv_stream, &recv_slice, recv_stream->length - received, - drain_continue.get()) && - GRPC_ERROR_NONE == - grpc_byte_stream_pull(exec_ctx, recv_stream, &recv_slice) && - (received += GRPC_SLICE_LENGTH(recv_slice), - grpc_slice_unref_internal(exec_ctx, recv_slice), true)); + drain_continue.get())); }); drain_continue = MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) { - grpc_byte_stream_pull(exec_ctx, recv_stream, &recv_slice); received += GRPC_SLICE_LENGTH(recv_slice); grpc_slice_unref_internal(exec_ctx, recv_slice); grpc_closure_run(exec_ctx, drain.get(), GRPC_ERROR_NONE); From 67dd855337d890656b46c8a6247ee924850fa935 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 12 Apr 2017 16:42:30 -0700 Subject: [PATCH 356/461] Combine multiple temporally disconnected runs --- tools/profiling/microbenchmarks/bm_diff.py | 79 +++++++++++----------- 1 file changed, 41 insertions(+), 38 deletions(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index c3738605194..5bc0eacd22c 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -94,7 +94,8 @@ argp.add_argument('-t', '--track', help='Which metrics to track') argp.add_argument('-b', '--benchmarks', nargs='+', choices=_AVAILABLE_BENCHMARK_TESTS, default=['bm_cq']) argp.add_argument('-d', '--diff_base', type=str) -argp.add_argument('-r', '--repetitions', type=int, default=30) +argp.add_argument('-r', '--repetitions', type=int, default=5) +argp.add_argument('-l', '--loops', type=int, default=5) argp.add_argument('-p', '--p_threshold', type=float, default=0.01) argp.add_argument('-j', '--jobs', type=int, default=multiprocessing.cpu_count()) args = argp.parse_args() @@ -123,33 +124,34 @@ def build(): subprocess.check_call(make_cmd('opt')) subprocess.check_call(make_cmd('counters')) -def collect1(bm, cfg, ver): +def collect1(bm, cfg, ver, idx): cmd = ['bins/%s/%s' % (cfg, bm), - '--benchmark_out=%s.%s.%s.json' % (bm, cfg, ver), + '--benchmark_out=%s.%s.%s.%d.json' % (bm, cfg, ver, idx), '--benchmark_out_format=json', '--benchmark_repetitions=%d' % (args.repetitions) ] return jobset.JobSpec(cmd, shortname='%s %s %s' % (bm, cfg, ver), verbose_success=True, timeout_seconds=None) -build() -jobset.run(itertools.chain( - (collect1(bm, 'opt', 'new') for bm in args.benchmarks), - (collect1(bm, 'counters', 'new') for bm in args.benchmarks), -), maxjobs=args.jobs) - -where_am_i = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip() -subprocess.check_call(['git', 'checkout', args.diff_base]) - -try: +for loop in range(0, args.loops): build() jobset.run(itertools.chain( - (collect1(bm, 'opt', 'old') for bm in args.benchmarks), - (collect1(bm, 'counters', 'old') for bm in args.benchmarks), + (collect1(bm, 'opt', 'new', loop) for bm in args.benchmarks), + (collect1(bm, 'counters', 'new', loop) for bm in args.benchmarks), ), maxjobs=args.jobs) -finally: - subprocess.check_call(['git', 'checkout', where_am_i]) - subprocess.check_call(['git', 'submodule', 'update']) + + where_am_i = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip() + subprocess.check_call(['git', 'checkout', args.diff_base]) + + try: + build() + jobset.run(itertools.chain( + (collect1(bm, 'opt', 'old', loop) for bm in args.benchmarks), + (collect1(bm, 'counters', 'old', loop) for bm in args.benchmarks), + ), maxjobs=args.jobs) + finally: + subprocess.check_call(['git', 'checkout', where_am_i]) + subprocess.check_call(['git', 'submodule', 'update']) class Benchmark: @@ -174,7 +176,7 @@ class Benchmark: mdn_diff = abs(median(new) - median(old)) print '%s: new=%r old=%r mdn_diff=%r' % (f, new, old, mdn_diff) s = speedup.speedup(new, old) - if s and mdn_diff > 0.5 and abs(s) >= 10: + if s and mdn_diff > 0.5: self.final[f] = '%+d%%' % s return self.final.keys() @@ -188,25 +190,26 @@ class Benchmark: benchmarks = collections.defaultdict(Benchmark) for bm in args.benchmarks: - with open('%s.counters.new.json' % bm) as f: - js_new_ctr = json.loads(f.read()) - with open('%s.opt.new.json' % bm) as f: - js_new_opt = json.loads(f.read()) - with open('%s.counters.old.json' % bm) as f: - js_old_ctr = json.loads(f.read()) - with open('%s.opt.old.json' % bm) as f: - js_old_opt = json.loads(f.read()) - - for row in bm_json.expand_json(js_new_ctr, js_new_opt): - print row - name = row['cpp_name'] - if name.endswith('_mean') or name.endswith('_stddev'): continue - benchmarks[name].add_sample(row, True) - for row in bm_json.expand_json(js_old_ctr, js_old_opt): - print row - name = row['cpp_name'] - if name.endswith('_mean') or name.endswith('_stddev'): continue - benchmarks[name].add_sample(row, False) + for loop in args.loops: + with open('%s.counters.new.%d.json' % (bm, loop)) as f: + js_new_ctr = json.loads(f.read()) + with open('%s.opt.new.%d.json' % (bm, loop)) as f: + js_new_opt = json.loads(f.read()) + with open('%s.counters.old.%d.json' % (bm, loop)) as f: + js_old_ctr = json.loads(f.read()) + with open('%s.opt.old.%d.json' % (bm, loop)) as f: + js_old_opt = json.loads(f.read()) + + for row in bm_json.expand_json(js_new_ctr, js_new_opt): + print row + name = row['cpp_name'] + if name.endswith('_mean') or name.endswith('_stddev'): continue + benchmarks[name].add_sample(row, True) + for row in bm_json.expand_json(js_old_ctr, js_old_opt): + print row + name = row['cpp_name'] + if name.endswith('_mean') or name.endswith('_stddev'): continue + benchmarks[name].add_sample(row, False) really_interesting = set() for name, bm in benchmarks.items(): From d02c9d2b54f8ab0f263351328451df9718c7cbdf Mon Sep 17 00:00:00 2001 From: Makarand Dharmapurikar Date: Wed, 12 Apr 2017 16:52:39 -0700 Subject: [PATCH 357/461] add ability to run objc interop tests --- tools/run_tests/run_interop_tests.py | 43 ++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/tools/run_tests/run_interop_tests.py b/tools/run_tests/run_interop_tests.py index d2bf529fef3..fcc752fdea4 100755 --- a/tools/run_tests/run_interop_tests.py +++ b/tools/run_tests/run_interop_tests.py @@ -371,6 +371,39 @@ class PHP7Language: def __str__(self): return 'php7' +class ObjcLanguage: + + def __init__(self): + self.client_cwd = 'src/objective-c/tests' + self.safename = str(self) + + def client_cmd(self, args): + # from args, extract the server port and craft xcodebuild command out of it + for arg in args: + port = re.search('--server_port=(\d+)', arg) + if port: + portnum = port.group(1) + cmdline = 'pod install && xcodebuild -workspace Tests.xcworkspace -scheme InteropTestsLocalSSL -destination name="iPhone 6" HOST_PORT_LOCALSSL=localhost:%s test'%portnum + return [cmdline] + + def cloud_to_prod_env(self): + return {} + + def global_env(self): + return {} + + def unimplemented_test_cases(self): + # ObjC test runs all cases with the same command. It ignores the testcase + # cmdline argument. Here we return all but one test cases as unimplemented, + # and depend upon ObjC test's behavior that it runs all cases even when + # we tell it to run just one. + return _TEST_CASES[1:] + + def unimplemented_test_cases_server(self): + return _SKIP_COMPRESSION + + def __str__(self): + return 'objc' class RubyLanguage: @@ -402,7 +435,6 @@ class RubyLanguage: def __str__(self): return 'ruby' - class PythonLanguage: def __init__(self): @@ -460,6 +492,7 @@ _LANGUAGES = { 'node' : NodeLanguage(), 'php' : PHPLanguage(), 'php7' : PHP7Language(), + 'objc' : ObjcLanguage(), 'ruby' : RubyLanguage(), 'python' : PythonLanguage(), } @@ -667,7 +700,8 @@ def cloud_to_cloud_jobspec(language, test_case, server_name, server_host, cwd = language.client_cwd environ = language.global_env() - if docker_image: + if docker_image and language.safename != 'objc': + # we can't run client in docker for objc. container_name = dockerjob.random_name('interop_client_%s' % language.safename) cmdline = docker_run_cmdline(cmdline, image=docker_image, @@ -820,7 +854,7 @@ argp.add_argument('-l', '--language', choices=['all'] + sorted(_LANGUAGES), nargs='+', default=['all'], - help='Clients to run.') + help='Clients to run. Objc client can be only run on OSX.') argp.add_argument('-j', '--jobs', default=multiprocessing.cpu_count(), type=int) argp.add_argument('--cloud_to_prod', default=False, @@ -942,6 +976,9 @@ if args.use_docker: build_jobs = [] for l in languages_to_build: + if str(l) == 'objc': + # we don't need to build a docker image for objc + continue job = build_interop_image_jobspec(l) docker_images[str(l)] = job.tag build_jobs.append(job) From c7609c4f3f5471f87f3aaf66f4328accf29dd33e Mon Sep 17 00:00:00 2001 From: Yuxuan Li Date: Wed, 12 Apr 2017 17:55:31 -0700 Subject: [PATCH 358/461] profile cpp overhead for call create --- test/cpp/microbenchmarks/bm_call_create.cc | 79 +++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index 136b7c0340f..2fe4e0f53b8 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -166,6 +166,83 @@ static void BM_LameChannelCallCreateCpp(benchmark::State &state) { } BENCHMARK(BM_LameChannelCallCreateCpp); +static void do_nothing(void *ignored) {} + +static void BM_LameChannelCallCreateCore(benchmark::State &state) { + TrackCounters track_counters; + + grpc_channel *channel; + grpc_completion_queue *cq; + grpc_metadata_array initial_metadata_recv; + grpc_metadata_array trailing_metadata_recv; + grpc_byte_buffer *response_payload_recv = NULL; + grpc_status_code status; + grpc_slice details; + grpc::testing::EchoRequest send_request; + grpc_slice send_request_slice = + grpc_slice_new(&send_request, sizeof(send_request), do_nothing); + grpc_slice host = grpc_slice_from_static_string("localhost"); + + channel = grpc_lame_client_channel_create( + "localhost:1234", GRPC_STATUS_UNAUTHENTICATED, "blah"); + cq = grpc_completion_queue_create(NULL); + + while (state.KeepRunning()) { + GPR_TIMER_SCOPE("BenchmarkCycle", 0); + grpc_call *call = grpc_channel_create_call( + channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq, + grpc_slice_from_static_string("/EchoTestService/AsyncEcho"), &host, + gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + grpc_metadata_array_init(&initial_metadata_recv); + grpc_metadata_array_init(&trailing_metadata_recv); + grpc_byte_buffer *request_payload_send = + grpc_raw_byte_buffer_create(&send_request_slice, 1); + + // Fill in call ops + grpc_op ops[6]; + memset(ops, 0, sizeof(ops)); + grpc_op *op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op++; + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message.send_message = request_payload_send; + op++; + op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; + op++; + op->op = GRPC_OP_RECV_INITIAL_METADATA; + op->data.recv_initial_metadata.recv_initial_metadata = + &initial_metadata_recv; + op++; + op->op = GRPC_OP_RECV_MESSAGE; + op->data.recv_message.recv_message = &response_payload_recv; + op++; + op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; + op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; + op->data.recv_status_on_client.status = &status; + op->data.recv_status_on_client.status_details = &details; + op++; + + GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, ops, + (size_t)(op - ops), + (void *)1, NULL)); + grpc_event ev = grpc_completion_queue_next( + cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + GPR_ASSERT(ev.type != GRPC_QUEUE_SHUTDOWN); + GPR_ASSERT(ev.success != 0); + grpc_call_destroy(call); + grpc_byte_buffer_destroy(request_payload_send); + grpc_byte_buffer_destroy(response_payload_recv); + grpc_metadata_array_destroy(&initial_metadata_recv); + grpc_metadata_array_destroy(&trailing_metadata_recv); + } + grpc_channel_destroy(channel); + grpc_completion_queue_destroy(cq); + grpc_slice_unref(send_request_slice); + track_counters.Finish(state); +} +BENCHMARK(BM_LameChannelCallCreateCore); + static void FilterDestroy(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { gpr_free(arg); @@ -560,7 +637,7 @@ static const grpc_channel_filter isolated_call_filter = { GetPeer, GetChannelInfo, "isolated_call_filter"}; -} +} // namespace isolated_call_filter class IsolatedCallFixture : public TrackCounters { public: From db32770412f32ab35f82f52272309cc9f0996be8 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 12 Apr 2017 18:23:47 -0700 Subject: [PATCH 359/461] Fix modulemap redefinition --- src/objective-c/BoringSSL.podspec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/objective-c/BoringSSL.podspec b/src/objective-c/BoringSSL.podspec index 908bb0b5e5e..55cc6f677e4 100644 --- a/src/objective-c/BoringSSL.podspec +++ b/src/objective-c/BoringSSL.podspec @@ -31,7 +31,7 @@ Pod::Spec.new do |s| s.name = 'BoringSSL' - version = '8.0' + version = '8.1' s.version = version s.summary = 'BoringSSL is a fork of OpenSSL that is designed to meet Google’s needs.' # Adapted from the homepage: @@ -95,7 +95,7 @@ Pod::Spec.new do |s| # The module map and umbrella header created automatically by Cocoapods don't work for C libraries # like this one. The following file, and a correct umbrella header, are created on the fly by the # `prepare_command` of this pod. - s.module_map = 'include/openssl/module.modulemap' + s.module_map = 'include/openssl/BoringSSL.modulemap' # We don't need to inhibit all warnings; only -Wno-shorten-64-to-32. But Cocoapods' linter doesn't # want that for some reason. @@ -186,7 +186,7 @@ Pod::Spec.new do |s| #include "x509.h" #include "x509v3.h" EOF - cat > include/openssl/module.modulemap < include/openssl/BoringSSL.modulemap < Date: Wed, 12 Apr 2017 18:06:36 -0700 Subject: [PATCH 360/461] Add GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED --- .../chttp2/transport/chttp2_transport.c | 23 ++++++++++--------- .../ext/transport/chttp2/transport/internal.h | 1 + 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 5ad31c7d2cd..ecf278329eb 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -544,9 +544,9 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), t->keepalive_time), &t->init_keepalive_ping_locked, gpr_now(GPR_CLOCK_MONOTONIC)); } else { - /* Use GRPC_CHTTP2_KEEPALIVE_STATE_DYING to indicate there are no inflight - keeaplive timers */ - t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DYING; + /* Use GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED to indicate there are no + inflight keeaplive timers */ + t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED; } grpc_chttp2_initiate_write(exec_ctx, t, false, "init"); @@ -596,18 +596,17 @@ static void close_transport_locked(grpc_exec_ctx *exec_ctx, GRPC_ERROR_REF(error), "close_transport"); grpc_endpoint_shutdown(exec_ctx, t->ep, GRPC_ERROR_REF(error)); switch (t->keepalive_state) { - case GRPC_CHTTP2_KEEPALIVE_STATE_WAITING: { + case GRPC_CHTTP2_KEEPALIVE_STATE_WAITING: grpc_timer_cancel(exec_ctx, &t->keepalive_ping_timer); break; - } - case GRPC_CHTTP2_KEEPALIVE_STATE_PINGING: { + case GRPC_CHTTP2_KEEPALIVE_STATE_PINGING: grpc_timer_cancel(exec_ctx, &t->keepalive_ping_timer); grpc_timer_cancel(exec_ctx, &t->keepalive_watchdog_timer); break; - } - case GRPC_CHTTP2_KEEPALIVE_STATE_DYING: { + case GRPC_CHTTP2_KEEPALIVE_STATE_DYING: + case GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED: + /* keepalive timers are not set in these two states */ break; - } } /* flush writable stream list to avoid dangling references */ @@ -2269,7 +2268,9 @@ static void init_keepalive_ping_locked(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { grpc_chttp2_transport *t = arg; GPR_ASSERT(t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING); - if (error == GRPC_ERROR_NONE && !(t->destroying || t->closed)) { + if (t->destroying || t->closed) { + t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DYING; + } else if (error == GRPC_ERROR_NONE) { if (t->keepalive_permit_without_calls || grpc_chttp2_stream_map_size(&t->stream_map) > 0) { t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_PINGING; @@ -2284,7 +2285,7 @@ static void init_keepalive_ping_locked(grpc_exec_ctx *exec_ctx, void *arg, gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), t->keepalive_time), &t->init_keepalive_ping_locked, gpr_now(GPR_CLOCK_MONOTONIC)); } - } else if (error == GRPC_ERROR_CANCELLED && !(t->destroying || t->closed)) { + } else if (error == GRPC_ERROR_CANCELLED) { /* The keepalive ping timer may be cancelled by bdp */ GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping"); grpc_timer_init( diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 6eb848b8d77..0452081dd5c 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -222,6 +222,7 @@ typedef enum { GRPC_CHTTP2_KEEPALIVE_STATE_WAITING, GRPC_CHTTP2_KEEPALIVE_STATE_PINGING, GRPC_CHTTP2_KEEPALIVE_STATE_DYING, + GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED, } grpc_chttp2_keepalive_state; struct grpc_chttp2_transport { From 8cf15aa9ecc63be67a828c1175c6840b00722e57 Mon Sep 17 00:00:00 2001 From: Matt Kwong Date: Wed, 12 Apr 2017 19:10:39 -0700 Subject: [PATCH 361/461] Fix typo in Kokoro scripts --- tools/internal_ci/linux/sanitizer/grpc_cpp_asan.sh | 2 +- tools/internal_ci/linux/sanitizer/grpc_cpp_tsan.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/internal_ci/linux/sanitizer/grpc_cpp_asan.sh b/tools/internal_ci/linux/sanitizer/grpc_cpp_asan.sh index c3bf79b1fb5..47ccb26f878 100755 --- a/tools/internal_ci/linux/sanitizer/grpc_cpp_asan.sh +++ b/tools/internal_ci/linux/sanitizer/grpc_cpp_asan.sh @@ -37,4 +37,4 @@ git submodule update --init # download docker images from dockerhub export DOCKERHUB_ORGANIZATION=grpctesting -tools/run_tests/run_tests_matrix.py -f cpp asan +tools/run_tests/run_tests_matrix.py -f c++ asan diff --git a/tools/internal_ci/linux/sanitizer/grpc_cpp_tsan.sh b/tools/internal_ci/linux/sanitizer/grpc_cpp_tsan.sh index c72a106c91a..ee3ec5ebb08 100755 --- a/tools/internal_ci/linux/sanitizer/grpc_cpp_tsan.sh +++ b/tools/internal_ci/linux/sanitizer/grpc_cpp_tsan.sh @@ -37,4 +37,4 @@ git submodule update --init # download docker images from dockerhub export DOCKERHUB_ORGANIZATION=grpctesting -tools/run_tests/run_tests_matrix.py -f cpp tsan +tools/run_tests/run_tests_matrix.py -f c++ tsan From 29723ee1ba8a52bc8b373d9bbe3dcfae266b95f1 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 12 Apr 2017 20:24:42 -0700 Subject: [PATCH 362/461] Revert "Revert "Implement lazy deframe"" --- .../chttp2/transport/chttp2_transport.c | 338 ++++++++++------ .../transport/chttp2/transport/frame_data.c | 365 ++++++++++-------- .../transport/chttp2/transport/frame_data.h | 24 +- .../ext/transport/chttp2/transport/internal.h | 51 ++- .../ext/transport/chttp2/transport/parsing.c | 5 +- .../cronet/transport/cronet_transport.c | 17 +- src/core/lib/channel/compress_filter.c | 14 +- src/core/lib/channel/http_client_filter.c | 14 +- src/core/lib/surface/call.c | 44 ++- src/core/lib/transport/byte_stream.c | 32 +- src/core/lib/transport/byte_stream.h | 21 +- .../microbenchmarks/bm_chttp2_transport.cc | 9 +- 12 files changed, 584 insertions(+), 350 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index a7d047d6e7a..29ed4bf90e5 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -44,6 +44,7 @@ #include #include +#include "src/core/ext/transport/chttp2/transport/frame_data.h" #include "src/core/ext/transport/chttp2/transport/internal.h" #include "src/core/ext/transport/chttp2/transport/varint.h" #include "src/core/lib/channel/channel_args.h" @@ -129,6 +130,11 @@ static void incoming_byte_stream_update_flow_control(grpc_exec_ctx *exec_ctx, static void incoming_byte_stream_destroy_locked(grpc_exec_ctx *exec_ctx, void *byte_stream, grpc_error *error_ignored); +static void incoming_byte_stream_publish_error( + grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, + grpc_error *error); +static void incoming_byte_stream_unref(grpc_exec_ctx *exec_ctx, + grpc_chttp2_incoming_byte_stream *bs); static void benign_reclaimer_locked(grpc_exec_ctx *exec_ctx, void *t, grpc_error *error); @@ -174,6 +180,9 @@ static void finish_keepalive_ping_locked(grpc_exec_ctx *exec_ctx, void *arg, static void keepalive_watchdog_fired_locked(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error); +static void reset_byte_stream(grpc_exec_ctx *exec_ctx, void *arg, + grpc_error *error); + /******************************************************************************* * CONSTRUCTION/DESTRUCTION/REFCOUNTING */ @@ -655,7 +664,6 @@ static int init_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, /* We reserve one 'active stream' that's dropped when the stream is read-closed. The others are for incoming_byte_streams that are actively reading */ - gpr_ref_init(&s->active_streams, 1); GRPC_CHTTP2_STREAM_REF(s, "chttp2"); grpc_chttp2_incoming_metadata_buffer_init(&s->metadata_buffer[0], arena); @@ -665,6 +673,11 @@ static int init_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, s->deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); grpc_closure_init(&s->complete_fetch_locked, complete_fetch_locked, s, grpc_schedule_on_exec_ctx); + grpc_slice_buffer_init(&s->unprocessed_incoming_frames_buffer); + grpc_slice_buffer_init(&s->frame_storage); + s->pending_byte_stream = false; + grpc_closure_init(&s->reset_byte_stream, reset_byte_stream, s, + grpc_combiner_scheduler(t->combiner, false)); GRPC_CHTTP2_REF_TRANSPORT(t, "stream"); @@ -682,7 +695,6 @@ static int init_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, static void destroy_stream_locked(grpc_exec_ctx *exec_ctx, void *sp, grpc_error *error) { - grpc_byte_stream *bs; grpc_chttp2_stream *s = sp; grpc_chttp2_transport *t = s->t; @@ -693,9 +705,9 @@ static void destroy_stream_locked(grpc_exec_ctx *exec_ctx, void *sp, GPR_ASSERT(grpc_chttp2_stream_map_find(&t->stream_map, s->id) == NULL); } - while ((bs = grpc_chttp2_incoming_frame_queue_pop(&s->incoming_frames))) { - incoming_byte_stream_destroy_locked(exec_ctx, bs, GRPC_ERROR_NONE); - } + grpc_slice_buffer_destroy_internal(exec_ctx, + &s->unprocessed_incoming_frames_buffer); + grpc_slice_buffer_destroy_internal(exec_ctx, &s->frame_storage); grpc_chttp2_list_remove_stalled_by_transport(t, s); grpc_chttp2_list_remove_stalled_by_stream(t, s); @@ -722,6 +734,7 @@ static void destroy_stream_locked(grpc_exec_ctx *exec_ctx, void *sp, grpc_slice_buffer_destroy_internal(exec_ctx, &s->flow_controlled_buffer); GRPC_ERROR_UNREF(s->read_closed_error); GRPC_ERROR_UNREF(s->write_closed_error); + GRPC_ERROR_UNREF(s->byte_stream_error); if (s->incoming_window_delta > 0) { GRPC_CHTTP2_FLOW_DEBIT_STREAM_INCOMING_WINDOW_DELTA( @@ -1175,8 +1188,9 @@ static void continue_fetching_send_locked(grpc_exec_ctx *exec_ctx, s->fetching_send_message = NULL; return; /* early out */ } else if (grpc_byte_stream_next(exec_ctx, s->fetching_send_message, - &s->fetching_slice, UINT32_MAX, - &s->complete_fetch_locked)) { + UINT32_MAX, &s->complete_fetch_locked)) { + grpc_byte_stream_pull(exec_ctx, s->fetching_send_message, + &s->fetching_slice); add_fetched_slice_locked(exec_ctx, t, s); } } @@ -1187,9 +1201,15 @@ static void complete_fetch_locked(grpc_exec_ctx *exec_ctx, void *gs, grpc_chttp2_stream *s = gs; grpc_chttp2_transport *t = s->t; if (error == GRPC_ERROR_NONE) { - add_fetched_slice_locked(exec_ctx, t, s); - continue_fetching_send_locked(exec_ctx, t, s); - } else { + error = grpc_byte_stream_pull(exec_ctx, s->fetching_send_message, + &s->fetching_slice); + if (error == GRPC_ERROR_NONE) { + add_fetched_slice_locked(exec_ctx, t, s); + continue_fetching_send_locked(exec_ctx, t, s); + } + } + + if (error != GRPC_ERROR_NONE) { /* TODO(ctiller): what to do here */ abort(); } @@ -1424,8 +1444,7 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op, GPR_ASSERT(s->recv_message_ready == NULL); s->recv_message_ready = op_payload->recv_message.recv_message_ready; s->recv_message = op_payload->recv_message.recv_message; - if (s->id != 0 && - (s->incoming_frames.head == NULL || s->incoming_frames.head->is_tail)) { + if (s->id != 0 && s->frame_storage.length == 0) { incoming_byte_stream_update_flow_control(exec_ctx, t, s, 5, 0); } grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); @@ -1614,13 +1633,13 @@ static void perform_transport_op(grpc_exec_ctx *exec_ctx, grpc_transport *gt, void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s) { - grpc_byte_stream *bs; if (s->recv_initial_metadata_ready != NULL && s->published_metadata[0] != GRPC_METADATA_NOT_PUBLISHED) { if (s->seen_error) { - while ((bs = grpc_chttp2_incoming_frame_queue_pop(&s->incoming_frames)) != - NULL) { - incoming_byte_stream_destroy_locked(exec_ctx, bs, GRPC_ERROR_NONE); + grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->frame_storage); + if (!s->pending_byte_stream) { + grpc_slice_buffer_reset_and_unref_internal( + exec_ctx, &s->unprocessed_incoming_frames_buffer); } } grpc_chttp2_incoming_metadata_buffer_publish( @@ -1633,39 +1652,65 @@ void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_exec_ctx *exec_ctx, void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s) { - grpc_byte_stream *bs; + grpc_error *error = GRPC_ERROR_NONE; if (s->recv_message_ready != NULL) { - while (s->final_metadata_requested && s->seen_error && - (bs = grpc_chttp2_incoming_frame_queue_pop(&s->incoming_frames)) != - NULL) { - incoming_byte_stream_destroy_locked(exec_ctx, bs, GRPC_ERROR_NONE); + *s->recv_message = NULL; + if (s->final_metadata_requested && s->seen_error) { + grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->frame_storage); + if (!s->pending_byte_stream) { + grpc_slice_buffer_reset_and_unref_internal( + exec_ctx, &s->unprocessed_incoming_frames_buffer); + } } - if (s->incoming_frames.head != NULL) { - *s->recv_message = - grpc_chttp2_incoming_frame_queue_pop(&s->incoming_frames); - GPR_ASSERT(*s->recv_message != NULL); + if (!s->pending_byte_stream) { + while (s->unprocessed_incoming_frames_buffer.length > 0 || + s->frame_storage.length > 0) { + if (s->unprocessed_incoming_frames_buffer.length == 0) { + grpc_slice_buffer_swap(&s->unprocessed_incoming_frames_buffer, + &s->frame_storage); + } + error = deframe_unprocessed_incoming_frames( + exec_ctx, &s->data_parser, s, + &s->unprocessed_incoming_frames_buffer, NULL, s->recv_message); + if (error != GRPC_ERROR_NONE) { + s->seen_error = true; + grpc_slice_buffer_reset_and_unref_internal(exec_ctx, + &s->frame_storage); + grpc_slice_buffer_reset_and_unref_internal( + exec_ctx, &s->unprocessed_incoming_frames_buffer); + break; + } else if (*s->recv_message != NULL) { + break; + } + } + } + if (error == GRPC_ERROR_NONE && *s->recv_message != NULL) { null_then_run_closure(exec_ctx, &s->recv_message_ready, GRPC_ERROR_NONE); } else if (s->published_metadata[1] != GRPC_METADATA_NOT_PUBLISHED) { *s->recv_message = NULL; null_then_run_closure(exec_ctx, &s->recv_message_ready, GRPC_ERROR_NONE); } + GRPC_ERROR_UNREF(error); } } void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s) { - grpc_byte_stream *bs; grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); if (s->recv_trailing_metadata_finished != NULL && s->read_closed && s->write_closed) { if (s->seen_error) { - while ((bs = grpc_chttp2_incoming_frame_queue_pop(&s->incoming_frames)) != - NULL) { - incoming_byte_stream_destroy_locked(exec_ctx, bs, GRPC_ERROR_NONE); + grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->frame_storage); + if (!s->pending_byte_stream) { + grpc_slice_buffer_reset_and_unref_internal( + exec_ctx, &s->unprocessed_incoming_frames_buffer); } } - if (s->all_incoming_byte_streams_finished && + bool pending_data = s->pending_byte_stream || + s->unprocessed_incoming_frames_buffer.length > 0; + if (s->read_closed && s->frame_storage.length == 0 && + (!pending_data || s->seen_error) && s->recv_trailing_metadata_finished != NULL) { grpc_chttp2_incoming_metadata_buffer_publish( exec_ctx, &s->metadata_buffer[1], s->recv_trailing_metadata); @@ -1676,14 +1721,6 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx *exec_ctx, } } -static void decrement_active_streams_locked(grpc_exec_ctx *exec_ctx, - grpc_chttp2_transport *t, - grpc_chttp2_stream *s) { - if ((s->all_incoming_byte_streams_finished = gpr_unref(&s->active_streams))) { - grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, t, s); - } -} - static void remove_stream(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, uint32_t id, grpc_error *error) { grpc_chttp2_stream *s = grpc_chttp2_stream_map_delete(&t->stream_map, id); @@ -1692,10 +1729,19 @@ static void remove_stream(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, t->incoming_stream = NULL; grpc_chttp2_parsing_become_skip_parser(exec_ctx, t); } - if (s->data_parser.parsing_frame != NULL) { - grpc_chttp2_incoming_byte_stream_finished( - exec_ctx, s->data_parser.parsing_frame, GRPC_ERROR_REF(error)); - s->data_parser.parsing_frame = NULL; + if (s->pending_byte_stream) { + if (s->on_next != NULL) { + grpc_chttp2_incoming_byte_stream *bs = s->data_parser.parsing_frame; + if (error == GRPC_ERROR_NONE) { + error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message"); + } + incoming_byte_stream_publish_error(exec_ctx, bs, error); + incoming_byte_stream_unref(exec_ctx, bs); + s->data_parser.parsing_frame = NULL; + } else { + GRPC_ERROR_UNREF(s->byte_stream_error); + s->byte_stream_error = GRPC_ERROR_REF(error); + } } if (grpc_chttp2_stream_map_size(&t->stream_map) == 0) { @@ -1881,7 +1927,6 @@ void grpc_chttp2_mark_stream_closed(grpc_exec_ctx *exec_ctx, s->published_metadata[i] = GPRC_METADATA_PUBLISHED_AT_CLOSE; } } - decrement_active_streams_locked(exec_ctx, t, s); grpc_chttp2_maybe_complete_recv_initial_metadata(exec_ctx, t, s); grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); } @@ -2419,12 +2464,28 @@ static void set_pollset_set(grpc_exec_ctx *exec_ctx, grpc_transport *gt, * BYTE STREAM */ +static void reset_byte_stream(grpc_exec_ctx *exec_ctx, void *arg, + grpc_error *error) { + grpc_chttp2_stream *s = (grpc_chttp2_stream *)arg; + + s->pending_byte_stream = false; + if (error == GRPC_ERROR_NONE) { + grpc_chttp2_maybe_complete_recv_message(exec_ctx, s->t, s); + grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, s->t, s); + } else { + GPR_ASSERT(error != GRPC_ERROR_NONE); + grpc_closure_sched(exec_ctx, s->on_next, GRPC_ERROR_REF(error)); + s->on_next = NULL; + GRPC_ERROR_UNREF(s->byte_stream_error); + s->byte_stream_error = GRPC_ERROR_NONE; + grpc_chttp2_cancel_stream(exec_ctx, s->t, s, GRPC_ERROR_REF(error)); + s->byte_stream_error = error; + } +} + static void incoming_byte_stream_unref(grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs) { if (gpr_unref(&bs->refs)) { - GRPC_ERROR_UNREF(bs->error); - grpc_slice_buffer_destroy_internal(exec_ctx, &bs->slices); - gpr_mu_destroy(&bs->slice_mu); gpr_free(bs); } } @@ -2484,47 +2545,90 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t = bs->transport; grpc_chttp2_stream *s = bs->stream; - if (bs->is_tail) { - gpr_mu_lock(&bs->slice_mu); - size_t cur_length = bs->slices.length; - gpr_mu_unlock(&bs->slice_mu); - incoming_byte_stream_update_flow_control( - exec_ctx, t, s, bs->next_action.max_size_hint, cur_length); - } - gpr_mu_lock(&bs->slice_mu); - if (bs->slices.count > 0) { - *bs->next_action.slice = grpc_slice_buffer_take_first(&bs->slices); - grpc_closure_run(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_NONE); - } else if (bs->error != GRPC_ERROR_NONE) { - grpc_closure_run(exec_ctx, bs->next_action.on_complete, - GRPC_ERROR_REF(bs->error)); + size_t cur_length = s->frame_storage.length; + incoming_byte_stream_update_flow_control( + exec_ctx, t, s, bs->next_action.max_size_hint, cur_length); + + GPR_ASSERT(s->unprocessed_incoming_frames_buffer.length == 0); + if (s->frame_storage.length > 0) { + grpc_slice_buffer_swap(&s->frame_storage, + &s->unprocessed_incoming_frames_buffer); + grpc_closure_sched(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_NONE); + } else if (s->byte_stream_error != GRPC_ERROR_NONE) { + grpc_closure_sched(exec_ctx, bs->next_action.on_complete, + GRPC_ERROR_REF(s->byte_stream_error)); + if (s->data_parser.parsing_frame != NULL) { + incoming_byte_stream_unref(exec_ctx, s->data_parser.parsing_frame); + s->data_parser.parsing_frame = NULL; + } + } else if (s->read_closed) { + if (bs->remaining_bytes != 0) { + s->byte_stream_error = + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message"); + grpc_closure_sched(exec_ctx, bs->next_action.on_complete, + GRPC_ERROR_REF(s->byte_stream_error)); + if (s->data_parser.parsing_frame != NULL) { + incoming_byte_stream_unref(exec_ctx, s->data_parser.parsing_frame); + s->data_parser.parsing_frame = NULL; + } + } else { + /* Should never reach here. */ + GPR_ASSERT(false); + } } else { - bs->on_next = bs->next_action.on_complete; - bs->next = bs->next_action.slice; + s->on_next = bs->next_action.on_complete; } - gpr_mu_unlock(&bs->slice_mu); incoming_byte_stream_unref(exec_ctx, bs); } -static int incoming_byte_stream_next(grpc_exec_ctx *exec_ctx, - grpc_byte_stream *byte_stream, - grpc_slice *slice, size_t max_size_hint, - grpc_closure *on_complete) { +static bool incoming_byte_stream_next(grpc_exec_ctx *exec_ctx, + grpc_byte_stream *byte_stream, + size_t max_size_hint, + grpc_closure *on_complete) { GPR_TIMER_BEGIN("incoming_byte_stream_next", 0); grpc_chttp2_incoming_byte_stream *bs = (grpc_chttp2_incoming_byte_stream *)byte_stream; - gpr_ref(&bs->refs); - bs->next_action.slice = slice; - bs->next_action.max_size_hint = max_size_hint; - bs->next_action.on_complete = on_complete; - grpc_closure_sched( - exec_ctx, - grpc_closure_init( - &bs->next_action.closure, incoming_byte_stream_next_locked, bs, - grpc_combiner_scheduler(bs->transport->combiner, false)), - GRPC_ERROR_NONE); - GPR_TIMER_END("incoming_byte_stream_next", 0); - return 0; + grpc_chttp2_stream *s = bs->stream; + if (s->unprocessed_incoming_frames_buffer.length > 0) { + return true; + } else { + gpr_ref(&bs->refs); + bs->next_action.max_size_hint = max_size_hint; + bs->next_action.on_complete = on_complete; + grpc_closure_sched( + exec_ctx, + grpc_closure_init( + &bs->next_action.closure, incoming_byte_stream_next_locked, bs, + grpc_combiner_scheduler(bs->transport->combiner, false)), + GRPC_ERROR_NONE); + GPR_TIMER_END("incoming_byte_stream_next", 0); + return false; + } +} + +static grpc_error *incoming_byte_stream_pull(grpc_exec_ctx *exec_ctx, + grpc_byte_stream *byte_stream, + grpc_slice *slice) { + GPR_TIMER_BEGIN("incoming_byte_stream_pull", 0); + grpc_chttp2_incoming_byte_stream *bs = + (grpc_chttp2_incoming_byte_stream *)byte_stream; + grpc_chttp2_stream *s = bs->stream; + + if (s->unprocessed_incoming_frames_buffer.length > 0) { + grpc_error *error = deframe_unprocessed_incoming_frames( + exec_ctx, &s->data_parser, s, &s->unprocessed_incoming_frames_buffer, + slice, NULL); + if (error != GRPC_ERROR_NONE) { + return error; + } + } else { + grpc_error *error = + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message"); + grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error)); + return error; + } + GPR_TIMER_END("incoming_byte_stream_pull", 0); + return GRPC_ERROR_NONE; } static void incoming_byte_stream_destroy(grpc_exec_ctx *exec_ctx, @@ -2534,9 +2638,14 @@ static void incoming_byte_stream_destroy_locked(grpc_exec_ctx *exec_ctx, void *byte_stream, grpc_error *error_ignored) { grpc_chttp2_incoming_byte_stream *bs = byte_stream; + grpc_chttp2_stream *s = bs->stream; + grpc_chttp2_transport *t = s->t; + GPR_ASSERT(bs->base.destroy == incoming_byte_stream_destroy); - decrement_active_streams_locked(exec_ctx, bs->transport, bs->stream); incoming_byte_stream_unref(exec_ctx, bs); + s->pending_byte_stream = false; + grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); + grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, t, s); } static void incoming_byte_stream_destroy(grpc_exec_ctx *exec_ctx, @@ -2556,50 +2665,53 @@ static void incoming_byte_stream_destroy(grpc_exec_ctx *exec_ctx, static void incoming_byte_stream_publish_error( grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, grpc_error *error) { + grpc_chttp2_stream *s = bs->stream; + GPR_ASSERT(error != GRPC_ERROR_NONE); - grpc_closure_sched(exec_ctx, bs->on_next, GRPC_ERROR_REF(error)); - bs->on_next = NULL; - GRPC_ERROR_UNREF(bs->error); + grpc_closure_sched(exec_ctx, s->on_next, GRPC_ERROR_REF(error)); + s->on_next = NULL; + GRPC_ERROR_UNREF(s->byte_stream_error); + s->byte_stream_error = GRPC_ERROR_REF(error); grpc_chttp2_cancel_stream(exec_ctx, bs->transport, bs->stream, GRPC_ERROR_REF(error)); - bs->error = error; } -void grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, - grpc_chttp2_incoming_byte_stream *bs, - grpc_slice slice) { - gpr_mu_lock(&bs->slice_mu); +grpc_error *grpc_chttp2_incoming_byte_stream_push( + grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, + grpc_slice slice, grpc_slice *slice_out) { + grpc_chttp2_stream *s = bs->stream; + if (bs->remaining_bytes < GRPC_SLICE_LENGTH(slice)) { - incoming_byte_stream_publish_error( - exec_ctx, bs, - GRPC_ERROR_CREATE_FROM_STATIC_STRING("Too many bytes in stream")); + grpc_error *error = + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Too many bytes in stream"); + + grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error)); + grpc_slice_unref_internal(exec_ctx, slice); + return error; } else { bs->remaining_bytes -= (uint32_t)GRPC_SLICE_LENGTH(slice); - if (bs->on_next != NULL) { - *bs->next = slice; - grpc_closure_sched(exec_ctx, bs->on_next, GRPC_ERROR_NONE); - bs->on_next = NULL; - } else { - grpc_slice_buffer_add(&bs->slices, slice); + if (slice_out != NULL) { + *slice_out = slice; } + return GRPC_ERROR_NONE; } - gpr_mu_unlock(&bs->slice_mu); } -void grpc_chttp2_incoming_byte_stream_finished( +grpc_error *grpc_chttp2_incoming_byte_stream_finished( grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, - grpc_error *error) { + grpc_error *error, bool reset_on_error) { + grpc_chttp2_stream *s = bs->stream; + if (error == GRPC_ERROR_NONE) { - gpr_mu_lock(&bs->slice_mu); if (bs->remaining_bytes != 0) { error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message"); } - gpr_mu_unlock(&bs->slice_mu); } - if (error != GRPC_ERROR_NONE) { - incoming_byte_stream_publish_error(exec_ctx, bs, error); + if (error != GRPC_ERROR_NONE && reset_on_error) { + grpc_closure_sched(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error)); } incoming_byte_stream_unref(exec_ctx, bs); + return error; } grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( @@ -2611,26 +2723,12 @@ grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( incoming_byte_stream->remaining_bytes = frame_size; incoming_byte_stream->base.flags = flags; incoming_byte_stream->base.next = incoming_byte_stream_next; + incoming_byte_stream->base.pull = incoming_byte_stream_pull; incoming_byte_stream->base.destroy = incoming_byte_stream_destroy; - gpr_mu_init(&incoming_byte_stream->slice_mu); gpr_ref_init(&incoming_byte_stream->refs, 2); - incoming_byte_stream->next_message = NULL; incoming_byte_stream->transport = t; incoming_byte_stream->stream = s; - gpr_ref(&incoming_byte_stream->stream->active_streams); - grpc_slice_buffer_init(&incoming_byte_stream->slices); - incoming_byte_stream->on_next = NULL; - incoming_byte_stream->is_tail = 1; - incoming_byte_stream->error = GRPC_ERROR_NONE; - grpc_chttp2_incoming_frame_queue *q = &s->incoming_frames; - if (q->head == NULL) { - q->head = incoming_byte_stream; - } else { - q->tail->is_tail = 0; - q->tail->next_message = incoming_byte_stream; - } - q->tail = incoming_byte_stream; - grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); + s->byte_stream_error = GRPC_ERROR_NONE; return incoming_byte_stream; } diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c index 6e9258ee7ee..5d382d80a8b 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -40,6 +40,7 @@ #include #include #include "src/core/ext/transport/chttp2/transport/internal.h" +#include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/slice/slice_string_helpers.h" #include "src/core/lib/support/string.h" #include "src/core/lib/transport/transport.h" @@ -53,16 +54,17 @@ grpc_error *grpc_chttp2_data_parser_init(grpc_chttp2_data_parser *parser) { void grpc_chttp2_data_parser_destroy(grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *parser) { if (parser->parsing_frame != NULL) { - grpc_chttp2_incoming_byte_stream_finished( + GRPC_ERROR_UNREF(grpc_chttp2_incoming_byte_stream_finished( exec_ctx, parser->parsing_frame, - GRPC_ERROR_CREATE_FROM_STATIC_STRING("Parser destroyed")); + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Parser destroyed"), false)); } GRPC_ERROR_UNREF(parser->error); } grpc_error *grpc_chttp2_data_parser_begin_frame(grpc_chttp2_data_parser *parser, uint8_t flags, - uint32_t stream_id) { + uint32_t stream_id, + grpc_chttp2_stream *s) { if (flags & ~GRPC_CHTTP2_DATA_FLAG_END_STREAM) { char *msg; gpr_asprintf(&msg, "unsupported data flags: 0x%02x", flags); @@ -74,47 +76,14 @@ grpc_error *grpc_chttp2_data_parser_begin_frame(grpc_chttp2_data_parser *parser, } if (flags & GRPC_CHTTP2_DATA_FLAG_END_STREAM) { - parser->is_last_frame = 1; + s->received_last_frame = true; } else { - parser->is_last_frame = 0; + s->received_last_frame = false; } return GRPC_ERROR_NONE; } -void grpc_chttp2_incoming_frame_queue_merge( - grpc_chttp2_incoming_frame_queue *head_dst, - grpc_chttp2_incoming_frame_queue *tail_src) { - if (tail_src->head == NULL) { - return; - } - - if (head_dst->head == NULL) { - *head_dst = *tail_src; - memset(tail_src, 0, sizeof(*tail_src)); - return; - } - - head_dst->tail->next_message = tail_src->head; - head_dst->tail = tail_src->tail; - memset(tail_src, 0, sizeof(*tail_src)); -} - -grpc_byte_stream *grpc_chttp2_incoming_frame_queue_pop( - grpc_chttp2_incoming_frame_queue *q) { - grpc_byte_stream *out; - if (q->head == NULL) { - return NULL; - } - out = &q->head->base; - if (q->head == q->tail) { - memset(q, 0, sizeof(*q)); - } else { - q->head = q->head->next_message; - } - return out; -} - void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer *inbuf, uint32_t write_bytes, int is_eof, grpc_transport_one_way_stats *stats, @@ -143,145 +112,217 @@ void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer *inbuf, stats->data_bytes += write_bytes; } -static grpc_error *parse_inner(grpc_exec_ctx *exec_ctx, - grpc_chttp2_data_parser *p, - grpc_chttp2_transport *t, grpc_chttp2_stream *s, - grpc_slice slice) { - uint8_t *const beg = GRPC_SLICE_START_PTR(slice); - uint8_t *const end = GRPC_SLICE_END_PTR(slice); - uint8_t *cur = beg; - uint32_t message_flags; - grpc_chttp2_incoming_byte_stream *incoming_byte_stream; - char *msg; +grpc_error *deframe_unprocessed_incoming_frames(grpc_exec_ctx *exec_ctx, + grpc_chttp2_data_parser *p, + grpc_chttp2_stream *s, + grpc_slice_buffer *slices, + grpc_slice *slice_out, + grpc_byte_stream **stream_out) { + grpc_error *error = GRPC_ERROR_NONE; + grpc_chttp2_transport *t = s->t; - if (cur == end) { - return GRPC_ERROR_NONE; - } + while (slices->count > 0) { + uint8_t *beg = NULL; + uint8_t *end = NULL; + uint8_t *cur = NULL; - switch (p->state) { - case GRPC_CHTTP2_DATA_ERROR: - p->state = GRPC_CHTTP2_DATA_ERROR; - return GRPC_ERROR_REF(p->error); - fh_0: - case GRPC_CHTTP2_DATA_FH_0: - s->stats.incoming.framing_bytes++; - p->frame_type = *cur; - switch (p->frame_type) { - case 0: - p->is_frame_compressed = 0; /* GPR_FALSE */ - break; - case 1: - p->is_frame_compressed = 1; /* GPR_TRUE */ - break; - default: - gpr_asprintf(&msg, "Bad GRPC frame type 0x%02x", p->frame_type); - p->error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg); - p->error = grpc_error_set_int(p->error, GRPC_ERROR_INT_STREAM_ID, - (intptr_t)s->id); - gpr_free(msg); - msg = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); - p->error = grpc_error_set_str(p->error, GRPC_ERROR_STR_RAW_BYTES, - grpc_slice_from_copied_string(msg)); - gpr_free(msg); - p->error = - grpc_error_set_int(p->error, GRPC_ERROR_INT_OFFSET, cur - beg); - p->state = GRPC_CHTTP2_DATA_ERROR; - return GRPC_ERROR_REF(p->error); - } - if (++cur == end) { - p->state = GRPC_CHTTP2_DATA_FH_1; - return GRPC_ERROR_NONE; - } - /* fallthrough */ - case GRPC_CHTTP2_DATA_FH_1: - s->stats.incoming.framing_bytes++; - p->frame_size = ((uint32_t)*cur) << 24; - if (++cur == end) { - p->state = GRPC_CHTTP2_DATA_FH_2; - return GRPC_ERROR_NONE; - } - /* fallthrough */ - case GRPC_CHTTP2_DATA_FH_2: - s->stats.incoming.framing_bytes++; - p->frame_size |= ((uint32_t)*cur) << 16; - if (++cur == end) { - p->state = GRPC_CHTTP2_DATA_FH_3; - return GRPC_ERROR_NONE; - } - /* fallthrough */ - case GRPC_CHTTP2_DATA_FH_3: - s->stats.incoming.framing_bytes++; - p->frame_size |= ((uint32_t)*cur) << 8; - if (++cur == end) { - p->state = GRPC_CHTTP2_DATA_FH_4; - return GRPC_ERROR_NONE; - } - /* fallthrough */ - case GRPC_CHTTP2_DATA_FH_4: - s->stats.incoming.framing_bytes++; - p->frame_size |= ((uint32_t)*cur); - p->state = GRPC_CHTTP2_DATA_FRAME; - ++cur; - message_flags = 0; - if (p->is_frame_compressed) { - message_flags |= GRPC_WRITE_INTERNAL_COMPRESS; - } - p->parsing_frame = incoming_byte_stream = - grpc_chttp2_incoming_byte_stream_create(exec_ctx, t, s, p->frame_size, - message_flags); - /* fallthrough */ - case GRPC_CHTTP2_DATA_FRAME: - if (cur == end) { - return GRPC_ERROR_NONE; - } - uint32_t remaining = (uint32_t)(end - cur); - if (remaining == p->frame_size) { - s->stats.incoming.data_bytes += p->frame_size; - grpc_chttp2_incoming_byte_stream_push( - exec_ctx, p->parsing_frame, - grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); - grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, - GRPC_ERROR_NONE); - p->parsing_frame = NULL; - p->state = GRPC_CHTTP2_DATA_FH_0; - return GRPC_ERROR_NONE; - } else if (remaining > p->frame_size) { - s->stats.incoming.data_bytes += p->frame_size; - grpc_chttp2_incoming_byte_stream_push( - exec_ctx, p->parsing_frame, - grpc_slice_sub(slice, (size_t)(cur - beg), - (size_t)(cur + p->frame_size - beg))); - grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame, - GRPC_ERROR_NONE); - p->parsing_frame = NULL; - cur += p->frame_size; - goto fh_0; /* loop */ - } else { - GPR_ASSERT(remaining <= p->frame_size); - grpc_chttp2_incoming_byte_stream_push( - exec_ctx, p->parsing_frame, - grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); - p->frame_size -= remaining; - s->stats.incoming.data_bytes += remaining; + grpc_slice slice = grpc_slice_buffer_take_first(slices); + + beg = GRPC_SLICE_START_PTR(slice); + end = GRPC_SLICE_END_PTR(slice); + cur = beg; + uint32_t message_flags; + char *msg; + + if (cur == end) { + grpc_slice_unref_internal(exec_ctx, slice); + continue; + } + + switch (p->state) { + case GRPC_CHTTP2_DATA_ERROR: + p->state = GRPC_CHTTP2_DATA_ERROR; + grpc_slice_unref_internal(exec_ctx, slice); + return GRPC_ERROR_REF(p->error); + case GRPC_CHTTP2_DATA_FH_0: + p->frame_type = *cur; + switch (p->frame_type) { + case 0: + p->is_frame_compressed = false; /* GPR_FALSE */ + break; + case 1: + p->is_frame_compressed = true; /* GPR_TRUE */ + break; + default: + gpr_asprintf(&msg, "Bad GRPC frame type 0x%02x", p->frame_type); + p->error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg); + p->error = grpc_error_set_int(p->error, GRPC_ERROR_INT_STREAM_ID, + (intptr_t)s->id); + gpr_free(msg); + msg = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); + p->error = grpc_error_set_str(p->error, GRPC_ERROR_STR_RAW_BYTES, + grpc_slice_from_copied_string(msg)); + gpr_free(msg); + p->error = + grpc_error_set_int(p->error, GRPC_ERROR_INT_OFFSET, cur - beg); + p->state = GRPC_CHTTP2_DATA_ERROR; + grpc_slice_unref_internal(exec_ctx, slice); + return GRPC_ERROR_REF(p->error); + } + if (++cur == end) { + p->state = GRPC_CHTTP2_DATA_FH_1; + grpc_slice_unref_internal(exec_ctx, slice); + continue; + } + /* fallthrough */ + case GRPC_CHTTP2_DATA_FH_1: + p->frame_size = ((uint32_t)*cur) << 24; + if (++cur == end) { + p->state = GRPC_CHTTP2_DATA_FH_2; + grpc_slice_unref_internal(exec_ctx, slice); + continue; + } + /* fallthrough */ + case GRPC_CHTTP2_DATA_FH_2: + p->frame_size |= ((uint32_t)*cur) << 16; + if (++cur == end) { + p->state = GRPC_CHTTP2_DATA_FH_3; + grpc_slice_unref_internal(exec_ctx, slice); + continue; + } + /* fallthrough */ + case GRPC_CHTTP2_DATA_FH_3: + p->frame_size |= ((uint32_t)*cur) << 8; + if (++cur == end) { + p->state = GRPC_CHTTP2_DATA_FH_4; + grpc_slice_unref_internal(exec_ctx, slice); + continue; + } + /* fallthrough */ + case GRPC_CHTTP2_DATA_FH_4: + GPR_ASSERT(stream_out != NULL); + GPR_ASSERT(p->parsing_frame == NULL); + p->frame_size |= ((uint32_t)*cur); + p->state = GRPC_CHTTP2_DATA_FRAME; + ++cur; + message_flags = 0; + if (p->is_frame_compressed) { + message_flags |= GRPC_WRITE_INTERNAL_COMPRESS; + } + p->parsing_frame = grpc_chttp2_incoming_byte_stream_create( + exec_ctx, t, s, p->frame_size, message_flags); + *stream_out = &p->parsing_frame->base; + if (p->parsing_frame->remaining_bytes == 0) { + GRPC_ERROR_UNREF(grpc_chttp2_incoming_byte_stream_finished( + exec_ctx, p->parsing_frame, GRPC_ERROR_NONE, true)); + p->parsing_frame = NULL; + p->state = GRPC_CHTTP2_DATA_FH_0; + } + s->pending_byte_stream = true; + + if (cur != end) { + grpc_slice_buffer_undo_take_first( + &s->unprocessed_incoming_frames_buffer, + grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + } + grpc_slice_unref_internal(exec_ctx, slice); return GRPC_ERROR_NONE; + case GRPC_CHTTP2_DATA_FRAME: { + GPR_ASSERT(p->parsing_frame != NULL); + GPR_ASSERT(slice_out != NULL); + if (cur == end) { + grpc_slice_unref_internal(exec_ctx, slice); + continue; + } + uint32_t remaining = (uint32_t)(end - cur); + if (remaining == p->frame_size) { + if (GRPC_ERROR_NONE != (error = grpc_chttp2_incoming_byte_stream_push( + exec_ctx, p->parsing_frame, + grpc_slice_sub(slice, (size_t)(cur - beg), + (size_t)(end - beg)), + slice_out))) { + grpc_slice_unref_internal(exec_ctx, slice); + return error; + } + if (GRPC_ERROR_NONE != + (error = grpc_chttp2_incoming_byte_stream_finished( + exec_ctx, p->parsing_frame, GRPC_ERROR_NONE, true))) { + grpc_slice_unref_internal(exec_ctx, slice); + return error; + } + p->parsing_frame = NULL; + p->state = GRPC_CHTTP2_DATA_FH_0; + grpc_slice_unref_internal(exec_ctx, slice); + return GRPC_ERROR_NONE; + } else if (remaining < p->frame_size) { + if (GRPC_ERROR_NONE != (error = grpc_chttp2_incoming_byte_stream_push( + exec_ctx, p->parsing_frame, + grpc_slice_sub(slice, (size_t)(cur - beg), + (size_t)(end - beg)), + slice_out))) { + return error; + } + p->frame_size -= remaining; + grpc_slice_unref_internal(exec_ctx, slice); + return GRPC_ERROR_NONE; + } else { + GPR_ASSERT(remaining > p->frame_size); + if (GRPC_ERROR_NONE != + (grpc_chttp2_incoming_byte_stream_push( + exec_ctx, p->parsing_frame, + grpc_slice_sub(slice, (size_t)(cur - beg), + (size_t)(cur + p->frame_size - beg)), + slice_out))) { + grpc_slice_unref_internal(exec_ctx, slice); + return error; + } + if (GRPC_ERROR_NONE != + (error = grpc_chttp2_incoming_byte_stream_finished( + exec_ctx, p->parsing_frame, GRPC_ERROR_NONE, true))) { + grpc_slice_unref_internal(exec_ctx, slice); + return error; + } + p->parsing_frame = NULL; + p->state = GRPC_CHTTP2_DATA_FH_0; + cur += p->frame_size; + grpc_slice_buffer_undo_take_first( + &s->unprocessed_incoming_frames_buffer, + grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); + grpc_slice_unref_internal(exec_ctx, slice); + return GRPC_ERROR_NONE; + } } + } } - GPR_UNREACHABLE_CODE( - return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Should never reach here")); + return GRPC_ERROR_NONE; } grpc_error *grpc_chttp2_data_parser_parse(grpc_exec_ctx *exec_ctx, void *parser, grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_slice slice, int is_last) { - grpc_chttp2_data_parser *p = parser; - grpc_error *error = parse_inner(exec_ctx, p, t, s, slice); + /* grpc_error *error = parse_inner_buffer(exec_ctx, p, t, s, slice); */ + s->stats.incoming.framing_bytes += GRPC_SLICE_LENGTH(slice); + if (!s->pending_byte_stream) { + grpc_slice_ref_internal(slice); + grpc_slice_buffer_add(&s->frame_storage, slice); + grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); + } else if (s->on_next) { + GPR_ASSERT(s->frame_storage.length == 0); + grpc_slice_ref_internal(slice); + grpc_slice_buffer_add(&s->unprocessed_incoming_frames_buffer, slice); + grpc_closure_sched(exec_ctx, s->on_next, GRPC_ERROR_NONE); + s->on_next = NULL; + } else { + grpc_slice_ref_internal(slice); + grpc_slice_buffer_add(&s->frame_storage, slice); + } - if (is_last && p->is_last_frame) { + if (is_last && s->received_last_frame) { grpc_chttp2_mark_stream_closed(exec_ctx, t, s, true, false, GRPC_ERROR_NONE); } - return error; + return GRPC_ERROR_NONE; } diff --git a/src/core/ext/transport/chttp2/transport/frame_data.h b/src/core/ext/transport/chttp2/transport/frame_data.h index 264ad146085..2fb8983c38e 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.h +++ b/src/core/ext/transport/chttp2/transport/frame_data.h @@ -56,28 +56,16 @@ typedef enum { typedef struct grpc_chttp2_incoming_byte_stream grpc_chttp2_incoming_byte_stream; -typedef struct grpc_chttp2_incoming_frame_queue { - grpc_chttp2_incoming_byte_stream *head; - grpc_chttp2_incoming_byte_stream *tail; -} grpc_chttp2_incoming_frame_queue; - typedef struct { grpc_chttp2_stream_state state; - uint8_t is_last_frame; uint8_t frame_type; uint32_t frame_size; grpc_error *error; - int is_frame_compressed; + bool is_frame_compressed; grpc_chttp2_incoming_byte_stream *parsing_frame; } grpc_chttp2_data_parser; -void grpc_chttp2_incoming_frame_queue_merge( - grpc_chttp2_incoming_frame_queue *head_dst, - grpc_chttp2_incoming_frame_queue *tail_src); -grpc_byte_stream *grpc_chttp2_incoming_frame_queue_pop( - grpc_chttp2_incoming_frame_queue *q); - /* initialize per-stream state for data frame parsing */ grpc_error *grpc_chttp2_data_parser_init(grpc_chttp2_data_parser *parser); @@ -87,7 +75,8 @@ void grpc_chttp2_data_parser_destroy(grpc_exec_ctx *exec_ctx, /* start processing a new data frame */ grpc_error *grpc_chttp2_data_parser_begin_frame(grpc_chttp2_data_parser *parser, uint8_t flags, - uint32_t stream_id); + uint32_t stream_id, + grpc_chttp2_stream *s); /* handle a slice of a data frame - is_last indicates the last slice of a frame */ @@ -101,4 +90,11 @@ void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer *inbuf, grpc_transport_one_way_stats *stats, grpc_slice_buffer *outbuf); +grpc_error *deframe_unprocessed_incoming_frames(grpc_exec_ctx *exec_ctx, + grpc_chttp2_data_parser *p, + grpc_chttp2_stream *s, + grpc_slice_buffer *slices, + grpc_slice *slice_out, + grpc_byte_stream **stream_out); + #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_DATA_H */ diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index 6eb848b8d77..a10e3886ea1 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -195,22 +195,20 @@ typedef struct grpc_chttp2_write_cb { struct grpc_chttp2_incoming_byte_stream { grpc_byte_stream base; gpr_refcount refs; - struct grpc_chttp2_incoming_byte_stream *next_message; - grpc_error *error; - grpc_chttp2_transport *transport; - grpc_chttp2_stream *stream; - bool is_tail; + grpc_chttp2_transport *transport; /* immutable */ + grpc_chttp2_stream *stream; /* immutable */ - gpr_mu slice_mu; // protects slices, on_next - grpc_slice_buffer slices; - grpc_closure *on_next; - grpc_slice *next; + /* Accessed only by transport thread when stream->pending_byte_stream == false + * Accessed only by application thread when stream->pending_byte_stream == + * true */ uint32_t remaining_bytes; + /* Accessed only by transport thread when stream->pending_byte_stream == false + * Accessed only by application thread when stream->pending_byte_stream == + * true */ struct { grpc_closure closure; - grpc_slice *slice; size_t max_size_hint; grpc_closure *on_complete; } next_action; @@ -445,8 +443,8 @@ struct grpc_chttp2_stream { uint32_t id; /** window available for us to send to peer, over or under the initial window - * size of the transport... ie: - * outgoing_window = outgoing_window_delta + transport.initial_window_size */ + * size of the transport... ie: + * outgoing_window = outgoing_window_delta + transport.initial_window_size */ int64_t outgoing_window_delta; /** things the upper layers would like to send */ grpc_metadata_batch *send_initial_metadata; @@ -473,9 +471,6 @@ struct grpc_chttp2_stream { grpc_transport_stream_stats *collecting_stats; grpc_transport_stream_stats stats; - /** number of streams that are currently being read */ - gpr_refcount active_streams; - /** Is this stream closed for writing. */ bool write_closed; /** Is this stream reading half-closed. */ @@ -499,7 +494,17 @@ struct grpc_chttp2_stream { grpc_chttp2_incoming_metadata_buffer metadata_buffer[2]; - grpc_chttp2_incoming_frame_queue incoming_frames; + grpc_slice_buffer frame_storage; /* protected by t combiner */ + + /* Accessed only by transport thread when stream->pending_byte_stream == false + * Accessed only by application thread when stream->pending_byte_stream == + * true */ + grpc_slice_buffer unprocessed_incoming_frames_buffer; + grpc_closure *on_next; /* protected by t combiner */ + bool pending_byte_stream; /* protected by t combiner */ + grpc_closure reset_byte_stream; + grpc_error *byte_stream_error; /* protected by t combiner */ + bool received_last_frame; /* protected by t combiner */ gpr_timespec deadline; @@ -512,6 +517,9 @@ struct grpc_chttp2_stream { * incoming_window = incoming_window_delta + transport.initial_window_size */ int64_t incoming_window_delta; /** parsing state for data frames */ + /* Accessed only by transport thread when stream->pending_byte_stream == false + * Accessed only by application thread when stream->pending_byte_stream == + * true */ grpc_chttp2_data_parser data_parser; /** number of bytes received - reset at end of parse thread execution */ int64_t received_bytes; @@ -790,10 +798,13 @@ void grpc_chttp2_ref_transport(grpc_chttp2_transport *t); grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create( grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s, uint32_t frame_size, uint32_t flags); -void grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx, - grpc_chttp2_incoming_byte_stream *bs, - grpc_slice slice); -void grpc_chttp2_incoming_byte_stream_finished( +grpc_error *grpc_chttp2_incoming_byte_stream_push( + grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, + grpc_slice slice, grpc_slice *slice_out); +grpc_error *grpc_chttp2_incoming_byte_stream_finished( + grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, + grpc_error *error, bool reset_on_error); +void grpc_chttp2_incoming_byte_stream_notify( grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs, grpc_error *error); diff --git a/src/core/ext/transport/chttp2/transport/parsing.c b/src/core/ext/transport/chttp2/transport/parsing.c index 7e457ced270..638b137316f 100644 --- a/src/core/ext/transport/chttp2/transport/parsing.c +++ b/src/core/ext/transport/chttp2/transport/parsing.c @@ -458,12 +458,13 @@ static grpc_error *init_data_frame_parser(grpc_exec_ctx *exec_ctx, return init_skip_frame_parser(exec_ctx, t, 0); } if (err == GRPC_ERROR_NONE) { - err = grpc_chttp2_data_parser_begin_frame(&s->data_parser, - t->incoming_frame_flags, s->id); + err = grpc_chttp2_data_parser_begin_frame( + &s->data_parser, t->incoming_frame_flags, s->id, s); } error_handler: if (err == GRPC_ERROR_NONE) { t->incoming_stream = s; + /* t->parser = grpc_chttp2_data_parser_parse;*/ t->parser = grpc_chttp2_data_parser_parse; t->parser_data = &s->data_parser; return GRPC_ERROR_NONE; diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c index 88335ecd0be..7896c70f9eb 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.c +++ b/src/core/ext/transport/cronet/transport/cronet_transport.c @@ -973,9 +973,20 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, grpc_slice_buffer write_slice_buffer; grpc_slice slice; grpc_slice_buffer_init(&write_slice_buffer); - grpc_byte_stream_next( - NULL, stream_op->payload->send_message.send_message, &slice, - stream_op->payload->send_message.send_message->length, NULL); + if (1 != grpc_byte_stream_next( + exec_ctx, stream_op->payload->send_message.send_message, + stream_op->payload->send_message.send_message->length, + NULL)) { + /* Should never reach here */ + GPR_ASSERT(false); + } + if (GRPC_ERROR_NONE != + grpc_byte_stream_pull(exec_ctx, + stream_op->payload->send_message.send_message, + &slice)) { + /* Should never reach here */ + GPR_ASSERT(false); + } grpc_slice_buffer_add(&write_slice_buffer, slice); if (write_slice_buffer.count != 1) { /* Empty request not handled yet */ diff --git a/src/core/lib/channel/compress_filter.c b/src/core/lib/channel/compress_filter.c index 4625cba0d25..764524b24d1 100644 --- a/src/core/lib/channel/compress_filter.c +++ b/src/core/lib/channel/compress_filter.c @@ -221,6 +221,13 @@ static void finish_send_message(grpc_exec_ctx *exec_ctx, static void got_slice(grpc_exec_ctx *exec_ctx, void *elemp, grpc_error *error) { grpc_call_element *elem = elemp; call_data *calld = elem->call_data; + if (GRPC_ERROR_NONE != + grpc_byte_stream_pull(exec_ctx, + calld->send_op->payload->send_message.send_message, + &calld->incoming_slice)) { + /* Should never reach here */ + abort(); + } grpc_slice_buffer_add(&calld->slices, calld->incoming_slice); if (calld->send_length == calld->slices.length) { finish_send_message(exec_ctx, elem); @@ -233,8 +240,11 @@ static void continue_send_message(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) { call_data *calld = elem->call_data; while (grpc_byte_stream_next( - exec_ctx, calld->send_op->payload->send_message.send_message, - &calld->incoming_slice, ~(size_t)0, &calld->got_slice)) { + exec_ctx, calld->send_op->payload->send_message.send_message, ~(size_t)0, + &calld->got_slice)) { + grpc_byte_stream_pull(exec_ctx, + calld->send_op->payload->send_message.send_message, + &calld->incoming_slice); grpc_slice_buffer_add(&calld->slices, calld->incoming_slice); if (calld->send_length == calld->slices.length) { finish_send_message(exec_ctx, elem); diff --git a/src/core/lib/channel/http_client_filter.c b/src/core/lib/channel/http_client_filter.c index 4e47c5c658f..151fb9885de 100644 --- a/src/core/lib/channel/http_client_filter.c +++ b/src/core/lib/channel/http_client_filter.c @@ -220,8 +220,11 @@ static void continue_send_message(grpc_exec_ctx *exec_ctx, call_data *calld = elem->call_data; uint8_t *wrptr = calld->payload_bytes; while (grpc_byte_stream_next( - exec_ctx, calld->send_op->payload->send_message.send_message, - &calld->incoming_slice, ~(size_t)0, &calld->got_slice)) { + exec_ctx, calld->send_op->payload->send_message.send_message, ~(size_t)0, + &calld->got_slice)) { + grpc_byte_stream_pull(exec_ctx, + calld->send_op->payload->send_message.send_message, + &calld->incoming_slice); memcpy(wrptr, GRPC_SLICE_START_PTR(calld->incoming_slice), GRPC_SLICE_LENGTH(calld->incoming_slice)); wrptr += GRPC_SLICE_LENGTH(calld->incoming_slice); @@ -237,6 +240,13 @@ static void got_slice(grpc_exec_ctx *exec_ctx, void *elemp, grpc_error *error) { grpc_call_element *elem = elemp; call_data *calld = elem->call_data; calld->send_message_blocked = false; + if (GRPC_ERROR_NONE != + grpc_byte_stream_pull(exec_ctx, + calld->send_op->payload->send_message.send_message, + &calld->incoming_slice)) { + /* Should never reach here */ + abort(); + } grpc_slice_buffer_add(&calld->slices, calld->incoming_slice); if (calld->send_length == calld->slices.length) { /* Pass down the original send_message op that was blocked.*/ diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 97d50a91be5..3e96d097985 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -1187,6 +1187,7 @@ static void finish_batch_step(grpc_exec_ctx *exec_ctx, batch_control *bctl) { static void continue_receiving_slices(grpc_exec_ctx *exec_ctx, batch_control *bctl) { + grpc_error *error; grpc_call *call = bctl->call; for (;;) { size_t remaining = call->receiving_stream->length - @@ -1198,11 +1199,22 @@ static void continue_receiving_slices(grpc_exec_ctx *exec_ctx, finish_batch_step(exec_ctx, bctl); return; } - if (grpc_byte_stream_next(exec_ctx, call->receiving_stream, - &call->receiving_slice, remaining, + if (grpc_byte_stream_next(exec_ctx, call->receiving_stream, remaining, &call->receiving_slice_ready)) { - grpc_slice_buffer_add(&(*call->receiving_buffer)->data.raw.slice_buffer, - call->receiving_slice); + error = grpc_byte_stream_pull(exec_ctx, call->receiving_stream, + &call->receiving_slice); + if (error == GRPC_ERROR_NONE) { + grpc_slice_buffer_add(&(*call->receiving_buffer)->data.raw.slice_buffer, + call->receiving_slice); + } else { + grpc_byte_stream_destroy(exec_ctx, call->receiving_stream); + call->receiving_stream = NULL; + grpc_byte_buffer_destroy(*call->receiving_buffer); + *call->receiving_buffer = NULL; + call->receiving_message = 0; + finish_batch_step(exec_ctx, bctl); + return; + } } else { return; } @@ -1213,12 +1225,24 @@ static void receiving_slice_ready(grpc_exec_ctx *exec_ctx, void *bctlp, grpc_error *error) { batch_control *bctl = bctlp; grpc_call *call = bctl->call; + grpc_byte_stream *bs = call->receiving_stream; + bool release_error = false; if (error == GRPC_ERROR_NONE) { - grpc_slice_buffer_add(&(*call->receiving_buffer)->data.raw.slice_buffer, - call->receiving_slice); - continue_receiving_slices(exec_ctx, bctl); - } else { + grpc_slice slice; + error = grpc_byte_stream_pull(exec_ctx, bs, &slice); + if (error == GRPC_ERROR_NONE) { + grpc_slice_buffer_add(&(*call->receiving_buffer)->data.raw.slice_buffer, + slice); + continue_receiving_slices(exec_ctx, bctl); + } else { + /* Error returned by grpc_byte_stream_pull needs to be released manually + */ + release_error = true; + } + } + + if (error != GRPC_ERROR_NONE) { if (grpc_trace_operation_failures) { GRPC_LOG_IF_ERROR("receiving_slice_ready", GRPC_ERROR_REF(error)); } @@ -1226,7 +1250,11 @@ static void receiving_slice_ready(grpc_exec_ctx *exec_ctx, void *bctlp, call->receiving_stream = NULL; grpc_byte_buffer_destroy(*call->receiving_buffer); *call->receiving_buffer = NULL; + call->receiving_message = 0; finish_batch_step(exec_ctx, bctl); + if (release_error) { + GRPC_ERROR_UNREF(error); + } } } diff --git a/src/core/lib/transport/byte_stream.c b/src/core/lib/transport/byte_stream.c index 4d4206189e7..5800c70ef44 100644 --- a/src/core/lib/transport/byte_stream.c +++ b/src/core/lib/transport/byte_stream.c @@ -40,10 +40,15 @@ #include "src/core/lib/slice/slice_internal.h" int grpc_byte_stream_next(grpc_exec_ctx *exec_ctx, - grpc_byte_stream *byte_stream, grpc_slice *slice, - size_t max_size_hint, grpc_closure *on_complete) { - return byte_stream->next(exec_ctx, byte_stream, slice, max_size_hint, - on_complete); + grpc_byte_stream *byte_stream, size_t max_size_hint, + grpc_closure *on_complete) { + return byte_stream->next(exec_ctx, byte_stream, max_size_hint, on_complete); +} + +grpc_error *grpc_byte_stream_pull(grpc_exec_ctx *exec_ctx, + grpc_byte_stream *byte_stream, + grpc_slice *slice) { + return byte_stream->pull(exec_ctx, byte_stream, slice); } void grpc_byte_stream_destroy(grpc_exec_ctx *exec_ctx, @@ -53,16 +58,24 @@ void grpc_byte_stream_destroy(grpc_exec_ctx *exec_ctx, /* slice_buffer_stream */ -static int slice_buffer_stream_next(grpc_exec_ctx *exec_ctx, - grpc_byte_stream *byte_stream, - grpc_slice *slice, size_t max_size_hint, - grpc_closure *on_complete) { +static bool slice_buffer_stream_next(grpc_exec_ctx *exec_ctx, + grpc_byte_stream *byte_stream, + size_t max_size_hint, + grpc_closure *on_complete) { + grpc_slice_buffer_stream *stream = (grpc_slice_buffer_stream *)byte_stream; + GPR_ASSERT(stream->cursor < stream->backing_buffer->count); + return true; +} + +static grpc_error *slice_buffer_stream_pull(grpc_exec_ctx *exec_ctx, + grpc_byte_stream *byte_stream, + grpc_slice *slice) { grpc_slice_buffer_stream *stream = (grpc_slice_buffer_stream *)byte_stream; GPR_ASSERT(stream->cursor < stream->backing_buffer->count); *slice = grpc_slice_ref_internal(stream->backing_buffer->slices[stream->cursor]); stream->cursor++; - return 1; + return GRPC_ERROR_NONE; } static void slice_buffer_stream_destroy(grpc_exec_ctx *exec_ctx, @@ -75,6 +88,7 @@ void grpc_slice_buffer_stream_init(grpc_slice_buffer_stream *stream, stream->base.length = (uint32_t)slice_buffer->length; stream->base.flags = flags; stream->base.next = slice_buffer_stream_next; + stream->base.pull = slice_buffer_stream_pull; stream->base.destroy = slice_buffer_stream_destroy; stream->backing_buffer = slice_buffer; stream->cursor = 0; diff --git a/src/core/lib/transport/byte_stream.h b/src/core/lib/transport/byte_stream.h index 1fdd5b4d775..381c65fb044 100644 --- a/src/core/lib/transport/byte_stream.h +++ b/src/core/lib/transport/byte_stream.h @@ -49,9 +49,10 @@ typedef struct grpc_byte_stream grpc_byte_stream; struct grpc_byte_stream { uint32_t length; uint32_t flags; - int (*next)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, - grpc_slice *slice, size_t max_size_hint, - grpc_closure *on_complete); + bool (*next)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, + size_t max_size_hint, grpc_closure *on_complete); + grpc_error *(*pull)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, + grpc_slice *slice); void (*destroy)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream); }; @@ -61,12 +62,20 @@ struct grpc_byte_stream { * * max_size_hint can be set as a hint as to the maximum number * of bytes that would be acceptable to read. + */ +int grpc_byte_stream_next(grpc_exec_ctx *exec_ctx, + grpc_byte_stream *byte_stream, size_t max_size_hint, + grpc_closure *on_complete); + +/* returns the next slice in the byte stream when it is ready (indicated by + * either grpc_byte_stream_next returning 1 or on_complete passed to + * grpc_byte_stream_next is called). * * once a slice is returned into *slice, it is owned by the caller. */ -int grpc_byte_stream_next(grpc_exec_ctx *exec_ctx, - grpc_byte_stream *byte_stream, grpc_slice *slice, - size_t max_size_hint, grpc_closure *on_complete); +grpc_error *grpc_byte_stream_pull(grpc_exec_ctx *exec_ctx, + grpc_byte_stream *byte_stream, + grpc_slice *slice); void grpc_byte_stream_destroy(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream); diff --git a/test/cpp/microbenchmarks/bm_chttp2_transport.cc b/test/cpp/microbenchmarks/bm_chttp2_transport.cc index c89f349ca7f..8c5413b5fda 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_transport.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_transport.cc @@ -569,12 +569,17 @@ static void BM_TransportStreamRecv(benchmark::State &state) { grpc_closure_sched(exec_ctx, c.get(), GRPC_ERROR_NONE); return; } - } while (grpc_byte_stream_next(exec_ctx, recv_stream, &recv_slice, + } while (grpc_byte_stream_next(exec_ctx, recv_stream, recv_stream->length - received, - drain_continue.get())); + drain_continue.get()) && + GRPC_ERROR_NONE == + grpc_byte_stream_pull(exec_ctx, recv_stream, &recv_slice) && + (received += GRPC_SLICE_LENGTH(recv_slice), + grpc_slice_unref_internal(exec_ctx, recv_slice), true)); }); drain_continue = MakeClosure([&](grpc_exec_ctx *exec_ctx, grpc_error *error) { + grpc_byte_stream_pull(exec_ctx, recv_stream, &recv_slice); received += GRPC_SLICE_LENGTH(recv_slice); grpc_slice_unref_internal(exec_ctx, recv_slice); grpc_closure_run(exec_ctx, drain.get(), GRPC_ERROR_NONE); From f03607658a00f63e16363433466b6675efb4ca46 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 12 Apr 2017 20:37:40 -0700 Subject: [PATCH 363/461] Fix flow control problem --- .../ext/transport/chttp2/transport/chttp2_transport.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 29ed4bf90e5..16cf40c2c96 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1441,12 +1441,19 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op, } if (op->recv_message) { + size_t already_received; GPR_ASSERT(s->recv_message_ready == NULL); + GPR_ASSERT(!s->pending_byte_stream); s->recv_message_ready = op_payload->recv_message.recv_message_ready; s->recv_message = op_payload->recv_message.recv_message; - if (s->id != 0 && s->frame_storage.length == 0) { - incoming_byte_stream_update_flow_control(exec_ctx, t, s, 5, 0); + if (s->pending_byte_stream) { + already_received = s->frame_storage.length; + } else { + already_received = s->frame_storage.length + + s->unprocessed_incoming_frames_buffer.length; } + incoming_byte_stream_update_flow_control(exec_ctx, t, s, 5, + already_received); grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); } From 840a1352150b5e52068dbfc2e02f43d91ecb9c1c Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Thu, 13 Apr 2017 03:12:52 -0700 Subject: [PATCH 364/461] Add shutdown_cq as a server cq so that progress can be made when calling cq_pluck on f->shutdown_cq --- .../tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m | 1 + 1 file changed, 1 insertion(+) diff --git a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m index 3dd264718cb..d9aec7ae68b 100644 --- a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m +++ b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m @@ -111,6 +111,7 @@ static void chttp2_init_server_secure_fullstack( } f->server = grpc_server_create(server_args, NULL); grpc_server_register_completion_queue(f->server, f->cq, NULL); + grpc_server_register_completion_queue(f->server, f->shutdown_cq, NULL); GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr, server_creds)); grpc_server_credentials_release(server_creds); From c1b86a1c33e03ce2965a1548616a09c546d07113 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 13 Apr 2017 06:51:13 -0700 Subject: [PATCH 365/461] Fix duplicated dep --- BUILD | 2 -- 1 file changed, 2 deletions(-) diff --git a/BUILD b/BUILD index a48d4073f35..16c96c8ca20 100644 --- a/BUILD +++ b/BUILD @@ -76,7 +76,6 @@ grpc_cc_library( "grpc_transport_chttp2_client_secure", "grpc_transport_chttp2_server_insecure", "grpc_transport_chttp2_server_secure", - "grpc_max_age_filter", "grpc_message_size_filter", "grpc_deadline_filter", ], @@ -118,7 +117,6 @@ grpc_cc_library( "grpc_resolver_sockaddr", "grpc_transport_chttp2_client_insecure", "grpc_transport_chttp2_server_insecure", - "grpc_max_age_filter", "grpc_message_size_filter", "grpc_deadline_filter", ], From 694cd708313945c31e4b2c1b518d3cff80f8b031 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 13 Apr 2017 07:11:34 -0700 Subject: [PATCH 366/461] Fix new tests --- test/core/end2end/tests/filter_call_init_fails.c | 6 +++--- test/core/end2end/tests/max_connection_idle.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/core/end2end/tests/filter_call_init_fails.c b/test/core/end2end/tests/filter_call_init_fails.c index 7dcc23157af..c06ad965e74 100644 --- a/test/core/end2end/tests/filter_call_init_fails.c +++ b/test/core/end2end/tests/filter_call_init_fails.c @@ -282,7 +282,7 @@ static void test_client_channel_filter(grpc_end2end_test_config config) { grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); + grpc_call_unref(c); cq_verifier_destroy(cqv); @@ -370,7 +370,7 @@ static void test_client_subchannel_filter(grpc_end2end_test_config config) { // Reset and create a new call. (The first call uses a different code // path in client_channel.c than subsequent calls on the same channel, // and we need to test both.) - grpc_call_destroy(c); + grpc_call_unref(c); status = GRPC_STATUS_OK; grpc_slice_unref(details); details = grpc_empty_slice(); @@ -397,7 +397,7 @@ static void test_client_subchannel_filter(grpc_end2end_test_config config) { grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); + grpc_call_unref(c); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/max_connection_idle.c b/test/core/end2end/tests/max_connection_idle.c index 98bc08c6d5a..1375deee7de 100644 --- a/test/core/end2end/tests/max_connection_idle.c +++ b/test/core/end2end/tests/max_connection_idle.c @@ -175,8 +175,8 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_details_destroy(&call_details); - grpc_call_destroy(c); - grpc_call_destroy(s); + grpc_call_unref(c); + grpc_call_unref(s); cq_verifier_destroy(cqv); } From 17a93b33e07636c8fb012ee1375498a10b956e31 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Thu, 13 Apr 2017 07:14:47 -0700 Subject: [PATCH 367/461] Fix test. --- test/core/end2end/tests/max_message_length.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/core/end2end/tests/max_message_length.c b/test/core/end2end/tests/max_message_length.c index ab58d9f9a62..a8b6f1f79a9 100644 --- a/test/core/end2end/tests/max_message_length.c +++ b/test/core/end2end/tests/max_message_length.c @@ -272,7 +272,7 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config, GPR_ASSERT(was_cancelled == 1); done: - GPR_ASSERT(status == GRPC_STATUS_INVALID_ARGUMENT); + GPR_ASSERT(status == GRPC_STATUS_RESOURCE_EXHAUSTED); GPR_ASSERT( grpc_slice_str_cmp( details, send_limit @@ -466,7 +466,7 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config, GPR_ASSERT(0 == grpc_slice_str_cmp(call_details.host, "foo.test.google.fr:1234")); - GPR_ASSERT(status == GRPC_STATUS_INVALID_ARGUMENT); + GPR_ASSERT(status == GRPC_STATUS_RESOURCE_EXHAUSTED); GPR_ASSERT( grpc_slice_str_cmp( details, send_limit From 0362d6b374e4b10e324e09e750b88d6c6bc834d1 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 13 Apr 2017 07:59:08 -0700 Subject: [PATCH 368/461] ubsan fixes --- src/core/ext/census/context.c | 2 +- src/core/ext/census/resource.c | 4 +++- src/core/lib/channel/http_client_filter.c | 6 ++++-- test/core/end2end/fuzzers/api_fuzzer.c | 2 +- test/core/support/spinlock_test.c | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/core/ext/census/context.c b/src/core/ext/census/context.c index 0dfc4ecbf1d..4195cb1c9b3 100644 --- a/src/core/ext/census/context.c +++ b/src/core/ext/census/context.c @@ -200,7 +200,7 @@ static bool tag_set_add_tag(struct tag_set *tags, const census_tag *tag, // allocate new memory if needed tags->kvm_size += 2 * CENSUS_MAX_TAG_KV_LEN + TAG_HEADER_SIZE; char *new_kvm = gpr_malloc(tags->kvm_size); - memcpy(new_kvm, tags->kvm, tags->kvm_used); + if (tags->kvm_used > 0) memcpy(new_kvm, tags->kvm, tags->kvm_used); gpr_free(tags->kvm); tags->kvm = new_kvm; } diff --git a/src/core/ext/census/resource.c b/src/core/ext/census/resource.c index ed44f004f91..26ea1a86720 100644 --- a/src/core/ext/census/resource.c +++ b/src/core/ext/census/resource.c @@ -223,7 +223,9 @@ size_t allocate_resource(void) { if (n_resources == n_defined_resources) { size_t new_n_resources = n_resources ? n_resources * 2 : 2; resource **new_resources = gpr_malloc(new_n_resources * sizeof(resource *)); - memcpy(new_resources, resources, n_resources * sizeof(resource *)); + if (n_resources != 0) { + memcpy(new_resources, resources, n_resources * sizeof(resource *)); + } memset(new_resources + n_resources, 0, (new_n_resources - n_resources) * sizeof(resource *)); gpr_free(resources); diff --git a/src/core/lib/channel/http_client_filter.c b/src/core/lib/channel/http_client_filter.c index 4e47c5c658f..255f5388aa8 100644 --- a/src/core/lib/channel/http_client_filter.c +++ b/src/core/lib/channel/http_client_filter.c @@ -222,8 +222,10 @@ static void continue_send_message(grpc_exec_ctx *exec_ctx, while (grpc_byte_stream_next( exec_ctx, calld->send_op->payload->send_message.send_message, &calld->incoming_slice, ~(size_t)0, &calld->got_slice)) { - memcpy(wrptr, GRPC_SLICE_START_PTR(calld->incoming_slice), - GRPC_SLICE_LENGTH(calld->incoming_slice)); + if (GRPC_SLICE_LENGTH(calld->incoming_slice) > 0) { + memcpy(wrptr, GRPC_SLICE_START_PTR(calld->incoming_slice), + GRPC_SLICE_LENGTH(calld->incoming_slice)); + } wrptr += GRPC_SLICE_LENGTH(calld->incoming_slice); grpc_slice_buffer_add(&calld->slices, calld->incoming_slice); if (calld->send_length == calld->slices.length) { diff --git a/test/core/end2end/fuzzers/api_fuzzer.c b/test/core/end2end/fuzzers/api_fuzzer.c index a0acf5bf602..0ec5a23d5d2 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.c +++ b/test/core/end2end/fuzzers/api_fuzzer.c @@ -967,7 +967,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { break; } grpc_op *ops = gpr_malloc(sizeof(grpc_op) * num_ops); - memset(ops, 0, sizeof(grpc_op) * num_ops); + if (num_ops > 0) memset(ops, 0, sizeof(grpc_op) * num_ops); bool ok = true; size_t i; grpc_op *op; diff --git a/test/core/support/spinlock_test.c b/test/core/support/spinlock_test.c index c70e76c7ea1..96055e9bd78 100644 --- a/test/core/support/spinlock_test.c +++ b/test/core/support/spinlock_test.c @@ -109,7 +109,7 @@ static void test(const char *name, void (*body)(void *m), int timeout_s, start, gpr_time_from_micros((int64_t)timeout_s * 1000000, GPR_TIMESPAN)); fprintf(stderr, "%s:", name); while (gpr_time_cmp(gpr_now(GPR_CLOCK_REALTIME), deadline) < 0) { - iterations <<= 1; + if (iterations < INT64_MAX / 2) iterations <<= 1; fprintf(stderr, " %ld", (long)iterations); m = test_new(10, iterations, incr_step); test_create_threads(m, body); From 59bf91c72e4f8d249a004e4ac7879bec27be8bfd Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 13 Apr 2017 08:43:51 -0700 Subject: [PATCH 369/461] tweaks, fix bug --- tools/profiling/microbenchmarks/bm_diff.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index 5bc0eacd22c..4fa4869b642 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -94,8 +94,8 @@ argp.add_argument('-t', '--track', help='Which metrics to track') argp.add_argument('-b', '--benchmarks', nargs='+', choices=_AVAILABLE_BENCHMARK_TESTS, default=['bm_cq']) argp.add_argument('-d', '--diff_base', type=str) -argp.add_argument('-r', '--repetitions', type=int, default=5) -argp.add_argument('-l', '--loops', type=int, default=5) +argp.add_argument('-r', '--repetitions', type=int, default=3) +argp.add_argument('-l', '--loops', type=int, default=7) argp.add_argument('-p', '--p_threshold', type=float, default=0.01) argp.add_argument('-j', '--jobs', type=int, default=multiprocessing.cpu_count()) args = argp.parse_args() @@ -190,7 +190,7 @@ class Benchmark: benchmarks = collections.defaultdict(Benchmark) for bm in args.benchmarks: - for loop in args.loops: + for loop in range(0, args.loops): with open('%s.counters.new.%d.json' % (bm, loop)) as f: js_new_ctr = json.loads(f.read()) with open('%s.opt.new.%d.json' % (bm, loop)) as f: From dd475487c20d8ae44fc5bb36afc50592807b44de Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 13 Apr 2017 08:54:22 -0700 Subject: [PATCH 370/461] Minor patch --- .../chttp2/transport/chttp2_transport.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 16cf40c2c96..e2f7bb433a4 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1446,14 +1446,16 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op, GPR_ASSERT(!s->pending_byte_stream); s->recv_message_ready = op_payload->recv_message.recv_message_ready; s->recv_message = op_payload->recv_message.recv_message; - if (s->pending_byte_stream) { - already_received = s->frame_storage.length; - } else { - already_received = s->frame_storage.length + - s->unprocessed_incoming_frames_buffer.length; + if (s->id != 0) { + if (s->pending_byte_stream) { + already_received = s->frame_storage.length; + } else { + already_received = s->frame_storage.length + + s->unprocessed_incoming_frames_buffer.length; + } + incoming_byte_stream_update_flow_control(exec_ctx, t, s, 5, + already_received); } - incoming_byte_stream_update_flow_control(exec_ctx, t, s, 5, - already_received); grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s); } From 7fb4036a172f23f6d2bf6b451c1052f9495c880d Mon Sep 17 00:00:00 2001 From: Makarand Dharmapurikar Date: Thu, 13 Apr 2017 09:07:47 -0700 Subject: [PATCH 371/461] clang-format fix --- test/cpp/interop/client.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index ea27f2827de..6f1d910304c 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -164,7 +164,7 @@ int main(int argc, char** argv) { actions["unimplemented_service"] = std::bind(&grpc::testing::InteropClient::DoUnimplementedService, &client); actions["cacheable_unary"] = - std::bind(&grpc::testing::InteropClient::DoCacheableUnary, &client); + std::bind(&grpc::testing::InteropClient::DoCacheableUnary, &client); UpdateActions(&actions); From a103f7bbdfd1d8834d8386644d7f5e2d7b8d1a90 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 13 Apr 2017 09:25:44 -0700 Subject: [PATCH 372/461] update comments --- include/grpc++/impl/codegen/server_interface.h | 2 -- include/grpc++/server.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/include/grpc++/impl/codegen/server_interface.h b/include/grpc++/impl/codegen/server_interface.h index 79750117047..31d55529efc 100644 --- a/include/grpc++/impl/codegen/server_interface.h +++ b/include/grpc++/impl/codegen/server_interface.h @@ -122,8 +122,6 @@ class ServerInterface : public CallHook { /// caller is required to keep all completion queues live until the server is /// destroyed. /// \param num_cqs How many completion queues does \a cqs hold. - /// - /// \return true on a successful shutdown. virtual void Start(ServerCompletionQueue** cqs, size_t num_cqs) = 0; virtual void ShutdownInternal(gpr_timespec deadline) = 0; diff --git a/include/grpc++/server.h b/include/grpc++/server.h index af90a5c70b7..6d5f89d360a 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -177,8 +177,6 @@ class Server final : public ServerInterface, private GrpcLibraryCodegen { /// caller is required to keep all completion queues live until the server is /// destroyed. /// \param num_cqs How many completion queues does \a cqs hold. - /// - /// \return true on a successful shutdown. void Start(ServerCompletionQueue** cqs, size_t num_cqs) override; void PerformOpsOnCall(CallOpSetInterface* ops, Call* call) override; From 6163da513578c2526c3b1de16a3deb8c913e2c34 Mon Sep 17 00:00:00 2001 From: yang-g Date: Thu, 13 Apr 2017 09:39:42 -0700 Subject: [PATCH 373/461] Disallow empty method slice in api_fuzzer --- test/core/end2end/fuzzers/api_fuzzer.c | 3 +++ .../clusterfuzz-testcase-5867145026076672 | Bin 0 -> 46 bytes tools/run_tests/generated/tests.json | 23 ++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 test/core/end2end/fuzzers/api_fuzzer_corpus/clusterfuzz-testcase-5867145026076672 diff --git a/test/core/end2end/fuzzers/api_fuzzer.c b/test/core/end2end/fuzzers/api_fuzzer.c index a0acf5bf602..cd983a70a65 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.c +++ b/test/core/end2end/fuzzers/api_fuzzer.c @@ -932,6 +932,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { } uint32_t propagation_mask = read_uint32(&inp); grpc_slice method = read_string_like_slice(&inp); + if (GRPC_SLICE_LENGTH(method) == 0) { + ok = false; + } grpc_slice host = read_string_like_slice(&inp); gpr_timespec deadline = gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), diff --git a/test/core/end2end/fuzzers/api_fuzzer_corpus/clusterfuzz-testcase-5867145026076672 b/test/core/end2end/fuzzers/api_fuzzer_corpus/clusterfuzz-testcase-5867145026076672 new file mode 100644 index 0000000000000000000000000000000000000000..3fd5427b46662d86534978f322d512466c8765af GIT binary patch literal 46 wcmZQ7PAw`+En;9`Vc<$+Wc Date: Thu, 13 Apr 2017 10:29:38 -0700 Subject: [PATCH 374/461] added env var to the Cronet target --- src/objective-c/tests/Tests.xcodeproj/project.pbxproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj index f838f4c2214..b01d5ffceaa 100644 --- a/src/objective-c/tests/Tests.xcodeproj/project.pbxproj +++ b/src/objective-c/tests/Tests.xcodeproj/project.pbxproj @@ -1568,6 +1568,7 @@ GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", + "HOST_PORT_REMOTE=$(HOST_PORT_REMOTE)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_TREAT_WARNINGS_AS_ERRORS = YES; From 93b06d7ac143f1c9ff44c426f263ccf6a520e9c8 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 13 Apr 2017 11:16:29 -0700 Subject: [PATCH 375/461] Add a C++ compatibility check config --- Makefile | 9 +++++ build.yaml | 4 +++ tools/run_tests/generated/configs.json | 3 ++ tools/run_tests/generated/tests.json | 46 ++++++++++++++++++++++++++ 4 files changed, 62 insertions(+) diff --git a/Makefile b/Makefile index 942059248ec..190798dbd55 100644 --- a/Makefile +++ b/Makefile @@ -157,6 +157,15 @@ LDXX_asan-noleaks = clang++ CPPFLAGS_asan-noleaks = -O0 -fsanitize-coverage=edge -fsanitize=address -fno-omit-frame-pointer -Wno-unused-command-line-argument -DGPR_NO_DIRECT_SYSCALLS LDFLAGS_asan-noleaks = -fsanitize=address +VALID_CONFIG_c++-compat = 1 +CC_c++-compat = $(DEFAULT_CC) +CXX_c++-compat = $(DEFAULT_CXX) +LD_c++-compat = $(DEFAULT_CC) +LDXX_c++-compat = $(DEFAULT_CXX) +CFLAGS_c++-compat = -Wc++-compat +CPPFLAGS_c++-compat = -O0 +DEFINES_c++-compat = _DEBUG DEBUG + VALID_CONFIG_ubsan = 1 REQUIRE_CUSTOM_LIBRARIES_ubsan = 1 CC_ubsan = clang diff --git a/build.yaml b/build.yaml index ff5ce618cdb..9ca17eb33e6 100644 --- a/build.yaml +++ b/build.yaml @@ -4332,6 +4332,10 @@ configs: basicprof: CPPFLAGS: -O2 -DGRPC_BASIC_PROFILER -DGRPC_TIMERS_RDTSC DEFINES: NDEBUG + c++-compat: + CFLAGS: -Wc++-compat + CPPFLAGS: -O0 + DEFINES: _DEBUG DEBUG counters: CPPFLAGS: -O2 -DGPR_LOW_LEVEL_COUNTERS DEFINES: NDEBUG diff --git a/tools/run_tests/generated/configs.json b/tools/run_tests/generated/configs.json index 93dd6fb3d43..abbe76d60c2 100644 --- a/tools/run_tests/generated/configs.json +++ b/tools/run_tests/generated/configs.json @@ -38,6 +38,9 @@ "ASAN_OPTIONS": "detect_leaks=0:color=always" } }, + { + "config": "c++-compat" + }, { "config": "ubsan", "environ": { diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index a08caf30d36..f9c5b7df339 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -42394,6 +42394,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42431,6 +42432,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42468,6 +42470,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42505,6 +42508,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42542,6 +42546,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42579,6 +42584,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42616,6 +42622,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42653,6 +42660,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42692,6 +42700,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42729,6 +42738,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42768,6 +42778,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42805,6 +42816,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42842,6 +42854,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42879,6 +42892,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42916,6 +42930,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42953,6 +42968,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -42990,6 +43006,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43027,6 +43044,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43064,6 +43082,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43101,6 +43120,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43138,6 +43158,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43175,6 +43196,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43212,6 +43234,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43249,6 +43272,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43286,6 +43310,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43323,6 +43348,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43360,6 +43386,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43397,6 +43424,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43434,6 +43462,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43471,6 +43500,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43508,6 +43538,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43547,6 +43578,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43584,6 +43616,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43623,6 +43656,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43660,6 +43694,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43697,6 +43732,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43734,6 +43770,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43771,6 +43808,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43808,6 +43846,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43845,6 +43884,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43882,6 +43922,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43919,6 +43960,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43956,6 +43998,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -43993,6 +44036,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -44030,6 +44074,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", @@ -44067,6 +44112,7 @@ "asan-noleaks", "asan-trace-cmp", "basicprof", + "c++-compat", "counters", "dbg", "gcov", From c9f4bf9fcd9201a7447dcb351c810ef7200755a8 Mon Sep 17 00:00:00 2001 From: yang-g Date: Thu, 13 Apr 2017 11:21:51 -0700 Subject: [PATCH 376/461] get rid of the trailing null in path --- src/core/lib/channel/http_client_filter.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/core/lib/channel/http_client_filter.c b/src/core/lib/channel/http_client_filter.c index 151fb9885de..11b36146d86 100644 --- a/src/core/lib/channel/http_client_filter.c +++ b/src/core/lib/channel/http_client_filter.c @@ -341,11 +341,8 @@ static grpc_error *hc_mutate_op(grpc_exec_ctx *exec_ctx, /* remove trailing unused memory and add trailing 0 to terminate string */ char *t = (char *)GRPC_SLICE_START_PTR(path_with_query_slice); - /* safe to use strlen since base64_encode will always add '\0' */ - size_t path_length = strlen(t) + 1; - *(t + path_length) = '\0'; path_with_query_slice = - grpc_slice_sub(path_with_query_slice, 0, path_length); + grpc_slice_sub(path_with_query_slice, 0, strlen(t)); /* substitute previous path with the new path+query */ grpc_mdelem mdelem_path_and_query = grpc_mdelem_from_slices( From 63ed60f0483523522067d098abb6044ab6b99e27 Mon Sep 17 00:00:00 2001 From: Makarand Dharmapurikar Date: Thu, 13 Apr 2017 12:45:18 -0700 Subject: [PATCH 377/461] using grpc_base64_decode_with_len to simplify code --- src/core/lib/channel/http_server_filter.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/lib/channel/http_server_filter.c b/src/core/lib/channel/http_server_filter.c index 45dcc26f9a3..ebcde5315fe 100644 --- a/src/core/lib/channel/http_server_filter.c +++ b/src/core/lib/channel/http_server_filter.c @@ -228,8 +228,6 @@ static grpc_error *server_filter_incoming_metadata(grpc_exec_ctx *exec_ctx, if (offset < path_length) { grpc_slice query_slice = grpc_slice_sub(path_slice, offset + 1, path_length); - /* add a trailing '\0' before decoding */ - const char *b64_data = grpc_slice_to_c_string(query_slice); /* substitute path metadata with just the path (not query) */ grpc_mdelem mdelem_path_without_query = grpc_mdelem_from_slices( @@ -240,12 +238,14 @@ static grpc_error *server_filter_incoming_metadata(grpc_exec_ctx *exec_ctx, /* decode payload from query and add to the slice buffer to be returned */ const int k_url_safe = 1; - grpc_slice_buffer_add(&calld->read_slice_buffer, - grpc_base64_decode(exec_ctx, b64_data, k_url_safe)); + grpc_slice_buffer_add( + &calld->read_slice_buffer, + grpc_base64_decode_with_len( + exec_ctx, (const char *)GRPC_SLICE_START_PTR(query_slice), + GRPC_SLICE_LENGTH(query_slice), k_url_safe)); grpc_slice_buffer_stream_init(&calld->read_stream, &calld->read_slice_buffer, 0); calld->seen_path_with_query = true; - gpr_free((void *)b64_data); grpc_slice_unref_internal(exec_ctx, query_slice); } else { gpr_log(GPR_ERROR, "GET request without QUERY"); From d6547f45d1fd2c85f8e860db7894ab19411c52f2 Mon Sep 17 00:00:00 2001 From: Julien Boeuf Date: Thu, 13 Apr 2017 09:22:18 -0700 Subject: [PATCH 378/461] Be more explicit about the contract for free_fn in the gpr_allocation_functions doc. --- include/grpc/support/alloc.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/grpc/support/alloc.h b/include/grpc/support/alloc.h index 541433c6880..017d75a3d0e 100644 --- a/include/grpc/support/alloc.h +++ b/include/grpc/support/alloc.h @@ -68,7 +68,8 @@ GPRAPI void gpr_free_aligned(void *ptr); /** Request the family of allocation functions in \a functions be used. NOTE * that this request will be honored in a *best effort* basis and that no - * guarantees are made about the default functions (eg, malloc) being called. */ + * guarantees are made about the default functions (eg, malloc) being called. + * The functions.free_fn implementation must be a no-op for NULL input. */ GPRAPI void gpr_set_allocation_functions(gpr_allocation_functions functions); /** Return the family of allocation functions currently in effect. */ From c2b1f1672d23d2a374205d77f374b54cee66fe61 Mon Sep 17 00:00:00 2001 From: Bogdan Drutu Date: Fri, 31 Mar 2017 09:38:36 -0700 Subject: [PATCH 379/461] Change metadata names used by the instrumentation. --- src/core/lib/transport/static_metadata.c | 765 +++++++++++---------- src/core/lib/transport/static_metadata.h | 186 ++--- test/core/end2end/fuzzers/hpack.dictionary | 5 +- tools/codegen/core/gen_static_metadata.py | 343 +++++---- 4 files changed, 689 insertions(+), 610 deletions(-) diff --git a/src/core/lib/transport/static_metadata.c b/src/core/lib/transport/static_metadata.c index c13ba230b32..599d4ad1171 100644 --- a/src/core/lib/transport/static_metadata.c +++ b/src/core/lib/transport/static_metadata.c @@ -51,67 +51,69 @@ static uint8_t g_bytes[] = { 115, 103, 114, 112, 99, 45, 112, 97, 121, 108, 111, 97, 100, 45, 98, 105, 110, 103, 114, 112, 99, 45, 101, 110, 99, 111, 100, 105, 110, 103, 103, 114, 112, 99, 45, 97, 99, 99, 101, 112, 116, 45, 101, 110, 99, - 111, 100, 105, 110, 103, 99, 111, 110, 116, 101, 110, 116, 45, 116, 121, - 112, 101, 103, 114, 112, 99, 45, 105, 110, 116, 101, 114, 110, 97, 108, - 45, 101, 110, 99, 111, 100, 105, 110, 103, 45, 114, 101, 113, 117, 101, - 115, 116, 117, 115, 101, 114, 45, 97, 103, 101, 110, 116, 104, 111, 115, - 116, 108, 98, 45, 116, 111, 107, 101, 110, 103, 114, 112, 99, 45, 116, - 105, 109, 101, 111, 117, 116, 103, 114, 112, 99, 45, 116, 114, 97, 99, - 105, 110, 103, 45, 98, 105, 110, 103, 114, 112, 99, 45, 115, 116, 97, - 116, 115, 45, 98, 105, 110, 103, 114, 112, 99, 46, 119, 97, 105, 116, - 95, 102, 111, 114, 95, 114, 101, 97, 100, 121, 103, 114, 112, 99, 46, - 116, 105, 109, 101, 111, 117, 116, 103, 114, 112, 99, 46, 109, 97, 120, - 95, 114, 101, 113, 117, 101, 115, 116, 95, 109, 101, 115, 115, 97, 103, - 101, 95, 98, 121, 116, 101, 115, 103, 114, 112, 99, 46, 109, 97, 120, - 95, 114, 101, 115, 112, 111, 110, 115, 101, 95, 109, 101, 115, 115, 97, - 103, 101, 95, 98, 121, 116, 101, 115, 47, 103, 114, 112, 99, 46, 108, - 98, 46, 118, 49, 46, 76, 111, 97, 100, 66, 97, 108, 97, 110, 99, - 101, 114, 47, 66, 97, 108, 97, 110, 99, 101, 76, 111, 97, 100, 48, - 49, 50, 105, 100, 101, 110, 116, 105, 116, 121, 103, 122, 105, 112, 100, - 101, 102, 108, 97, 116, 101, 116, 114, 97, 105, 108, 101, 114, 115, 97, - 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 103, 114, 112, 99, - 80, 79, 83, 84, 50, 48, 48, 52, 48, 52, 104, 116, 116, 112, 104, - 116, 116, 112, 115, 103, 114, 112, 99, 71, 69, 84, 80, 85, 84, 47, - 47, 105, 110, 100, 101, 120, 46, 104, 116, 109, 108, 50, 48, 52, 50, - 48, 54, 51, 48, 52, 52, 48, 48, 53, 48, 48, 97, 99, 99, 101, - 112, 116, 45, 99, 104, 97, 114, 115, 101, 116, 97, 99, 99, 101, 112, - 116, 45, 101, 110, 99, 111, 100, 105, 110, 103, 103, 122, 105, 112, 44, - 32, 100, 101, 102, 108, 97, 116, 101, 97, 99, 99, 101, 112, 116, 45, - 108, 97, 110, 103, 117, 97, 103, 101, 97, 99, 99, 101, 112, 116, 45, - 114, 97, 110, 103, 101, 115, 97, 99, 99, 101, 112, 116, 97, 99, 99, - 101, 115, 115, 45, 99, 111, 110, 116, 114, 111, 108, 45, 97, 108, 108, - 111, 119, 45, 111, 114, 105, 103, 105, 110, 97, 103, 101, 97, 108, 108, - 111, 119, 97, 117, 116, 104, 111, 114, 105, 122, 97, 116, 105, 111, 110, - 99, 97, 99, 104, 101, 45, 99, 111, 110, 116, 114, 111, 108, 99, 111, - 110, 116, 101, 110, 116, 45, 100, 105, 115, 112, 111, 115, 105, 116, 105, - 111, 110, 99, 111, 110, 116, 101, 110, 116, 45, 101, 110, 99, 111, 100, - 105, 110, 103, 99, 111, 110, 116, 101, 110, 116, 45, 108, 97, 110, 103, - 117, 97, 103, 101, 99, 111, 110, 116, 101, 110, 116, 45, 108, 101, 110, - 103, 116, 104, 99, 111, 110, 116, 101, 110, 116, 45, 108, 111, 99, 97, - 116, 105, 111, 110, 99, 111, 110, 116, 101, 110, 116, 45, 114, 97, 110, - 103, 101, 99, 111, 111, 107, 105, 101, 100, 97, 116, 101, 101, 116, 97, - 103, 101, 120, 112, 101, 99, 116, 101, 120, 112, 105, 114, 101, 115, 102, - 114, 111, 109, 105, 102, 45, 109, 97, 116, 99, 104, 105, 102, 45, 109, - 111, 100, 105, 102, 105, 101, 100, 45, 115, 105, 110, 99, 101, 105, 102, - 45, 110, 111, 110, 101, 45, 109, 97, 116, 99, 104, 105, 102, 45, 114, - 97, 110, 103, 101, 105, 102, 45, 117, 110, 109, 111, 100, 105, 102, 105, - 101, 100, 45, 115, 105, 110, 99, 101, 108, 97, 115, 116, 45, 109, 111, - 100, 105, 102, 105, 101, 100, 108, 105, 110, 107, 108, 111, 99, 97, 116, - 105, 111, 110, 109, 97, 120, 45, 102, 111, 114, 119, 97, 114, 100, 115, - 112, 114, 111, 120, 121, 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, - 97, 116, 101, 112, 114, 111, 120, 121, 45, 97, 117, 116, 104, 111, 114, - 105, 122, 97, 116, 105, 111, 110, 114, 97, 110, 103, 101, 114, 101, 102, - 101, 114, 101, 114, 114, 101, 102, 114, 101, 115, 104, 114, 101, 116, 114, - 121, 45, 97, 102, 116, 101, 114, 115, 101, 114, 118, 101, 114, 115, 101, - 116, 45, 99, 111, 111, 107, 105, 101, 115, 116, 114, 105, 99, 116, 45, - 116, 114, 97, 110, 115, 112, 111, 114, 116, 45, 115, 101, 99, 117, 114, - 105, 116, 121, 116, 114, 97, 110, 115, 102, 101, 114, 45, 101, 110, 99, - 111, 100, 105, 110, 103, 118, 97, 114, 121, 118, 105, 97, 119, 119, 119, - 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 105, 100, - 101, 110, 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 105, - 100, 101, 110, 116, 105, 116, 121, 44, 103, 122, 105, 112, 100, 101, 102, - 108, 97, 116, 101, 44, 103, 122, 105, 112, 105, 100, 101, 110, 116, 105, - 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 44, 103, 122, 105, 112}; + 111, 100, 105, 110, 103, 103, 114, 112, 99, 45, 115, 101, 114, 118, 101, + 114, 45, 115, 116, 97, 116, 115, 45, 98, 105, 110, 103, 114, 112, 99, + 45, 116, 97, 103, 115, 45, 98, 105, 110, 103, 114, 112, 99, 45, 116, + 114, 97, 99, 101, 45, 98, 105, 110, 99, 111, 110, 116, 101, 110, 116, + 45, 116, 121, 112, 101, 103, 114, 112, 99, 45, 105, 110, 116, 101, 114, + 110, 97, 108, 45, 101, 110, 99, 111, 100, 105, 110, 103, 45, 114, 101, + 113, 117, 101, 115, 116, 117, 115, 101, 114, 45, 97, 103, 101, 110, 116, + 104, 111, 115, 116, 108, 98, 45, 116, 111, 107, 101, 110, 103, 114, 112, + 99, 45, 116, 105, 109, 101, 111, 117, 116, 103, 114, 112, 99, 46, 119, + 97, 105, 116, 95, 102, 111, 114, 95, 114, 101, 97, 100, 121, 103, 114, + 112, 99, 46, 116, 105, 109, 101, 111, 117, 116, 103, 114, 112, 99, 46, + 109, 97, 120, 95, 114, 101, 113, 117, 101, 115, 116, 95, 109, 101, 115, + 115, 97, 103, 101, 95, 98, 121, 116, 101, 115, 103, 114, 112, 99, 46, + 109, 97, 120, 95, 114, 101, 115, 112, 111, 110, 115, 101, 95, 109, 101, + 115, 115, 97, 103, 101, 95, 98, 121, 116, 101, 115, 47, 103, 114, 112, + 99, 46, 108, 98, 46, 118, 49, 46, 76, 111, 97, 100, 66, 97, 108, + 97, 110, 99, 101, 114, 47, 66, 97, 108, 97, 110, 99, 101, 76, 111, + 97, 100, 48, 49, 50, 105, 100, 101, 110, 116, 105, 116, 121, 103, 122, + 105, 112, 100, 101, 102, 108, 97, 116, 101, 116, 114, 97, 105, 108, 101, + 114, 115, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 103, + 114, 112, 99, 80, 79, 83, 84, 50, 48, 48, 52, 48, 52, 104, 116, + 116, 112, 104, 116, 116, 112, 115, 103, 114, 112, 99, 71, 69, 84, 80, + 85, 84, 47, 47, 105, 110, 100, 101, 120, 46, 104, 116, 109, 108, 50, + 48, 52, 50, 48, 54, 51, 48, 52, 52, 48, 48, 53, 48, 48, 97, + 99, 99, 101, 112, 116, 45, 99, 104, 97, 114, 115, 101, 116, 97, 99, + 99, 101, 112, 116, 45, 101, 110, 99, 111, 100, 105, 110, 103, 103, 122, + 105, 112, 44, 32, 100, 101, 102, 108, 97, 116, 101, 97, 99, 99, 101, + 112, 116, 45, 108, 97, 110, 103, 117, 97, 103, 101, 97, 99, 99, 101, + 112, 116, 45, 114, 97, 110, 103, 101, 115, 97, 99, 99, 101, 112, 116, + 97, 99, 99, 101, 115, 115, 45, 99, 111, 110, 116, 114, 111, 108, 45, + 97, 108, 108, 111, 119, 45, 111, 114, 105, 103, 105, 110, 97, 103, 101, + 97, 108, 108, 111, 119, 97, 117, 116, 104, 111, 114, 105, 122, 97, 116, + 105, 111, 110, 99, 97, 99, 104, 101, 45, 99, 111, 110, 116, 114, 111, + 108, 99, 111, 110, 116, 101, 110, 116, 45, 100, 105, 115, 112, 111, 115, + 105, 116, 105, 111, 110, 99, 111, 110, 116, 101, 110, 116, 45, 101, 110, + 99, 111, 100, 105, 110, 103, 99, 111, 110, 116, 101, 110, 116, 45, 108, + 97, 110, 103, 117, 97, 103, 101, 99, 111, 110, 116, 101, 110, 116, 45, + 108, 101, 110, 103, 116, 104, 99, 111, 110, 116, 101, 110, 116, 45, 108, + 111, 99, 97, 116, 105, 111, 110, 99, 111, 110, 116, 101, 110, 116, 45, + 114, 97, 110, 103, 101, 99, 111, 111, 107, 105, 101, 100, 97, 116, 101, + 101, 116, 97, 103, 101, 120, 112, 101, 99, 116, 101, 120, 112, 105, 114, + 101, 115, 102, 114, 111, 109, 105, 102, 45, 109, 97, 116, 99, 104, 105, + 102, 45, 109, 111, 100, 105, 102, 105, 101, 100, 45, 115, 105, 110, 99, + 101, 105, 102, 45, 110, 111, 110, 101, 45, 109, 97, 116, 99, 104, 105, + 102, 45, 114, 97, 110, 103, 101, 105, 102, 45, 117, 110, 109, 111, 100, + 105, 102, 105, 101, 100, 45, 115, 105, 110, 99, 101, 108, 97, 115, 116, + 45, 109, 111, 100, 105, 102, 105, 101, 100, 108, 105, 110, 107, 108, 111, + 99, 97, 116, 105, 111, 110, 109, 97, 120, 45, 102, 111, 114, 119, 97, + 114, 100, 115, 112, 114, 111, 120, 121, 45, 97, 117, 116, 104, 101, 110, + 116, 105, 99, 97, 116, 101, 112, 114, 111, 120, 121, 45, 97, 117, 116, + 104, 111, 114, 105, 122, 97, 116, 105, 111, 110, 114, 97, 110, 103, 101, + 114, 101, 102, 101, 114, 101, 114, 114, 101, 102, 114, 101, 115, 104, 114, + 101, 116, 114, 121, 45, 97, 102, 116, 101, 114, 115, 101, 114, 118, 101, + 114, 115, 101, 116, 45, 99, 111, 111, 107, 105, 101, 115, 116, 114, 105, + 99, 116, 45, 116, 114, 97, 110, 115, 112, 111, 114, 116, 45, 115, 101, + 99, 117, 114, 105, 116, 121, 116, 114, 97, 110, 115, 102, 101, 114, 45, + 101, 110, 99, 111, 100, 105, 110, 103, 118, 97, 114, 121, 118, 105, 97, + 119, 119, 119, 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, + 101, 105, 100, 101, 110, 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, + 116, 101, 105, 100, 101, 110, 116, 105, 116, 121, 44, 103, 122, 105, 112, + 100, 101, 102, 108, 97, 116, 101, 44, 103, 122, 105, 112, 105, 100, 101, + 110, 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 44, 103, + 122, 105, 112}; static void static_ref(void *unused) {} static void static_unref(grpc_exec_ctx *exec_ctx, void *unused) {} @@ -220,6 +222,7 @@ grpc_slice_refcount grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT] = { {&grpc_static_metadata_vtable, &static_sub_refcnt}, {&grpc_static_metadata_vtable, &static_sub_refcnt}, {&grpc_static_metadata_vtable, &static_sub_refcnt}, + {&grpc_static_metadata_vtable, &static_sub_refcnt}, }; const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = { @@ -246,177 +249,179 @@ const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = { {.refcount = &grpc_static_metadata_refcounts[10], .data.refcounted = {g_bytes + 90, 20}}, {.refcount = &grpc_static_metadata_refcounts[11], - .data.refcounted = {g_bytes + 110, 12}}, + .data.refcounted = {g_bytes + 110, 21}}, {.refcount = &grpc_static_metadata_refcounts[12], - .data.refcounted = {g_bytes + 122, 30}}, + .data.refcounted = {g_bytes + 131, 13}}, {.refcount = &grpc_static_metadata_refcounts[13], - .data.refcounted = {g_bytes + 152, 10}}, + .data.refcounted = {g_bytes + 144, 14}}, {.refcount = &grpc_static_metadata_refcounts[14], - .data.refcounted = {g_bytes + 162, 4}}, + .data.refcounted = {g_bytes + 158, 12}}, {.refcount = &grpc_static_metadata_refcounts[15], - .data.refcounted = {g_bytes + 166, 8}}, + .data.refcounted = {g_bytes + 170, 30}}, {.refcount = &grpc_static_metadata_refcounts[16], - .data.refcounted = {g_bytes + 174, 12}}, + .data.refcounted = {g_bytes + 200, 10}}, {.refcount = &grpc_static_metadata_refcounts[17], - .data.refcounted = {g_bytes + 186, 16}}, + .data.refcounted = {g_bytes + 210, 4}}, {.refcount = &grpc_static_metadata_refcounts[18], - .data.refcounted = {g_bytes + 202, 14}}, + .data.refcounted = {g_bytes + 214, 8}}, {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}, + .data.refcounted = {g_bytes + 222, 12}}, {.refcount = &grpc_static_metadata_refcounts[20], - .data.refcounted = {g_bytes + 216, 19}}, + .data.refcounted = {g_bytes + 234, 0}}, {.refcount = &grpc_static_metadata_refcounts[21], - .data.refcounted = {g_bytes + 235, 12}}, + .data.refcounted = {g_bytes + 234, 19}}, {.refcount = &grpc_static_metadata_refcounts[22], - .data.refcounted = {g_bytes + 247, 30}}, + .data.refcounted = {g_bytes + 253, 12}}, {.refcount = &grpc_static_metadata_refcounts[23], - .data.refcounted = {g_bytes + 277, 31}}, + .data.refcounted = {g_bytes + 265, 30}}, {.refcount = &grpc_static_metadata_refcounts[24], - .data.refcounted = {g_bytes + 308, 36}}, + .data.refcounted = {g_bytes + 295, 31}}, {.refcount = &grpc_static_metadata_refcounts[25], - .data.refcounted = {g_bytes + 344, 1}}, + .data.refcounted = {g_bytes + 326, 36}}, {.refcount = &grpc_static_metadata_refcounts[26], - .data.refcounted = {g_bytes + 345, 1}}, + .data.refcounted = {g_bytes + 362, 1}}, {.refcount = &grpc_static_metadata_refcounts[27], - .data.refcounted = {g_bytes + 346, 1}}, + .data.refcounted = {g_bytes + 363, 1}}, {.refcount = &grpc_static_metadata_refcounts[28], - .data.refcounted = {g_bytes + 347, 8}}, + .data.refcounted = {g_bytes + 364, 1}}, {.refcount = &grpc_static_metadata_refcounts[29], - .data.refcounted = {g_bytes + 355, 4}}, + .data.refcounted = {g_bytes + 365, 8}}, {.refcount = &grpc_static_metadata_refcounts[30], - .data.refcounted = {g_bytes + 359, 7}}, + .data.refcounted = {g_bytes + 373, 4}}, {.refcount = &grpc_static_metadata_refcounts[31], - .data.refcounted = {g_bytes + 366, 8}}, + .data.refcounted = {g_bytes + 377, 7}}, {.refcount = &grpc_static_metadata_refcounts[32], - .data.refcounted = {g_bytes + 374, 16}}, + .data.refcounted = {g_bytes + 384, 8}}, {.refcount = &grpc_static_metadata_refcounts[33], - .data.refcounted = {g_bytes + 390, 4}}, + .data.refcounted = {g_bytes + 392, 16}}, {.refcount = &grpc_static_metadata_refcounts[34], - .data.refcounted = {g_bytes + 394, 3}}, + .data.refcounted = {g_bytes + 408, 4}}, {.refcount = &grpc_static_metadata_refcounts[35], - .data.refcounted = {g_bytes + 397, 3}}, + .data.refcounted = {g_bytes + 412, 3}}, {.refcount = &grpc_static_metadata_refcounts[36], - .data.refcounted = {g_bytes + 400, 4}}, + .data.refcounted = {g_bytes + 415, 3}}, {.refcount = &grpc_static_metadata_refcounts[37], - .data.refcounted = {g_bytes + 404, 5}}, + .data.refcounted = {g_bytes + 418, 4}}, {.refcount = &grpc_static_metadata_refcounts[38], - .data.refcounted = {g_bytes + 409, 4}}, + .data.refcounted = {g_bytes + 422, 5}}, {.refcount = &grpc_static_metadata_refcounts[39], - .data.refcounted = {g_bytes + 413, 3}}, + .data.refcounted = {g_bytes + 427, 4}}, {.refcount = &grpc_static_metadata_refcounts[40], - .data.refcounted = {g_bytes + 416, 3}}, + .data.refcounted = {g_bytes + 431, 3}}, {.refcount = &grpc_static_metadata_refcounts[41], - .data.refcounted = {g_bytes + 419, 1}}, + .data.refcounted = {g_bytes + 434, 3}}, {.refcount = &grpc_static_metadata_refcounts[42], - .data.refcounted = {g_bytes + 420, 11}}, + .data.refcounted = {g_bytes + 437, 1}}, {.refcount = &grpc_static_metadata_refcounts[43], - .data.refcounted = {g_bytes + 431, 3}}, + .data.refcounted = {g_bytes + 438, 11}}, {.refcount = &grpc_static_metadata_refcounts[44], - .data.refcounted = {g_bytes + 434, 3}}, + .data.refcounted = {g_bytes + 449, 3}}, {.refcount = &grpc_static_metadata_refcounts[45], - .data.refcounted = {g_bytes + 437, 3}}, + .data.refcounted = {g_bytes + 452, 3}}, {.refcount = &grpc_static_metadata_refcounts[46], - .data.refcounted = {g_bytes + 440, 3}}, + .data.refcounted = {g_bytes + 455, 3}}, {.refcount = &grpc_static_metadata_refcounts[47], - .data.refcounted = {g_bytes + 443, 3}}, + .data.refcounted = {g_bytes + 458, 3}}, {.refcount = &grpc_static_metadata_refcounts[48], - .data.refcounted = {g_bytes + 446, 14}}, + .data.refcounted = {g_bytes + 461, 3}}, {.refcount = &grpc_static_metadata_refcounts[49], - .data.refcounted = {g_bytes + 460, 15}}, + .data.refcounted = {g_bytes + 464, 14}}, {.refcount = &grpc_static_metadata_refcounts[50], - .data.refcounted = {g_bytes + 475, 13}}, + .data.refcounted = {g_bytes + 478, 15}}, {.refcount = &grpc_static_metadata_refcounts[51], - .data.refcounted = {g_bytes + 488, 15}}, + .data.refcounted = {g_bytes + 493, 13}}, {.refcount = &grpc_static_metadata_refcounts[52], - .data.refcounted = {g_bytes + 503, 13}}, + .data.refcounted = {g_bytes + 506, 15}}, {.refcount = &grpc_static_metadata_refcounts[53], - .data.refcounted = {g_bytes + 516, 6}}, + .data.refcounted = {g_bytes + 521, 13}}, {.refcount = &grpc_static_metadata_refcounts[54], - .data.refcounted = {g_bytes + 522, 27}}, + .data.refcounted = {g_bytes + 534, 6}}, {.refcount = &grpc_static_metadata_refcounts[55], - .data.refcounted = {g_bytes + 549, 3}}, + .data.refcounted = {g_bytes + 540, 27}}, {.refcount = &grpc_static_metadata_refcounts[56], - .data.refcounted = {g_bytes + 552, 5}}, + .data.refcounted = {g_bytes + 567, 3}}, {.refcount = &grpc_static_metadata_refcounts[57], - .data.refcounted = {g_bytes + 557, 13}}, + .data.refcounted = {g_bytes + 570, 5}}, {.refcount = &grpc_static_metadata_refcounts[58], - .data.refcounted = {g_bytes + 570, 13}}, + .data.refcounted = {g_bytes + 575, 13}}, {.refcount = &grpc_static_metadata_refcounts[59], - .data.refcounted = {g_bytes + 583, 19}}, + .data.refcounted = {g_bytes + 588, 13}}, {.refcount = &grpc_static_metadata_refcounts[60], - .data.refcounted = {g_bytes + 602, 16}}, + .data.refcounted = {g_bytes + 601, 19}}, {.refcount = &grpc_static_metadata_refcounts[61], - .data.refcounted = {g_bytes + 618, 16}}, + .data.refcounted = {g_bytes + 620, 16}}, {.refcount = &grpc_static_metadata_refcounts[62], - .data.refcounted = {g_bytes + 634, 14}}, + .data.refcounted = {g_bytes + 636, 16}}, {.refcount = &grpc_static_metadata_refcounts[63], - .data.refcounted = {g_bytes + 648, 16}}, + .data.refcounted = {g_bytes + 652, 14}}, {.refcount = &grpc_static_metadata_refcounts[64], - .data.refcounted = {g_bytes + 664, 13}}, + .data.refcounted = {g_bytes + 666, 16}}, {.refcount = &grpc_static_metadata_refcounts[65], - .data.refcounted = {g_bytes + 677, 6}}, + .data.refcounted = {g_bytes + 682, 13}}, {.refcount = &grpc_static_metadata_refcounts[66], - .data.refcounted = {g_bytes + 683, 4}}, + .data.refcounted = {g_bytes + 695, 6}}, {.refcount = &grpc_static_metadata_refcounts[67], - .data.refcounted = {g_bytes + 687, 4}}, + .data.refcounted = {g_bytes + 701, 4}}, {.refcount = &grpc_static_metadata_refcounts[68], - .data.refcounted = {g_bytes + 691, 6}}, + .data.refcounted = {g_bytes + 705, 4}}, {.refcount = &grpc_static_metadata_refcounts[69], - .data.refcounted = {g_bytes + 697, 7}}, + .data.refcounted = {g_bytes + 709, 6}}, {.refcount = &grpc_static_metadata_refcounts[70], - .data.refcounted = {g_bytes + 704, 4}}, + .data.refcounted = {g_bytes + 715, 7}}, {.refcount = &grpc_static_metadata_refcounts[71], - .data.refcounted = {g_bytes + 708, 8}}, + .data.refcounted = {g_bytes + 722, 4}}, {.refcount = &grpc_static_metadata_refcounts[72], - .data.refcounted = {g_bytes + 716, 17}}, + .data.refcounted = {g_bytes + 726, 8}}, {.refcount = &grpc_static_metadata_refcounts[73], - .data.refcounted = {g_bytes + 733, 13}}, + .data.refcounted = {g_bytes + 734, 17}}, {.refcount = &grpc_static_metadata_refcounts[74], - .data.refcounted = {g_bytes + 746, 8}}, + .data.refcounted = {g_bytes + 751, 13}}, {.refcount = &grpc_static_metadata_refcounts[75], - .data.refcounted = {g_bytes + 754, 19}}, + .data.refcounted = {g_bytes + 764, 8}}, {.refcount = &grpc_static_metadata_refcounts[76], - .data.refcounted = {g_bytes + 773, 13}}, + .data.refcounted = {g_bytes + 772, 19}}, {.refcount = &grpc_static_metadata_refcounts[77], - .data.refcounted = {g_bytes + 786, 4}}, + .data.refcounted = {g_bytes + 791, 13}}, {.refcount = &grpc_static_metadata_refcounts[78], - .data.refcounted = {g_bytes + 790, 8}}, + .data.refcounted = {g_bytes + 804, 4}}, {.refcount = &grpc_static_metadata_refcounts[79], - .data.refcounted = {g_bytes + 798, 12}}, + .data.refcounted = {g_bytes + 808, 8}}, {.refcount = &grpc_static_metadata_refcounts[80], - .data.refcounted = {g_bytes + 810, 18}}, + .data.refcounted = {g_bytes + 816, 12}}, {.refcount = &grpc_static_metadata_refcounts[81], - .data.refcounted = {g_bytes + 828, 19}}, + .data.refcounted = {g_bytes + 828, 18}}, {.refcount = &grpc_static_metadata_refcounts[82], - .data.refcounted = {g_bytes + 847, 5}}, + .data.refcounted = {g_bytes + 846, 19}}, {.refcount = &grpc_static_metadata_refcounts[83], - .data.refcounted = {g_bytes + 852, 7}}, + .data.refcounted = {g_bytes + 865, 5}}, {.refcount = &grpc_static_metadata_refcounts[84], - .data.refcounted = {g_bytes + 859, 7}}, + .data.refcounted = {g_bytes + 870, 7}}, {.refcount = &grpc_static_metadata_refcounts[85], - .data.refcounted = {g_bytes + 866, 11}}, + .data.refcounted = {g_bytes + 877, 7}}, {.refcount = &grpc_static_metadata_refcounts[86], - .data.refcounted = {g_bytes + 877, 6}}, + .data.refcounted = {g_bytes + 884, 11}}, {.refcount = &grpc_static_metadata_refcounts[87], - .data.refcounted = {g_bytes + 883, 10}}, + .data.refcounted = {g_bytes + 895, 6}}, {.refcount = &grpc_static_metadata_refcounts[88], - .data.refcounted = {g_bytes + 893, 25}}, + .data.refcounted = {g_bytes + 901, 10}}, {.refcount = &grpc_static_metadata_refcounts[89], - .data.refcounted = {g_bytes + 918, 17}}, + .data.refcounted = {g_bytes + 911, 25}}, {.refcount = &grpc_static_metadata_refcounts[90], - .data.refcounted = {g_bytes + 935, 4}}, + .data.refcounted = {g_bytes + 936, 17}}, {.refcount = &grpc_static_metadata_refcounts[91], - .data.refcounted = {g_bytes + 939, 3}}, + .data.refcounted = {g_bytes + 953, 4}}, {.refcount = &grpc_static_metadata_refcounts[92], - .data.refcounted = {g_bytes + 942, 16}}, + .data.refcounted = {g_bytes + 957, 3}}, {.refcount = &grpc_static_metadata_refcounts[93], - .data.refcounted = {g_bytes + 958, 16}}, + .data.refcounted = {g_bytes + 960, 16}}, {.refcount = &grpc_static_metadata_refcounts[94], - .data.refcounted = {g_bytes + 974, 13}}, + .data.refcounted = {g_bytes + 976, 16}}, {.refcount = &grpc_static_metadata_refcounts[95], - .data.refcounted = {g_bytes + 987, 12}}, + .data.refcounted = {g_bytes + 992, 13}}, {.refcount = &grpc_static_metadata_refcounts[96], - .data.refcounted = {g_bytes + 999, 21}}, + .data.refcounted = {g_bytes + 1005, 12}}, + {.refcount = &grpc_static_metadata_refcounts[97], + .data.refcounted = {g_bytes + 1017, 21}}, }; uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = { @@ -426,16 +431,16 @@ uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 6, 6, 8, 8}; static const int8_t elems_r[] = { - 10, 8, -3, 0, 9, 21, -75, 22, 0, 10, -7, 20, 0, 19, 18, 17, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - -48, -49, 16, -51, -52, -53, -54, -54, -55, -56, -57, 0, 37, 36, 35, 34, - 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, - 17, 16, 15, 14, 13, 12, 11, 14, 13, 12, 11, 10, 9, 8, 0}; + 10, 8, -3, 0, 9, 21, -76, 22, 0, 10, -7, 0, 0, 0, 14, 0, + 13, 12, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -50, -51, 15, -53, -54, -55, -56, -56, -57, -58, 0, 37, 36, 35, 34, + 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, + 17, 16, 15, 14, 13, 12, 11, 10, 13, 12, 11, 10, 9, 8, 7, 0}; static uint32_t elems_phash(uint32_t i) { - i -= 41; - uint32_t x = i % 95; - uint32_t y = i / 95; + i -= 42; + uint32_t x = i % 96; + uint32_t y = i / 96; uint32_t h = x; if (y < GPR_ARRAY_SIZE(elems_r)) { uint32_t delta = (uint32_t)elems_r[y]; @@ -445,29 +450,29 @@ static uint32_t elems_phash(uint32_t i) { } static const uint16_t elem_keys[] = { - 998, 999, 1000, 237, 238, 239, 240, 241, 136, 137, 41, 42, - 424, 425, 426, 901, 902, 903, 704, 705, 1086, 516, 706, 1280, - 1377, 1474, 4675, 4772, 4803, 4966, 5063, 5160, 5257, 1099, 5354, 5451, - 5548, 5645, 5742, 5839, 5936, 6033, 6130, 6227, 6324, 6421, 6518, 6615, - 6712, 6809, 6906, 7003, 7100, 7197, 7294, 7391, 7488, 7585, 7682, 7779, - 7876, 7973, 8070, 8167, 8264, 1063, 1064, 1065, 1066, 8361, 8458, 8555, - 8652, 8749, 8846, 8943, 310, 0, 0, 0, 0, 0, 0, 0, + 1009, 1010, 1011, 240, 241, 242, 243, 244, 138, 139, 42, 43, + 429, 430, 431, 911, 912, 913, 712, 713, 1392, 522, 714, 1588, + 1686, 1784, 4822, 4920, 4951, 5116, 5214, 5312, 5410, 1405, 5508, 5606, + 5704, 5802, 5900, 5998, 6096, 6194, 6292, 6390, 6488, 6586, 6684, 6782, + 6880, 6978, 7076, 7174, 7272, 7370, 7468, 7566, 7664, 7762, 7860, 7958, + 8056, 8154, 8252, 8350, 8448, 1074, 1075, 1076, 1077, 8546, 8644, 8742, + 8840, 8938, 9036, 9134, 0, 314, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 130, 228, 229, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 132, 231, 232, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; static const uint8_t elem_idxs[] = { 73, 76, 74, 19, 20, 21, 22, 23, 15, 16, 17, 18, 11, 12, 13, 3, 4, 5, 0, 1, 41, 6, 2, 69, 48, 55, 24, 25, 26, 27, 28, 29, 30, 7, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, 60, 61, 62, 63, 64, 75, 77, 78, 79, 65, 66, 67, 68, 70, 71, - 72, 14, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 8, 9, 10}; + 72, 255, 14, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 8, 9, 10}; grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b) { if (a == -1 || b == -1) return GRPC_MDNULL; - uint32_t k = (uint32_t)(a * 97 + b); + uint32_t k = (uint32_t)(a * 98 + b); uint32_t h = elems_phash(k); return h < GPR_ARRAY_SIZE(elem_keys) && elem_keys[h] == k ? GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[elem_idxs[h]], @@ -476,326 +481,326 @@ grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b) { } grpc_mdelem_data grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { - {{.refcount = &grpc_static_metadata_refcounts[7], - .data.refcounted = {g_bytes + 50, 11}}, - {.refcount = &grpc_static_metadata_refcounts[25], - .data.refcounted = {g_bytes + 344, 1}}}, {{.refcount = &grpc_static_metadata_refcounts[7], .data.refcounted = {g_bytes + 50, 11}}, {.refcount = &grpc_static_metadata_refcounts[26], - .data.refcounted = {g_bytes + 345, 1}}}, + .data.refcounted = {g_bytes + 362, 1}}}, {{.refcount = &grpc_static_metadata_refcounts[7], .data.refcounted = {g_bytes + 50, 11}}, {.refcount = &grpc_static_metadata_refcounts[27], - .data.refcounted = {g_bytes + 346, 1}}}, - {{.refcount = &grpc_static_metadata_refcounts[9], - .data.refcounted = {g_bytes + 77, 13}}, + .data.refcounted = {g_bytes + 363, 1}}}, + {{.refcount = &grpc_static_metadata_refcounts[7], + .data.refcounted = {g_bytes + 50, 11}}, {.refcount = &grpc_static_metadata_refcounts[28], - .data.refcounted = {g_bytes + 347, 8}}}, + .data.refcounted = {g_bytes + 364, 1}}}, {{.refcount = &grpc_static_metadata_refcounts[9], .data.refcounted = {g_bytes + 77, 13}}, {.refcount = &grpc_static_metadata_refcounts[29], - .data.refcounted = {g_bytes + 355, 4}}}, + .data.refcounted = {g_bytes + 365, 8}}}, {{.refcount = &grpc_static_metadata_refcounts[9], .data.refcounted = {g_bytes + 77, 13}}, {.refcount = &grpc_static_metadata_refcounts[30], - .data.refcounted = {g_bytes + 359, 7}}}, + .data.refcounted = {g_bytes + 373, 4}}}, + {{.refcount = &grpc_static_metadata_refcounts[9], + .data.refcounted = {g_bytes + 77, 13}}, + {.refcount = &grpc_static_metadata_refcounts[31], + .data.refcounted = {g_bytes + 377, 7}}}, {{.refcount = &grpc_static_metadata_refcounts[5], .data.refcounted = {g_bytes + 36, 2}}, - {.refcount = &grpc_static_metadata_refcounts[31], - .data.refcounted = {g_bytes + 366, 8}}}, - {{.refcount = &grpc_static_metadata_refcounts[11], - .data.refcounted = {g_bytes + 110, 12}}, {.refcount = &grpc_static_metadata_refcounts[32], - .data.refcounted = {g_bytes + 374, 16}}}, + .data.refcounted = {g_bytes + 384, 8}}}, + {{.refcount = &grpc_static_metadata_refcounts[14], + .data.refcounted = {g_bytes + 158, 12}}, + {.refcount = &grpc_static_metadata_refcounts[33], + .data.refcounted = {g_bytes + 392, 16}}}, {{.refcount = &grpc_static_metadata_refcounts[1], .data.refcounted = {g_bytes + 5, 7}}, - {.refcount = &grpc_static_metadata_refcounts[33], - .data.refcounted = {g_bytes + 390, 4}}}, - {{.refcount = &grpc_static_metadata_refcounts[2], - .data.refcounted = {g_bytes + 12, 7}}, {.refcount = &grpc_static_metadata_refcounts[34], - .data.refcounted = {g_bytes + 394, 3}}}, + .data.refcounted = {g_bytes + 408, 4}}}, {{.refcount = &grpc_static_metadata_refcounts[2], .data.refcounted = {g_bytes + 12, 7}}, {.refcount = &grpc_static_metadata_refcounts[35], - .data.refcounted = {g_bytes + 397, 3}}}, - {{.refcount = &grpc_static_metadata_refcounts[4], - .data.refcounted = {g_bytes + 29, 7}}, + .data.refcounted = {g_bytes + 412, 3}}}, + {{.refcount = &grpc_static_metadata_refcounts[2], + .data.refcounted = {g_bytes + 12, 7}}, {.refcount = &grpc_static_metadata_refcounts[36], - .data.refcounted = {g_bytes + 400, 4}}}, + .data.refcounted = {g_bytes + 415, 3}}}, {{.refcount = &grpc_static_metadata_refcounts[4], .data.refcounted = {g_bytes + 29, 7}}, {.refcount = &grpc_static_metadata_refcounts[37], - .data.refcounted = {g_bytes + 404, 5}}}, + .data.refcounted = {g_bytes + 418, 4}}}, {{.refcount = &grpc_static_metadata_refcounts[4], .data.refcounted = {g_bytes + 29, 7}}, {.refcount = &grpc_static_metadata_refcounts[38], - .data.refcounted = {g_bytes + 409, 4}}}, + .data.refcounted = {g_bytes + 422, 5}}}, + {{.refcount = &grpc_static_metadata_refcounts[4], + .data.refcounted = {g_bytes + 29, 7}}, + {.refcount = &grpc_static_metadata_refcounts[39], + .data.refcounted = {g_bytes + 427, 4}}}, {{.refcount = &grpc_static_metadata_refcounts[3], .data.refcounted = {g_bytes + 19, 10}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[1], .data.refcounted = {g_bytes + 5, 7}}, - {.refcount = &grpc_static_metadata_refcounts[39], - .data.refcounted = {g_bytes + 413, 3}}}, + {.refcount = &grpc_static_metadata_refcounts[40], + .data.refcounted = {g_bytes + 431, 3}}}, {{.refcount = &grpc_static_metadata_refcounts[1], .data.refcounted = {g_bytes + 5, 7}}, - {.refcount = &grpc_static_metadata_refcounts[40], - .data.refcounted = {g_bytes + 416, 3}}}, - {{.refcount = &grpc_static_metadata_refcounts[0], - .data.refcounted = {g_bytes + 0, 5}}, {.refcount = &grpc_static_metadata_refcounts[41], - .data.refcounted = {g_bytes + 419, 1}}}, + .data.refcounted = {g_bytes + 434, 3}}}, {{.refcount = &grpc_static_metadata_refcounts[0], .data.refcounted = {g_bytes + 0, 5}}, {.refcount = &grpc_static_metadata_refcounts[42], - .data.refcounted = {g_bytes + 420, 11}}}, - {{.refcount = &grpc_static_metadata_refcounts[2], - .data.refcounted = {g_bytes + 12, 7}}, + .data.refcounted = {g_bytes + 437, 1}}}, + {{.refcount = &grpc_static_metadata_refcounts[0], + .data.refcounted = {g_bytes + 0, 5}}, {.refcount = &grpc_static_metadata_refcounts[43], - .data.refcounted = {g_bytes + 431, 3}}}, + .data.refcounted = {g_bytes + 438, 11}}}, {{.refcount = &grpc_static_metadata_refcounts[2], .data.refcounted = {g_bytes + 12, 7}}, {.refcount = &grpc_static_metadata_refcounts[44], - .data.refcounted = {g_bytes + 434, 3}}}, + .data.refcounted = {g_bytes + 449, 3}}}, {{.refcount = &grpc_static_metadata_refcounts[2], .data.refcounted = {g_bytes + 12, 7}}, {.refcount = &grpc_static_metadata_refcounts[45], - .data.refcounted = {g_bytes + 437, 3}}}, + .data.refcounted = {g_bytes + 452, 3}}}, {{.refcount = &grpc_static_metadata_refcounts[2], .data.refcounted = {g_bytes + 12, 7}}, {.refcount = &grpc_static_metadata_refcounts[46], - .data.refcounted = {g_bytes + 440, 3}}}, + .data.refcounted = {g_bytes + 455, 3}}}, {{.refcount = &grpc_static_metadata_refcounts[2], .data.refcounted = {g_bytes + 12, 7}}, {.refcount = &grpc_static_metadata_refcounts[47], - .data.refcounted = {g_bytes + 443, 3}}}, - {{.refcount = &grpc_static_metadata_refcounts[48], - .data.refcounted = {g_bytes + 446, 14}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[49], - .data.refcounted = {g_bytes + 460, 15}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 458, 3}}}, + {{.refcount = &grpc_static_metadata_refcounts[2], + .data.refcounted = {g_bytes + 12, 7}}, + {.refcount = &grpc_static_metadata_refcounts[48], + .data.refcounted = {g_bytes + 461, 3}}}, {{.refcount = &grpc_static_metadata_refcounts[49], - .data.refcounted = {g_bytes + 460, 15}}, - {.refcount = &grpc_static_metadata_refcounts[50], - .data.refcounted = {g_bytes + 475, 13}}}, - {{.refcount = &grpc_static_metadata_refcounts[51], - .data.refcounted = {g_bytes + 488, 15}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 464, 14}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, + {{.refcount = &grpc_static_metadata_refcounts[50], + .data.refcounted = {g_bytes + 478, 15}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, + {{.refcount = &grpc_static_metadata_refcounts[50], + .data.refcounted = {g_bytes + 478, 15}}, + {.refcount = &grpc_static_metadata_refcounts[51], + .data.refcounted = {g_bytes + 493, 13}}}, {{.refcount = &grpc_static_metadata_refcounts[52], - .data.refcounted = {g_bytes + 503, 13}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 506, 15}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[53], - .data.refcounted = {g_bytes + 516, 6}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 521, 13}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[54], - .data.refcounted = {g_bytes + 522, 27}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 534, 6}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[55], - .data.refcounted = {g_bytes + 549, 3}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 540, 27}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[56], - .data.refcounted = {g_bytes + 552, 5}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 567, 3}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[57], - .data.refcounted = {g_bytes + 557, 13}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 570, 5}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[58], - .data.refcounted = {g_bytes + 570, 13}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 575, 13}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[59], - .data.refcounted = {g_bytes + 583, 19}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 588, 13}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[60], - .data.refcounted = {g_bytes + 602, 16}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 601, 19}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[61], - .data.refcounted = {g_bytes + 618, 16}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 620, 16}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[62], - .data.refcounted = {g_bytes + 634, 14}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 636, 16}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[63], - .data.refcounted = {g_bytes + 648, 16}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 652, 14}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[64], - .data.refcounted = {g_bytes + 664, 13}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[11], - .data.refcounted = {g_bytes + 110, 12}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 666, 16}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[65], - .data.refcounted = {g_bytes + 677, 6}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 682, 13}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, + {{.refcount = &grpc_static_metadata_refcounts[14], + .data.refcounted = {g_bytes + 158, 12}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[66], - .data.refcounted = {g_bytes + 683, 4}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 695, 6}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[67], - .data.refcounted = {g_bytes + 687, 4}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 701, 4}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[68], - .data.refcounted = {g_bytes + 691, 6}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 705, 4}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[69], - .data.refcounted = {g_bytes + 697, 7}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 709, 6}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[70], - .data.refcounted = {g_bytes + 704, 4}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[14], - .data.refcounted = {g_bytes + 162, 4}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 715, 7}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[71], - .data.refcounted = {g_bytes + 708, 8}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 722, 4}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, + {{.refcount = &grpc_static_metadata_refcounts[17], + .data.refcounted = {g_bytes + 210, 4}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[72], - .data.refcounted = {g_bytes + 716, 17}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 726, 8}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[73], - .data.refcounted = {g_bytes + 733, 13}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 734, 17}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[74], - .data.refcounted = {g_bytes + 746, 8}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 751, 13}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[75], - .data.refcounted = {g_bytes + 754, 19}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 764, 8}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[76], - .data.refcounted = {g_bytes + 773, 13}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[15], - .data.refcounted = {g_bytes + 166, 8}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 772, 19}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[77], - .data.refcounted = {g_bytes + 786, 4}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 791, 13}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, + {{.refcount = &grpc_static_metadata_refcounts[18], + .data.refcounted = {g_bytes + 214, 8}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[78], - .data.refcounted = {g_bytes + 790, 8}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 804, 4}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[79], - .data.refcounted = {g_bytes + 798, 12}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 808, 8}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[80], - .data.refcounted = {g_bytes + 810, 18}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 816, 12}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[81], - .data.refcounted = {g_bytes + 828, 19}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 828, 18}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[82], - .data.refcounted = {g_bytes + 847, 5}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 846, 19}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[83], - .data.refcounted = {g_bytes + 852, 7}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 865, 5}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[84], - .data.refcounted = {g_bytes + 859, 7}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 870, 7}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[85], - .data.refcounted = {g_bytes + 866, 11}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 877, 7}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[86], - .data.refcounted = {g_bytes + 877, 6}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 884, 11}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[87], - .data.refcounted = {g_bytes + 883, 10}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 895, 6}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[88], - .data.refcounted = {g_bytes + 893, 25}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 901, 10}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[89], - .data.refcounted = {g_bytes + 918, 17}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[13], - .data.refcounted = {g_bytes + 152, 10}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 911, 25}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[90], - .data.refcounted = {g_bytes + 935, 4}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 936, 17}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, + {{.refcount = &grpc_static_metadata_refcounts[16], + .data.refcounted = {g_bytes + 200, 10}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[91], - .data.refcounted = {g_bytes + 939, 3}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 953, 4}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[92], - .data.refcounted = {g_bytes + 942, 16}}, - {.refcount = &grpc_static_metadata_refcounts[19], - .data.refcounted = {g_bytes + 216, 0}}}, + .data.refcounted = {g_bytes + 957, 3}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, + {{.refcount = &grpc_static_metadata_refcounts[93], + .data.refcounted = {g_bytes + 960, 16}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[10], .data.refcounted = {g_bytes + 90, 20}}, - {.refcount = &grpc_static_metadata_refcounts[28], - .data.refcounted = {g_bytes + 347, 8}}}, - {{.refcount = &grpc_static_metadata_refcounts[10], - .data.refcounted = {g_bytes + 90, 20}}, - {.refcount = &grpc_static_metadata_refcounts[30], - .data.refcounted = {g_bytes + 359, 7}}}, + {.refcount = &grpc_static_metadata_refcounts[29], + .data.refcounted = {g_bytes + 365, 8}}}, {{.refcount = &grpc_static_metadata_refcounts[10], .data.refcounted = {g_bytes + 90, 20}}, - {.refcount = &grpc_static_metadata_refcounts[93], - .data.refcounted = {g_bytes + 958, 16}}}, + {.refcount = &grpc_static_metadata_refcounts[31], + .data.refcounted = {g_bytes + 377, 7}}}, {{.refcount = &grpc_static_metadata_refcounts[10], .data.refcounted = {g_bytes + 90, 20}}, - {.refcount = &grpc_static_metadata_refcounts[29], - .data.refcounted = {g_bytes + 355, 4}}}, + {.refcount = &grpc_static_metadata_refcounts[94], + .data.refcounted = {g_bytes + 976, 16}}}, {{.refcount = &grpc_static_metadata_refcounts[10], .data.refcounted = {g_bytes + 90, 20}}, - {.refcount = &grpc_static_metadata_refcounts[94], - .data.refcounted = {g_bytes + 974, 13}}}, + {.refcount = &grpc_static_metadata_refcounts[30], + .data.refcounted = {g_bytes + 373, 4}}}, {{.refcount = &grpc_static_metadata_refcounts[10], .data.refcounted = {g_bytes + 90, 20}}, {.refcount = &grpc_static_metadata_refcounts[95], - .data.refcounted = {g_bytes + 987, 12}}}, + .data.refcounted = {g_bytes + 992, 13}}}, {{.refcount = &grpc_static_metadata_refcounts[10], .data.refcounted = {g_bytes + 90, 20}}, {.refcount = &grpc_static_metadata_refcounts[96], - .data.refcounted = {g_bytes + 999, 21}}}, + .data.refcounted = {g_bytes + 1005, 12}}}, + {{.refcount = &grpc_static_metadata_refcounts[10], + .data.refcounted = {g_bytes + 90, 20}}, + {.refcount = &grpc_static_metadata_refcounts[97], + .data.refcounted = {g_bytes + 1017, 21}}}, }; const uint8_t grpc_static_accept_encoding_metadata[8] = {0, 73, 74, 75, 76, 77, 78, 79}; diff --git a/src/core/lib/transport/static_metadata.h b/src/core/lib/transport/static_metadata.h index f9600ee2e4e..dcbe418edc5 100644 --- a/src/core/lib/transport/static_metadata.h +++ b/src/core/lib/transport/static_metadata.h @@ -44,7 +44,7 @@ #include "src/core/lib/transport/metadata.h" -#define GRPC_STATIC_MDSTR_COUNT 97 +#define GRPC_STATIC_MDSTR_COUNT 98 extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]; /* ":path" */ #define GRPC_MDSTR_PATH (grpc_static_slice_table[0]) @@ -68,182 +68,184 @@ extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]; #define GRPC_MDSTR_GRPC_ENCODING (grpc_static_slice_table[9]) /* "grpc-accept-encoding" */ #define GRPC_MDSTR_GRPC_ACCEPT_ENCODING (grpc_static_slice_table[10]) +/* "grpc-server-stats-bin" */ +#define GRPC_MDSTR_GRPC_SERVER_STATS_BIN (grpc_static_slice_table[11]) +/* "grpc-tags-bin" */ +#define GRPC_MDSTR_GRPC_TAGS_BIN (grpc_static_slice_table[12]) +/* "grpc-trace-bin" */ +#define GRPC_MDSTR_GRPC_TRACE_BIN (grpc_static_slice_table[13]) /* "content-type" */ -#define GRPC_MDSTR_CONTENT_TYPE (grpc_static_slice_table[11]) +#define GRPC_MDSTR_CONTENT_TYPE (grpc_static_slice_table[14]) /* "grpc-internal-encoding-request" */ -#define GRPC_MDSTR_GRPC_INTERNAL_ENCODING_REQUEST (grpc_static_slice_table[12]) +#define GRPC_MDSTR_GRPC_INTERNAL_ENCODING_REQUEST (grpc_static_slice_table[15]) /* "user-agent" */ -#define GRPC_MDSTR_USER_AGENT (grpc_static_slice_table[13]) +#define GRPC_MDSTR_USER_AGENT (grpc_static_slice_table[16]) /* "host" */ -#define GRPC_MDSTR_HOST (grpc_static_slice_table[14]) +#define GRPC_MDSTR_HOST (grpc_static_slice_table[17]) /* "lb-token" */ -#define GRPC_MDSTR_LB_TOKEN (grpc_static_slice_table[15]) +#define GRPC_MDSTR_LB_TOKEN (grpc_static_slice_table[18]) /* "grpc-timeout" */ -#define GRPC_MDSTR_GRPC_TIMEOUT (grpc_static_slice_table[16]) -/* "grpc-tracing-bin" */ -#define GRPC_MDSTR_GRPC_TRACING_BIN (grpc_static_slice_table[17]) -/* "grpc-stats-bin" */ -#define GRPC_MDSTR_GRPC_STATS_BIN (grpc_static_slice_table[18]) +#define GRPC_MDSTR_GRPC_TIMEOUT (grpc_static_slice_table[19]) /* "" */ -#define GRPC_MDSTR_EMPTY (grpc_static_slice_table[19]) +#define GRPC_MDSTR_EMPTY (grpc_static_slice_table[20]) /* "grpc.wait_for_ready" */ -#define GRPC_MDSTR_GRPC_DOT_WAIT_FOR_READY (grpc_static_slice_table[20]) +#define GRPC_MDSTR_GRPC_DOT_WAIT_FOR_READY (grpc_static_slice_table[21]) /* "grpc.timeout" */ -#define GRPC_MDSTR_GRPC_DOT_TIMEOUT (grpc_static_slice_table[21]) +#define GRPC_MDSTR_GRPC_DOT_TIMEOUT (grpc_static_slice_table[22]) /* "grpc.max_request_message_bytes" */ #define GRPC_MDSTR_GRPC_DOT_MAX_REQUEST_MESSAGE_BYTES \ - (grpc_static_slice_table[22]) + (grpc_static_slice_table[23]) /* "grpc.max_response_message_bytes" */ #define GRPC_MDSTR_GRPC_DOT_MAX_RESPONSE_MESSAGE_BYTES \ - (grpc_static_slice_table[23]) + (grpc_static_slice_table[24]) /* "/grpc.lb.v1.LoadBalancer/BalanceLoad" */ #define GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD \ - (grpc_static_slice_table[24]) + (grpc_static_slice_table[25]) /* "0" */ -#define GRPC_MDSTR_0 (grpc_static_slice_table[25]) +#define GRPC_MDSTR_0 (grpc_static_slice_table[26]) /* "1" */ -#define GRPC_MDSTR_1 (grpc_static_slice_table[26]) +#define GRPC_MDSTR_1 (grpc_static_slice_table[27]) /* "2" */ -#define GRPC_MDSTR_2 (grpc_static_slice_table[27]) +#define GRPC_MDSTR_2 (grpc_static_slice_table[28]) /* "identity" */ -#define GRPC_MDSTR_IDENTITY (grpc_static_slice_table[28]) +#define GRPC_MDSTR_IDENTITY (grpc_static_slice_table[29]) /* "gzip" */ -#define GRPC_MDSTR_GZIP (grpc_static_slice_table[29]) +#define GRPC_MDSTR_GZIP (grpc_static_slice_table[30]) /* "deflate" */ -#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table[30]) +#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table[31]) /* "trailers" */ -#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table[31]) +#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table[32]) /* "application/grpc" */ -#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table[32]) +#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table[33]) /* "POST" */ -#define GRPC_MDSTR_POST (grpc_static_slice_table[33]) +#define GRPC_MDSTR_POST (grpc_static_slice_table[34]) /* "200" */ -#define GRPC_MDSTR_200 (grpc_static_slice_table[34]) +#define GRPC_MDSTR_200 (grpc_static_slice_table[35]) /* "404" */ -#define GRPC_MDSTR_404 (grpc_static_slice_table[35]) +#define GRPC_MDSTR_404 (grpc_static_slice_table[36]) /* "http" */ -#define GRPC_MDSTR_HTTP (grpc_static_slice_table[36]) +#define GRPC_MDSTR_HTTP (grpc_static_slice_table[37]) /* "https" */ -#define GRPC_MDSTR_HTTPS (grpc_static_slice_table[37]) +#define GRPC_MDSTR_HTTPS (grpc_static_slice_table[38]) /* "grpc" */ -#define GRPC_MDSTR_GRPC (grpc_static_slice_table[38]) +#define GRPC_MDSTR_GRPC (grpc_static_slice_table[39]) /* "GET" */ -#define GRPC_MDSTR_GET (grpc_static_slice_table[39]) +#define GRPC_MDSTR_GET (grpc_static_slice_table[40]) /* "PUT" */ -#define GRPC_MDSTR_PUT (grpc_static_slice_table[40]) +#define GRPC_MDSTR_PUT (grpc_static_slice_table[41]) /* "/" */ -#define GRPC_MDSTR_SLASH (grpc_static_slice_table[41]) +#define GRPC_MDSTR_SLASH (grpc_static_slice_table[42]) /* "/index.html" */ -#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table[42]) +#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table[43]) /* "204" */ -#define GRPC_MDSTR_204 (grpc_static_slice_table[43]) +#define GRPC_MDSTR_204 (grpc_static_slice_table[44]) /* "206" */ -#define GRPC_MDSTR_206 (grpc_static_slice_table[44]) +#define GRPC_MDSTR_206 (grpc_static_slice_table[45]) /* "304" */ -#define GRPC_MDSTR_304 (grpc_static_slice_table[45]) +#define GRPC_MDSTR_304 (grpc_static_slice_table[46]) /* "400" */ -#define GRPC_MDSTR_400 (grpc_static_slice_table[46]) +#define GRPC_MDSTR_400 (grpc_static_slice_table[47]) /* "500" */ -#define GRPC_MDSTR_500 (grpc_static_slice_table[47]) +#define GRPC_MDSTR_500 (grpc_static_slice_table[48]) /* "accept-charset" */ -#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table[48]) +#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table[49]) /* "accept-encoding" */ -#define GRPC_MDSTR_ACCEPT_ENCODING (grpc_static_slice_table[49]) +#define GRPC_MDSTR_ACCEPT_ENCODING (grpc_static_slice_table[50]) /* "gzip, deflate" */ -#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table[50]) +#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table[51]) /* "accept-language" */ -#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table[51]) +#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table[52]) /* "accept-ranges" */ -#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table[52]) +#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table[53]) /* "accept" */ -#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table[53]) +#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table[54]) /* "access-control-allow-origin" */ -#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table[54]) +#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table[55]) /* "age" */ -#define GRPC_MDSTR_AGE (grpc_static_slice_table[55]) +#define GRPC_MDSTR_AGE (grpc_static_slice_table[56]) /* "allow" */ -#define GRPC_MDSTR_ALLOW (grpc_static_slice_table[56]) +#define GRPC_MDSTR_ALLOW (grpc_static_slice_table[57]) /* "authorization" */ -#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table[57]) +#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table[58]) /* "cache-control" */ -#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table[58]) +#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table[59]) /* "content-disposition" */ -#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table[59]) +#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table[60]) /* "content-encoding" */ -#define GRPC_MDSTR_CONTENT_ENCODING (grpc_static_slice_table[60]) +#define GRPC_MDSTR_CONTENT_ENCODING (grpc_static_slice_table[61]) /* "content-language" */ -#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table[61]) +#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table[62]) /* "content-length" */ -#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table[62]) +#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table[63]) /* "content-location" */ -#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table[63]) +#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table[64]) /* "content-range" */ -#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table[64]) +#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table[65]) /* "cookie" */ -#define GRPC_MDSTR_COOKIE (grpc_static_slice_table[65]) +#define GRPC_MDSTR_COOKIE (grpc_static_slice_table[66]) /* "date" */ -#define GRPC_MDSTR_DATE (grpc_static_slice_table[66]) +#define GRPC_MDSTR_DATE (grpc_static_slice_table[67]) /* "etag" */ -#define GRPC_MDSTR_ETAG (grpc_static_slice_table[67]) +#define GRPC_MDSTR_ETAG (grpc_static_slice_table[68]) /* "expect" */ -#define GRPC_MDSTR_EXPECT (grpc_static_slice_table[68]) +#define GRPC_MDSTR_EXPECT (grpc_static_slice_table[69]) /* "expires" */ -#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table[69]) +#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table[70]) /* "from" */ -#define GRPC_MDSTR_FROM (grpc_static_slice_table[70]) +#define GRPC_MDSTR_FROM (grpc_static_slice_table[71]) /* "if-match" */ -#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table[71]) +#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table[72]) /* "if-modified-since" */ -#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table[72]) +#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table[73]) /* "if-none-match" */ -#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table[73]) +#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table[74]) /* "if-range" */ -#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table[74]) +#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table[75]) /* "if-unmodified-since" */ -#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[75]) +#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[76]) /* "last-modified" */ -#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[76]) +#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[77]) /* "link" */ -#define GRPC_MDSTR_LINK (grpc_static_slice_table[77]) +#define GRPC_MDSTR_LINK (grpc_static_slice_table[78]) /* "location" */ -#define GRPC_MDSTR_LOCATION (grpc_static_slice_table[78]) +#define GRPC_MDSTR_LOCATION (grpc_static_slice_table[79]) /* "max-forwards" */ -#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[79]) +#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[80]) /* "proxy-authenticate" */ -#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[80]) +#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[81]) /* "proxy-authorization" */ -#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[81]) +#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[82]) /* "range" */ -#define GRPC_MDSTR_RANGE (grpc_static_slice_table[82]) +#define GRPC_MDSTR_RANGE (grpc_static_slice_table[83]) /* "referer" */ -#define GRPC_MDSTR_REFERER (grpc_static_slice_table[83]) +#define GRPC_MDSTR_REFERER (grpc_static_slice_table[84]) /* "refresh" */ -#define GRPC_MDSTR_REFRESH (grpc_static_slice_table[84]) +#define GRPC_MDSTR_REFRESH (grpc_static_slice_table[85]) /* "retry-after" */ -#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[85]) +#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[86]) /* "server" */ -#define GRPC_MDSTR_SERVER (grpc_static_slice_table[86]) +#define GRPC_MDSTR_SERVER (grpc_static_slice_table[87]) /* "set-cookie" */ -#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[87]) +#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[88]) /* "strict-transport-security" */ -#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[88]) +#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[89]) /* "transfer-encoding" */ -#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[89]) +#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[90]) /* "vary" */ -#define GRPC_MDSTR_VARY (grpc_static_slice_table[90]) +#define GRPC_MDSTR_VARY (grpc_static_slice_table[91]) /* "via" */ -#define GRPC_MDSTR_VIA (grpc_static_slice_table[91]) +#define GRPC_MDSTR_VIA (grpc_static_slice_table[92]) /* "www-authenticate" */ -#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[92]) +#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[93]) /* "identity,deflate" */ -#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[93]) +#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[94]) /* "identity,gzip" */ -#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[94]) +#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[95]) /* "deflate,gzip" */ -#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[95]) +#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[96]) /* "identity,deflate,gzip" */ #define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \ - (grpc_static_slice_table[96]) + (grpc_static_slice_table[97]) extern const grpc_slice_refcount_vtable grpc_static_metadata_vtable; extern grpc_slice_refcount @@ -512,6 +514,9 @@ typedef enum { GRPC_BATCH_GRPC_PAYLOAD_BIN, GRPC_BATCH_GRPC_ENCODING, GRPC_BATCH_GRPC_ACCEPT_ENCODING, + GRPC_BATCH_GRPC_SERVER_STATS_BIN, + GRPC_BATCH_GRPC_TAGS_BIN, + GRPC_BATCH_GRPC_TRACE_BIN, GRPC_BATCH_CONTENT_TYPE, GRPC_BATCH_GRPC_INTERNAL_ENCODING_REQUEST, GRPC_BATCH_USER_AGENT, @@ -534,6 +539,9 @@ typedef union { struct grpc_linked_mdelem *grpc_payload_bin; struct grpc_linked_mdelem *grpc_encoding; struct grpc_linked_mdelem *grpc_accept_encoding; + struct grpc_linked_mdelem *grpc_server_stats_bin; + struct grpc_linked_mdelem *grpc_tags_bin; + struct grpc_linked_mdelem *grpc_trace_bin; struct grpc_linked_mdelem *content_type; struct grpc_linked_mdelem *grpc_internal_encoding_request; struct grpc_linked_mdelem *user_agent; diff --git a/test/core/end2end/fuzzers/hpack.dictionary b/test/core/end2end/fuzzers/hpack.dictionary index 6b967854191..4282c612146 100644 --- a/test/core/end2end/fuzzers/hpack.dictionary +++ b/test/core/end2end/fuzzers/hpack.dictionary @@ -10,14 +10,15 @@ "\x10grpc-payload-bin" "\x0Dgrpc-encoding" "\x14grpc-accept-encoding" +"\x15grpc-server-stats-bin" +"\x0Dgrpc-tags-bin" +"\x0Egrpc-trace-bin" "\x0Ccontent-type" "\x1Egrpc-internal-encoding-request" "\x0Auser-agent" "\x04host" "\x08lb-token" "\x0Cgrpc-timeout" -"\x10grpc-tracing-bin" -"\x0Egrpc-stats-bin" "\x00" "\x13grpc.wait_for_ready" "\x0Cgrpc.timeout" diff --git a/tools/codegen/core/gen_static_metadata.py b/tools/codegen/core/gen_static_metadata.py index 109701f740b..ead57b2bf6d 100755 --- a/tools/codegen/core/gen_static_metadata.py +++ b/tools/codegen/core/gen_static_metadata.py @@ -56,8 +56,9 @@ CONFIG = [ ':authority', 'grpc-message', 'grpc-status', - 'grpc-tracing-bin', - 'grpc-stats-bin', + 'grpc-server-stats-bin', + 'grpc-tags-bin', + 'grpc-trace-bin', '', # channel arg keys 'grpc.wait_for_ready', @@ -154,6 +155,9 @@ METADATA_BATCH_CALLOUTS = [ 'grpc-payload-bin', 'grpc-encoding', 'grpc-accept-encoding', + 'grpc-server-stats-bin', + 'grpc-tags-bin', + 'grpc-trace-bin', 'content-type', 'grpc-internal-encoding-request', 'user-agent', @@ -167,6 +171,7 @@ COMPRESSION_ALGORITHMS = [ 'gzip', ] + # utility: mangle the name of a config def mangle(elem, name=None): xl = { @@ -177,43 +182,56 @@ def mangle(elem, name=None): ',': 'comma', ' ': '_', } + def m0(x): - if not x: return 'empty' + if not x: + return 'empty' r = '' for c in x: put = xl.get(c, c.lower()) - if not put: continue + if not put: + continue last_is_underscore = r[-1] == '_' if r else True - if last_is_underscore and put == '_': continue + if last_is_underscore and put == '_': + continue elif len(put) > 1: - if not last_is_underscore: r += '_' + if not last_is_underscore: + r += '_' r += put r += '_' else: r += put - if r[-1] == '_': r = r[:-1] + if r[-1] == '_': + r = r[:-1] return r + def n(default, name=name): - if name is None: return 'grpc_%s_' % default - if name == '': return '' + if name is None: + return 'grpc_%s_' % default + if name == '': + return '' return 'grpc_%s_' % name + if isinstance(elem, tuple): return '%s%s_%s' % (n('mdelem'), m0(elem[0]), m0(elem[1])) else: return '%s%s' % (n('mdstr'), m0(elem)) + # utility: generate some hash value for a string def fake_hash(elem): return hashlib.md5(elem).hexdigest()[0:8] + # utility: print a big comment block into a set of files def put_banner(files, banner): for f in files: - print >>f, '/*' + print >> f, '/*' for line in banner: - print >>f, ' * %s' % line - print >>f, ' */' - print >>f + print >> f, ' * %s' % line + print >> f, ' */' + print >> f + # build a list of all the strings we need all_strs = list() @@ -236,7 +254,7 @@ for elem in CONFIG: if elem not in all_strs: all_strs.append(elem) compression_elems = [] -for mask in range(1, 1<>H, '#ifndef GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H' -print >>H, '#define GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H' -print >>H -print >>H, '#include "src/core/lib/transport/metadata.h"' -print >>H +print >> H, '#ifndef GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H' +print >> H, '#define GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H' +print >> H +print >> H, '#include "src/core/lib/transport/metadata.h"' +print >> H -print >>C, '#include "src/core/lib/transport/static_metadata.h"' -print >>C -print >>C, '#include "src/core/lib/slice/slice_internal.h"' -print >>C +print >> C, '#include "src/core/lib/transport/static_metadata.h"' +print >> C +print >> C, '#include "src/core/lib/slice/slice_internal.h"' +print >> C str_ofs = 0 id2strofs = {} for i, elem in enumerate(all_strs): id2strofs[i] = str_ofs - str_ofs += len(elem); + str_ofs += len(elem) + + def slice_def(i): - return '{.refcount = &grpc_static_metadata_refcounts[%d], .data.refcounted = {g_bytes+%d, %d}}' % (i, id2strofs[i], len(all_strs[i])) + return ('{.refcount = &grpc_static_metadata_refcounts[%d], .data.refcounted =' + ' {g_bytes+%d, %d}}') % ( + i, id2strofs[i], len(all_strs[i])) + # validate configuration for elem in METADATA_BATCH_CALLOUTS: assert elem in all_strs -print >>H, '#define GRPC_STATIC_MDSTR_COUNT %d' % len(all_strs) -print >>H, 'extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT];' +print >> H, '#define GRPC_STATIC_MDSTR_COUNT %d' % len(all_strs) +print >> H, ('extern const grpc_slice ' + 'grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT];') for i, elem in enumerate(all_strs): - print >>H, '/* "%s" */' % elem - print >>H, '#define %s (grpc_static_slice_table[%d])' % (mangle(elem).upper(), i) -print >>H -print >>C, 'static uint8_t g_bytes[] = {%s};' % (','.join('%d' % ord(c) for c in ''.join(all_strs))) -print >>C -print >>C, 'static void static_ref(void *unused) {}' -print >>C, 'static void static_unref(grpc_exec_ctx *exec_ctx, void *unused) {}' -print >>C, 'static const grpc_slice_refcount_vtable static_sub_vtable = {static_ref, static_unref, grpc_slice_default_eq_impl, grpc_slice_default_hash_impl};'; -print >>H, 'extern const grpc_slice_refcount_vtable grpc_static_metadata_vtable;'; -print >>C, 'const grpc_slice_refcount_vtable grpc_static_metadata_vtable = {static_ref, static_unref, grpc_static_slice_eq, grpc_static_slice_hash};'; -print >>C, 'static grpc_slice_refcount static_sub_refcnt = {&static_sub_vtable, &static_sub_refcnt};'; -print >>H, 'extern grpc_slice_refcount grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT];' -print >>C, 'grpc_slice_refcount grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT] = {' + print >> H, '/* "%s" */' % elem + print >> H, '#define %s (grpc_static_slice_table[%d])' % ( + mangle(elem).upper(), i) +print >> H +print >> C, 'static uint8_t g_bytes[] = {%s};' % ( + ','.join('%d' % ord(c) for c in ''.join(all_strs))) +print >> C +print >> C, 'static void static_ref(void *unused) {}' +print >> C, 'static void static_unref(grpc_exec_ctx *exec_ctx, void *unused) {}' +print >> C, ('static const grpc_slice_refcount_vtable static_sub_vtable = ' + '{static_ref, static_unref, grpc_slice_default_eq_impl, ' + 'grpc_slice_default_hash_impl};') +print >> H, ('extern const grpc_slice_refcount_vtable ' + 'grpc_static_metadata_vtable;') +print >> C, ('const grpc_slice_refcount_vtable grpc_static_metadata_vtable = ' + '{static_ref, static_unref, grpc_static_slice_eq, ' + 'grpc_static_slice_hash};') +print >> C, ('static grpc_slice_refcount static_sub_refcnt = ' + '{&static_sub_vtable, &static_sub_refcnt};') +print >> H, ('extern grpc_slice_refcount ' + 'grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT];') +print >> C, ('grpc_slice_refcount ' + 'grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT] = {') for i, elem in enumerate(all_strs): - print >>C, ' {&grpc_static_metadata_vtable, &static_sub_refcnt},' -print >>C, '};' -print >>C -print >>H, '#define GRPC_IS_STATIC_METADATA_STRING(slice) \\' -print >>H, ' ((slice).refcount != NULL && (slice).refcount->vtable == &grpc_static_metadata_vtable)' -print >>H -print >>C, 'const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = {' + print >> C, ' {&grpc_static_metadata_vtable, &static_sub_refcnt},' +print >> C, '};' +print >> C +print >> H, '#define GRPC_IS_STATIC_METADATA_STRING(slice) \\' +print >> H, (' ((slice).refcount != NULL && (slice).refcount->vtable == ' + '&grpc_static_metadata_vtable)') +print >> H +print >> C, ('const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]' + ' = {') for i, elem in enumerate(all_strs): - print >>C, slice_def(i) + ',' -print >>C, '};' -print >>C -print >>H, '#define GRPC_STATIC_METADATA_INDEX(static_slice) \\' -print >>H, ' ((int)((static_slice).refcount - grpc_static_metadata_refcounts))' -print >>H - -print >>D, '# hpack fuzzing dictionary' + print >> C, slice_def(i) + ',' +print >> C, '};' +print >> C +print >> H, '#define GRPC_STATIC_METADATA_INDEX(static_slice) \\' +print >> H, (' ((int)((static_slice).refcount - ' + 'grpc_static_metadata_refcounts))') +print >> H + +print >> D, '# hpack fuzzing dictionary' for i, elem in enumerate(all_strs): - print >>D, '%s' % (esc_dict([len(elem)] + [ord(c) for c in elem])) + print >> D, '%s' % (esc_dict([len(elem)] + [ord(c) for c in elem])) for i, elem in enumerate(all_elems): - print >>D, '%s' % (esc_dict([0, len(elem[0])] + [ord(c) for c in elem[0]] + - [len(elem[1])] + [ord(c) for c in elem[1]])) - -print >>H, '#define GRPC_STATIC_MDELEM_COUNT %d' % len(all_elems) -print >>H, 'extern grpc_mdelem_data grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];' -print >>H, 'extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT];' + print >> D, '%s' % (esc_dict([0, len(elem[0])] + [ord(c) for c in elem[0]] + + [len(elem[1])] + [ord(c) for c in elem[1]])) + +print >> H, '#define GRPC_STATIC_MDELEM_COUNT %d' % len(all_elems) +print >> H, ('extern grpc_mdelem_data ' + 'grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];') +print >> H, ('extern uintptr_t ' + 'grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT];') for i, elem in enumerate(all_elems): - print >>H, '/* "%s": "%s" */' % elem - print >>H, '#define %s (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[%d], GRPC_MDELEM_STORAGE_STATIC))' % (mangle(elem).upper(), i) -print >>H -print >>C, 'uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = {' -print >>C, ' %s' % ','.join('%d' % static_userdata.get(elem, 0) for elem in all_elems) -print >>C, '};' -print >>C + print >> H, '/* "%s": "%s" */' % elem + print >> H, ('#define %s (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[%d], ' + 'GRPC_MDELEM_STORAGE_STATIC))') % ( + mangle(elem).upper(), i) +print >> H +print >> C, ('uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] ' + '= {') +print >> C, ' %s' % ','.join('%d' % static_userdata.get(elem, 0) + for elem in all_elems) +print >> C, '};' +print >> C + def str_idx(s): for i, s2 in enumerate(all_strs): if s == s2: return i + def md_idx(m): for i, m2 in enumerate(all_elems): if m == m2: return i + def offset_trials(mink): yield 0 for i in range(1, 100): for mul in [-1, 1]: yield mul * i + def perfect_hash(keys, name): p = perfection.hash_parameters(keys) + def f(i, p=p): i += p.offset x = i % p.t y = i / p.t return x + p.r[y] + return { - 'PHASHRANGE': p.t - 1 + max(p.r), - 'PHASHNKEYS': len(p.slots), - 'pyfunc': f, - 'code': """ + 'PHASHRANGE': + p.t - 1 + max(p.r), + 'PHASHNKEYS': + len(p.slots), + 'pyfunc': + f, + 'code': + """ static const int8_t %(name)s_r[] = {%(r)s}; static uint32_t %(name)s_phash(uint32_t i) { i %(offset_sign)s= %(offset)d; @@ -430,71 +489,77 @@ static uint32_t %(name)s_phash(uint32_t i) { return h; } """ % { - 'name': name, - 'r': ','.join('%d' % (r if r is not None else 0) for r in p.r), - 't': p.t, - 'offset': abs(p.offset), - 'offset_sign': '+' if p.offset > 0 else '-' + 'name': name, + 'r': ','.join('%d' % (r if r is not None else 0) for r in p.r), + 't': p.t, + 'offset': abs(p.offset), + 'offset_sign': '+' if p.offset > 0 else '-' } } -elem_keys = [str_idx(elem[0]) * len(all_strs) + str_idx(elem[1]) for elem in all_elems] -elem_hash = perfect_hash(elem_keys, "elems") -print >>C, elem_hash['code'] +elem_keys = [ + str_idx(elem[0]) * len(all_strs) + str_idx(elem[1]) for elem in all_elems +] +elem_hash = perfect_hash(elem_keys, 'elems') +print >> C, elem_hash['code'] keys = [0] * int(elem_hash['PHASHRANGE']) idxs = [255] * int(elem_hash['PHASHNKEYS']) for i, k in enumerate(elem_keys): - h = elem_hash['pyfunc'](k) - assert keys[h] == 0 - keys[h] = k - idxs[h] = i -print >>C, 'static const uint16_t elem_keys[] = {%s};' % ','.join('%d' % k for k in keys) -print >>C, 'static const uint8_t elem_idxs[] = {%s};' % ','.join('%d' % i for i in idxs) -print >>C - -print >>H, 'grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b);' -print >>C, 'grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b) {' -print >>C, ' if (a == -1 || b == -1) return GRPC_MDNULL;' -print >>C, ' uint32_t k = (uint32_t)(a * %d + b);' % len(all_strs) -print >>C, ' uint32_t h = elems_phash(k);' -print >>C, ' return h < GPR_ARRAY_SIZE(elem_keys) && elem_keys[h] == k ? GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[elem_idxs[h]], GRPC_MDELEM_STORAGE_STATIC) : GRPC_MDNULL;' -print >>C, '}' -print >>C - -print >>C, 'grpc_mdelem_data grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = {' + h = elem_hash['pyfunc'](k) + assert keys[h] == 0 + keys[h] = k + idxs[h] = i +print >> C, 'static const uint16_t elem_keys[] = {%s};' % ','.join( + '%d' % k for k in keys) +print >> C, 'static const uint8_t elem_idxs[] = {%s};' % ','.join( + '%d' % i for i in idxs) +print >> C + +print >> H, 'grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b);' +print >> C, 'grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b) {' +print >> C, ' if (a == -1 || b == -1) return GRPC_MDNULL;' +print >> C, ' uint32_t k = (uint32_t)(a * %d + b);' % len(all_strs) +print >> C, ' uint32_t h = elems_phash(k);' +print >> C, ' return h < GPR_ARRAY_SIZE(elem_keys) && elem_keys[h] == k ? GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[elem_idxs[h]], GRPC_MDELEM_STORAGE_STATIC) : GRPC_MDNULL;' +print >> C, '}' +print >> C + +print >> C, 'grpc_mdelem_data grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = {' for a, b in all_elems: - print >>C, '{%s,%s},' % (slice_def(str_idx(a)), slice_def(str_idx(b))) -print >>C, '};' + print >> C, '{%s,%s},' % (slice_def(str_idx(a)), slice_def(str_idx(b))) +print >> C, '};' -print >>H, 'typedef enum {' +print >> H, 'typedef enum {' for elem in METADATA_BATCH_CALLOUTS: - print >>H, ' %s,' % mangle(elem, 'batch').upper() -print >>H, ' GRPC_BATCH_CALLOUTS_COUNT' -print >>H, '} grpc_metadata_batch_callouts_index;' -print >>H -print >>H, 'typedef union {' -print >>H, ' struct grpc_linked_mdelem *array[GRPC_BATCH_CALLOUTS_COUNT];' -print >>H, ' struct {' + print >> H, ' %s,' % mangle(elem, 'batch').upper() +print >> H, ' GRPC_BATCH_CALLOUTS_COUNT' +print >> H, '} grpc_metadata_batch_callouts_index;' +print >> H +print >> H, 'typedef union {' +print >> H, ' struct grpc_linked_mdelem *array[GRPC_BATCH_CALLOUTS_COUNT];' +print >> H, ' struct {' for elem in METADATA_BATCH_CALLOUTS: - print >>H, ' struct grpc_linked_mdelem *%s;' % mangle(elem, '').lower() -print >>H, ' } named;' -print >>H, '} grpc_metadata_batch_callouts;' -print >>H -print >>H, '#define GRPC_BATCH_INDEX_OF(slice) \\' -print >>H, ' (GRPC_IS_STATIC_METADATA_STRING((slice)) ? (grpc_metadata_batch_callouts_index)GPR_CLAMP(GRPC_STATIC_METADATA_INDEX((slice)), 0, GRPC_BATCH_CALLOUTS_COUNT) : GRPC_BATCH_CALLOUTS_COUNT)' -print >>H - -print >>H, 'extern const uint8_t grpc_static_accept_encoding_metadata[%d];' % (1 << len(COMPRESSION_ALGORITHMS)) -print >>C, 'const uint8_t grpc_static_accept_encoding_metadata[%d] = {' % (1 << len(COMPRESSION_ALGORITHMS)) -print >>C, '0,%s' % ','.join('%d' % md_idx(elem) for elem in compression_elems) -print >>C, '};' -print >>C - -print >>H, '#define GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS(algs) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[grpc_static_accept_encoding_metadata[(algs)]], GRPC_MDELEM_STORAGE_STATIC))' - -print >>H, '#endif /* GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H */' + print >> H, ' struct grpc_linked_mdelem *%s;' % mangle(elem, '').lower() +print >> H, ' } named;' +print >> H, '} grpc_metadata_batch_callouts;' +print >> H +print >> H, '#define GRPC_BATCH_INDEX_OF(slice) \\' +print >> H, ' (GRPC_IS_STATIC_METADATA_STRING((slice)) ? (grpc_metadata_batch_callouts_index)GPR_CLAMP(GRPC_STATIC_METADATA_INDEX((slice)), 0, GRPC_BATCH_CALLOUTS_COUNT) : GRPC_BATCH_CALLOUTS_COUNT)' +print >> H + +print >> H, 'extern const uint8_t grpc_static_accept_encoding_metadata[%d];' % ( + 1 << len(COMPRESSION_ALGORITHMS)) +print >> C, 'const uint8_t grpc_static_accept_encoding_metadata[%d] = {' % ( + 1 << len(COMPRESSION_ALGORITHMS)) +print >> C, '0,%s' % ','.join('%d' % md_idx(elem) for elem in compression_elems) +print >> C, '};' +print >> C + +print >> H, '#define GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS(algs) (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[grpc_static_accept_encoding_metadata[(algs)]], GRPC_MDELEM_STORAGE_STATIC))' + +print >> H, '#endif /* GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H */' H.close() C.close() From 2eeedad744ca186903f3ef62459aed693bb06916 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Thu, 13 Apr 2017 14:25:05 -0700 Subject: [PATCH 380/461] fix mac issues --- .../CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m | 1 - test/core/end2end/tests/cancel_after_invoke.c | 10 +++++----- test/core/end2end/tests/cancel_with_status.c | 10 +++++----- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m index d9aec7ae68b..3dd264718cb 100644 --- a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m +++ b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.m @@ -111,7 +111,6 @@ static void chttp2_init_server_secure_fullstack( } f->server = grpc_server_create(server_args, NULL); grpc_server_register_completion_queue(f->server, f->cq, NULL); - grpc_server_register_completion_queue(f->server, f->shutdown_cq, NULL); GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr, server_creds)); grpc_server_credentials_release(server_creds); diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c index 95951a255e8..f29012b86dc 100644 --- a/test/core/end2end/tests/cancel_after_invoke.c +++ b/test/core/end2end/tests/cancel_after_invoke.c @@ -77,11 +77,11 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), - grpc_timeout_seconds_to_deadline(5), - NULL) - .type == GRPC_OP_COMPLETE); + grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); + grpc_event ev = grpc_completion_queue_next( + f->cq, grpc_timeout_seconds_to_deadline(5), NULL); + GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); + GPR_ASSERT(ev.tag == tag(1000)); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/cancel_with_status.c b/test/core/end2end/tests/cancel_with_status.c index d10ad429181..180748c2aea 100644 --- a/test/core/end2end/tests/cancel_with_status.c +++ b/test/core/end2end/tests/cancel_with_status.c @@ -76,11 +76,11 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), - grpc_timeout_seconds_to_deadline(5), - NULL) - .type == GRPC_OP_COMPLETE); + grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); + grpc_event ev = grpc_completion_queue_next( + f->cq, grpc_timeout_seconds_to_deadline(5), NULL); + GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); + GPR_ASSERT(ev.tag == tag(1000)); grpc_server_destroy(f->server); f->server = NULL; } From 6814d0742ca083a9e5a979b7f6c1df48ed0c85b8 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 13 Apr 2017 14:25:19 -0700 Subject: [PATCH 381/461] In all cases when writing, respect what the peer has asked for (not what the peer has acknowledged we asked for) --- src/core/ext/transport/chttp2/transport/writing.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/writing.c b/src/core/ext/transport/chttp2/transport/writing.c index ae9df175ffd..069780ae5af 100644 --- a/src/core/ext/transport/chttp2/transport/writing.c +++ b/src/core/ext/transport/chttp2/transport/writing.c @@ -224,9 +224,9 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx, .is_eof = false, .use_true_binary_metadata = t->settings - [GRPC_ACKED_SETTINGS] + [GRPC_PEER_SETTINGS] [GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA] != 0, - .max_frame_size = t->settings[GRPC_ACKED_SETTINGS] + .max_frame_size = t->settings[GRPC_PEER_SETTINGS] [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], .stats = &s->stats.outgoing}; grpc_chttp2_encode_header(exec_ctx, &t->hpack_compressor, @@ -267,7 +267,7 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx, (int64_t)t->settings[GRPC_PEER_SETTINGS] [GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE]); uint32_t max_outgoing = (uint32_t)GPR_MIN( - t->settings[GRPC_ACKED_SETTINGS] + t->settings[GRPC_PEER_SETTINGS] [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], GPR_MIN(stream_outgoing_window, t->outgoing_window)); if (max_outgoing > 0) { @@ -328,11 +328,11 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx, .is_eof = true, .use_true_binary_metadata = t->settings - [GRPC_ACKED_SETTINGS] + [GRPC_PEER_SETTINGS] [GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA] != 0, .max_frame_size = - t->settings[GRPC_ACKED_SETTINGS] + t->settings[GRPC_PEER_SETTINGS] [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], .stats = &s->stats.outgoing}; grpc_chttp2_encode_header(exec_ctx, &t->hpack_compressor, From 956f70098eced839f590b9dded76939f6c0b9fd0 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Thu, 13 Apr 2017 15:40:06 -0700 Subject: [PATCH 382/461] Keep LB policy alive during high freq of resolver updates --- .../filters/client_channel/client_channel.c | 77 ++++++++++++++++--- 1 file changed, 66 insertions(+), 11 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel.c b/src/core/ext/filters/client_channel/client_channel.c index 83e3b8f118d..e446f0543a8 100644 --- a/src/core/ext/filters/client_channel/client_channel.c +++ b/src/core/ext/filters/client_channel/client_channel.c @@ -236,14 +236,19 @@ static void set_channel_connectivity_state_locked(grpc_exec_ctx *exec_ctx, grpc_connectivity_state state, grpc_error *error, const char *reason) { - if ((state == GRPC_CHANNEL_TRANSIENT_FAILURE || - state == GRPC_CHANNEL_SHUTDOWN) && - chand->lb_policy != NULL) { - /* cancel picks with wait_for_ready=false */ - grpc_lb_policy_cancel_picks_locked( - exec_ctx, chand->lb_policy, - /* mask= */ GRPC_INITIAL_METADATA_WAIT_FOR_READY, - /* check= */ 0, GRPC_ERROR_REF(error)); + if (chand->lb_policy != NULL) { + if (state == GRPC_CHANNEL_TRANSIENT_FAILURE) { + /* cancel picks with wait_for_ready=false */ + grpc_lb_policy_cancel_picks_locked( + exec_ctx, chand->lb_policy, + /* mask= */ GRPC_INITIAL_METADATA_WAIT_FOR_READY, + /* check= */ 0, GRPC_ERROR_REF(error)); + } else if (state == GRPC_CHANNEL_SHUTDOWN) { + /* cancel all picks */ + grpc_lb_policy_cancel_picks_locked(exec_ctx, chand->lb_policy, + /* mask= */ 0, /* check= */ 0, + GRPC_ERROR_REF(error)); + } } grpc_connectivity_state_set(exec_ctx, &chand->state_tracker, state, error, reason); @@ -346,6 +351,37 @@ static void parse_retry_throttle_params(const grpc_json *field, void *arg) { } } +// Wrap a closure associated with \a lb_policy. The associated callback (\a +// wrapped_on_pick_closure_cb) is responsible for unref'ing \a lb_policy after +// scheduling \a wrapped_closure. +typedef struct wrapped_on_pick_closure_arg { + /* the closure instance using this struct as argument */ + grpc_closure wrapper_closure; + + /* the original closure. Usually a on_complete/notify cb for pick() and ping() + * calls against the internal RR instance, respectively. */ + grpc_closure *wrapped_closure; + + /* The policy instance related to the closure */ + grpc_lb_policy *lb_policy; + + /* heap memory to be freed upon closure execution. Usually this arg. */ + void *free_when_done; +} wrapped_on_pick_closure_arg; + +// Invoke \a arg->wrapped_closure, unref \a arg->lb_policy and free +// arg->free_when_done (usually \a arg itself). +static void wrapped_on_pick_closure_cb(grpc_exec_ctx *exec_ctx, void *arg, + grpc_error *error) { + wrapped_on_pick_closure_arg *wc_arg = arg; + GPR_ASSERT(wc_arg->wrapped_closure != NULL); + GPR_ASSERT(wc_arg->lb_policy != NULL); + GPR_ASSERT(wc_arg->free_when_done != NULL); + grpc_closure_sched(exec_ctx, wc_arg->wrapped_closure, GRPC_ERROR_REF(error)); + GRPC_LB_POLICY_UNREF(exec_ctx, wc_arg->lb_policy, "pick_subchannel_wrapping"); + gpr_free(wc_arg->free_when_done); +} + static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { channel_data *chand = arg; @@ -1031,11 +1067,30 @@ static bool pick_subchannel_locked( const grpc_lb_policy_pick_args inputs = { initial_metadata, initial_metadata_flags, &calld->lb_token_mdelem, gpr_inf_future(GPR_CLOCK_MONOTONIC)}; - const bool result = grpc_lb_policy_pick_locked( - exec_ctx, lb_policy, &inputs, connected_subchannel, NULL, on_ready); + + // Wrap the user-provided callback in order to hold a strong reference to + // the LB policy for the duration of the pick. + wrapped_on_pick_closure_arg *w_on_pick_arg = + gpr_zalloc(sizeof(*w_on_pick_arg)); + grpc_closure_init(&w_on_pick_arg->wrapper_closure, + wrapped_on_pick_closure_cb, w_on_pick_arg, + grpc_schedule_on_exec_ctx); + w_on_pick_arg->wrapped_closure = on_ready; + GRPC_LB_POLICY_REF(lb_policy, "pick_subchannel_wrapping"); + w_on_pick_arg->lb_policy = lb_policy; + w_on_pick_arg->free_when_done = w_on_pick_arg; + const bool pick_done = grpc_lb_policy_pick_locked( + exec_ctx, lb_policy, &inputs, connected_subchannel, NULL, + &w_on_pick_arg->wrapper_closure); + if (pick_done) { + /* synchronous grpc_lb_policy_pick call. Unref the LB policy. */ + GRPC_LB_POLICY_UNREF(exec_ctx, w_on_pick_arg->lb_policy, + "pick_subchannel_wrapping"); + gpr_free(w_on_pick_arg->free_when_done); + } GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "pick_subchannel"); GPR_TIMER_END("pick_subchannel", 0); - return result; + return pick_done; } if (chand->resolver != NULL && !chand->started_resolving) { chand->started_resolving = true; From 784018d8a4ff251a74305406c402d9fa3bb6295b Mon Sep 17 00:00:00 2001 From: Yuxuan Li Date: Thu, 13 Apr 2017 16:17:37 -0700 Subject: [PATCH 383/461] use grpc_channel_create_registered_call --- test/cpp/microbenchmarks/bm_call_create.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index 2fe4e0f53b8..ada732c233b 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -181,17 +181,16 @@ static void BM_LameChannelCallCreateCore(benchmark::State &state) { grpc::testing::EchoRequest send_request; grpc_slice send_request_slice = grpc_slice_new(&send_request, sizeof(send_request), do_nothing); - grpc_slice host = grpc_slice_from_static_string("localhost"); channel = grpc_lame_client_channel_create( "localhost:1234", GRPC_STATUS_UNAUTHENTICATED, "blah"); cq = grpc_completion_queue_create(NULL); - + void *rc = grpc_channel_register_call( + channel, "/grpc.testing.EchoTestService/Echo", NULL, NULL); while (state.KeepRunning()) { GPR_TIMER_SCOPE("BenchmarkCycle", 0); - grpc_call *call = grpc_channel_create_call( - channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq, - grpc_slice_from_static_string("/EchoTestService/AsyncEcho"), &host, + grpc_call *call = grpc_channel_create_registered_call( + channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq, rc, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&trailing_metadata_recv); From d9986c3cf70606dfc2b7aa6933fb5ea180bce05d Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Thu, 13 Apr 2017 16:20:56 -0700 Subject: [PATCH 384/461] 1.3.x branch cut --- BUILD | 4 ++-- CMakeLists.txt | 2 +- Makefile | 6 +++--- build.yaml | 4 ++-- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.json | 2 +- package.xml | 4 ++-- src/core/lib/surface/version.c | 2 +- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Core/Version.csproj.include | 2 +- src/csharp/Grpc.Core/VersionInfo.cs | 2 +- src/csharp/build_packages_dotnetcli.bat | 2 +- src/csharp/build_packages_dotnetcli.sh | 4 ++-- src/node/health_check/package.json | 4 ++-- src/node/tools/package.json | 2 +- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/private/version.h | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- tools/doxygen/Doxyfile.core | 2 +- tools/doxygen/Doxyfile.core.internal | 2 +- 31 files changed, 38 insertions(+), 38 deletions(-) diff --git a/BUILD b/BUILD index 12bd026c951..4087216a5d1 100644 --- a/BUILD +++ b/BUILD @@ -40,9 +40,9 @@ load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_proto_plugin") # This should be updated along with build.yaml g_stands_for = "gentle" -core_version = "3.0.0-dev" +core_version = "3.0.0-pre1" -version = "1.3.0-dev" +version = "1.3.0-pre1" grpc_cc_library( name = "gpr", diff --git a/CMakeLists.txt b/CMakeLists.txt index d3db20d4203..81dba56b9ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,7 @@ cmake_minimum_required(VERSION 2.8) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.3.0-dev") +set(PACKAGE_VERSION "1.3.0-pre1") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index 8c26b2e910a..01e06f1003d 100644 --- a/Makefile +++ b/Makefile @@ -419,9 +419,9 @@ E = @echo Q = @ endif -CORE_VERSION = 3.0.0-dev -CPP_VERSION = 1.3.0-dev -CSHARP_VERSION = 1.3.0-dev +CORE_VERSION = 3.0.0-pre1 +CPP_VERSION = 1.3.0-pre1 +CSHARP_VERSION = 1.3.0-pre1 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/build.yaml b/build.yaml index 7db01506302..7edad7e9db3 100644 --- a/build.yaml +++ b/build.yaml @@ -12,9 +12,9 @@ settings: '#08': Use "-preN" suffixes to identify pre-release versions '#09': Per-language overrides are possible with (eg) ruby_version tag here '#10': See the expand_version.py for all the quirks here - core_version: 3.0.0-dev + core_version: 3.0.0-pre1 g_stands_for: gentle - version: 1.3.0-dev + version: 1.3.0-pre1 filegroups: - name: census public_headers: diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index aed17ae9c3d..bd129f73b5f 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -37,7 +37,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.3.0-dev' + version = '1.3.0-pre1' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'http://www.grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 1940015782e..de30032ee67 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -36,7 +36,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.3.0-dev' + version = '1.3.0-pre1' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'http://www.grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index 841a8533633..642b4cad425 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -36,7 +36,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.3.0-dev' + version = '1.3.0-pre1' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'http://www.grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index 08ea79118d1..ac3057e8706 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -35,7 +35,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.3.0-dev' + version = '1.3.0-pre1' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'http://www.grpc.io' diff --git a/package.json b/package.json index 7f242326d7e..d4f7b56b6a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grpc", - "version": "1.3.0-dev", + "version": "1.3.0-pre1", "author": "Google Inc.", "description": "gRPC Library for Node", "homepage": "http://www.grpc.io/", diff --git a/package.xml b/package.xml index 57e50725e8e..6ed135e17ba 100644 --- a/package.xml +++ b/package.xml @@ -13,8 +13,8 @@ 2017-03-01 - 1.3.0dev - 1.3.0dev + 1.3.0RC1 + 1.3.0RC1 beta diff --git a/src/core/lib/surface/version.c b/src/core/lib/surface/version.c index ba80bd801ee..959b45da2b3 100644 --- a/src/core/lib/surface/version.c +++ b/src/core/lib/surface/version.c @@ -36,6 +36,6 @@ #include -const char *grpc_version_string(void) { return "3.0.0-dev"; } +const char *grpc_version_string(void) { return "3.0.0-pre1"; } const char *grpc_g_stands_for(void) { return "gentle"; } diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index f5a0e4131de..16a295de2ea 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -37,5 +37,5 @@ #include namespace grpc { -grpc::string Version() { return "1.3.0-dev"; } +grpc::string Version() { return "1.3.0-pre1"; } } diff --git a/src/csharp/Grpc.Core/Version.csproj.include b/src/csharp/Grpc.Core/Version.csproj.include index ce9d0d2d5d2..5409c98fe7f 100755 --- a/src/csharp/Grpc.Core/Version.csproj.include +++ b/src/csharp/Grpc.Core/Version.csproj.include @@ -1,7 +1,7 @@ - 1.3.0-dev + 1.3.0-pre1 3.2.0 diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs index 6012d904b69..03d4a96f05d 100644 --- a/src/csharp/Grpc.Core/VersionInfo.cs +++ b/src/csharp/Grpc.Core/VersionInfo.cs @@ -53,6 +53,6 @@ namespace Grpc.Core /// /// Current version of gRPC C# /// - public const string CurrentVersion = "1.3.0-dev"; + public const string CurrentVersion = "1.3.0-pre1"; } } diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat index 7558ca60c71..2f8d5b8157d 100755 --- a/src/csharp/build_packages_dotnetcli.bat +++ b/src/csharp/build_packages_dotnetcli.bat @@ -28,7 +28,7 @@ @rem OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @rem Current package versions -set VERSION=1.3.0-dev +set VERSION=1.3.0-pre1 @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 2186bd3c568..3096b3e45b6 100755 --- a/src/csharp/build_packages_dotnetcli.sh +++ b/src/csharp/build_packages_dotnetcli.sh @@ -70,7 +70,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.3.0-dev" -OutputDirectory ../../artifacts -nuget pack Grpc.Tools.nuspec -Version "1.3.0-dev" -OutputDirectory ../../artifacts +nuget pack Grpc.nuspec -Version "1.3.0-pre1" -OutputDirectory ../../artifacts +nuget pack Grpc.Tools.nuspec -Version "1.3.0-pre1" -OutputDirectory ../../artifacts (cd ../../artifacts && zip csharp_nugets_dotnetcli.zip *.nupkg) diff --git a/src/node/health_check/package.json b/src/node/health_check/package.json index e218f5a4063..3d331182981 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.3.0-dev", + "version": "1.3.0-pre1", "author": "Google Inc.", "description": "Health check service for use with gRPC", "repository": { @@ -15,7 +15,7 @@ } ], "dependencies": { - "grpc": "^1.3.0-dev", + "grpc": "^1.3.0-pre1", "lodash": "^3.9.3", "google-protobuf": "^3.0.0" }, diff --git a/src/node/tools/package.json b/src/node/tools/package.json index 3096c6e42a8..056f28ab3c1 100644 --- a/src/node/tools/package.json +++ b/src/node/tools/package.json @@ -1,6 +1,6 @@ { "name": "grpc-tools", - "version": "1.3.0-dev", + "version": "1.3.0-pre1", "author": "Google Inc.", "description": "Tools for developing with gRPC on Node.js", "homepage": "http://www.grpc.io/", diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index 2f41ad196a6..e636d9c902a 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.3.0-dev' + v = '1.3.0-pre1' 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 09155ee4d40..b53033d5248 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -38,4 +38,4 @@ // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.3.0-dev" +#define GRPC_OBJC_VERSION_STRING @"1.3.0-pre1" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index 267d848e743..a37630a1851 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION='1.3.0.dev0' +VERSION='1.3.0rc1' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index 4ff5e266a1f..c08110ec2cc 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION='1.3.0.dev0' +VERSION='1.3.0rc1' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index 8ffc08c04b8..45657326211 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION='1.3.0.dev0' +VERSION='1.3.0rc1' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index ba82dce6f6d..aadfabfddee 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION='1.3.0.dev0' +VERSION='1.3.0rc1' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index 9901158e735..fa804685b38 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -29,5 +29,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.3.0.dev' + VERSION = '1.3.0.pre1' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index 632c0100bd8..fa19aee62b5 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -29,6 +29,6 @@ module GRPC module Tools - VERSION = '1.3.0.dev' + VERSION = '1.3.0.pre1' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index ad35b90bad3..289c0b13c38 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION='1.3.0.dev0' +VERSION='1.3.0rc1' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 59e619749a8..01a2dfb74f8 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.3.0-dev +PROJECT_NUMBER = 1.3.0-pre1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index afab2296a02..7734d8ba11f 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.3.0-dev +PROJECT_NUMBER = 1.3.0-pre1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.core b/tools/doxygen/Doxyfile.core index e6ca9cb845c..d651c9209e0 100644 --- a/tools/doxygen/Doxyfile.core +++ b/tools/doxygen/Doxyfile.core @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Core" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 3.0.0-dev +PROJECT_NUMBER = 3.0.0-pre1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 915648640f6..f5ffe97e499 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Core" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 3.0.0-dev +PROJECT_NUMBER = 3.0.0-pre1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a From 9e1acc0796b80d61d2a4ea8a18018db65ad6a372 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Thu, 13 Apr 2017 16:30:15 -0700 Subject: [PATCH 385/461] master to 1.4.0-dev --- BUILD | 2 +- CMakeLists.txt | 2 +- Makefile | 4 ++-- build.yaml | 2 +- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.json | 2 +- package.xml | 4 ++-- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Core/Version.csproj.include | 2 +- src/csharp/Grpc.Core/VersionInfo.cs | 4 ++-- src/csharp/build_packages_dotnetcli.bat | 2 +- src/csharp/build_packages_dotnetcli.sh | 4 ++-- src/node/health_check/package.json | 4 ++-- src/node/tools/package.json | 2 +- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/private/version.h | 2 +- src/php/composer.json | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- 29 files changed, 34 insertions(+), 34 deletions(-) diff --git a/BUILD b/BUILD index 12bd026c951..54f50c07838 100644 --- a/BUILD +++ b/BUILD @@ -42,7 +42,7 @@ g_stands_for = "gentle" core_version = "3.0.0-dev" -version = "1.3.0-dev" +version = "1.4.0-dev" grpc_cc_library( name = "gpr", diff --git a/CMakeLists.txt b/CMakeLists.txt index d3db20d4203..ef8b45a394b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,7 @@ cmake_minimum_required(VERSION 2.8) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.3.0-dev") +set(PACKAGE_VERSION "1.4.0-dev") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index 8c26b2e910a..223291467b3 100644 --- a/Makefile +++ b/Makefile @@ -420,8 +420,8 @@ Q = @ endif CORE_VERSION = 3.0.0-dev -CPP_VERSION = 1.3.0-dev -CSHARP_VERSION = 1.3.0-dev +CPP_VERSION = 1.4.0-dev +CSHARP_VERSION = 1.4.0-dev CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/build.yaml b/build.yaml index 7db01506302..63985cda147 100644 --- a/build.yaml +++ b/build.yaml @@ -14,7 +14,7 @@ settings: '#10': See the expand_version.py for all the quirks here core_version: 3.0.0-dev g_stands_for: gentle - version: 1.3.0-dev + version: 1.4.0-dev filegroups: - name: census public_headers: diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index aed17ae9c3d..af836383368 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -37,7 +37,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.3.0-dev' + version = '1.4.0-dev' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'http://www.grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 1940015782e..62cb0d11a1c 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -36,7 +36,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.3.0-dev' + version = '1.4.0-dev' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'http://www.grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index 841a8533633..77ceb22123c 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -36,7 +36,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.3.0-dev' + version = '1.4.0-dev' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'http://www.grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index 08ea79118d1..10520bd3880 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -35,7 +35,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.3.0-dev' + version = '1.4.0-dev' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'http://www.grpc.io' diff --git a/package.json b/package.json index 7f242326d7e..6a01ae23243 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grpc", - "version": "1.3.0-dev", + "version": "1.4.0-dev", "author": "Google Inc.", "description": "gRPC Library for Node", "homepage": "http://www.grpc.io/", diff --git a/package.xml b/package.xml index 57e50725e8e..d2eb2512ecd 100644 --- a/package.xml +++ b/package.xml @@ -13,8 +13,8 @@ 2017-03-01 - 1.3.0dev - 1.3.0dev + 1.4.0dev + 1.4.0dev beta diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index f5a0e4131de..72a4c4cf94a 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -37,5 +37,5 @@ #include namespace grpc { -grpc::string Version() { return "1.3.0-dev"; } +grpc::string Version() { return "1.4.0-dev"; } } diff --git a/src/csharp/Grpc.Core/Version.csproj.include b/src/csharp/Grpc.Core/Version.csproj.include index ce9d0d2d5d2..6af2af10bd0 100755 --- a/src/csharp/Grpc.Core/Version.csproj.include +++ b/src/csharp/Grpc.Core/Version.csproj.include @@ -1,7 +1,7 @@ - 1.3.0-dev + 1.4.0-dev 3.2.0 diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs index 6012d904b69..2e55d9d80eb 100644 --- a/src/csharp/Grpc.Core/VersionInfo.cs +++ b/src/csharp/Grpc.Core/VersionInfo.cs @@ -48,11 +48,11 @@ namespace Grpc.Core /// /// Current AssemblyFileVersion of gRPC C# assemblies /// - public const string CurrentAssemblyFileVersion = "1.3.0.0"; + public const string CurrentAssemblyFileVersion = "1.4.0.0"; /// /// Current version of gRPC C# /// - public const string CurrentVersion = "1.3.0-dev"; + public const string CurrentVersion = "1.4.0-dev"; } } diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat index 7558ca60c71..673642e3d87 100755 --- a/src/csharp/build_packages_dotnetcli.bat +++ b/src/csharp/build_packages_dotnetcli.bat @@ -28,7 +28,7 @@ @rem OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @rem Current package versions -set VERSION=1.3.0-dev +set VERSION=1.4.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 2186bd3c568..ee923e3d870 100755 --- a/src/csharp/build_packages_dotnetcli.sh +++ b/src/csharp/build_packages_dotnetcli.sh @@ -70,7 +70,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.3.0-dev" -OutputDirectory ../../artifacts -nuget pack Grpc.Tools.nuspec -Version "1.3.0-dev" -OutputDirectory ../../artifacts +nuget pack Grpc.nuspec -Version "1.4.0-dev" -OutputDirectory ../../artifacts +nuget pack Grpc.Tools.nuspec -Version "1.4.0-dev" -OutputDirectory ../../artifacts (cd ../../artifacts && zip csharp_nugets_dotnetcli.zip *.nupkg) diff --git a/src/node/health_check/package.json b/src/node/health_check/package.json index e218f5a4063..37c9b7a54f5 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.3.0-dev", + "version": "1.4.0-dev", "author": "Google Inc.", "description": "Health check service for use with gRPC", "repository": { @@ -15,7 +15,7 @@ } ], "dependencies": { - "grpc": "^1.3.0-dev", + "grpc": "^1.4.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 3096c6e42a8..a81aa87f4bb 100644 --- a/src/node/tools/package.json +++ b/src/node/tools/package.json @@ -1,6 +1,6 @@ { "name": "grpc-tools", - "version": "1.3.0-dev", + "version": "1.4.0-dev", "author": "Google Inc.", "description": "Tools for developing with gRPC on Node.js", "homepage": "http://www.grpc.io/", diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index 2f41ad196a6..2f29058b59d 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.3.0-dev' + v = '1.4.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 09155ee4d40..c846f4214c9 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -38,4 +38,4 @@ // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.3.0-dev" +#define GRPC_OBJC_VERSION_STRING @"1.4.0-dev" diff --git a/src/php/composer.json b/src/php/composer.json index 2b140077cc5..24c17c3b572 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": "BSD-3-Clause", - "version": "1.3.0", + "version": "1.4.0", "require": { "php": ">=5.5.0", "google/protobuf": "^v3.1.0" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index 267d848e743..ea4bc7ba207 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION='1.3.0.dev0' +VERSION='1.4.0.dev0' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index 4ff5e266a1f..26aa555e14c 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION='1.3.0.dev0' +VERSION='1.4.0.dev0' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index 8ffc08c04b8..978d6b4011f 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION='1.3.0.dev0' +VERSION='1.4.0.dev0' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index ba82dce6f6d..5f0b0848846 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION='1.3.0.dev0' +VERSION='1.4.0.dev0' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index 9901158e735..f30dff335f1 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -29,5 +29,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.3.0.dev' + VERSION = '1.4.0.dev' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index 632c0100bd8..1f8d4afb95f 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -29,6 +29,6 @@ module GRPC module Tools - VERSION = '1.3.0.dev' + VERSION = '1.4.0.dev' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index ad35b90bad3..1f2aa81c850 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION='1.3.0.dev0' +VERSION='1.4.0.dev0' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 59e619749a8..1864dd9e908 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.3.0-dev +PROJECT_NUMBER = 1.4.0-dev # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index afab2296a02..0ab0804488b 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.3.0-dev +PROJECT_NUMBER = 1.4.0-dev # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a From f25f50511e1e752eaf940a98e34b72a48e2cd4b6 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 13 Apr 2017 17:22:32 -0700 Subject: [PATCH 386/461] Build for more versions of electron, restrict when a Windows warning is shown --- binding.gyp | 4 +++- templates/binding.gyp.template | 4 +++- tools/run_tests/artifacts/build_artifact_node.bat | 2 +- tools/run_tests/artifacts/build_artifact_node.sh | 2 +- tools/run_tests/run_tests.py | 4 ++-- tools/run_tests/run_tests_matrix.py | 3 ++- 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/binding.gyp b/binding.gyp index b33cef5a4ec..16334a22a7f 100644 --- a/binding.gyp +++ b/binding.gyp @@ -507,7 +507,7 @@ }, ] }], - ['OS == "win"', { + ['OS == "win" and runtime!="electron"', { 'targets': [ { # IMPORTANT WINDOWS BUILD INFORMATION @@ -518,6 +518,8 @@ # when including the Node headers. The remedy for this is to remove # the OpenSSL headers, from the downloaded Node development package, # which is typically located in `.node-gyp` in your home directory. + # + # This is not true of Electron, which does not have OpenSSL headers. 'target_name': 'WINDOWS_BUILD_WARNING', 'rules': [ { diff --git a/templates/binding.gyp.template b/templates/binding.gyp.template index 55a91c5b93d..a2e8c588920 100644 --- a/templates/binding.gyp.template +++ b/templates/binding.gyp.template @@ -205,7 +205,7 @@ % endfor ] }], - ['OS == "win"', { + ['OS == "win" and runtime!="electron"', { 'targets': [ { # IMPORTANT WINDOWS BUILD INFORMATION @@ -216,6 +216,8 @@ # when including the Node headers. The remedy for this is to remove # the OpenSSL headers, from the downloaded Node development package, # which is typically located in `.node-gyp` in your home directory. + # + # This is not true of Electron, which does not have OpenSSL headers. 'target_name': 'WINDOWS_BUILD_WARNING', 'rules': [ { diff --git a/tools/run_tests/artifacts/build_artifact_node.bat b/tools/run_tests/artifacts/build_artifact_node.bat index 336a63b9f56..bfd4461f721 100644 --- a/tools/run_tests/artifacts/build_artifact_node.bat +++ b/tools/run_tests/artifacts/build_artifact_node.bat @@ -29,7 +29,7 @@ set node_versions=4.0.0 5.0.0 6.0.0 7.0.0 -set electron_versions=1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 +set electron_versions=1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 set PATH=%PATH%;C:\Program Files\nodejs\;%APPDATA%\npm diff --git a/tools/run_tests/artifacts/build_artifact_node.sh b/tools/run_tests/artifacts/build_artifact_node.sh index a33ab45ac21..2da2ac5f919 100755 --- a/tools/run_tests/artifacts/build_artifact_node.sh +++ b/tools/run_tests/artifacts/build_artifact_node.sh @@ -44,7 +44,7 @@ npm update node_versions=( 4.0.0 5.0.0 6.0.0 7.0.0 ) -electron_versions=( 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 ) +electron_versions=( 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 ) for version in ${node_versions[@]} do diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index cfa7071e002..9130bc960a8 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -429,7 +429,7 @@ class NodeLanguage(object): # we should specify in the compiler argument _check_compiler(self.args.compiler, ['default', 'node0.12', 'node4', 'node5', 'node6', - 'node7', 'electron1.3']) + 'node7', 'electron1.3', 'electron1.6']) if args.iomgr_platform == "uv": self.use_uv = True else: @@ -1178,7 +1178,7 @@ argp.add_argument('--compiler', 'vs2013', 'vs2015', 'python2.7', 'python3.4', 'python3.5', 'python3.6', 'pypy', 'pypy3', 'python_alpine', 'node0.12', 'node4', 'node5', 'node6', 'node7', - 'electron1.3', + 'electron1.3', 'electron1.6', 'coreclr', 'cmake'], default='default', diff --git a/tools/run_tests/run_tests_matrix.py b/tools/run_tests/run_tests_matrix.py index a00d84fd9a7..8bc8236b24d 100755 --- a/tools/run_tests/run_tests_matrix.py +++ b/tools/run_tests/run_tests_matrix.py @@ -287,7 +287,8 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS) configs=['dbg'], platforms=['linux'], arch='default', - compiler='electron1.3', + compiler='electron1.6', + iomgr_platform='uv', labels=['portability'], extra_args=extra_args, inner_jobs=inner_jobs) From a3aec5032aeeac00ad85fa1b14a4be74755f4656 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 13 Apr 2017 17:34:17 -0700 Subject: [PATCH 387/461] Remove arm_arch and hack version number --- src/objective-c/BoringSSL.podspec | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/objective-c/BoringSSL.podspec b/src/objective-c/BoringSSL.podspec index 55cc6f677e4..7880aad10ba 100644 --- a/src/objective-c/BoringSSL.podspec +++ b/src/objective-c/BoringSSL.podspec @@ -69,8 +69,9 @@ Pod::Spec.new do |s| s.source = { :git => 'https://boringssl.googlesource.com/boringssl', - :tag => "version_for_cocoapods_#{version}", - # :commit => '4fec04b48406111cb88fdd8d196253adc54f7a31', + # Restore this version name hack in the next version!! + # :tag => "version_for_cocoapods_#{version}", + :tag => "version_for_cocoapods_8.0", } name = 'openssl' @@ -112,6 +113,7 @@ Pod::Spec.new do |s| s.subspec 'Interface' do |ss| ss.header_mappings_dir = 'include/openssl' ss.source_files = 'include/openssl/*.h' + ss.exclude_files = 'include/openssl/arm_arch.h' end s.subspec 'Implementation' do |ss| ss.header_mappings_dir = '.' @@ -148,11 +150,6 @@ Pod::Spec.new do |s| #include "ssl.h" #include "crypto.h" #include "aes.h" - /* The following macros are defined by base.h. The latter is the first file included by the - other headers. */ - #if defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64) - # include "arm_arch.h" - #endif #include "asn1.h" #include "asn1_mac.h" #include "asn1t.h" From 964647729e22d3e2fddf11409191e61fe8d1a971 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 13 Apr 2017 22:06:25 -0700 Subject: [PATCH 388/461] Update bm_diff.py --- tools/profiling/microbenchmarks/bm_diff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index 4fa4869b642..4f21a76c610 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -176,7 +176,7 @@ class Benchmark: mdn_diff = abs(median(new) - median(old)) print '%s: new=%r old=%r mdn_diff=%r' % (f, new, old, mdn_diff) s = speedup.speedup(new, old) - if s and mdn_diff > 0.5: + if abs(s) > 3 and mdn_diff > 0.5: self.final[f] = '%+d%%' % s return self.final.keys() From b575394351209239b754b99b3839ba4c799fc831 Mon Sep 17 00:00:00 2001 From: Mehrdad Afshari Date: Thu, 13 Apr 2017 16:23:10 -0700 Subject: [PATCH 389/461] Use _pb2_grpc module to access gRPC entities --- .../grpcio_reflection/grpc_reflection/v1alpha/reflection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py b/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py index c58cb3ecf17..cd896f32c3c 100644 --- a/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py +++ b/src/python/grpcio_reflection/grpc_reflection/v1alpha/reflection.py @@ -56,7 +56,7 @@ def _file_descriptor_response(descriptor): file_descriptor_proto=(serialized_proto,)),) -class ReflectionServicer(reflection_pb2.ServerReflectionServicer): +class ReflectionServicer(reflection_pb2_grpc.ServerReflectionServicer): """Servicer handling RPCs for service statuses.""" def __init__(self, service_names, pool=None): From 6aba1e574a9fc420cfa3e0274a377f5db2571fdc Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 13 Apr 2017 15:40:22 +0000 Subject: [PATCH 390/461] Fix broken test --- test/core/end2end/tests/streaming_error_response.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/core/end2end/tests/streaming_error_response.c b/test/core/end2end/tests/streaming_error_response.c index c652d9469d5..e032b339880 100644 --- a/test/core/end2end/tests/streaming_error_response.c +++ b/test/core/end2end/tests/streaming_error_response.c @@ -182,6 +182,9 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); + if (!request_status_early) { + CQ_EXPECT_COMPLETION(cqv, tag(1), 1); + } cq_verify(cqv); memset(ops, 0, sizeof(ops)); @@ -193,9 +196,6 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(103), 1); - if (!request_status_early) { - CQ_EXPECT_COMPLETION(cqv, tag(1), 1); - } cq_verify(cqv); memset(ops, 0, sizeof(ops)); From a094b1a4c616f481ff7c41d55238e1b496d60ba6 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 13 Apr 2017 15:48:39 +0000 Subject: [PATCH 391/461] Fix broken test --- test/core/end2end/tests/keepalive_timeout.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/core/end2end/tests/keepalive_timeout.c b/test/core/end2end/tests/keepalive_timeout.c index bf6ca0d9d94..b53a50d7a1e 100644 --- a/test/core/end2end/tests/keepalive_timeout.c +++ b/test/core/end2end/tests/keepalive_timeout.c @@ -188,8 +188,6 @@ static void test_keepalive_timeout(grpc_end2end_test_config config) { GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); - cq_verify(cqv); - CQ_EXPECT_COMPLETION(cqv, tag(1), 1); cq_verify(cqv); From 9b3d39184688cf8fcb159714a1c74608facb15ae Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 13 Apr 2017 16:41:14 +0000 Subject: [PATCH 392/461] Fix broken test --- test/core/end2end/tests/resource_quota_server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/core/end2end/tests/resource_quota_server.c b/test/core/end2end/tests/resource_quota_server.c index 4d3ce1c937c..d6d640b8dd7 100644 --- a/test/core/end2end/tests/resource_quota_server.c +++ b/test/core/end2end/tests/resource_quota_server.c @@ -203,7 +203,7 @@ void resource_quota_server(grpc_end2end_test_config config) { op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; - op->flags = 0; + op->flags = GRPC_INITIAL_METADATA_WAIT_FOR_READY; op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; From 233ad390fa30ff90d927dd29f277a914a0cf0621 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 14 Apr 2017 08:25:53 -0700 Subject: [PATCH 393/461] Accelerate by running more jobs in parallel, and only building twice --- tools/profiling/microbenchmarks/bm_diff.py | 41 ++++++++++++---------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index 4f21a76c610..d1d49037cb3 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -44,6 +44,7 @@ import comment_on_pr import jobset import itertools import speedup +import random _INTERESTING = ( 'cpu_time', @@ -114,7 +115,7 @@ def make_cmd(cfg): return ['make'] + args.benchmarks + [ 'CONFIG=%s' % cfg, '-j', '%d' % args.jobs] -def build(): +def build(dest): subprocess.check_call(['git', 'submodule', 'update']) try: subprocess.check_call(make_cmd('opt')) @@ -123,6 +124,7 @@ def build(): subprocess.check_call(['make', 'clean']) subprocess.check_call(make_cmd('opt')) subprocess.check_call(make_cmd('counters')) + os.rename('bin', dest) def collect1(bm, cfg, ver, idx): cmd = ['bins/%s/%s' % (cfg, bm), @@ -130,29 +132,30 @@ def collect1(bm, cfg, ver, idx): '--benchmark_out_format=json', '--benchmark_repetitions=%d' % (args.repetitions) ] - return jobset.JobSpec(cmd, shortname='%s %s %s' % (bm, cfg, ver), + return jobset.JobSpec(cmd, shortname='%s %s %s %d/%d' % (bm, cfg, ver, idx+1, args.loops), verbose_success=True, timeout_seconds=None) -for loop in range(0, args.loops): - build() - jobset.run(itertools.chain( - (collect1(bm, 'opt', 'new', loop) for bm in args.benchmarks), - (collect1(bm, 'counters', 'new', loop) for bm in args.benchmarks), - ), maxjobs=args.jobs) +build('new') - where_am_i = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip() - subprocess.check_call(['git', 'checkout', args.diff_base]) +where_am_i = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip() +subprocess.check_call(['git', 'checkout', args.diff_base]) - try: - build() - jobset.run(itertools.chain( - (collect1(bm, 'opt', 'old', loop) for bm in args.benchmarks), - (collect1(bm, 'counters', 'old', loop) for bm in args.benchmarks), - ), maxjobs=args.jobs) - finally: - subprocess.check_call(['git', 'checkout', where_am_i]) - subprocess.check_call(['git', 'submodule', 'update']) +try: + build('old') +finally: + subprocess.check_call(['git', 'checkout', where_am_i]) + subprocess.check_call(['git', 'submodule', 'update']) + +for loop in args.loops: + jobs.extend(x for x in itertools.chain( + (collect1(bm, 'opt', 'new', loop) for bm in args.benchmarks), + (collect1(bm, 'counters', 'new', loop) for bm in args.benchmarks), + (collect1(bm, 'opt', 'old', loop) for bm in args.benchmarks), + (collect1(bm, 'counters', 'old', loop) for bm in args.benchmarks), + )) +random.shuffle(jobs) +jobset.run(jobs, maxjobs=args.jobs) class Benchmark: From a00e51ccfee3ca6877ef568c8a5d65867ce974ca Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 14 Apr 2017 08:27:39 -0700 Subject: [PATCH 394/461] Fix dir names --- tools/profiling/microbenchmarks/bm_diff.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index d1d49037cb3..634e2814466 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -124,10 +124,10 @@ def build(dest): subprocess.check_call(['make', 'clean']) subprocess.check_call(make_cmd('opt')) subprocess.check_call(make_cmd('counters')) - os.rename('bin', dest) + os.rename('bins', dest) def collect1(bm, cfg, ver, idx): - cmd = ['bins/%s/%s' % (cfg, bm), + cmd = ['%s/%s/%s' % (ver, cfg, bm), '--benchmark_out=%s.%s.%s.%d.json' % (bm, cfg, ver, idx), '--benchmark_out_format=json', '--benchmark_repetitions=%d' % (args.repetitions) @@ -139,7 +139,6 @@ build('new') where_am_i = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip() subprocess.check_call(['git', 'checkout', args.diff_base]) - try: build('old') finally: From 0553b9c75d87394ebddb53722e11acaec2305810 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 14 Apr 2017 08:31:17 -0700 Subject: [PATCH 395/461] Properly clean --- tools/profiling/microbenchmarks/bm_diff.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index 634e2814466..d22a97fd1ea 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -45,6 +45,7 @@ import jobset import itertools import speedup import random +import shutil _INTERESTING = ( 'cpu_time', @@ -116,6 +117,7 @@ def make_cmd(cfg): 'CONFIG=%s' % cfg, '-j', '%d' % args.jobs] def build(dest): + shutil.rmtree('bm_diff_%s' % dest, ignore_errors=True) subprocess.check_call(['git', 'submodule', 'update']) try: subprocess.check_call(make_cmd('opt')) @@ -124,10 +126,10 @@ def build(dest): subprocess.check_call(['make', 'clean']) subprocess.check_call(make_cmd('opt')) subprocess.check_call(make_cmd('counters')) - os.rename('bins', dest) + os.rename('bins', 'bm_diff_%s' % dest) def collect1(bm, cfg, ver, idx): - cmd = ['%s/%s/%s' % (ver, cfg, bm), + cmd = ['bm_diff_%s/%s/%s' % (ver, cfg, bm), '--benchmark_out=%s.%s.%s.%d.json' % (bm, cfg, ver, idx), '--benchmark_out_format=json', '--benchmark_repetitions=%d' % (args.repetitions) From 0ebff8b2137f799b1beaebf89835b060c53461a3 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 14 Apr 2017 08:32:38 -0700 Subject: [PATCH 396/461] Iterate properly --- tools/profiling/microbenchmarks/bm_diff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index d22a97fd1ea..07c145e4e48 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -147,7 +147,7 @@ finally: subprocess.check_call(['git', 'checkout', where_am_i]) subprocess.check_call(['git', 'submodule', 'update']) -for loop in args.loops: +for loop in range(0, args.loops): jobs.extend(x for x in itertools.chain( (collect1(bm, 'opt', 'new', loop) for bm in args.benchmarks), (collect1(bm, 'counters', 'new', loop) for bm in args.benchmarks), From bc442e1ff0e2fd8107d41219c3c52472324efa77 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 14 Apr 2017 08:33:55 -0700 Subject: [PATCH 397/461] Declare jobs --- tools/profiling/microbenchmarks/bm_diff.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index 07c145e4e48..a6e77b375f1 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -147,6 +147,7 @@ finally: subprocess.check_call(['git', 'checkout', where_am_i]) subprocess.check_call(['git', 'submodule', 'update']) +jobs = [] for loop in range(0, args.loops): jobs.extend(x for x in itertools.chain( (collect1(bm, 'opt', 'new', loop) for bm in args.benchmarks), From d71ba8392aadb43eb015270499c711a4221ddd95 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 14 Apr 2017 08:36:11 -0700 Subject: [PATCH 398/461] Tweak defaults --- tools/profiling/microbenchmarks/bm_diff.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index a6e77b375f1..bd0da57598f 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -96,8 +96,8 @@ argp.add_argument('-t', '--track', help='Which metrics to track') argp.add_argument('-b', '--benchmarks', nargs='+', choices=_AVAILABLE_BENCHMARK_TESTS, default=['bm_cq']) argp.add_argument('-d', '--diff_base', type=str) -argp.add_argument('-r', '--repetitions', type=int, default=3) -argp.add_argument('-l', '--loops', type=int, default=7) +argp.add_argument('-r', '--repetitions', type=int, default=1) +argp.add_argument('-l', '--loops', type=int, default=30) argp.add_argument('-p', '--p_threshold', type=float, default=0.01) argp.add_argument('-j', '--jobs', type=int, default=multiprocessing.cpu_count()) args = argp.parse_args() From 13c0e6e549175f29cb2d22bd3b2f7b00e5c2e94c Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 14 Apr 2017 08:40:04 -0700 Subject: [PATCH 399/461] Update .gitignore --- .gitignore | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.gitignore b/.gitignore index ad3ec64ab5a..5e38f5fa01b 100644 --- a/.gitignore +++ b/.gitignore @@ -118,3 +118,13 @@ gdb.txt # ctags file tags + +# perf data +perf.data +perf.data.old + +# bm_diff +bm_diff_new/ +bm_diff_old/ +bm_*.json + From 97e40da5a1219ccd838e0818d060b217c0830ae5 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 14 Apr 2017 09:04:07 -0700 Subject: [PATCH 400/461] Less samples, more random --- tools/profiling/microbenchmarks/bm_diff.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index bd0da57598f..3d4fa2a96a5 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -97,8 +97,7 @@ argp.add_argument('-t', '--track', argp.add_argument('-b', '--benchmarks', nargs='+', choices=_AVAILABLE_BENCHMARK_TESTS, default=['bm_cq']) argp.add_argument('-d', '--diff_base', type=str) argp.add_argument('-r', '--repetitions', type=int, default=1) -argp.add_argument('-l', '--loops', type=int, default=30) -argp.add_argument('-p', '--p_threshold', type=float, default=0.01) +argp.add_argument('-l', '--loops', type=int, default=12) argp.add_argument('-j', '--jobs', type=int, default=multiprocessing.cpu_count()) args = argp.parse_args() @@ -155,7 +154,7 @@ for loop in range(0, args.loops): (collect1(bm, 'opt', 'old', loop) for bm in args.benchmarks), (collect1(bm, 'counters', 'old', loop) for bm in args.benchmarks), )) -random.shuffle(jobs) +random.shuffle(jobs, random.SystemRandom().random) jobset.run(jobs, maxjobs=args.jobs) From 0bbdb022de0279168523bf3994003b1642ce742e Mon Sep 17 00:00:00 2001 From: Yuxuan Li Date: Fri, 14 Apr 2017 11:47:18 -0700 Subject: [PATCH 401/461] adding a benchmark for c core call create that do two separate batches. --- test/cpp/microbenchmarks/bm_call_create.cc | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index ada732c233b..4b99a804274 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -242,6 +242,89 @@ static void BM_LameChannelCallCreateCore(benchmark::State &state) { } BENCHMARK(BM_LameChannelCallCreateCore); +static void BM_LameChannelCallCreateCoreSeparateBatch(benchmark::State &state) { + TrackCounters track_counters; + + grpc_channel *channel; + grpc_completion_queue *cq; + grpc_metadata_array initial_metadata_recv; + grpc_metadata_array trailing_metadata_recv; + grpc_byte_buffer *response_payload_recv = NULL; + grpc_status_code status; + grpc_slice details; + grpc::testing::EchoRequest send_request; + grpc_slice send_request_slice = + grpc_slice_new(&send_request, sizeof(send_request), do_nothing); + + channel = grpc_lame_client_channel_create( + "localhost:1234", GRPC_STATUS_UNAUTHENTICATED, "blah"); + cq = grpc_completion_queue_create(NULL); + void *rc = grpc_channel_register_call( + channel, "/grpc.testing.EchoTestService/Echo", NULL, NULL); + while (state.KeepRunning()) { + GPR_TIMER_SCOPE("BenchmarkCycle", 0); + grpc_call *call = grpc_channel_create_registered_call( + channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq, rc, + gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + grpc_metadata_array_init(&initial_metadata_recv); + grpc_metadata_array_init(&trailing_metadata_recv); + grpc_byte_buffer *request_payload_send = + grpc_raw_byte_buffer_create(&send_request_slice, 1); + + // Fill in call ops + grpc_op ops[3]; + memset(ops, 0, sizeof(ops)); + grpc_op *op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op++; + op->op = GRPC_OP_SEND_MESSAGE; + op->data.send_message.send_message = request_payload_send; + op++; + op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; + op++; + GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, ops, + (size_t)(op - ops), + (void *)0, NULL)); + memset(ops, 0, sizeof(ops)); + op = ops; + op->op = GRPC_OP_RECV_INITIAL_METADATA; + op->data.recv_initial_metadata.recv_initial_metadata = + &initial_metadata_recv; + op++; + op->op = GRPC_OP_RECV_MESSAGE; + op->data.recv_message.recv_message = &response_payload_recv; + op++; + op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; + op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; + op->data.recv_status_on_client.status = &status; + op->data.recv_status_on_client.status_details = &details; + op++; + + GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, ops, + (size_t)(op - ops), + (void *)1, NULL)); + grpc_event ev = grpc_completion_queue_next( + cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + GPR_ASSERT(ev.type != GRPC_QUEUE_SHUTDOWN); + GPR_ASSERT(ev.success == 0); + ev = grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), + NULL); + GPR_ASSERT(ev.type != GRPC_QUEUE_SHUTDOWN); + GPR_ASSERT(ev.success != 0); + grpc_call_destroy(call); + grpc_byte_buffer_destroy(request_payload_send); + grpc_byte_buffer_destroy(response_payload_recv); + grpc_metadata_array_destroy(&initial_metadata_recv); + grpc_metadata_array_destroy(&trailing_metadata_recv); + } + grpc_channel_destroy(channel); + grpc_completion_queue_destroy(cq); + grpc_slice_unref(send_request_slice); + track_counters.Finish(state); +} +BENCHMARK(BM_LameChannelCallCreateCoreSeparateBatch); + static void FilterDestroy(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { gpr_free(arg); From eafeea48a981d799c2c893102b6f0cbe25163a7f Mon Sep 17 00:00:00 2001 From: yang-g Date: Fri, 14 Apr 2017 12:34:10 -0700 Subject: [PATCH 402/461] Update ServerGlobalCallback::AddPort api --- include/grpc++/server.h | 3 ++- src/cpp/server/server_cc.cc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/grpc++/server.h b/include/grpc++/server.h index 489937712ec..325bd138c7e 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -89,7 +89,8 @@ class Server final : public ServerInterface, private GrpcLibraryCodegen { /// Called before server is started. virtual void PreServerStart(Server* server) {} /// Called after a server port is added. - virtual void AddPort(Server* server, int port) {} + virtual void AddPort(Server* server, const grpc::string& addr, + ServerCredentials* creds, int port) {} }; /// Set the global callback object. Can only be called once. Does not take /// ownership of callbacks, and expects the pointed to object to be alive diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index ce173a1ee2d..325f8d3c6f1 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -490,7 +490,7 @@ int Server::AddListeningPort(const grpc::string& addr, ServerCredentials* creds) { GPR_ASSERT(!started_); int port = creds->AddPortToServer(addr, server_); - global_callbacks_->AddPort(this, port); + global_callbacks_->AddPort(this, addr, creds, port); return port; } From 349907b6459b639a937130f4de23e785cbf289d1 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 14 Apr 2017 13:00:47 -0700 Subject: [PATCH 403/461] Handle EINTR on reading file --- tools/profiling/microbenchmarks/bm_diff.py | 25 +++++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index 3d4fa2a96a5..ba0c225f6cc 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -46,6 +46,7 @@ import itertools import speedup import random import shutil +import errno _INTERESTING = ( 'cpu_time', @@ -191,18 +192,26 @@ class Benchmark: return [self.final[f] if f in self.final else '' for f in flds] +def read_file(filename): + while True: + try: + with open(filename) as f: + return f.read() + except IOError, e: + if e.errno != errno.EINTR: + raise + +def read_json(filename): + return json.loads(read_file(filename)) + benchmarks = collections.defaultdict(Benchmark) for bm in args.benchmarks: for loop in range(0, args.loops): - with open('%s.counters.new.%d.json' % (bm, loop)) as f: - js_new_ctr = json.loads(f.read()) - with open('%s.opt.new.%d.json' % (bm, loop)) as f: - js_new_opt = json.loads(f.read()) - with open('%s.counters.old.%d.json' % (bm, loop)) as f: - js_old_ctr = json.loads(f.read()) - with open('%s.opt.old.%d.json' % (bm, loop)) as f: - js_old_opt = json.loads(f.read()) + js_new_ctr = read_json('%s.counters.new.%d.json' % (bm, loop)) + js_new_opt = read_json('%s.opt.new.%d.json' % (bm, loop)) + js_old_ctr = read_json('%s.counters.old.%d.json' % (bm, loop)) + js_old_opt = read_json('%s.opt.old.%d.json' % (bm, loop)) for row in bm_json.expand_json(js_new_ctr, js_new_opt): print row From 8b24229b7ca6b30b6c3eae64e20551386abc6ecb Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 14 Apr 2017 13:15:16 -0700 Subject: [PATCH 404/461] Fix merge --- test/core/end2end/invalid_call_argument_test.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/test/core/end2end/invalid_call_argument_test.c b/test/core/end2end/invalid_call_argument_test.c index 8df64b9e741..e9a31f278c7 100644 --- a/test/core/end2end/invalid_call_argument_test.c +++ b/test/core/end2end/invalid_call_argument_test.c @@ -125,12 +125,8 @@ static void prepare_test(int is_client) { } static void cleanup_test() { -<<<<<<< HEAD - grpc_call_unref(g_state.call); -======= grpc_completion_queue *shutdown_cq; - grpc_call_destroy(g_state.call); ->>>>>>> e412a180602753972ac496560322e224a5db987f + grpc_call_unref(g_state.call); cq_verifier_destroy(g_state.cqv); grpc_channel_destroy(g_state.chan); grpc_slice_unref(g_state.details); @@ -138,16 +134,10 @@ static void cleanup_test() { grpc_metadata_array_destroy(&g_state.trailing_metadata_recv); if (!g_state.is_client) { -<<<<<<< HEAD - grpc_call_unref(g_state.server_call); - grpc_server_shutdown_and_notify(g_state.server, g_state.cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(g_state.cq, tag(1000), -======= shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); - grpc_call_destroy(g_state.server_call); + grpc_call_unref(g_state.server_call); grpc_server_shutdown_and_notify(g_state.server, shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(shutdown_cq, tag(1000), ->>>>>>> e412a180602753972ac496560322e224a5db987f grpc_timeout_seconds_to_deadline(5), NULL) .type == GRPC_OP_COMPLETE); From 2f4679ea348637cd5882ace228f2dc6bc0649d4c Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Fri, 14 Apr 2017 13:06:27 -0700 Subject: [PATCH 405/461] Fix handling of slice in http_client_filter --- include/grpc/slice.h | 6 +++--- src/core/ext/filters/http/client/http_client_filter.c | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/include/grpc/slice.h b/include/grpc/slice.h index ea66e094e98..8c32a30d762 100644 --- a/include/grpc/slice.h +++ b/include/grpc/slice.h @@ -102,9 +102,9 @@ GPRAPI grpc_slice grpc_slice_from_static_string(const char *source); /* Create a slice pointing to constant memory */ GPRAPI grpc_slice grpc_slice_from_static_buffer(const void *source, size_t len); -/* Return a result slice derived from s, which shares a ref count with s, where - result.data==s.data+begin, and result.length==end-begin. - The ref count of s is increased by one. +/* Return a result slice derived from s, which shares a ref count with \a s, + where result.data==s.data+begin, and result.length==end-begin. The ref count + of \a s is increased by one. Do not assign result back to \a s. Requires s initialized, begin <= end, begin <= s.length, and end <= source->length. */ GPRAPI grpc_slice grpc_slice_sub(grpc_slice s, size_t begin, size_t end); diff --git a/src/core/ext/filters/http/client/http_client_filter.c b/src/core/ext/filters/http/client/http_client_filter.c index b896c7e7bba..7bab7b1462d 100644 --- a/src/core/ext/filters/http/client/http_client_filter.c +++ b/src/core/ext/filters/http/client/http_client_filter.c @@ -313,7 +313,6 @@ static grpc_error *hc_mutate_op(grpc_exec_ctx *exec_ctx, estimated_len += grpc_base64_estimate_encoded_size( op->payload->send_message.send_message->length, k_url_safe, k_multi_line); - estimated_len += 1; /* for the trailing 0 */ grpc_slice path_with_query_slice = grpc_slice_malloc(estimated_len); /* memcopy individual pieces into this slice */ @@ -335,7 +334,7 @@ static grpc_error *hc_mutate_op(grpc_exec_ctx *exec_ctx, char *t = (char *)GRPC_SLICE_START_PTR(path_with_query_slice); /* safe to use strlen since base64_encode will always add '\0' */ path_with_query_slice = - grpc_slice_sub(path_with_query_slice, 0, strlen(t)); + grpc_slice_sub_no_ref(path_with_query_slice, 0, strlen(t)); /* substitute previous path with the new path+query */ grpc_mdelem mdelem_path_and_query = grpc_mdelem_from_slices( @@ -349,7 +348,6 @@ static grpc_error *hc_mutate_op(grpc_exec_ctx *exec_ctx, calld->on_complete = op->on_complete; op->on_complete = &calld->hc_on_complete; op->send_message = false; - grpc_slice_unref_internal(exec_ctx, path_with_query_slice); } else { /* Not all data is available. Fall back to POST. */ gpr_log(GPR_DEBUG, From 3725128dc659829b69bb4eced8fec3f0621da890 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Fri, 14 Apr 2017 13:46:03 -0700 Subject: [PATCH 406/461] Comments --- .../filters/client_channel/client_channel.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel.c b/src/core/ext/filters/client_channel/client_channel.c index e446f0543a8..813d7aa06dd 100644 --- a/src/core/ext/filters/client_channel/client_channel.c +++ b/src/core/ext/filters/client_channel/client_channel.c @@ -236,6 +236,10 @@ static void set_channel_connectivity_state_locked(grpc_exec_ctx *exec_ctx, grpc_connectivity_state state, grpc_error *error, const char *reason) { + /* TODO: Improve failure handling: + * - Make it possible for policies to return GRPC_CHANNEL_TRANSIENT_FAILURE. + * - Hand over pending picks from old policies during the switch that happens + * when resolver provides an update. */ if (chand->lb_policy != NULL) { if (state == GRPC_CHANNEL_TRANSIENT_FAILURE) { /* cancel picks with wait_for_ready=false */ @@ -364,22 +368,18 @@ typedef struct wrapped_on_pick_closure_arg { /* The policy instance related to the closure */ grpc_lb_policy *lb_policy; - - /* heap memory to be freed upon closure execution. Usually this arg. */ - void *free_when_done; } wrapped_on_pick_closure_arg; -// Invoke \a arg->wrapped_closure, unref \a arg->lb_policy and free -// arg->free_when_done (usually \a arg itself). +// Invoke \a arg->wrapped_closure, unref \a arg->lb_policy and free \a arg. static void wrapped_on_pick_closure_cb(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { wrapped_on_pick_closure_arg *wc_arg = arg; + GPR_ASSERT(wc_arg != NULL); GPR_ASSERT(wc_arg->wrapped_closure != NULL); GPR_ASSERT(wc_arg->lb_policy != NULL); - GPR_ASSERT(wc_arg->free_when_done != NULL); - grpc_closure_sched(exec_ctx, wc_arg->wrapped_closure, GRPC_ERROR_REF(error)); + grpc_closure_run(exec_ctx, wc_arg->wrapped_closure, GRPC_ERROR_REF(error)); GRPC_LB_POLICY_UNREF(exec_ctx, wc_arg->lb_policy, "pick_subchannel_wrapping"); - gpr_free(wc_arg->free_when_done); + gpr_free(wc_arg); } static void on_resolver_result_changed_locked(grpc_exec_ctx *exec_ctx, @@ -1078,7 +1078,6 @@ static bool pick_subchannel_locked( w_on_pick_arg->wrapped_closure = on_ready; GRPC_LB_POLICY_REF(lb_policy, "pick_subchannel_wrapping"); w_on_pick_arg->lb_policy = lb_policy; - w_on_pick_arg->free_when_done = w_on_pick_arg; const bool pick_done = grpc_lb_policy_pick_locked( exec_ctx, lb_policy, &inputs, connected_subchannel, NULL, &w_on_pick_arg->wrapper_closure); @@ -1086,7 +1085,7 @@ static bool pick_subchannel_locked( /* synchronous grpc_lb_policy_pick call. Unref the LB policy. */ GRPC_LB_POLICY_UNREF(exec_ctx, w_on_pick_arg->lb_policy, "pick_subchannel_wrapping"); - gpr_free(w_on_pick_arg->free_when_done); + gpr_free(w_on_pick_arg); } GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "pick_subchannel"); GPR_TIMER_END("pick_subchannel", 0); From 9c8e9be16bace39e31df10c16327aa7620ff3ca9 Mon Sep 17 00:00:00 2001 From: Makarand Dharmapurikar Date: Fri, 14 Apr 2017 14:01:33 -0700 Subject: [PATCH 407/461] removed 'objc' from list of 'all' languages --- tools/run_tests/run_interop_tests.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/run_tests/run_interop_tests.py b/tools/run_tests/run_interop_tests.py index fcc752fdea4..89725c10a63 100755 --- a/tools/run_tests/run_interop_tests.py +++ b/tools/run_tests/run_interop_tests.py @@ -947,9 +947,13 @@ if not args.use_docker and servers: print('Running interop servers is only supported with --use_docker option enabled.') sys.exit(1) + +# we want to include everything but objc in 'all' +# because objc won't run on non-mac platforms +all_but_objc = set(six.iterkeys(_LANGUAGES)) - set(['objc']) languages = set(_LANGUAGES[l] for l in itertools.chain.from_iterable( - six.iterkeys(_LANGUAGES) if x == 'all' else [x] + all_but_objc if x == 'all' else [x] for x in args.language)) languages_http2_clients_for_http2_server_interop = set() From d471818d8c986b2e4e86c2150dbbf2d54fb0d526 Mon Sep 17 00:00:00 2001 From: Makarand Dharmapurikar Date: Fri, 14 Apr 2017 15:05:41 -0700 Subject: [PATCH 408/461] script to run objc interop tests --- tools/jenkins/run_interop_objc.sh | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 tools/jenkins/run_interop_objc.sh diff --git a/tools/jenkins/run_interop_objc.sh b/tools/jenkins/run_interop_objc.sh new file mode 100755 index 00000000000..29f9ac989c7 --- /dev/null +++ b/tools/jenkins/run_interop_objc.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# Copyright 2017, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# This script is invoked by Jenkins and runs interop test suite. +set -ex + +export LANG=en_US.UTF-8 + +# Enter the gRPC repo root +cd $(dirname $0)/../.. + +tools/run_tests/run_interop_tests.py -l objc -s all --use_docker -t -j 1 $@ || true From 5ec52ae01a08f6060cc90125f916dd056b899174 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Fri, 14 Apr 2017 15:07:28 -0700 Subject: [PATCH 409/461] PHP: add ares as deps --- build.yaml | 1 + config.m4 | 57 +++++++++++++++++++++++++++- package.xml | 73 ++++++++++++++++++++++++++++++++++++ templates/config.m4.template | 7 +++- 4 files changed, 136 insertions(+), 2 deletions(-) diff --git a/build.yaml b/build.yaml index 7edad7e9db3..781118f3077 100644 --- a/build.yaml +++ b/build.yaml @@ -4473,6 +4473,7 @@ php_config_m4: deps: - grpc - gpr + - ares - boringssl headers: - src/php/ext/grpc/byte_buffer.h diff --git a/config.m4 b/config.m4 index c414fc3620f..74b60c9241c 100644 --- a/config.m4 +++ b/config.m4 @@ -8,6 +8,8 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/include) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/src/php/ext/grpc) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/boringssl/include) + PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/cares) + PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/cares/cares) LIBS="-lpthread $LIBS" @@ -18,8 +20,11 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_LIBRARY(dl) case $host in - *darwin*) ;; + *darwin*) + PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/cares/config_darwin) + ;; *) + PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/cares/config_linux) PHP_ADD_LIBRARY(rt,,GRPC_SHARED_LIBADD) PHP_ADD_LIBRARY(rt) ;; @@ -621,6 +626,55 @@ if test "$PHP_GRPC" != "no"; then third_party/boringssl/ssl/tls13_server.c \ third_party/boringssl/ssl/tls_method.c \ third_party/boringssl/ssl/tls_record.c \ + third_party/cares/cares/ares__close_sockets.c \ + third_party/cares/cares/ares__get_hostent.c \ + third_party/cares/cares/ares__read_line.c \ + third_party/cares/cares/ares__timeval.c \ + third_party/cares/cares/ares_cancel.c \ + third_party/cares/cares/ares_create_query.c \ + third_party/cares/cares/ares_data.c \ + third_party/cares/cares/ares_destroy.c \ + third_party/cares/cares/ares_expand_name.c \ + third_party/cares/cares/ares_expand_string.c \ + third_party/cares/cares/ares_fds.c \ + third_party/cares/cares/ares_free_hostent.c \ + third_party/cares/cares/ares_free_string.c \ + third_party/cares/cares/ares_getenv.c \ + third_party/cares/cares/ares_gethostbyaddr.c \ + third_party/cares/cares/ares_gethostbyname.c \ + third_party/cares/cares/ares_getnameinfo.c \ + third_party/cares/cares/ares_getopt.c \ + third_party/cares/cares/ares_getsock.c \ + third_party/cares/cares/ares_init.c \ + third_party/cares/cares/ares_library_init.c \ + third_party/cares/cares/ares_llist.c \ + third_party/cares/cares/ares_mkquery.c \ + third_party/cares/cares/ares_nowarn.c \ + third_party/cares/cares/ares_options.c \ + third_party/cares/cares/ares_parse_a_reply.c \ + third_party/cares/cares/ares_parse_aaaa_reply.c \ + third_party/cares/cares/ares_parse_mx_reply.c \ + third_party/cares/cares/ares_parse_naptr_reply.c \ + third_party/cares/cares/ares_parse_ns_reply.c \ + third_party/cares/cares/ares_parse_ptr_reply.c \ + third_party/cares/cares/ares_parse_soa_reply.c \ + third_party/cares/cares/ares_parse_srv_reply.c \ + third_party/cares/cares/ares_parse_txt_reply.c \ + third_party/cares/cares/ares_platform.c \ + third_party/cares/cares/ares_process.c \ + third_party/cares/cares/ares_query.c \ + third_party/cares/cares/ares_search.c \ + third_party/cares/cares/ares_send.c \ + third_party/cares/cares/ares_strcasecmp.c \ + third_party/cares/cares/ares_strdup.c \ + third_party/cares/cares/ares_strerror.c \ + third_party/cares/cares/ares_timeout.c \ + third_party/cares/cares/ares_version.c \ + third_party/cares/cares/ares_writev.c \ + third_party/cares/cares/bitncmp.c \ + third_party/cares/cares/inet_net_pton.c \ + third_party/cares/cares/inet_ntop.c \ + third_party/cares/cares/windows_port.c \ , $ext_shared, , -Wall -Werror \ -Wno-parentheses-equality -Wno-unused-value -std=c11 \ -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN \ @@ -717,5 +771,6 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/x509) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/x509v3) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/ssl) + PHP_ADD_BUILD_DIR($ext_builddir/third_party/cares/cares) PHP_ADD_BUILD_DIR($ext_builddir/third_party/nanopb) fi diff --git a/package.xml b/package.xml index 6ed135e17ba..54a7bae49ac 100644 --- a/package.xml +++ b/package.xml @@ -1027,6 +1027,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/templates/config.m4.template b/templates/config.m4.template index f5f1d23088d..13ff7389e68 100644 --- a/templates/config.m4.template +++ b/templates/config.m4.template @@ -10,6 +10,8 @@ PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/include) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/src/php/ext/grpc) PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/boringssl/include) + PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/cares) + PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/cares/cares) LIBS="-lpthread $LIBS" @@ -20,8 +22,11 @@ PHP_ADD_LIBRARY(dl) case $host in - *darwin*) ;; + *darwin*) + PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/cares/config_darwin) + ;; *) + PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/cares/config_linux) PHP_ADD_LIBRARY(rt,,GRPC_SHARED_LIBADD) PHP_ADD_LIBRARY(rt) ;; From c59db4b136a3991f0edce0ac9cc008cf7737f0fb Mon Sep 17 00:00:00 2001 From: Makarand Dharmapurikar Date: Fri, 14 Apr 2017 15:08:31 -0700 Subject: [PATCH 410/461] added more tests to 'unimplemented' --- tools/run_tests/run_interop_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/run_tests/run_interop_tests.py b/tools/run_tests/run_interop_tests.py index 89725c10a63..44e93eb9cc3 100755 --- a/tools/run_tests/run_interop_tests.py +++ b/tools/run_tests/run_interop_tests.py @@ -397,7 +397,7 @@ class ObjcLanguage: # cmdline argument. Here we return all but one test cases as unimplemented, # and depend upon ObjC test's behavior that it runs all cases even when # we tell it to run just one. - return _TEST_CASES[1:] + return _TEST_CASES[1:] + _SKIP_COMPRESSION + _SKIP_DATA_FRAME_PADDING def unimplemented_test_cases_server(self): return _SKIP_COMPRESSION From 2a9b5d77ed0b139f71f9b9e04e527fb09afdbec9 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Fri, 14 Apr 2017 12:10:55 -0700 Subject: [PATCH 411/461] defer grpc_init and background threads until first grpc object init --- src/ruby/ext/grpc/rb_call_credentials.c | 4 ++-- src/ruby/ext/grpc/rb_channel.c | 11 +++++++---- src/ruby/ext/grpc/rb_channel.h | 2 ++ src/ruby/ext/grpc/rb_channel_credentials.c | 3 +++ src/ruby/ext/grpc/rb_compression_options.c | 7 +++++-- src/ruby/ext/grpc/rb_grpc.c | 22 ++++++++++++++-------- src/ruby/ext/grpc/rb_grpc.h | 2 ++ src/ruby/ext/grpc/rb_server.c | 6 +++++- 8 files changed, 40 insertions(+), 17 deletions(-) diff --git a/src/ruby/ext/grpc/rb_call_credentials.c b/src/ruby/ext/grpc/rb_call_credentials.c index 280f21c9731..fac2cbb04d1 100644 --- a/src/ruby/ext/grpc/rb_call_credentials.c +++ b/src/ruby/ext/grpc/rb_call_credentials.c @@ -221,6 +221,8 @@ static VALUE grpc_rb_call_credentials_init(VALUE self, VALUE proc) { grpc_call_credentials *creds = NULL; grpc_metadata_credentials_plugin plugin; + grpc_ruby_once_init(); + TypedData_Get_Struct(self, grpc_rb_call_credentials, &grpc_rb_call_credentials_data_type, wrapper); @@ -281,8 +283,6 @@ void Init_grpc_call_credentials() { grpc_rb_call_credentials_compose, -1); id_callback = rb_intern("__callback"); - - grpc_rb_event_queue_thread_start(); } /* Gets the wrapped grpc_call_credentials from the ruby wrapper */ diff --git a/src/ruby/ext/grpc/rb_channel.c b/src/ruby/ext/grpc/rb_channel.c index 1c20c8813ff..6d12ff9ebd0 100644 --- a/src/ruby/ext/grpc/rb_channel.c +++ b/src/ruby/ext/grpc/rb_channel.c @@ -166,6 +166,8 @@ static VALUE grpc_rb_channel_init(int argc, VALUE *argv, VALUE self) { grpc_channel_args args; MEMZERO(&args, grpc_channel_args, 1); + grpc_ruby_once_init(); + /* "3" == 3 mandatory args */ rb_scan_args(argc, argv, "3", &target, &channel_args, &credentials); @@ -521,10 +523,12 @@ static VALUE run_poll_channels_loop(VALUE arg) { * calls - so that c-core can reconnect if needed, when there aren't any RPC's. * TODO(apolcyn) remove this when core handles new RPCs on dead connections. */ -static void start_poll_channels_loop() { - channel_polling_cq = grpc_completion_queue_create(NULL); +void grpc_rb_channel_polling_thread_start() { + GPR_ASSERT(!abort_channel_polling); + GPR_ASSERT(channel_polling_cq == NULL); + gpr_mu_init(&global_connection_polling_mu); - abort_channel_polling = 0; + channel_polling_cq = grpc_completion_queue_create(NULL); rb_thread_create(run_poll_channels_loop, NULL); } @@ -597,7 +601,6 @@ void Init_grpc_channel() { id_insecure_channel = rb_intern("this_channel_is_insecure"); Init_grpc_propagate_masks(); Init_grpc_connectivity_states(); - start_poll_channels_loop(); } /* Gets the wrapped channel from the ruby wrapper */ diff --git a/src/ruby/ext/grpc/rb_channel.h b/src/ruby/ext/grpc/rb_channel.h index 77e1f6acbca..fdceb79bca5 100644 --- a/src/ruby/ext/grpc/rb_channel.h +++ b/src/ruby/ext/grpc/rb_channel.h @@ -41,6 +41,8 @@ /* Initializes the Channel class. */ void Init_grpc_channel(); +void grpc_rb_channel_polling_thread_start(); + /* Gets the wrapped channel from the ruby wrapper */ grpc_channel* grpc_rb_get_wrapped_channel(VALUE v); diff --git a/src/ruby/ext/grpc/rb_channel_credentials.c b/src/ruby/ext/grpc/rb_channel_credentials.c index 5b7aa3417e6..d334c091486 100644 --- a/src/ruby/ext/grpc/rb_channel_credentials.c +++ b/src/ruby/ext/grpc/rb_channel_credentials.c @@ -156,6 +156,9 @@ static VALUE grpc_rb_channel_credentials_init(int argc, VALUE *argv, VALUE self) grpc_ssl_pem_key_cert_pair key_cert_pair; const char *pem_root_certs_cstr = NULL; MEMZERO(&key_cert_pair, grpc_ssl_pem_key_cert_pair, 1); + + grpc_ruby_once_init(); + /* "03" == no mandatory arg, 3 optional */ rb_scan_args(argc, argv, "03", &pem_root_certs, &pem_private_key, &pem_cert_chain); diff --git a/src/ruby/ext/grpc/rb_compression_options.c b/src/ruby/ext/grpc/rb_compression_options.c index 6b2467ee461..b23e82b0dba 100644 --- a/src/ruby/ext/grpc/rb_compression_options.c +++ b/src/ruby/ext/grpc/rb_compression_options.c @@ -100,8 +100,11 @@ static rb_data_type_t grpc_rb_compression_options_data_type = { Allocate the wrapped grpc compression options and initialize it here too. */ static VALUE grpc_rb_compression_options_alloc(VALUE cls) { - grpc_rb_compression_options *wrapper = - gpr_malloc(sizeof(grpc_rb_compression_options)); + grpc_rb_compression_options *wrapper = NULL; + + grpc_ruby_once_init(); + + wrapper = gpr_malloc(sizeof(grpc_rb_compression_options)); wrapper->wrapped = NULL; wrapper->wrapped = gpr_malloc(sizeof(grpc_compression_options)); grpc_compression_options_init(wrapper->wrapped); diff --git a/src/ruby/ext/grpc/rb_grpc.c b/src/ruby/ext/grpc/rb_grpc.c index 17cd165a91d..584b5dbc63d 100644 --- a/src/ruby/ext/grpc/rb_grpc.c +++ b/src/ruby/ext/grpc/rb_grpc.c @@ -50,6 +50,8 @@ #include "rb_server.h" #include "rb_server_credentials.h" #include "rb_compression_options.h" +#include "rb_event_thread.h" +#include "rb_channel.h" static VALUE grpc_rb_cTimeVal = Qnil; @@ -291,17 +293,14 @@ VALUE sym_metadata = Qundef; static gpr_once g_once_init = GPR_ONCE_INIT; -static void grpc_ruby_once_init() { +static void grpc_ruby_once_init_internal() { grpc_init(); + grpc_rb_event_queue_thread_start(); + grpc_rb_channel_polling_thread_start(); atexit(grpc_rb_shutdown); } -void Init_grpc_c() { - if (!grpc_rb_load_core()) { - rb_raise(rb_eLoadError, "Couldn't find or load gRPC's dynamic C core"); - return; - } - +void grpc_ruby_once_init() { /* ruby_vm_at_exit doesn't seem to be working. It would crash once every * blue moon, and some users are getting it repeatedly. See the discussions * - https://github.com/grpc/grpc/pull/5337 @@ -312,7 +311,14 @@ void Init_grpc_c() { * then loaded again by another VM within the same process, we need to * schedule our initialization and destruction only once. */ - gpr_once_init(&g_once_init, grpc_ruby_once_init); + gpr_once_init(&g_once_init, grpc_ruby_once_init_internal); +} + +void Init_grpc_c() { + if (!grpc_rb_load_core()) { + rb_raise(rb_eLoadError, "Couldn't find or load gRPC's dynamic C core"); + return; + } grpc_rb_mGRPC = rb_define_module("GRPC"); grpc_rb_mGrpcCore = rb_define_module_under(grpc_rb_mGRPC, "Core"); diff --git a/src/ruby/ext/grpc/rb_grpc.h b/src/ruby/ext/grpc/rb_grpc.h index 6ea6cbd0b6c..4bf11e75df2 100644 --- a/src/ruby/ext/grpc/rb_grpc.h +++ b/src/ruby/ext/grpc/rb_grpc.h @@ -82,4 +82,6 @@ VALUE grpc_rb_cannot_init_copy(VALUE copy, VALUE self); /* grpc_rb_time_timeval creates a gpr_timespec from a ruby time object. */ gpr_timespec grpc_rb_time_timeval(VALUE time, int interval); +void grpc_ruby_once_init(); + #endif /* GRPC_RB_H_ */ diff --git a/src/ruby/ext/grpc/rb_server.c b/src/ruby/ext/grpc/rb_server.c index 7b2f5774aa1..de79a5121ff 100644 --- a/src/ruby/ext/grpc/rb_server.c +++ b/src/ruby/ext/grpc/rb_server.c @@ -131,11 +131,15 @@ static VALUE grpc_rb_server_alloc(VALUE cls) { Initializes server instances. */ static VALUE grpc_rb_server_init(VALUE self, VALUE channel_args) { - grpc_completion_queue *cq = grpc_completion_queue_create(NULL); + grpc_completion_queue *cq = NULL; grpc_rb_server *wrapper = NULL; grpc_server *srv = NULL; grpc_channel_args args; MEMZERO(&args, grpc_channel_args, 1); + + grpc_ruby_once_init(); + + cq = grpc_completion_queue_create(NULL); TypedData_Get_Struct(self, grpc_rb_server, &grpc_rb_server_data_type, wrapper); grpc_rb_hash_convert_to_channel_args(channel_args, &args); From 792c7e3d278d144d4ca614006a06844d7796d30a Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Fri, 14 Apr 2017 15:56:04 -0700 Subject: [PATCH 412/461] add new test where client forks after require grpc, to test that lib startup --- src/ruby/end2end/forking_client_client.rb | 69 +++++++++++++++++++ src/ruby/end2end/forking_client_driver.rb | 69 +++++++++++++++++++ src/ruby/ext/grpc/rb_server.c | 2 - .../helper_scripts/run_ruby_end2end_tests.sh | 1 + 4 files changed, 139 insertions(+), 2 deletions(-) create mode 100755 src/ruby/end2end/forking_client_client.rb create mode 100755 src/ruby/end2end/forking_client_driver.rb diff --git a/src/ruby/end2end/forking_client_client.rb b/src/ruby/end2end/forking_client_client.rb new file mode 100755 index 00000000000..fbe03686b3b --- /dev/null +++ b/src/ruby/end2end/forking_client_client.rb @@ -0,0 +1,69 @@ +#!/usr/bin/env ruby + +# Copyright 2015, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Prompted by and minimal repro of https://github.com/grpc/grpc/issues/10658 + +require_relative './end2end_common' + +def main + server_port = '' + OptionParser.new do |opts| + opts.on('--client_control_port=P', String) do + STDERR.puts 'client control port not used' + end + opts.on('--server_port=P', String) do |p| + server_port = p + end + end.parse! + + p = fork do + stub = Echo::EchoServer::Stub.new("localhost:#{server_port}", + :this_channel_is_insecure) + stub.echo(Echo::EchoRequest.new(request: 'hello')) + end + + begin + Timeout.timeout(10) do + Process.wait(p) + end + rescue Timeout::Error + STDERR.puts "timeout waiting for forked process #{p}" + Process.kill('SIGKILL', p) + Process.wait(p) + raise 'Timed out waiting for client process. ' \ + 'It likely hangs when killed while in the middle of an rpc' + end + + client_exit_code = $CHILD_STATUS + fail "forked process failed #{client_exit_code}" if client_exit_code != 0 +end + +main diff --git a/src/ruby/end2end/forking_client_driver.rb b/src/ruby/end2end/forking_client_driver.rb new file mode 100755 index 00000000000..2c67b33590d --- /dev/null +++ b/src/ruby/end2end/forking_client_driver.rb @@ -0,0 +1,69 @@ +#!/usr/bin/env ruby + +# Copyright 2016, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +require_relative './end2end_common' + +def main + STDERR.puts 'start server' + server_runner = ServerRunner.new(EchoServerImpl) + server_port = server_runner.run + + # TODO(apolcyn) Can we get rid of this sleep? + # Without it, an immediate call to the just started EchoServer + # fails with UNAVAILABLE + sleep 1 + + STDERR.puts 'start client' + _, client_pid = start_client('forking_client_client.rb', + server_port) + + begin + Timeout.timeout(10) do + Process.wait(client_pid) + end + rescue Timeout::Error + STDERR.puts "timeout wait for client pid #{client_pid}" + Process.kill('SIGKILL', client_pid) + Process.wait(client_pid) + STDERR.puts 'killed client child' + raise 'Timed out waiting for client process. ' \ + 'It likely hangs when requiring grpc, then forking, then using grpc ' + end + + client_exit_code = $CHILD_STATUS + if client_exit_code != 0 + fail "forking client client failed, exit code #{client_exit_code}" + end + + server_runner.stop +end + +main diff --git a/src/ruby/ext/grpc/rb_server.c b/src/ruby/ext/grpc/rb_server.c index de79a5121ff..2286a99f249 100644 --- a/src/ruby/ext/grpc/rb_server.c +++ b/src/ruby/ext/grpc/rb_server.c @@ -222,8 +222,6 @@ static VALUE grpc_rb_server_request_call(VALUE self) { return Qnil; } - - /* build the NewServerRpc struct result */ deadline = gpr_convert_clock_type(st.details.deadline, GPR_CLOCK_REALTIME); result = rb_struct_new( diff --git a/tools/run_tests/helper_scripts/run_ruby_end2end_tests.sh b/tools/run_tests/helper_scripts/run_ruby_end2end_tests.sh index 92d69757073..cd289335c12 100755 --- a/tools/run_tests/helper_scripts/run_ruby_end2end_tests.sh +++ b/tools/run_tests/helper_scripts/run_ruby_end2end_tests.sh @@ -39,4 +39,5 @@ ruby src/ruby/end2end/channel_state_driver.rb || EXIT_CODE=1 ruby src/ruby/end2end/channel_closing_driver.rb || EXIT_CODE=1 ruby src/ruby/end2end/sig_int_during_channel_watch_driver.rb || EXIT_CODE=1 ruby src/ruby/end2end/killed_client_thread_driver.rb || EXIT_CODE=1 +ruby src/ruby/end2end/forking_client_driver.rb || EXIT_CODE=1 exit $EXIT_CODE From 2b0cb771b046d5ef285be2ed4427aa794c829c6c Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Mon, 3 Apr 2017 15:00:43 -0700 Subject: [PATCH 413/461] Just set frame size by BDP --- src/core/ext/transport/chttp2/transport/chttp2_transport.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 9269611dd9d..2c8a7b86996 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -2150,6 +2150,7 @@ static void update_bdp(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, (int)bdp); } push_setting(exec_ctx, t, GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, bdp); + push_setting(exec_ctx, t, GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE, bdp); } static grpc_error *try_http_parsing(grpc_exec_ctx *exec_ctx, From 4736e01c1672d378202df0faaada986c50141197 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Fri, 14 Apr 2017 17:32:00 -0700 Subject: [PATCH 414/461] add native grpc class init tests to check that presence of grpc_init calls --- src/ruby/end2end/forking_client_client.rb | 2 +- src/ruby/end2end/grpc_class_init_client.rb | 60 +++++++++++++++++ src/ruby/end2end/grpc_class_init_driver.rb | 67 +++++++++++++++++++ .../helper_scripts/run_ruby_end2end_tests.sh | 1 + 4 files changed, 129 insertions(+), 1 deletion(-) create mode 100755 src/ruby/end2end/grpc_class_init_client.rb create mode 100755 src/ruby/end2end/grpc_class_init_driver.rb diff --git a/src/ruby/end2end/forking_client_client.rb b/src/ruby/end2end/forking_client_client.rb index fbe03686b3b..c358d79f599 100755 --- a/src/ruby/end2end/forking_client_client.rb +++ b/src/ruby/end2end/forking_client_client.rb @@ -59,7 +59,7 @@ def main Process.kill('SIGKILL', p) Process.wait(p) raise 'Timed out waiting for client process. ' \ - 'It likely hangs when killed while in the middle of an rpc' + 'It likely hangs when using gRPC after loading it and then forking' end client_exit_code = $CHILD_STATUS diff --git a/src/ruby/end2end/grpc_class_init_client.rb b/src/ruby/end2end/grpc_class_init_client.rb new file mode 100755 index 00000000000..b321016b212 --- /dev/null +++ b/src/ruby/end2end/grpc_class_init_client.rb @@ -0,0 +1,60 @@ +#!/usr/bin/env ruby + +# Copyright 2015, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Try to catch if native gRPC class constructors are missing a 'grpc_init' + +require_relative './end2end_common' + +def main + grpc_class = '' + OptionParser.new do |opts| + opts.on('--grpc_class=P', String) do |p| + grpc_class = p + end + end.parse! + + case grpc_class + when 'channel' + GRPC::Core::Channel.new('dummy_host', nil, :this_channel_is_insecure) + when 'server' + GRPC::Core::Server.new({}) + when 'channel_credentials' + GRPC::Core::ChannelCredentials.new + when 'call_credentials' + GRPC::Core::CallCredentials.new(proc { |noop| noop }) + when 'compression_options' + GRPC::Core::CompressionOptions.new + else + fail "bad --grpc_class=#{grpc_class} param" + end +end + +main diff --git a/src/ruby/end2end/grpc_class_init_driver.rb b/src/ruby/end2end/grpc_class_init_driver.rb new file mode 100755 index 00000000000..764d029f149 --- /dev/null +++ b/src/ruby/end2end/grpc_class_init_driver.rb @@ -0,0 +1,67 @@ +#!/usr/bin/env ruby + +# Copyright 2016, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +require_relative './end2end_common' + +def main + native_grpc_classes = %w( channel + server + channel_credentials + call_credentials + compression_options ) + + native_grpc_classes.each do |grpc_class| + STDERR.puts 'start client' + this_dir = File.expand_path(File.dirname(__FILE__)) + client_path = File.join(this_dir, 'grpc_class_init_client.rb') + client_pid = Process.spawn(RbConfig.ruby, + client_path, + "--grpc_class=#{grpc_class}") + begin + Timeout.timeout(10) do + Process.wait(client_pid) + end + rescue Timeout::Error + STDERR.puts "timeout waiting for client pid #{client_pid}" + Process.kill('SIGKILL', client_pid) + Process.wait(client_pid) + STDERR.puts 'killed client child' + raise 'Timed out waiting for client process. ' \ + 'It likely hangs when the first constructed gRPC object has ' \ + "type: #{grpc_class}" + end + + client_exit_code = $CHILD_STATUS + fail "client failed, exit code #{client_exit_code}" if client_exit_code != 0 + end +end + +main diff --git a/tools/run_tests/helper_scripts/run_ruby_end2end_tests.sh b/tools/run_tests/helper_scripts/run_ruby_end2end_tests.sh index cd289335c12..6688025260f 100755 --- a/tools/run_tests/helper_scripts/run_ruby_end2end_tests.sh +++ b/tools/run_tests/helper_scripts/run_ruby_end2end_tests.sh @@ -40,4 +40,5 @@ ruby src/ruby/end2end/channel_closing_driver.rb || EXIT_CODE=1 ruby src/ruby/end2end/sig_int_during_channel_watch_driver.rb || EXIT_CODE=1 ruby src/ruby/end2end/killed_client_thread_driver.rb || EXIT_CODE=1 ruby src/ruby/end2end/forking_client_driver.rb || EXIT_CODE=1 +ruby src/ruby/end2end/grpc_class_init_driver.rb || EXIT_CODE=1 exit $EXIT_CODE From 53af23cfbf3b1fd4579ec084dbcb7b89a7ae2e96 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Sat, 15 Apr 2017 10:29:46 -0700 Subject: [PATCH 415/461] Improvements to Fake Resolver --- CMakeLists.txt | 32 +++ Makefile | 36 +++ build.yaml | 10 + .../client_channel/lb_policy_factory.c | 33 ++- .../client_channel/lb_policy_factory.h | 22 +- .../filters/client_channel/parse_address.c | 44 +++- .../filters/client_channel/parse_address.h | 19 +- .../resolver/sockaddr/sockaddr_resolver.c | 6 +- .../ext/filters/client_channel/subchannel.c | 8 +- .../ext/filters/client_channel/uri_parser.c | 4 +- .../ext/filters/client_channel/uri_parser.h | 2 +- src/core/lib/channel/channel_args.c | 11 +- src/core/lib/channel/channel_args.h | 3 +- src/core/lib/iomgr/sockaddr_utils.h | 2 +- .../credentials/fake/fake_credentials.c | 23 ++ .../credentials/fake/fake_credentials.h | 21 +- .../security/transport/security_connector.c | 8 +- test/core/client_channel/parse_address_test.c | 26 +-- test/core/client_channel/resolvers/BUILD | 40 +++- .../resolvers/fake_resolver_test.c | 187 ++++++++++++++++ test/core/end2end/BUILD | 79 ++++--- test/core/end2end/fake_resolver.c | 211 ++++++++++-------- test/core/end2end/fake_resolver.h | 34 +++ test/cpp/grpclb/grpclb_test.cc | 45 ++-- .../generated/sources_and_headers.json | 17 ++ tools/run_tests/generated/tests.json | 22 ++ vsprojects/buildtests_c.sln | 27 +++ .../fake_resolver_test.vcxproj | 199 +++++++++++++++++ .../fake_resolver_test.vcxproj.filters | 24 ++ 29 files changed, 975 insertions(+), 220 deletions(-) create mode 100644 test/core/client_channel/resolvers/fake_resolver_test.c create mode 100644 vsprojects/vcxproj/test/fake_resolver_test/fake_resolver_test.vcxproj create mode 100644 vsprojects/vcxproj/test/fake_resolver_test/fake_resolver_test.vcxproj.filters diff --git a/CMakeLists.txt b/CMakeLists.txt index 0dad894cc4c..a6a2af65d5d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -391,6 +391,7 @@ add_dependencies(buildtests_c error_test) if(_gRPC_PLATFORM_LINUX) add_dependencies(buildtests_c ev_epoll_linux_test) endif() +add_dependencies(buildtests_c fake_resolver_test) if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_dependencies(buildtests_c fd_conservation_posix_test) endif() @@ -5444,6 +5445,37 @@ target_link_libraries(ev_epoll_linux_test ) endif() +endif (gRPC_BUILD_TESTS) +if (gRPC_BUILD_TESTS) + +add_executable(fake_resolver_test + test/core/client_channel/resolvers/fake_resolver_test.c +) + + +target_include_directories(fake_resolver_test + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include + PRIVATE ${BORINGSSL_ROOT_DIR}/include + PRIVATE ${PROTOBUF_ROOT_DIR}/src + PRIVATE ${BENCHMARK_ROOT_DIR}/include + PRIVATE ${ZLIB_ROOT_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib + PRIVATE ${CARES_BUILD_INCLUDE_DIR} + PRIVATE ${CARES_INCLUDE_DIR} + PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares + PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include +) + +target_link_libraries(fake_resolver_test + ${_gRPC_ALLTARGETS_LIBRARIES} + grpc_test_util + grpc + gpr_test_util + gpr +) + endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) diff --git a/Makefile b/Makefile index b3d8737ecc1..8898939af9e 100644 --- a/Makefile +++ b/Makefile @@ -981,6 +981,7 @@ dualstack_socket_test: $(BINDIR)/$(CONFIG)/dualstack_socket_test endpoint_pair_test: $(BINDIR)/$(CONFIG)/endpoint_pair_test error_test: $(BINDIR)/$(CONFIG)/error_test ev_epoll_linux_test: $(BINDIR)/$(CONFIG)/ev_epoll_linux_test +fake_resolver_test: $(BINDIR)/$(CONFIG)/fake_resolver_test fd_conservation_posix_test: $(BINDIR)/$(CONFIG)/fd_conservation_posix_test fd_posix_test: $(BINDIR)/$(CONFIG)/fd_posix_test fling_client: $(BINDIR)/$(CONFIG)/fling_client @@ -1366,6 +1367,7 @@ buildtests_c: privatelibs_c \ $(BINDIR)/$(CONFIG)/endpoint_pair_test \ $(BINDIR)/$(CONFIG)/error_test \ $(BINDIR)/$(CONFIG)/ev_epoll_linux_test \ + $(BINDIR)/$(CONFIG)/fake_resolver_test \ $(BINDIR)/$(CONFIG)/fd_conservation_posix_test \ $(BINDIR)/$(CONFIG)/fd_posix_test \ $(BINDIR)/$(CONFIG)/fling_client \ @@ -1777,6 +1779,8 @@ test_c: buildtests_c $(Q) $(BINDIR)/$(CONFIG)/error_test || ( echo test error_test failed ; exit 1 ) $(E) "[RUN] Testing ev_epoll_linux_test" $(Q) $(BINDIR)/$(CONFIG)/ev_epoll_linux_test || ( echo test ev_epoll_linux_test failed ; exit 1 ) + $(E) "[RUN] Testing fake_resolver_test" + $(Q) $(BINDIR)/$(CONFIG)/fake_resolver_test || ( echo test fake_resolver_test failed ; exit 1 ) $(E) "[RUN] Testing fd_conservation_posix_test" $(Q) $(BINDIR)/$(CONFIG)/fd_conservation_posix_test || ( echo test fd_conservation_posix_test failed ; exit 1 ) $(E) "[RUN] Testing fd_posix_test" @@ -9401,6 +9405,38 @@ endif endif +FAKE_RESOLVER_TEST_SRC = \ + test/core/client_channel/resolvers/fake_resolver_test.c \ + +FAKE_RESOLVER_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(FAKE_RESOLVER_TEST_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/fake_resolver_test: openssl_dep_error + +else + + + +$(BINDIR)/$(CONFIG)/fake_resolver_test: $(FAKE_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LD) $(LDFLAGS) $(FAKE_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/fake_resolver_test + +endif + +$(OBJDIR)/$(CONFIG)/test/core/client_channel/resolvers/fake_resolver_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + +deps_fake_resolver_test: $(FAKE_RESOLVER_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(FAKE_RESOLVER_TEST_OBJS:.o=.dep) +endif +endif + + FD_CONSERVATION_POSIX_TEST_SRC = \ test/core/iomgr/fd_conservation_posix_test.c \ diff --git a/build.yaml b/build.yaml index cfa479c4ac4..f4461e40ef1 100644 --- a/build.yaml +++ b/build.yaml @@ -1820,6 +1820,16 @@ targets: - uv platforms: - linux +- name: fake_resolver_test + build: test + language: c + src: + - test/core/client_channel/resolvers/fake_resolver_test.c + deps: + - grpc_test_util + - grpc + - gpr_test_util + - gpr - name: fd_conservation_posix_test build: test language: c diff --git a/src/core/ext/filters/client_channel/lb_policy_factory.c b/src/core/ext/filters/client_channel/lb_policy_factory.c index e2af216b899..89b8bf89515 100644 --- a/src/core/ext/filters/client_channel/lb_policy_factory.c +++ b/src/core/ext/filters/client_channel/lb_policy_factory.c @@ -36,16 +36,18 @@ #include #include +#include "src/core/lib/channel/channel_args.h" + #include "src/core/ext/filters/client_channel/lb_policy_factory.h" +#include "src/core/ext/filters/client_channel/parse_address.h" grpc_lb_addresses* grpc_lb_addresses_create( size_t num_addresses, const grpc_lb_user_data_vtable* user_data_vtable) { - grpc_lb_addresses* addresses = gpr_malloc(sizeof(grpc_lb_addresses)); + grpc_lb_addresses* addresses = gpr_zalloc(sizeof(grpc_lb_addresses)); addresses->num_addresses = num_addresses; addresses->user_data_vtable = user_data_vtable; const size_t addresses_size = sizeof(grpc_lb_address) * num_addresses; - addresses->addresses = gpr_malloc(addresses_size); - memset(addresses->addresses, 0, addresses_size); + addresses->addresses = gpr_zalloc(addresses_size); return addresses; } @@ -69,7 +71,7 @@ grpc_lb_addresses* grpc_lb_addresses_copy(const grpc_lb_addresses* addresses) { void grpc_lb_addresses_set_address(grpc_lb_addresses* addresses, size_t index, void* address, size_t address_len, - bool is_balancer, char* balancer_name, + bool is_balancer, const char* balancer_name, void* user_data) { GPR_ASSERT(index < addresses->num_addresses); if (user_data != NULL) GPR_ASSERT(addresses->user_data_vtable != NULL); @@ -77,10 +79,22 @@ void grpc_lb_addresses_set_address(grpc_lb_addresses* addresses, size_t index, memcpy(target->address.addr, address, address_len); target->address.len = address_len; target->is_balancer = is_balancer; - target->balancer_name = balancer_name; + target->balancer_name = gpr_strdup(balancer_name); target->user_data = user_data; } +bool grpc_lb_addresses_set_address_from_uri(grpc_lb_addresses* addresses, + size_t index, const grpc_uri* uri, + bool is_balancer, + const char* balancer_name, + void* user_data) { + grpc_resolved_address address; + if (!grpc_parse_uri(uri, &address)) return false; + grpc_lb_addresses_set_address(addresses, index, address.addr, address.len, + is_balancer, balancer_name, user_data); + return true; +} + int grpc_lb_addresses_cmp(const grpc_lb_addresses* addresses1, const grpc_lb_addresses* addresses2) { if (addresses1->num_addresses > addresses2->num_addresses) return 1; @@ -147,6 +161,15 @@ grpc_arg grpc_lb_addresses_create_channel_arg( return arg; } +grpc_lb_addresses* grpc_lb_addresses_find_channel_arg( + const grpc_channel_args* channel_args) { + const grpc_arg* lb_addresses_arg = + grpc_channel_args_find(channel_args, GRPC_ARG_LB_ADDRESSES); + if (lb_addresses_arg == NULL || lb_addresses_arg->type != GRPC_ARG_POINTER) + return NULL; + return lb_addresses_arg->value.pointer.p; +} + void grpc_lb_policy_factory_ref(grpc_lb_policy_factory* factory) { factory->vtable->ref(factory); } diff --git a/src/core/ext/filters/client_channel/lb_policy_factory.h b/src/core/ext/filters/client_channel/lb_policy_factory.h index 81ab12ec8f9..9d6c0fc1398 100644 --- a/src/core/ext/filters/client_channel/lb_policy_factory.h +++ b/src/core/ext/filters/client_channel/lb_policy_factory.h @@ -34,12 +34,13 @@ #ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_FACTORY_H #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_FACTORY_H -#include "src/core/ext/filters/client_channel/client_channel_factory.h" -#include "src/core/ext/filters/client_channel/lb_policy.h" - #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/resolve_address.h" +#include "src/core/ext/filters/client_channel/client_channel_factory.h" +#include "src/core/ext/filters/client_channel/lb_policy.h" +#include "src/core/ext/filters/client_channel/uri_parser.h" + // Channel arg key for grpc_lb_addresses. #define GRPC_ARG_LB_ADDRESSES "grpc.lb_addresses" @@ -88,9 +89,18 @@ grpc_lb_addresses *grpc_lb_addresses_copy(const grpc_lb_addresses *addresses); * Takes ownership of \a balancer_name. */ void grpc_lb_addresses_set_address(grpc_lb_addresses *addresses, size_t index, void *address, size_t address_len, - bool is_balancer, char *balancer_name, + bool is_balancer, const char *balancer_name, void *user_data); +/** Sets the value of the address at index \a index of \a addresses from \a uri. + * Returns true upon success, false otherwise. Takes ownership of \a + * balancer_name. */ +bool grpc_lb_addresses_set_address_from_uri(grpc_lb_addresses *addresses, + size_t index, const grpc_uri *uri, + bool is_balancer, + const char *balancer_name, + void *user_data); + /** Compares \a addresses1 and \a addresses2. */ int grpc_lb_addresses_cmp(const grpc_lb_addresses *addresses1, const grpc_lb_addresses *addresses2); @@ -103,6 +113,10 @@ void grpc_lb_addresses_destroy(grpc_exec_ctx *exec_ctx, grpc_arg grpc_lb_addresses_create_channel_arg( const grpc_lb_addresses *addresses); +/** Returns the \a grpc_lb_addresses instance in \a channel_args or NULL */ +grpc_lb_addresses *grpc_lb_addresses_find_channel_arg( + const grpc_channel_args *channel_args); + /** Arguments passed to LB policies. */ typedef struct grpc_lb_policy_args { grpc_client_channel_factory *client_channel_factory; diff --git a/src/core/ext/filters/client_channel/parse_address.c b/src/core/ext/filters/client_channel/parse_address.c index 0c970620756..edc6ce697d8 100644 --- a/src/core/ext/filters/client_channel/parse_address.c +++ b/src/core/ext/filters/client_channel/parse_address.c @@ -48,7 +48,12 @@ #ifdef GRPC_HAVE_UNIX_SOCKET -int parse_unix(grpc_uri *uri, grpc_resolved_address *resolved_addr) { +bool grpc_parse_unix(const grpc_uri *uri, + grpc_resolved_address *resolved_addr) { + if (strcmp("unix", uri->scheme) != 0) { + gpr_log(GPR_ERROR, "Expected 'unix' scheme, got '%s'", uri->scheme); + return false; + } struct sockaddr_un *un = (struct sockaddr_un *)resolved_addr->addr; const size_t maxlen = sizeof(un->sun_path); const size_t path_len = strnlen(uri->path, maxlen); @@ -61,21 +66,29 @@ int parse_unix(grpc_uri *uri, grpc_resolved_address *resolved_addr) { #else /* GRPC_HAVE_UNIX_SOCKET */ -int parse_unix(grpc_uri *uri, grpc_resolved_address *resolved_addr) { abort(); } +bool grpc_parse_unix(const grpc_uri *uri, + grpc_resolved_address *resolved_addr) { + abort(); +} #endif /* GRPC_HAVE_UNIX_SOCKET */ -int parse_ipv4(grpc_uri *uri, grpc_resolved_address *resolved_addr) { +bool grpc_parse_ipv4(const grpc_uri *uri, + grpc_resolved_address *resolved_addr) { + if (strcmp("ipv4", uri->scheme) != 0) { + gpr_log(GPR_ERROR, "Expected 'ipv4' scheme, got '%s'", uri->scheme); + return false; + } const char *host_port = uri->path; char *host; char *port; int port_num; - int result = 0; + bool result = false; struct sockaddr_in *in = (struct sockaddr_in *)resolved_addr->addr; if (*host_port == '/') ++host_port; if (!gpr_split_host_port(host_port, &host, &port)) { - return 0; + return false; } memset(resolved_addr, 0, sizeof(grpc_resolved_address)); @@ -98,14 +111,19 @@ int parse_ipv4(grpc_uri *uri, grpc_resolved_address *resolved_addr) { goto done; } - result = 1; + result = true; done: gpr_free(host); gpr_free(port); return result; } -int parse_ipv6(grpc_uri *uri, grpc_resolved_address *resolved_addr) { +bool grpc_parse_ipv6(const grpc_uri *uri, + grpc_resolved_address *resolved_addr) { + if (strcmp("ipv6", uri->scheme) != 0) { + gpr_log(GPR_ERROR, "Expected 'ipv6' scheme, got '%s'", uri->scheme); + return false; + } const char *host_port = uri->path; char *host; char *port; @@ -168,3 +186,15 @@ done: gpr_free(port); return result; } + +bool grpc_parse_uri(const grpc_uri *uri, grpc_resolved_address *resolved_addr) { + if (strcmp("unix", uri->scheme) == 0) { + return grpc_parse_unix(uri, resolved_addr); + } else if (strcmp("ipv4", uri->scheme) == 0) { + return grpc_parse_ipv4(uri, resolved_addr); + } else if (strcmp("ipv6", uri->scheme) == 0) { + return grpc_parse_ipv6(uri, resolved_addr); + } + gpr_log(GPR_ERROR, "Can't parse scheme '%s'", uri->scheme); + return false; +} diff --git a/src/core/ext/filters/client_channel/parse_address.h b/src/core/ext/filters/client_channel/parse_address.h index c8d77baa008..fa7ea33a00b 100644 --- a/src/core/ext/filters/client_channel/parse_address.h +++ b/src/core/ext/filters/client_channel/parse_address.h @@ -39,16 +39,19 @@ #include "src/core/ext/filters/client_channel/uri_parser.h" #include "src/core/lib/iomgr/resolve_address.h" -/** Populate \a addr and \a len from \a uri, whose path is expected to contain a +/** Populate \a resolved_addr from \a uri, whose path is expected to contain a * unix socket path. Returns true upon success. */ -int parse_unix(grpc_uri *uri, grpc_resolved_address *resolved_addr); +bool grpc_parse_unix(const grpc_uri *uri, grpc_resolved_address *resolved_addr); -/** Populate /a addr and \a len from \a uri, whose path is expected to contain a - * host:port pair. Returns true upon success. */ -int parse_ipv4(grpc_uri *uri, grpc_resolved_address *resolved_addr); +/** Populate \a resolved_addr from \a uri, whose path is expected to contain an + * IPv4 host:port pair. Returns true upon success. */ +bool grpc_parse_ipv4(const grpc_uri *uri, grpc_resolved_address *resolved_addr); -/** Populate /a addr and \a len from \a uri, whose path is expected to contain a - * host:port pair. Returns true upon success. */ -int parse_ipv6(grpc_uri *uri, grpc_resolved_address *resolved_addr); +/** Populate \a resolved_addr from \a uri, whose path is expected to contain an + * IPv6 host:port pair. Returns true upon success. */ +bool grpc_parse_ipv6(const grpc_uri *uri, grpc_resolved_address *resolved_addr); + +/** Populate \a resolved_addr from \a uri. Returns true upon success. */ +bool grpc_parse_uri(const grpc_uri *uri, grpc_resolved_address *resolved_addr); #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PARSE_ADDRESS_H */ diff --git a/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c b/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c index 54f020d6914..4d7d878c237 100644 --- a/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c +++ b/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c @@ -157,8 +157,8 @@ static void do_nothing(void *ignored) {} static grpc_resolver *sockaddr_create(grpc_exec_ctx *exec_ctx, grpc_resolver_args *args, - int parse(grpc_uri *uri, - grpc_resolved_address *dst)) { + bool parse(const grpc_uri *uri, + grpc_resolved_address *dst)) { if (0 != strcmp(args->uri->authority, "")) { gpr_log(GPR_ERROR, "authority based uri's not supported by the %s scheme", args->uri->scheme); @@ -209,7 +209,7 @@ static void sockaddr_factory_unref(grpc_resolver_factory *factory) {} static grpc_resolver *name##_factory_create_resolver( \ grpc_exec_ctx *exec_ctx, grpc_resolver_factory *factory, \ grpc_resolver_args *args) { \ - return sockaddr_create(exec_ctx, args, parse_##name); \ + return sockaddr_create(exec_ctx, args, grpc_parse_##name); \ } \ static const grpc_resolver_factory_vtable name##_factory_vtable = { \ sockaddr_factory_ref, sockaddr_factory_unref, \ diff --git a/src/core/ext/filters/client_channel/subchannel.c b/src/core/ext/filters/client_channel/subchannel.c index 9a7a7a0ee5f..362b4a4a283 100644 --- a/src/core/ext/filters/client_channel/subchannel.c +++ b/src/core/ext/filters/client_channel/subchannel.c @@ -797,13 +797,7 @@ static void grpc_uri_to_sockaddr(grpc_exec_ctx *exec_ctx, const char *uri_str, grpc_resolved_address *addr) { grpc_uri *uri = grpc_uri_parse(exec_ctx, uri_str, 0 /* suppress_errors */); GPR_ASSERT(uri != NULL); - if (strcmp(uri->scheme, "ipv4") == 0) { - GPR_ASSERT(parse_ipv4(uri, addr)); - } else if (strcmp(uri->scheme, "ipv6") == 0) { - GPR_ASSERT(parse_ipv6(uri, addr)); - } else { - GPR_ASSERT(parse_unix(uri, addr)); - } + if (!grpc_parse_uri(uri, addr)) memset(addr, 0, sizeof(*addr)); grpc_uri_destroy(uri); } diff --git a/src/core/ext/filters/client_channel/uri_parser.c b/src/core/ext/filters/client_channel/uri_parser.c index f28db59e270..b233d835cbc 100644 --- a/src/core/ext/filters/client_channel/uri_parser.c +++ b/src/core/ext/filters/client_channel/uri_parser.c @@ -50,7 +50,7 @@ #define NOT_SET (~(size_t)0) static grpc_uri *bad_uri(const char *uri_text, size_t pos, const char *section, - int suppress_errors) { + bool suppress_errors) { char *line_prefix; size_t pfx_len; @@ -197,7 +197,7 @@ static void parse_query_parts(grpc_uri *uri) { } grpc_uri *grpc_uri_parse(grpc_exec_ctx *exec_ctx, const char *uri_text, - int suppress_errors) { + bool suppress_errors) { grpc_uri *uri; size_t scheme_begin = 0; size_t scheme_end = NOT_SET; diff --git a/src/core/ext/filters/client_channel/uri_parser.h b/src/core/ext/filters/client_channel/uri_parser.h index 2698d448d8e..b889040b167 100644 --- a/src/core/ext/filters/client_channel/uri_parser.h +++ b/src/core/ext/filters/client_channel/uri_parser.h @@ -53,7 +53,7 @@ typedef struct { /** parse a uri, return NULL on failure */ grpc_uri *grpc_uri_parse(grpc_exec_ctx *exec_ctx, const char *uri_text, - int suppress_errors); + bool suppress_errors); /** return the part of a query string after the '=' in "?key=xxx&...", or NULL * if key is not present */ diff --git a/src/core/lib/channel/channel_args.c b/src/core/lib/channel/channel_args.c index 3de31d99da1..238d176dfae 100644 --- a/src/core/lib/channel/channel_args.c +++ b/src/core/lib/channel/channel_args.c @@ -31,17 +31,18 @@ * */ -#include "src/core/lib/channel/channel_args.h" -#include -#include "src/core/lib/support/string.h" +#include +#include #include +#include #include #include #include #include -#include +#include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/support/string.h" static grpc_arg copy_arg(const grpc_arg *src) { grpc_arg dst; @@ -330,7 +331,7 @@ const grpc_arg *grpc_channel_args_find(const grpc_channel_args *args, } int grpc_channel_arg_get_integer(const grpc_arg *arg, - grpc_integer_options options) { + const grpc_integer_options options) { if (arg == NULL) return options.default_value; if (arg->type != GRPC_ARG_INTEGER) { gpr_log(GPR_ERROR, "%s ignored: it must be an integer", arg->key); diff --git a/src/core/lib/channel/channel_args.h b/src/core/lib/channel/channel_args.h index 5ffcacb7fd9..f0f603e2514 100644 --- a/src/core/lib/channel/channel_args.h +++ b/src/core/lib/channel/channel_args.h @@ -120,9 +120,10 @@ typedef struct grpc_integer_options { int min_value; int max_value; } grpc_integer_options; + /** Returns the value of \a arg, subject to the contraints in \a options. */ int grpc_channel_arg_get_integer(const grpc_arg *arg, - grpc_integer_options options); + const grpc_integer_options options); bool grpc_channel_arg_get_bool(const grpc_arg *arg, bool default_value); diff --git a/src/core/lib/iomgr/sockaddr_utils.h b/src/core/lib/iomgr/sockaddr_utils.h index 2b22f11b49d..be3ea2038f1 100644 --- a/src/core/lib/iomgr/sockaddr_utils.h +++ b/src/core/lib/iomgr/sockaddr_utils.h @@ -50,7 +50,7 @@ int grpc_sockaddr_to_v4mapped(const grpc_resolved_address *addr, grpc_resolved_address *addr6_out); /* If addr is ::, 0.0.0.0, or ::ffff:0.0.0.0, writes the port number to - *port_out (if not NULL) and returns true, otherwise returns false. */ + *port_out (if not NULL) and returns true, otherwise returns false. */ int grpc_sockaddr_is_wildcard(const grpc_resolved_address *addr, int *port_out); /* Writes 0.0.0.0:port and [::]:port to separate sockaddrs. */ diff --git a/src/core/lib/security/credentials/fake/fake_credentials.c b/src/core/lib/security/credentials/fake/fake_credentials.c index 68636ba2088..3fdb67fb912 100644 --- a/src/core/lib/security/credentials/fake/fake_credentials.c +++ b/src/core/lib/security/credentials/fake/fake_credentials.c @@ -39,11 +39,15 @@ #include #include +#include "src/core/lib/channel/channel_args.h" #include "src/core/lib/iomgr/executor.h" #include "src/core/lib/support/string.h" /* -- Fake transport security credentials. -- */ +#define GRPC_ARG_FAKE_SECURITY_EXPECTED_TARGETS \ + "grpc.fake_security.expected_targets" + static grpc_security_status fake_transport_security_create_security_connector( grpc_exec_ctx *exec_ctx, grpc_channel_credentials *c, grpc_call_credentials *call_creds, const char *target, @@ -88,6 +92,25 @@ grpc_server_credentials *grpc_fake_transport_security_server_credentials_create( return c; } +grpc_arg grpc_fake_transport_expected_targets_arg(char *expected_targets) { + grpc_arg arg; + arg.type = GRPC_ARG_STRING; + arg.key = GRPC_ARG_FAKE_SECURITY_EXPECTED_TARGETS; + arg.value.string = expected_targets; + return arg; +} + +const char *grpc_fake_transport_get_expected_targets( + const grpc_channel_args *args) { + const grpc_arg *expected_target_arg = + grpc_channel_args_find(args, GRPC_ARG_FAKE_SECURITY_EXPECTED_TARGETS); + if (expected_target_arg != NULL && + expected_target_arg->type == GRPC_ARG_STRING) { + return expected_target_arg->value.string; + } + return NULL; +} + /* -- Metadata-only test credentials. -- */ static void md_only_test_destruct(grpc_exec_ctx *exec_ctx, diff --git a/src/core/lib/security/credentials/fake/fake_credentials.h b/src/core/lib/security/credentials/fake/fake_credentials.h index 0fe98417c6c..a28b545a676 100644 --- a/src/core/lib/security/credentials/fake/fake_credentials.h +++ b/src/core/lib/security/credentials/fake/fake_credentials.h @@ -38,10 +38,17 @@ /* -- Fake transport security credentials. -- */ +/* Creates a fake transport security credentials object for testing. */ +grpc_channel_credentials *grpc_fake_transport_security_credentials_create(void); + +/* Creates a fake server transport security credentials object for testing. */ +grpc_server_credentials *grpc_fake_transport_security_server_credentials_create( + void); + /* Used to verify the target names given to the fake transport security * connector. * - * Its syntax by example: + * The syntax of \a expected_targets by example: * For LB channels: * "backend_target_1,backend_target_2,...;lb_target_1,lb_target_2,..." * For regular channels: @@ -50,15 +57,11 @@ * That is to say, LB channels have a heading list of LB targets separated from * the list of backend targets by a semicolon. For non-LB channels, only the * latter is present. */ -#define GRPC_ARG_FAKE_SECURITY_EXPECTED_TARGETS \ - "grpc.test_only.fake_security.expected_target" +grpc_arg grpc_fake_transport_expected_targets_arg(char *expected_targets); -/* Creates a fake transport security credentials object for testing. */ -grpc_channel_credentials *grpc_fake_transport_security_credentials_create(void); - -/* Creates a fake server transport security credentials object for testing. */ -grpc_server_credentials *grpc_fake_transport_security_server_credentials_create( - void); +/* Return the value associated with the expected targets channel arg or NULL */ +const char *grpc_fake_transport_get_expected_targets( + const grpc_channel_args *args); /* -- Metadata-only Test credentials. -- */ diff --git a/src/core/lib/security/transport/security_connector.c b/src/core/lib/security/transport/security_connector.c index dbe3263f92a..b15196e6770 100644 --- a/src/core/lib/security/transport/security_connector.c +++ b/src/core/lib/security/transport/security_connector.c @@ -423,12 +423,8 @@ grpc_channel_security_connector *grpc_fake_channel_security_connector_create( c->base.check_call_host = fake_channel_check_call_host; c->base.add_handshakers = fake_channel_add_handshakers; c->target = gpr_strdup(target); - const grpc_arg *expected_target_arg = - grpc_channel_args_find(args, GRPC_ARG_FAKE_SECURITY_EXPECTED_TARGETS); - if (expected_target_arg != NULL) { - GPR_ASSERT(expected_target_arg->type == GRPC_ARG_STRING); - c->expected_targets = gpr_strdup(expected_target_arg->value.string); - } + const char *expected_targets = grpc_fake_transport_get_expected_targets(args); + c->expected_targets = gpr_strdup(expected_targets); c->is_lb_channel = (grpc_lb_targets_info_find_in_args(args) != NULL); return &c->base; } diff --git a/test/core/client_channel/parse_address_test.c b/test/core/client_channel/parse_address_test.c index 629cdb001f9..802e41e5dee 100644 --- a/test/core/client_channel/parse_address_test.c +++ b/test/core/client_channel/parse_address_test.c @@ -47,12 +47,12 @@ #ifdef GRPC_HAVE_UNIX_SOCKET -static void test_parse_unix(const char *uri_text, const char *pathname) { +static void test_grpc_parse_unix(const char *uri_text, const char *pathname) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_uri *uri = grpc_uri_parse(&exec_ctx, uri_text, 0); grpc_resolved_address addr; - GPR_ASSERT(1 == parse_unix(uri, &addr)); + GPR_ASSERT(1 == grpc_parse_unix(uri, &addr)); struct sockaddr_un *addr_un = (struct sockaddr_un *)addr.addr; GPR_ASSERT(AF_UNIX == addr_un->sun_family); GPR_ASSERT(0 == strcmp(addr_un->sun_path, pathname)); @@ -63,18 +63,18 @@ static void test_parse_unix(const char *uri_text, const char *pathname) { #else /* GRPC_HAVE_UNIX_SOCKET */ -static void test_parse_unix(const char *uri_text, const char *pathname) {} +static void test_grpc_parse_unix(const char *uri_text, const char *pathname) {} #endif /* GRPC_HAVE_UNIX_SOCKET */ -static void test_parse_ipv4(const char *uri_text, const char *host, - unsigned short port) { +static void test_grpc_parse_ipv4(const char *uri_text, const char *host, + unsigned short port) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_uri *uri = grpc_uri_parse(&exec_ctx, uri_text, 0); grpc_resolved_address addr; char ntop_buf[INET_ADDRSTRLEN]; - GPR_ASSERT(1 == parse_ipv4(uri, &addr)); + GPR_ASSERT(1 == grpc_parse_ipv4(uri, &addr)); struct sockaddr_in *addr_in = (struct sockaddr_in *)addr.addr; GPR_ASSERT(AF_INET == addr_in->sin_family); GPR_ASSERT(NULL != grpc_inet_ntop(AF_INET, &addr_in->sin_addr, ntop_buf, @@ -86,14 +86,14 @@ static void test_parse_ipv4(const char *uri_text, const char *host, grpc_exec_ctx_finish(&exec_ctx); } -static void test_parse_ipv6(const char *uri_text, const char *host, - unsigned short port, uint32_t scope_id) { +static void test_grpc_parse_ipv6(const char *uri_text, const char *host, + unsigned short port, uint32_t scope_id) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_uri *uri = grpc_uri_parse(&exec_ctx, uri_text, 0); grpc_resolved_address addr; char ntop_buf[INET6_ADDRSTRLEN]; - GPR_ASSERT(1 == parse_ipv6(uri, &addr)); + GPR_ASSERT(1 == grpc_parse_ipv6(uri, &addr)); struct sockaddr_in6 *addr_in6 = (struct sockaddr_in6 *)addr.addr; GPR_ASSERT(AF_INET6 == addr_in6->sin6_family); GPR_ASSERT(NULL != grpc_inet_ntop(AF_INET6, &addr_in6->sin6_addr, ntop_buf, @@ -109,8 +109,8 @@ static void test_parse_ipv6(const char *uri_text, const char *host, int main(int argc, char **argv) { grpc_test_init(argc, argv); - test_parse_unix("unix:/path/name", "/path/name"); - test_parse_ipv4("ipv4:192.0.2.1:12345", "192.0.2.1", 12345); - test_parse_ipv6("ipv6:[2001:db8::1]:12345", "2001:db8::1", 12345, 0); - test_parse_ipv6("ipv6:[2001:db8::1%252]:12345", "2001:db8::1", 12345, 2); + test_grpc_parse_unix("unix:/path/name", "/path/name"); + test_grpc_parse_ipv4("ipv4:192.0.2.1:12345", "192.0.2.1", 12345); + test_grpc_parse_ipv6("ipv6:[2001:db8::1]:12345", "2001:db8::1", 12345, 0); + test_grpc_parse_ipv6("ipv6:[2001:db8::1%252]:12345", "2001:db8::1", 12345, 2); } diff --git a/test/core/client_channel/resolvers/BUILD b/test/core/client_channel/resolvers/BUILD index af37072e3a4..e8361cdef63 100644 --- a/test/core/client_channel/resolvers/BUILD +++ b/test/core/client_channel/resolvers/BUILD @@ -32,20 +32,48 @@ licenses(["notice"]) # 3-clause BSD cc_test( name = "dns_resolver_connectivity_test", srcs = ["dns_resolver_connectivity_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + copts = ["-std=c99"], + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) cc_test( name = "dns_resolver_test", srcs = ["dns_resolver_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + copts = ["-std=c99"], + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) cc_test( name = "sockaddr_resolver_test", srcs = ["sockaddr_resolver_test.c"], - deps = ["//:grpc", "//test/core/util:grpc_test_util", "//:gpr", "//test/core/util:gpr_test_util"], - copts = ['-std=c99'] + copts = ["-std=c99"], + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], +) + +cc_test( + name = "fake_resolver_test", + srcs = ["fake_resolver_test.c"], + copts = ["-std=c99"], + deps = [ + "//:gpr", + "//:grpc", + "//test/core/end2end:fake_resolver", + "//test/core/util:gpr_test_util", + "//test/core/util:grpc_test_util", + ], ) diff --git a/test/core/client_channel/resolvers/fake_resolver_test.c b/test/core/client_channel/resolvers/fake_resolver_test.c new file mode 100644 index 00000000000..861918fbd65 --- /dev/null +++ b/test/core/client_channel/resolvers/fake_resolver_test.c @@ -0,0 +1,187 @@ +/* + * + * Copyright 2017, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include + +#include "src/core/ext/filters/client_channel/lb_policy_factory.h" +#include "src/core/ext/filters/client_channel/parse_address.h" +#include "src/core/ext/filters/client_channel/resolver_registry.h" +#include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/iomgr/combiner.h" +#include "src/core/lib/security/credentials/fake/fake_credentials.h" + +#include "test/core/end2end/fake_resolver.h" +#include "test/core/util/test_config.h" + +static grpc_resolver *build_fake_resolver( + grpc_exec_ctx *exec_ctx, grpc_combiner *combiner, + grpc_fake_resolver_response_generator *response_generator) { + grpc_resolver_factory *factory = grpc_resolver_factory_lookup("test"); + grpc_arg generator_arg = + grpc_fake_resolver_response_generator_arg(response_generator); + grpc_resolver_args args; + memset(&args, 0, sizeof(args)); + grpc_channel_args channel_args = {1, &generator_arg}; + args.args = &channel_args; + args.combiner = combiner; + grpc_resolver *resolver = + grpc_resolver_factory_create_resolver(exec_ctx, factory, &args); + grpc_resolver_factory_unref(factory); + return resolver; +} + +typedef struct on_resolution_arg { + grpc_channel_args *resolver_result; + grpc_channel_args *expected_resolver_result; + bool was_called; +} on_resolution_arg; + +void on_resolution_cb(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { + on_resolution_arg *res = arg; + res->was_called = true; + // We only check the addresses channel arg because that's the only one + // explicitly set by the test via + // grpc_fake_resolver_response_generator_set_response. + const grpc_lb_addresses *actual_lb_addresses = + grpc_lb_addresses_find_channel_arg(res->resolver_result); + const grpc_lb_addresses *expected_lb_addresses = + grpc_lb_addresses_find_channel_arg(res->expected_resolver_result); + GPR_ASSERT( + grpc_lb_addresses_cmp(actual_lb_addresses, expected_lb_addresses) == 0); + grpc_channel_args_destroy(exec_ctx, res->resolver_result); + grpc_channel_args_destroy(exec_ctx, res->expected_resolver_result); +} + +static void test_fake_resolver() { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_combiner *combiner = grpc_combiner_create(NULL); + // Create resolver. + grpc_fake_resolver_response_generator *response_generator = + grpc_fake_resolver_response_generator_create(); + grpc_resolver *resolver = + build_fake_resolver(&exec_ctx, combiner, response_generator); + GPR_ASSERT(resolver != NULL); + + // Setup expectations. + grpc_uri *uris[] = {grpc_uri_parse(&exec_ctx, "ipv4:10.2.1.1:1234", true), + grpc_uri_parse(&exec_ctx, "ipv4:127.0.0.1:4321", true)}; + char *balancer_names[] = {"name1", "name2"}; + const bool is_balancer[] = {true, false}; + grpc_lb_addresses *addresses = grpc_lb_addresses_create(3, NULL); + for (size_t i = 0; i < GPR_ARRAY_SIZE(uris); ++i) { + grpc_lb_addresses_set_address_from_uri( + addresses, i, uris[i], is_balancer[i], balancer_names[i], NULL); + grpc_uri_destroy(uris[i]); + } + const grpc_arg addresses_arg = + grpc_lb_addresses_create_channel_arg(addresses); + grpc_channel_args *results = + grpc_channel_args_copy_and_add(NULL, &addresses_arg, 1); + grpc_lb_addresses_destroy(&exec_ctx, addresses); + on_resolution_arg on_res_arg; + memset(&on_res_arg, 0, sizeof(on_res_arg)); + on_res_arg.expected_resolver_result = results; + grpc_closure *on_resolution = grpc_closure_create( + on_resolution_cb, &on_res_arg, grpc_combiner_scheduler(combiner, false)); + + // Set resolver results and trigger first resolution. on_resolution_cb + // performs the checks. + grpc_fake_resolver_response_generator_set_response( + &exec_ctx, response_generator, results); + grpc_resolver_next_locked(&exec_ctx, resolver, &on_res_arg.resolver_result, + on_resolution); + grpc_exec_ctx_flush(&exec_ctx); + GPR_ASSERT(on_res_arg.was_called); + + // Setup update. + grpc_uri *uris_update[] = { + grpc_uri_parse(&exec_ctx, "ipv4:192.168.1.0:31416", true)}; + char *balancer_names_update[] = {"name3"}; + const bool is_balancer_update[] = {false}; + grpc_lb_addresses *addresses_update = grpc_lb_addresses_create(1, NULL); + for (size_t i = 0; i < GPR_ARRAY_SIZE(uris_update); ++i) { + grpc_lb_addresses_set_address_from_uri(addresses_update, i, uris_update[i], + is_balancer_update[i], + balancer_names_update[i], NULL); + grpc_uri_destroy(uris_update[i]); + } + + grpc_arg addresses_update_arg = + grpc_lb_addresses_create_channel_arg(addresses_update); + grpc_channel_args *results_update = + grpc_channel_args_copy_and_add(NULL, &addresses_update_arg, 1); + grpc_lb_addresses_destroy(&exec_ctx, addresses_update); + + // Setup expectations for the update. + on_resolution_arg on_res_arg_update; + memset(&on_res_arg_update, 0, sizeof(on_res_arg_update)); + on_res_arg_update.expected_resolver_result = results_update; + on_resolution = grpc_closure_create(on_resolution_cb, &on_res_arg_update, + grpc_combiner_scheduler(combiner, false)); + + // Set updated resolver results and trigger a second resolution. + grpc_fake_resolver_response_generator_set_response( + &exec_ctx, response_generator, results_update); + grpc_resolver_next_locked(&exec_ctx, resolver, + &on_res_arg_update.resolver_result, on_resolution); + grpc_exec_ctx_flush(&exec_ctx); + GPR_ASSERT(on_res_arg.was_called); + + // Requesting a new resolution without re-senting the response shouldn't + // trigger the resolution callback. + memset(&on_res_arg, 0, sizeof(on_res_arg)); + grpc_resolver_next_locked(&exec_ctx, resolver, &on_res_arg.resolver_result, + on_resolution); + grpc_exec_ctx_flush(&exec_ctx); + GPR_ASSERT(!on_res_arg.was_called); + + GRPC_COMBINER_UNREF(&exec_ctx, combiner, "test_fake_resolver"); + GRPC_RESOLVER_UNREF(&exec_ctx, resolver, "test_fake_resolver"); + grpc_exec_ctx_finish(&exec_ctx); + grpc_fake_resolver_response_generator_unref(response_generator); +} + +int main(int argc, char **argv) { + grpc_test_init(argc, argv); + grpc_fake_resolver_init(); // Registers the "test" scheme. + grpc_init(); + + test_fake_resolver(); + + grpc_shutdown(); + return 0; +} diff --git a/test/core/end2end/BUILD b/test/core/end2end/BUILD index 0cef7aa01df..ffea1cc4e8e 100644 --- a/test/core/end2end/BUILD +++ b/test/core/end2end/BUILD @@ -32,49 +32,66 @@ licenses(["notice"]) # 3-clause BSD load(":generate_tests.bzl", "grpc_end2end_tests") cc_library( - name = 'cq_verifier', - srcs = ['cq_verifier.c'], - hdrs = ['cq_verifier.h'], - deps = ['//:gpr', '//:grpc', '//test/core/util:grpc_test_util'], - copts = ['-std=c99'], - visibility = ["//test:__subpackages__"], + name = "cq_verifier", + srcs = ["cq_verifier.c"], + hdrs = ["cq_verifier.h"], + copts = ["-std=c99"], + visibility = ["//test:__subpackages__"], + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:grpc_test_util", + ], ) cc_library( - name = 'ssl_test_data', - visibility = ["//test:__subpackages__"], - hdrs = ['data/ssl_test_data.h'], - copts = ['-std=c99'], - srcs = [ - "data/client_certs.c", - "data/server1_cert.c", - "data/server1_key.c", - "data/test_root_cert.c", - ] + name = "ssl_test_data", + srcs = [ + "data/client_certs.c", + "data/server1_cert.c", + "data/server1_key.c", + "data/test_root_cert.c", + ], + hdrs = ["data/ssl_test_data.h"], + copts = ["-std=c99"], + visibility = ["//test:__subpackages__"], ) cc_library( - name = 'fake_resolver', - hdrs = ['fake_resolver.h'], - srcs = ['fake_resolver.c'], - copts = ['-std=c99'], - deps = ['//:gpr', '//:grpc', '//test/core/util:grpc_test_util'] + name = "fake_resolver", + srcs = ["fake_resolver.c"], + hdrs = ["fake_resolver.h"], + copts = ["-std=c99"], + visibility = ["//test:__subpackages__"], + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:grpc_test_util", + ], ) cc_library( - name = 'http_proxy', - hdrs = ['fixtures/http_proxy_fixture.h'], - srcs = ['fixtures/http_proxy_fixture.c'], - copts = ['-std=c99'], - deps = ['//:gpr', '//:grpc', '//test/core/util:grpc_test_util'] + name = "http_proxy", + srcs = ["fixtures/http_proxy_fixture.c"], + hdrs = ["fixtures/http_proxy_fixture.h"], + copts = ["-std=c99"], + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:grpc_test_util", + ], ) cc_library( - name = 'proxy', - hdrs = ['fixtures/proxy.h'], - srcs = ['fixtures/proxy.c'], - copts = ['-std=c99'], - deps = ['//:gpr', '//:grpc', '//test/core/util:grpc_test_util'] + name = "proxy", + srcs = ["fixtures/proxy.c"], + hdrs = ["fixtures/proxy.h"], + copts = ["-std=c99"], + deps = [ + "//:gpr", + "//:grpc", + "//test/core/util:grpc_test_util", + ], ) grpc_end2end_tests() diff --git a/test/core/end2end/fake_resolver.c b/test/core/end2end/fake_resolver.c index 1c7dd1339c1..6a71c20b804 100644 --- a/test/core/end2end/fake_resolver.c +++ b/test/core/end2end/fake_resolver.c @@ -32,6 +32,7 @@ // This is similar to the sockaddr resolver, except that it supports a // bunch of query args that are useful for dependency injection in tests. +#include #include #include #include @@ -46,12 +47,18 @@ #include "src/core/ext/filters/client_channel/parse_address.h" #include "src/core/ext/filters/client_channel/resolver_registry.h" #include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/iomgr/combiner.h" #include "src/core/lib/iomgr/resolve_address.h" #include "src/core/lib/iomgr/unix_sockets_posix.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/slice/slice_string_helpers.h" #include "src/core/lib/support/string.h" +#include "test/core/end2end/fake_resolver.h" + +#define GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR \ + "grpc.fake_resolver.response_generator" + // // fake_resolver // @@ -62,12 +69,11 @@ typedef struct { // passed-in parameters grpc_channel_args* channel_args; - grpc_lb_addresses* addresses; - // mutex guarding the rest of the state - gpr_mu mu; - // have we published? - bool published; + // If not NULL, the next set of resolution results to be returned to + // grpc_resolver_next_locked()'s closure. + grpc_channel_args* next_results; + // pending next completion, or NULL grpc_closure* next_completion; // target result address for next completion @@ -76,60 +82,137 @@ typedef struct { static void fake_resolver_destroy(grpc_exec_ctx* exec_ctx, grpc_resolver* gr) { fake_resolver* r = (fake_resolver*)gr; - gpr_mu_destroy(&r->mu); + grpc_channel_args_destroy(exec_ctx, r->next_results); grpc_channel_args_destroy(exec_ctx, r->channel_args); - grpc_lb_addresses_destroy(exec_ctx, r->addresses); gpr_free(r); } -static void fake_resolver_shutdown(grpc_exec_ctx* exec_ctx, - grpc_resolver* resolver) { +static void fake_resolver_shutdown_locked(grpc_exec_ctx* exec_ctx, + grpc_resolver* resolver) { fake_resolver* r = (fake_resolver*)resolver; - gpr_mu_lock(&r->mu); if (r->next_completion != NULL) { *r->target_result = NULL; grpc_closure_sched(exec_ctx, r->next_completion, GRPC_ERROR_NONE); r->next_completion = NULL; } - gpr_mu_unlock(&r->mu); } static void fake_resolver_maybe_finish_next_locked(grpc_exec_ctx* exec_ctx, fake_resolver* r) { - if (r->next_completion != NULL && !r->published) { - r->published = true; - grpc_arg arg = grpc_lb_addresses_create_channel_arg(r->addresses); + if (r->next_completion != NULL && r->next_results != NULL) { *r->target_result = - grpc_channel_args_copy_and_add(r->channel_args, &arg, 1); + grpc_channel_args_merge(r->channel_args, r->next_results); + grpc_channel_args_destroy(exec_ctx, r->next_results); grpc_closure_sched(exec_ctx, r->next_completion, GRPC_ERROR_NONE); r->next_completion = NULL; + r->next_results = NULL; } } -static void fake_resolver_channel_saw_error(grpc_exec_ctx* exec_ctx, - grpc_resolver* resolver) { +static void fake_resolver_channel_saw_error_locked(grpc_exec_ctx* exec_ctx, + grpc_resolver* resolver) { fake_resolver* r = (fake_resolver*)resolver; - gpr_mu_lock(&r->mu); - r->published = false; fake_resolver_maybe_finish_next_locked(exec_ctx, r); - gpr_mu_unlock(&r->mu); } -static void fake_resolver_next(grpc_exec_ctx* exec_ctx, grpc_resolver* resolver, - grpc_channel_args** target_result, - grpc_closure* on_complete) { +static void fake_resolver_next_locked(grpc_exec_ctx* exec_ctx, + grpc_resolver* resolver, + grpc_channel_args** target_result, + grpc_closure* on_complete) { fake_resolver* r = (fake_resolver*)resolver; - gpr_mu_lock(&r->mu); GPR_ASSERT(!r->next_completion); r->next_completion = on_complete; r->target_result = target_result; fake_resolver_maybe_finish_next_locked(exec_ctx, r); - gpr_mu_unlock(&r->mu); } static const grpc_resolver_vtable fake_resolver_vtable = { - fake_resolver_destroy, fake_resolver_shutdown, - fake_resolver_channel_saw_error, fake_resolver_next}; + fake_resolver_destroy, fake_resolver_shutdown_locked, + fake_resolver_channel_saw_error_locked, fake_resolver_next_locked}; + +struct grpc_fake_resolver_response_generator { + fake_resolver* resolver; // Set by the fake_resolver constructor to itself. + grpc_channel_args* next_response; + gpr_refcount refcount; +}; + +grpc_fake_resolver_response_generator* +grpc_fake_resolver_response_generator_create() { + grpc_fake_resolver_response_generator* generator = + gpr_zalloc(sizeof(*generator)); + gpr_ref_init(&generator->refcount, 1); + return generator; +} + +grpc_fake_resolver_response_generator* +grpc_fake_resolver_response_generator_ref( + grpc_fake_resolver_response_generator* generator) { + gpr_ref(&generator->refcount); + return generator; +} + +void grpc_fake_resolver_response_generator_unref( + grpc_fake_resolver_response_generator* generator) { + if (gpr_unref(&generator->refcount)) { + gpr_free(generator); + } +} + +static void set_response_cb(grpc_exec_ctx* exec_ctx, void* arg, + grpc_error* error) { + grpc_fake_resolver_response_generator* generator = arg; + fake_resolver* r = generator->resolver; + if (r->next_results != NULL) { + grpc_channel_args_destroy(exec_ctx, r->next_results); + } + r->next_results = generator->next_response; + fake_resolver_maybe_finish_next_locked(exec_ctx, r); +} + +void grpc_fake_resolver_response_generator_set_response( + grpc_exec_ctx* exec_ctx, grpc_fake_resolver_response_generator* generator, + grpc_channel_args* next_response) { + GPR_ASSERT(generator->resolver != NULL); + generator->next_response = grpc_channel_args_copy(next_response); + grpc_closure_sched( + exec_ctx, + grpc_closure_create( + set_response_cb, generator, + grpc_combiner_scheduler(generator->resolver->base.combiner, false)), + GRPC_ERROR_NONE); +} + +static void* response_generator_arg_copy(void* p) { + return grpc_fake_resolver_response_generator_ref(p); +} + +static void response_generator_arg_destroy(grpc_exec_ctx* exec_ctx, void* p) { + grpc_fake_resolver_response_generator_unref(p); +} + +static int response_generator_cmp(void* a, void* b) { return GPR_ICMP(a, b); } + +static const grpc_arg_pointer_vtable response_generator_arg_vtable = { + response_generator_arg_copy, response_generator_arg_destroy, + response_generator_cmp}; + +grpc_arg grpc_fake_resolver_response_generator_arg( + grpc_fake_resolver_response_generator* generator) { + grpc_arg arg; + arg.type = GRPC_ARG_POINTER; + arg.key = GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR; + arg.value.pointer.p = generator; + arg.value.pointer.vtable = &response_generator_arg_vtable; + return arg; +} + +grpc_fake_resolver_response_generator* +grpc_fake_resolver_get_response_generator(const grpc_channel_args* args) { + const grpc_arg* arg = + grpc_channel_args_find(args, GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR); + if (arg == NULL || arg->type != GRPC_ARG_POINTER) return NULL; + return arg->value.pointer.p; +} // // fake_resolver_factory @@ -139,81 +222,15 @@ static void fake_resolver_factory_ref(grpc_resolver_factory* factory) {} static void fake_resolver_factory_unref(grpc_resolver_factory* factory) {} -static void do_nothing(void* ignored) {} - static grpc_resolver* fake_resolver_create(grpc_exec_ctx* exec_ctx, grpc_resolver_factory* factory, grpc_resolver_args* args) { - if (0 != strcmp(args->uri->authority, "")) { - gpr_log(GPR_ERROR, "authority based uri's not supported by the %s scheme", - args->uri->scheme); - return NULL; - } - // Get lb_enabled arg. Anything other than "0" is interpreted as true. - const char* lb_enabled_qpart = - grpc_uri_get_query_arg(args->uri, "lb_enabled"); - const bool lb_enabled = - lb_enabled_qpart != NULL && strcmp("0", lb_enabled_qpart) != 0; - - // Get the balancer's names. - const char* balancer_names = - grpc_uri_get_query_arg(args->uri, "balancer_names"); - grpc_slice_buffer balancer_names_parts; - grpc_slice_buffer_init(&balancer_names_parts); - if (balancer_names != NULL) { - const grpc_slice balancer_names_slice = - grpc_slice_from_copied_string(balancer_names); - grpc_slice_split(balancer_names_slice, ",", &balancer_names_parts); - grpc_slice_unref(balancer_names_slice); - } - - // Construct addresses. - grpc_slice path_slice = - grpc_slice_new(args->uri->path, strlen(args->uri->path), do_nothing); - grpc_slice_buffer path_parts; - grpc_slice_buffer_init(&path_parts); - grpc_slice_split(path_slice, ",", &path_parts); - if (balancer_names_parts.count > 0 && - path_parts.count != balancer_names_parts.count) { - gpr_log(GPR_ERROR, - "Balancer names present but mismatched with number of addresses: " - "%lu balancer names != %lu addresses", - (unsigned long)balancer_names_parts.count, - (unsigned long)path_parts.count); - return NULL; - } - grpc_lb_addresses* addresses = - grpc_lb_addresses_create(path_parts.count, NULL /* user_data_vtable */); - bool errors_found = false; - for (size_t i = 0; i < addresses->num_addresses; i++) { - grpc_uri ith_uri = *args->uri; - char* part_str = grpc_slice_to_c_string(path_parts.slices[i]); - ith_uri.path = part_str; - if (!parse_ipv4(&ith_uri, &addresses->addresses[i].address)) { - errors_found = true; - } - gpr_free(part_str); - if (errors_found) break; - addresses->addresses[i].is_balancer = lb_enabled; - addresses->addresses[i].balancer_name = - balancer_names_parts.count > 0 - ? grpc_dump_slice(balancer_names_parts.slices[i], GPR_DUMP_ASCII) - : NULL; - } - grpc_slice_buffer_destroy_internal(exec_ctx, &path_parts); - grpc_slice_buffer_destroy_internal(exec_ctx, &balancer_names_parts); - grpc_slice_unref(path_slice); - if (errors_found) { - grpc_lb_addresses_destroy(exec_ctx, addresses); - return NULL; - } - // Instantiate resolver. - fake_resolver* r = gpr_malloc(sizeof(fake_resolver)); - memset(r, 0, sizeof(*r)); + fake_resolver* r = gpr_zalloc(sizeof(*r)); r->channel_args = grpc_channel_args_copy(args->args); - r->addresses = addresses; - gpr_mu_init(&r->mu); grpc_resolver_init(&r->base, &fake_resolver_vtable, args->combiner); + grpc_fake_resolver_response_generator* response_generator = + grpc_fake_resolver_get_response_generator(args->args); + if (response_generator != NULL) response_generator->resolver = r; return &r->base; } diff --git a/test/core/end2end/fake_resolver.h b/test/core/end2end/fake_resolver.h index 7a30347f301..447289adefa 100644 --- a/test/core/end2end/fake_resolver.h +++ b/test/core/end2end/fake_resolver.h @@ -32,8 +32,42 @@ #ifndef GRPC_TEST_CORE_END2END_FAKE_RESOLVER_H #define GRPC_TEST_CORE_END2END_FAKE_RESOLVER_H +#include "src/core/ext/filters/client_channel/lb_policy_factory.h" +#include "src/core/ext/filters/client_channel/uri_parser.h" +#include "src/core/lib/channel/channel_args.h" + #include "test/core/util/test_config.h" void grpc_fake_resolver_init(); +// Instances of \a grpc_fake_resolver_response_generator are passed to the +// fake resolver in a channel argument (see \a +// grpc_fake_resolver_response_generator_arg) in order to inject and trigger +// custom resolutions. See also \a +// grpc_fake_resolver_response_generator_set_response. +typedef struct grpc_fake_resolver_response_generator + grpc_fake_resolver_response_generator; +grpc_fake_resolver_response_generator* +grpc_fake_resolver_response_generator_create(); + +// Instruct the fake resolver associated with the \a response_generator instance +// to trigger a new resolution for \a uri and \a args. +void grpc_fake_resolver_response_generator_set_response( + grpc_exec_ctx* exec_ctx, grpc_fake_resolver_response_generator* generator, + grpc_channel_args* next_response); + +// Return a \a grpc_arg for a \a grpc_fake_resolver_response_generator instance. +grpc_arg grpc_fake_resolver_response_generator_arg( + grpc_fake_resolver_response_generator* generator); +// Return the \a grpc_fake_resolver_response_generator instance in \a args or +// NULL. +grpc_fake_resolver_response_generator* +grpc_fake_resolver_get_response_generator(const grpc_channel_args* args); + +grpc_fake_resolver_response_generator* +grpc_fake_resolver_response_generator_ref( + grpc_fake_resolver_response_generator* generator); +void grpc_fake_resolver_response_generator_unref( + grpc_fake_resolver_response_generator* generator); + #endif /* GRPC_TEST_CORE_END2END_FAKE_RESOLVER_H */ diff --git a/test/cpp/grpclb/grpclb_test.cc b/test/cpp/grpclb/grpclb_test.cc index a80431f46a1..997a8391eb7 100644 --- a/test/cpp/grpclb/grpclb_test.cc +++ b/test/cpp/grpclb/grpclb_test.cc @@ -573,34 +573,51 @@ static void perform_request(client_fixture *cf) { static void setup_client(const server_fixture *lb_server, const server_fixture *backends, client_fixture *cf) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - char *lb_uri; - // The grpclb LB policy will be automatically selected by virtue of - // the fact that the returned addresses are balancer addresses. - gpr_asprintf(&lb_uri, "test:///%s?lb_enabled=1&balancer_names=%s", - lb_server->servers_hostport, lb_server->balancer_name); - - grpc_arg expected_target_arg; - expected_target_arg.type = GRPC_ARG_STRING; - expected_target_arg.key = - const_cast(GRPC_ARG_FAKE_SECURITY_EXPECTED_TARGETS); char *expected_target_names = NULL; const char *backends_name = lb_server->servers_hostport; gpr_asprintf(&expected_target_names, "%s;%s", backends_name, BALANCERS_NAME); - expected_target_arg.value.string = const_cast(expected_target_names); + grpc_fake_resolver_response_generator *response_generator = + grpc_fake_resolver_response_generator_create(); + + grpc_lb_addresses *addresses = grpc_lb_addresses_create(1, NULL); + char *lb_uri_str; + gpr_asprintf(&lb_uri_str, "ipv4:%s", lb_server->servers_hostport); + grpc_uri *lb_uri = grpc_uri_parse(&exec_ctx, lb_uri_str, true); + GPR_ASSERT(lb_uri != NULL); + grpc_lb_addresses_set_address_from_uri(addresses, 0, lb_uri, true, + lb_server->balancer_name, NULL); + grpc_uri_destroy(lb_uri); + gpr_free(lb_uri_str); + + gpr_asprintf(&cf->server_uri, "test:///%s", lb_server->servers_hostport); + const grpc_arg fake_addresses = + grpc_lb_addresses_create_channel_arg(addresses); + grpc_channel_args *fake_result = + grpc_channel_args_copy_and_add(NULL, &fake_addresses, 1); + grpc_lb_addresses_destroy(&exec_ctx, addresses); + + const grpc_arg new_args[] = { + grpc_fake_transport_expected_targets_arg(expected_target_names), + grpc_fake_resolver_response_generator_arg(response_generator)}; + grpc_channel_args *args = - grpc_channel_args_copy_and_add(NULL, &expected_target_arg, 1); + grpc_channel_args_copy_and_add(NULL, new_args, GPR_ARRAY_SIZE(new_args)); gpr_free(expected_target_names); cf->cq = grpc_completion_queue_create_for_next(NULL); - cf->server_uri = lb_uri; grpc_channel_credentials *fake_creds = grpc_fake_transport_security_credentials_create(); cf->client = grpc_secure_channel_create(fake_creds, cf->server_uri, args, NULL); + grpc_fake_resolver_response_generator_set_response( + &exec_ctx, response_generator, fake_result); + grpc_channel_args_destroy(&exec_ctx, fake_result); grpc_channel_credentials_unref(&exec_ctx, fake_creds); grpc_channel_args_destroy(&exec_ctx, args); + grpc_fake_resolver_response_generator_unref(response_generator); + grpc_exec_ctx_finish(&exec_ctx); } static void teardown_client(client_fixture *cf) { @@ -787,8 +804,8 @@ TEST(GrpclbTest, InvalidAddressInServerlist) {} int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); - grpc_test_init(argc, argv); grpc_fake_resolver_init(); + grpc_test_init(argc, argv); grpc_init(); const auto result = RUN_ALL_TESTS(); grpc_shutdown(); diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 95d5649d000..aa4869e1c8a 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -470,6 +470,23 @@ "third_party": false, "type": "target" }, + { + "deps": [ + "gpr", + "gpr_test_util", + "grpc", + "grpc_test_util" + ], + "headers": [], + "is_filegroup": false, + "language": "c", + "name": "fake_resolver_test", + "src": [ + "test/core/client_channel/resolvers/fake_resolver_test.c" + ], + "third_party": false, + "type": "target" + }, { "deps": [ "gpr", diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index dde006737f2..6338ea70127 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -577,6 +577,28 @@ "linux" ] }, + { + "args": [], + "ci_platforms": [ + "linux", + "mac", + "posix", + "windows" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "exclude_iomgrs": [], + "flaky": false, + "gtest": false, + "language": "c", + "name": "fake_resolver_test", + "platforms": [ + "linux", + "mac", + "posix", + "windows" + ] + }, { "args": [], "ci_platforms": [ diff --git a/vsprojects/buildtests_c.sln b/vsprojects/buildtests_c.sln index 1e8336c54ef..6ae8bfa74de 100644 --- a/vsprojects/buildtests_c.sln +++ b/vsprojects/buildtests_c.sln @@ -317,6 +317,17 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "error_test", "vcxproj\test\ {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fake_resolver_test", "vcxproj\test\fake_resolver_test\fake_resolver_test.vcxproj", "{2F59EB2E-CEF9-A291-9480-1F737C3E5E57}" + ProjectSection(myProperties) = preProject + lib = "False" + EndProjectSection + ProjectSection(ProjectDependencies) = postProject + {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} = {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} + {29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9} + {EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037} + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + EndProjectSection +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fling_client", "vcxproj\test\fling_client\fling_client.vcxproj", "{0647D598-9611-F659-EA36-DF995C9F736B}" ProjectSection(myProperties) = preProject lib = "False" @@ -2116,6 +2127,22 @@ Global {42720233-A6D4-66BC-CCA2-06B57261D0B3}.Release-DLL|Win32.Build.0 = Release|Win32 {42720233-A6D4-66BC-CCA2-06B57261D0B3}.Release-DLL|x64.ActiveCfg = Release|x64 {42720233-A6D4-66BC-CCA2-06B57261D0B3}.Release-DLL|x64.Build.0 = Release|x64 + {2F59EB2E-CEF9-A291-9480-1F737C3E5E57}.Debug|Win32.ActiveCfg = Debug|Win32 + {2F59EB2E-CEF9-A291-9480-1F737C3E5E57}.Debug|x64.ActiveCfg = Debug|x64 + {2F59EB2E-CEF9-A291-9480-1F737C3E5E57}.Release|Win32.ActiveCfg = Release|Win32 + {2F59EB2E-CEF9-A291-9480-1F737C3E5E57}.Release|x64.ActiveCfg = Release|x64 + {2F59EB2E-CEF9-A291-9480-1F737C3E5E57}.Debug|Win32.Build.0 = Debug|Win32 + {2F59EB2E-CEF9-A291-9480-1F737C3E5E57}.Debug|x64.Build.0 = Debug|x64 + {2F59EB2E-CEF9-A291-9480-1F737C3E5E57}.Release|Win32.Build.0 = Release|Win32 + {2F59EB2E-CEF9-A291-9480-1F737C3E5E57}.Release|x64.Build.0 = Release|x64 + {2F59EB2E-CEF9-A291-9480-1F737C3E5E57}.Debug-DLL|Win32.ActiveCfg = Debug|Win32 + {2F59EB2E-CEF9-A291-9480-1F737C3E5E57}.Debug-DLL|Win32.Build.0 = Debug|Win32 + {2F59EB2E-CEF9-A291-9480-1F737C3E5E57}.Debug-DLL|x64.ActiveCfg = Debug|x64 + {2F59EB2E-CEF9-A291-9480-1F737C3E5E57}.Debug-DLL|x64.Build.0 = Debug|x64 + {2F59EB2E-CEF9-A291-9480-1F737C3E5E57}.Release-DLL|Win32.ActiveCfg = Release|Win32 + {2F59EB2E-CEF9-A291-9480-1F737C3E5E57}.Release-DLL|Win32.Build.0 = Release|Win32 + {2F59EB2E-CEF9-A291-9480-1F737C3E5E57}.Release-DLL|x64.ActiveCfg = Release|x64 + {2F59EB2E-CEF9-A291-9480-1F737C3E5E57}.Release-DLL|x64.Build.0 = Release|x64 {0647D598-9611-F659-EA36-DF995C9F736B}.Debug|Win32.ActiveCfg = Debug|Win32 {0647D598-9611-F659-EA36-DF995C9F736B}.Debug|x64.ActiveCfg = Debug|x64 {0647D598-9611-F659-EA36-DF995C9F736B}.Release|Win32.ActiveCfg = Release|Win32 diff --git a/vsprojects/vcxproj/test/fake_resolver_test/fake_resolver_test.vcxproj b/vsprojects/vcxproj/test/fake_resolver_test/fake_resolver_test.vcxproj new file mode 100644 index 00000000000..8ea721dd7b4 --- /dev/null +++ b/vsprojects/vcxproj/test/fake_resolver_test/fake_resolver_test.vcxproj @@ -0,0 +1,199 @@ + + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {2F59EB2E-CEF9-A291-9480-1F737C3E5E57} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + fake_resolver_test + static + Debug + static + Debug + + + fake_resolver_test + static + Release + static + Release + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Console + true + false + true + true + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Console + true + false + true + true + + + + + + + + + + {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} + + + {29D16885-7228-4C31-81ED-5F9187C7F2A9} + + + {EAB0A629-17A9-44DB-B5FF-E91A721FE037} + + + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + diff --git a/vsprojects/vcxproj/test/fake_resolver_test/fake_resolver_test.vcxproj.filters b/vsprojects/vcxproj/test/fake_resolver_test/fake_resolver_test.vcxproj.filters new file mode 100644 index 00000000000..353cae2b078 --- /dev/null +++ b/vsprojects/vcxproj/test/fake_resolver_test/fake_resolver_test.vcxproj.filters @@ -0,0 +1,24 @@ + + + + + test\core\client_channel\resolvers + + + + + + {05f58640-4b7c-c233-bf86-f119fe270ba1} + + + {caeef88d-baf6-603c-83b0-84b1009be480} + + + {c5bba556-fd85-f7b4-99b7-8b1eeb4dfcb2} + + + {eff74a86-6a4c-b68c-0330-6901d992c5c7} + + + + From a7a1098d2f4a88a038e61a949ee98bd2e5444b7a Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Fri, 14 Apr 2017 14:39:37 -0700 Subject: [PATCH 416/461] Updated load_balancer.proto --- .../proto/grpc/lb/v1/load_balancer.pb.c | 27 ++++-- .../proto/grpc/lb/v1/load_balancer.pb.h | 97 ++++++++++++------- src/proto/grpc/lb/v1/load_balancer.proto | 57 +++++++++-- test/cpp/grpclb/grpclb_api_test.cc | 12 ++- 4 files changed, 137 insertions(+), 56 deletions(-) diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c b/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c index e9adf98711e..fb119c7fc88 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c @@ -16,6 +16,12 @@ const pb_field_t grpc_lb_v1_Duration_fields[3] = { PB_LAST_FIELD }; +const pb_field_t grpc_lb_v1_Timestamp_fields[3] = { + PB_FIELD( 1, INT64 , OPTIONAL, STATIC , FIRST, grpc_lb_v1_Timestamp, seconds, seconds, 0), + PB_FIELD( 2, INT32 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_Timestamp, nanos, seconds, 0), + PB_LAST_FIELD +}; + const pb_field_t grpc_lb_v1_LoadBalanceRequest_fields[3] = { PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, grpc_lb_v1_LoadBalanceRequest, initial_request, initial_request, &grpc_lb_v1_InitialLoadBalanceRequest_fields), PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_lb_v1_LoadBalanceRequest, client_stats, initial_request, &grpc_lb_v1_ClientStats_fields), @@ -27,10 +33,14 @@ const pb_field_t grpc_lb_v1_InitialLoadBalanceRequest_fields[2] = { PB_LAST_FIELD }; -const pb_field_t grpc_lb_v1_ClientStats_fields[4] = { - PB_FIELD( 1, INT64 , OPTIONAL, STATIC , FIRST, grpc_lb_v1_ClientStats, total_requests, total_requests, 0), - PB_FIELD( 2, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, client_rpc_errors, total_requests, 0), - PB_FIELD( 3, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, dropped_requests, client_rpc_errors, 0), +const pb_field_t grpc_lb_v1_ClientStats_fields[8] = { + PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, grpc_lb_v1_ClientStats, timestamp, timestamp, &grpc_lb_v1_Timestamp_fields), + PB_FIELD( 2, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, num_calls_started, timestamp, 0), + PB_FIELD( 3, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, num_calls_finished, num_calls_started, 0), + PB_FIELD( 4, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, num_calls_finished_with_drop_for_rate_limiting, num_calls_finished, 0), + PB_FIELD( 5, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, num_calls_finished_with_drop_for_load_balancing, num_calls_finished_with_drop_for_rate_limiting, 0), + PB_FIELD( 6, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, num_calls_finished_with_client_failed_to_send, num_calls_finished_with_drop_for_load_balancing, 0), + PB_FIELD( 7, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_ClientStats, num_calls_finished_known_received, num_calls_finished_with_client_failed_to_send, 0), PB_LAST_FIELD }; @@ -52,11 +62,12 @@ const pb_field_t grpc_lb_v1_ServerList_fields[3] = { PB_LAST_FIELD }; -const pb_field_t grpc_lb_v1_Server_fields[5] = { +const pb_field_t grpc_lb_v1_Server_fields[6] = { PB_FIELD( 1, BYTES , OPTIONAL, STATIC , FIRST, grpc_lb_v1_Server, ip_address, ip_address, 0), PB_FIELD( 2, INT32 , OPTIONAL, STATIC , OTHER, grpc_lb_v1_Server, port, ip_address, 0), PB_FIELD( 3, STRING , OPTIONAL, STATIC , OTHER, grpc_lb_v1_Server, load_balance_token, port, 0), - PB_FIELD( 4, BOOL , OPTIONAL, STATIC , OTHER, grpc_lb_v1_Server, drop_request, load_balance_token, 0), + PB_FIELD( 4, BOOL , OPTIONAL, STATIC , OTHER, grpc_lb_v1_Server, drop_for_rate_limiting, load_balance_token, 0), + PB_FIELD( 5, BOOL , OPTIONAL, STATIC , OTHER, grpc_lb_v1_Server, drop_for_load_balancing, drop_for_rate_limiting, 0), PB_LAST_FIELD }; @@ -70,7 +81,7 @@ const pb_field_t grpc_lb_v1_Server_fields[5] = { * numbers or field sizes that are larger than what can fit in 8 or 16 bit * field descriptors. */ -PB_STATIC_ASSERT((pb_membersize(grpc_lb_v1_LoadBalanceRequest, initial_request) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceRequest, client_stats) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, initial_response) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, server_list) < 65536 && pb_membersize(grpc_lb_v1_InitialLoadBalanceResponse, client_stats_report_interval) < 65536 && pb_membersize(grpc_lb_v1_ServerList, servers) < 65536 && pb_membersize(grpc_lb_v1_ServerList, expiration_interval) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_grpc_lb_v1_Duration_grpc_lb_v1_LoadBalanceRequest_grpc_lb_v1_InitialLoadBalanceRequest_grpc_lb_v1_ClientStats_grpc_lb_v1_LoadBalanceResponse_grpc_lb_v1_InitialLoadBalanceResponse_grpc_lb_v1_ServerList_grpc_lb_v1_Server) +PB_STATIC_ASSERT((pb_membersize(grpc_lb_v1_LoadBalanceRequest, initial_request) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceRequest, client_stats) < 65536 && pb_membersize(grpc_lb_v1_ClientStats, timestamp) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, initial_response) < 65536 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, server_list) < 65536 && pb_membersize(grpc_lb_v1_InitialLoadBalanceResponse, client_stats_report_interval) < 65536 && pb_membersize(grpc_lb_v1_ServerList, servers) < 65536 && pb_membersize(grpc_lb_v1_ServerList, expiration_interval) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_grpc_lb_v1_Duration_grpc_lb_v1_Timestamp_grpc_lb_v1_LoadBalanceRequest_grpc_lb_v1_InitialLoadBalanceRequest_grpc_lb_v1_ClientStats_grpc_lb_v1_LoadBalanceResponse_grpc_lb_v1_InitialLoadBalanceResponse_grpc_lb_v1_ServerList_grpc_lb_v1_Server) #endif #if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT) @@ -81,7 +92,7 @@ PB_STATIC_ASSERT((pb_membersize(grpc_lb_v1_LoadBalanceRequest, initial_request) * numbers or field sizes that are larger than what can fit in the default * 8 bit descriptors. */ -PB_STATIC_ASSERT((pb_membersize(grpc_lb_v1_LoadBalanceRequest, initial_request) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceRequest, client_stats) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, initial_response) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, server_list) < 256 && pb_membersize(grpc_lb_v1_InitialLoadBalanceResponse, client_stats_report_interval) < 256 && pb_membersize(grpc_lb_v1_ServerList, servers) < 256 && pb_membersize(grpc_lb_v1_ServerList, expiration_interval) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_grpc_lb_v1_Duration_grpc_lb_v1_LoadBalanceRequest_grpc_lb_v1_InitialLoadBalanceRequest_grpc_lb_v1_ClientStats_grpc_lb_v1_LoadBalanceResponse_grpc_lb_v1_InitialLoadBalanceResponse_grpc_lb_v1_ServerList_grpc_lb_v1_Server) +PB_STATIC_ASSERT((pb_membersize(grpc_lb_v1_LoadBalanceRequest, initial_request) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceRequest, client_stats) < 256 && pb_membersize(grpc_lb_v1_ClientStats, timestamp) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, initial_response) < 256 && pb_membersize(grpc_lb_v1_LoadBalanceResponse, server_list) < 256 && pb_membersize(grpc_lb_v1_InitialLoadBalanceResponse, client_stats_report_interval) < 256 && pb_membersize(grpc_lb_v1_ServerList, servers) < 256 && pb_membersize(grpc_lb_v1_ServerList, expiration_interval) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_grpc_lb_v1_Duration_grpc_lb_v1_Timestamp_grpc_lb_v1_LoadBalanceRequest_grpc_lb_v1_InitialLoadBalanceRequest_grpc_lb_v1_ClientStats_grpc_lb_v1_LoadBalanceResponse_grpc_lb_v1_InitialLoadBalanceResponse_grpc_lb_v1_ServerList_grpc_lb_v1_Server) #endif diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h index 725aa7e386f..d3ae919ec27 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h @@ -14,16 +14,6 @@ extern "C" { #endif /* Struct definitions */ -typedef struct _grpc_lb_v1_ClientStats { - bool has_total_requests; - int64_t total_requests; - bool has_client_rpc_errors; - int64_t client_rpc_errors; - bool has_dropped_requests; - int64_t dropped_requests; -/* @@protoc_insertion_point(struct:grpc_lb_v1_ClientStats) */ -} grpc_lb_v1_ClientStats; - typedef struct _grpc_lb_v1_Duration { bool has_seconds; int64_t seconds; @@ -46,11 +36,39 @@ typedef struct _grpc_lb_v1_Server { int32_t port; bool has_load_balance_token; char load_balance_token[50]; - bool has_drop_request; - bool drop_request; + bool has_drop_for_rate_limiting; + bool drop_for_rate_limiting; + bool has_drop_for_load_balancing; + bool drop_for_load_balancing; /* @@protoc_insertion_point(struct:grpc_lb_v1_Server) */ } grpc_lb_v1_Server; +typedef struct _grpc_lb_v1_Timestamp { + bool has_seconds; + int64_t seconds; + bool has_nanos; + int32_t nanos; +/* @@protoc_insertion_point(struct:grpc_lb_v1_Timestamp) */ +} grpc_lb_v1_Timestamp; + +typedef struct _grpc_lb_v1_ClientStats { + bool has_timestamp; + grpc_lb_v1_Timestamp timestamp; + bool has_num_calls_started; + int64_t num_calls_started; + bool has_num_calls_finished; + int64_t num_calls_finished; + bool has_num_calls_finished_with_drop_for_rate_limiting; + int64_t num_calls_finished_with_drop_for_rate_limiting; + bool has_num_calls_finished_with_drop_for_load_balancing; + int64_t num_calls_finished_with_drop_for_load_balancing; + bool has_num_calls_finished_with_client_failed_to_send; + int64_t num_calls_finished_with_client_failed_to_send; + bool has_num_calls_finished_known_received; + int64_t num_calls_finished_known_received; +/* @@protoc_insertion_point(struct:grpc_lb_v1_ClientStats) */ +} grpc_lb_v1_ClientStats; + typedef struct _grpc_lb_v1_InitialLoadBalanceResponse { bool has_load_balancer_delegate; char load_balancer_delegate[64]; @@ -59,6 +77,13 @@ typedef struct _grpc_lb_v1_InitialLoadBalanceResponse { /* @@protoc_insertion_point(struct:grpc_lb_v1_InitialLoadBalanceResponse) */ } grpc_lb_v1_InitialLoadBalanceResponse; +typedef struct _grpc_lb_v1_ServerList { + pb_callback_t servers; + bool has_expiration_interval; + grpc_lb_v1_Duration expiration_interval; +/* @@protoc_insertion_point(struct:grpc_lb_v1_ServerList) */ +} grpc_lb_v1_ServerList; + typedef struct _grpc_lb_v1_LoadBalanceRequest { bool has_initial_request; grpc_lb_v1_InitialLoadBalanceRequest initial_request; @@ -67,13 +92,6 @@ typedef struct _grpc_lb_v1_LoadBalanceRequest { /* @@protoc_insertion_point(struct:grpc_lb_v1_LoadBalanceRequest) */ } grpc_lb_v1_LoadBalanceRequest; -typedef struct _grpc_lb_v1_ServerList { - pb_callback_t servers; - bool has_expiration_interval; - grpc_lb_v1_Duration expiration_interval; -/* @@protoc_insertion_point(struct:grpc_lb_v1_ServerList) */ -} grpc_lb_v1_ServerList; - typedef struct _grpc_lb_v1_LoadBalanceResponse { bool has_initial_response; grpc_lb_v1_InitialLoadBalanceResponse initial_response; @@ -86,61 +104,72 @@ typedef struct _grpc_lb_v1_LoadBalanceResponse { /* Initializer values for message structs */ #define grpc_lb_v1_Duration_init_default {false, 0, false, 0} +#define grpc_lb_v1_Timestamp_init_default {false, 0, false, 0} #define grpc_lb_v1_LoadBalanceRequest_init_default {false, grpc_lb_v1_InitialLoadBalanceRequest_init_default, false, grpc_lb_v1_ClientStats_init_default} #define grpc_lb_v1_InitialLoadBalanceRequest_init_default {false, ""} -#define grpc_lb_v1_ClientStats_init_default {false, 0, false, 0, false, 0} +#define grpc_lb_v1_ClientStats_init_default {false, grpc_lb_v1_Timestamp_init_default, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} #define grpc_lb_v1_LoadBalanceResponse_init_default {false, grpc_lb_v1_InitialLoadBalanceResponse_init_default, false, grpc_lb_v1_ServerList_init_default} #define grpc_lb_v1_InitialLoadBalanceResponse_init_default {false, "", false, grpc_lb_v1_Duration_init_default} #define grpc_lb_v1_ServerList_init_default {{{NULL}, NULL}, false, grpc_lb_v1_Duration_init_default} -#define grpc_lb_v1_Server_init_default {false, {0, {0}}, false, 0, false, "", false, 0} +#define grpc_lb_v1_Server_init_default {false, {0, {0}}, false, 0, false, "", false, 0, false, 0} #define grpc_lb_v1_Duration_init_zero {false, 0, false, 0} +#define grpc_lb_v1_Timestamp_init_zero {false, 0, false, 0} #define grpc_lb_v1_LoadBalanceRequest_init_zero {false, grpc_lb_v1_InitialLoadBalanceRequest_init_zero, false, grpc_lb_v1_ClientStats_init_zero} #define grpc_lb_v1_InitialLoadBalanceRequest_init_zero {false, ""} -#define grpc_lb_v1_ClientStats_init_zero {false, 0, false, 0, false, 0} +#define grpc_lb_v1_ClientStats_init_zero {false, grpc_lb_v1_Timestamp_init_zero, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0} #define grpc_lb_v1_LoadBalanceResponse_init_zero {false, grpc_lb_v1_InitialLoadBalanceResponse_init_zero, false, grpc_lb_v1_ServerList_init_zero} #define grpc_lb_v1_InitialLoadBalanceResponse_init_zero {false, "", false, grpc_lb_v1_Duration_init_zero} #define grpc_lb_v1_ServerList_init_zero {{{NULL}, NULL}, false, grpc_lb_v1_Duration_init_zero} -#define grpc_lb_v1_Server_init_zero {false, {0, {0}}, false, 0, false, "", false, 0} +#define grpc_lb_v1_Server_init_zero {false, {0, {0}}, false, 0, false, "", false, 0, false, 0} /* Field tags (for use in manual encoding/decoding) */ -#define grpc_lb_v1_ClientStats_total_requests_tag 1 -#define grpc_lb_v1_ClientStats_client_rpc_errors_tag 2 -#define grpc_lb_v1_ClientStats_dropped_requests_tag 3 #define grpc_lb_v1_Duration_seconds_tag 1 #define grpc_lb_v1_Duration_nanos_tag 2 #define grpc_lb_v1_InitialLoadBalanceRequest_name_tag 1 #define grpc_lb_v1_Server_ip_address_tag 1 #define grpc_lb_v1_Server_port_tag 2 #define grpc_lb_v1_Server_load_balance_token_tag 3 -#define grpc_lb_v1_Server_drop_request_tag 4 +#define grpc_lb_v1_Server_drop_for_rate_limiting_tag 4 +#define grpc_lb_v1_Server_drop_for_load_balancing_tag 5 +#define grpc_lb_v1_Timestamp_seconds_tag 1 +#define grpc_lb_v1_Timestamp_nanos_tag 2 +#define grpc_lb_v1_ClientStats_timestamp_tag 1 +#define grpc_lb_v1_ClientStats_num_calls_started_tag 2 +#define grpc_lb_v1_ClientStats_num_calls_finished_tag 3 +#define grpc_lb_v1_ClientStats_num_calls_finished_with_drop_for_rate_limiting_tag 4 +#define grpc_lb_v1_ClientStats_num_calls_finished_with_drop_for_load_balancing_tag 5 +#define grpc_lb_v1_ClientStats_num_calls_finished_with_client_failed_to_send_tag 6 +#define grpc_lb_v1_ClientStats_num_calls_finished_known_received_tag 7 #define grpc_lb_v1_InitialLoadBalanceResponse_load_balancer_delegate_tag 1 #define grpc_lb_v1_InitialLoadBalanceResponse_client_stats_report_interval_tag 2 -#define grpc_lb_v1_LoadBalanceRequest_initial_request_tag 1 -#define grpc_lb_v1_LoadBalanceRequest_client_stats_tag 2 #define grpc_lb_v1_ServerList_servers_tag 1 #define grpc_lb_v1_ServerList_expiration_interval_tag 3 +#define grpc_lb_v1_LoadBalanceRequest_initial_request_tag 1 +#define grpc_lb_v1_LoadBalanceRequest_client_stats_tag 2 #define grpc_lb_v1_LoadBalanceResponse_initial_response_tag 1 #define grpc_lb_v1_LoadBalanceResponse_server_list_tag 2 /* Struct field encoding specification for nanopb */ extern const pb_field_t grpc_lb_v1_Duration_fields[3]; +extern const pb_field_t grpc_lb_v1_Timestamp_fields[3]; extern const pb_field_t grpc_lb_v1_LoadBalanceRequest_fields[3]; extern const pb_field_t grpc_lb_v1_InitialLoadBalanceRequest_fields[2]; -extern const pb_field_t grpc_lb_v1_ClientStats_fields[4]; +extern const pb_field_t grpc_lb_v1_ClientStats_fields[8]; extern const pb_field_t grpc_lb_v1_LoadBalanceResponse_fields[3]; extern const pb_field_t grpc_lb_v1_InitialLoadBalanceResponse_fields[3]; extern const pb_field_t grpc_lb_v1_ServerList_fields[3]; -extern const pb_field_t grpc_lb_v1_Server_fields[5]; +extern const pb_field_t grpc_lb_v1_Server_fields[6]; /* Maximum encoded size of messages (where known) */ #define grpc_lb_v1_Duration_size 22 -#define grpc_lb_v1_LoadBalanceRequest_size 169 +#define grpc_lb_v1_Timestamp_size 22 +#define grpc_lb_v1_LoadBalanceRequest_size 226 #define grpc_lb_v1_InitialLoadBalanceRequest_size 131 -#define grpc_lb_v1_ClientStats_size 33 +#define grpc_lb_v1_ClientStats_size 90 #define grpc_lb_v1_LoadBalanceResponse_size (98 + grpc_lb_v1_ServerList_size) #define grpc_lb_v1_InitialLoadBalanceResponse_size 90 /* grpc_lb_v1_ServerList_size depends on runtime parameters */ -#define grpc_lb_v1_Server_size 83 +#define grpc_lb_v1_Server_size 85 /* Message IDs (where set with "msgid" option) */ #ifdef PB_MSGID diff --git a/src/proto/grpc/lb/v1/load_balancer.proto b/src/proto/grpc/lb/v1/load_balancer.proto index 44a5150a7e0..a2502fb284a 100644 --- a/src/proto/grpc/lb/v1/load_balancer.proto +++ b/src/proto/grpc/lb/v1/load_balancer.proto @@ -45,6 +45,20 @@ message Duration { int32 nanos = 2; } +message Timestamp { + + // Represents seconds of UTC time since Unix epoch + // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + // 9999-12-31T23:59:59Z inclusive. + int64 seconds = 1; + + // Non-negative fractions of a second at nanosecond resolution. Negative + // second values with fractions must still have non-negative nanos values + // that count forward in time. Must be from 0 to 999,999,999 + // inclusive. + int32 nanos = 2; +} + service LoadBalancer { // Bidirectional rpc to get a list of servers. rpc BalanceLoad(stream LoadBalanceRequest) @@ -63,22 +77,37 @@ message LoadBalanceRequest { } message InitialLoadBalanceRequest { - // Name of load balanced service (IE, service.grpc.gslb.google.com). Its + // Name of load balanced service (IE, balancer.service.com) // length should be less than 256 bytes. string name = 1; } // Contains client level statistics that are useful to load balancing. Each -// count should be reset to zero after reporting the stats. +// count except the timestamp should be reset to zero after reporting the stats. message ClientStats { - // The total number of requests sent by the client since the last report. - int64 total_requests = 1; + // The timestamp of generating the report. + Timestamp timestamp = 1; - // The number of client rpc errors since the last report. - int64 client_rpc_errors = 2; + // The total number of RPCs that started. + int64 num_calls_started = 2; - // The number of dropped requests since the last report. - int64 dropped_requests = 3; + // The total number of RPCs that finished. + int64 num_calls_finished = 3; + + // The total number of RPCs that were dropped by the client because of rate + // limiting. + int64 num_calls_finished_with_drop_for_rate_limiting = 4; + + // The total number of RPCs that were dropped by the client because of load + // balancing. + int64 num_calls_finished_with_drop_for_load_balancing = 5; + + // The total number of RPCs that failed to reach a server except dropped RPCs. + int64 num_calls_finished_with_client_failed_to_send = 6; + + // The total number of RPCs that finished and are known to have been received + // by a server. + int64 num_calls_finished_known_received = 7; } message LoadBalanceResponse { @@ -120,6 +149,10 @@ message ServerList { Duration expiration_interval = 3; } +// Contains server information. When none of the [drop_for_*] fields are true, +// use the other fields. When drop_for_rate_limiting is true, ignore all other +// fields. Use drop_for_load_balancing only when it is true and +// drop_for_rate_limiting is false. message Server { // A resolved address for the server, serialized in network-byte-order. It may // either be an IPv4 or IPv6 address. @@ -137,6 +170,10 @@ message Server { string load_balance_token = 3; // Indicates whether this particular request should be dropped by the client - // when this server is chosen from the list. - bool drop_request = 4; + // for rate limiting. + bool drop_for_rate_limiting = 4; + + // Indicates whether this particular request should be dropped by the client + // for load balancing. + bool drop_for_load_balancing = 5; } diff --git a/test/cpp/grpclb/grpclb_api_test.cc b/test/cpp/grpclb/grpclb_api_test.cc index d9df2bb6735..0b569f14157 100644 --- a/test/cpp/grpclb/grpclb_api_test.cc +++ b/test/cpp/grpclb/grpclb_api_test.cc @@ -106,11 +106,13 @@ TEST_F(GrpclbTest, ParseResponseServerList) { auto* server = serverlist->add_servers(); server->set_ip_address(Ip4ToPackedString("127.0.0.1")); server->set_port(12345); - server->set_drop_request(true); + server->set_drop_for_rate_limiting(true); + server->set_drop_for_load_balancing(false); server = response.mutable_server_list()->add_servers(); server->set_ip_address(Ip4ToPackedString("10.0.0.1")); server->set_port(54321); - server->set_drop_request(false); + server->set_drop_for_rate_limiting(false); + server->set_drop_for_load_balancing(true); auto* expiration_interval = serverlist->mutable_expiration_interval(); expiration_interval->set_seconds(888); expiration_interval->set_nanos(999); @@ -125,12 +127,14 @@ TEST_F(GrpclbTest, ParseResponseServerList) { EXPECT_EQ(PackedStringToIp(c_serverlist->servers[0]->ip_address), "127.0.0.1"); EXPECT_EQ(c_serverlist->servers[0]->port, 12345); - EXPECT_TRUE(c_serverlist->servers[0]->drop_request); + EXPECT_TRUE(c_serverlist->servers[0]->drop_for_rate_limiting); + EXPECT_FALSE(c_serverlist->servers[0]->drop_for_load_balancing); EXPECT_TRUE(c_serverlist->servers[1]->has_ip_address); EXPECT_EQ(PackedStringToIp(c_serverlist->servers[1]->ip_address), "10.0.0.1"); EXPECT_EQ(c_serverlist->servers[1]->port, 54321); - EXPECT_FALSE(c_serverlist->servers[1]->drop_request); + EXPECT_FALSE(c_serverlist->servers[1]->drop_for_rate_limiting); + EXPECT_TRUE(c_serverlist->servers[1]->drop_for_load_balancing); EXPECT_TRUE(c_serverlist->expiration_interval.has_seconds); EXPECT_EQ(c_serverlist->expiration_interval.seconds, 888); From a818f72c0c84f386d8e415e12f215453d35eeb21 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Fri, 14 Apr 2017 16:01:14 -0700 Subject: [PATCH 417/461] Load Reporting back to using metadata --- grpc.def | 1 - include/grpc/grpc.h | 6 - include/grpc/load_reporting.h | 12 +- .../filters/load_reporting/load_reporting.c | 17 -- .../load_reporting/load_reporting_filter.c | 27 ++- src/core/lib/channel/context.h | 3 - src/core/lib/transport/static_metadata.c | 195 +++++++++--------- src/core/lib/transport/static_metadata.h | 97 ++++----- src/cpp/server/server_context.cc | 12 +- src/ruby/ext/grpc/rb_grpc_imports.generated.c | 2 - src/ruby/ext/grpc/rb_grpc_imports.generated.h | 3 - test/core/end2end/fuzzers/hpack.dictionary | 2 + test/core/end2end/tests/load_reporting_hook.c | 22 +- tools/codegen/core/gen_static_metadata.py | 1 + 14 files changed, 201 insertions(+), 199 deletions(-) diff --git a/grpc.def b/grpc.def index 1589316a588..841d55f341d 100644 --- a/grpc.def +++ b/grpc.def @@ -72,7 +72,6 @@ EXPORTS grpc_channel_create_registered_call grpc_call_start_batch grpc_call_get_peer - grpc_call_set_load_reporting_cost_context grpc_census_call_set_context grpc_census_call_get_context grpc_channel_get_target diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 42cf201da44..9a65d34ce34 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -296,12 +296,6 @@ GRPCAPI grpc_call_error grpc_call_start_batch(grpc_call *call, functionality. Instead, use grpc_auth_context. */ GRPCAPI char *grpc_call_get_peer(grpc_call *call); -struct grpc_load_reporting_cost_context; - -/* Associate costs contained in \a cost_context to \a call. */ -GRPCAPI void grpc_call_set_load_reporting_cost_context( - grpc_call *call, struct grpc_load_reporting_cost_context *context); - struct census_context; /** Set census context for a call; Must be called before first call to diff --git a/include/grpc/load_reporting.h b/include/grpc/load_reporting.h index c833ce5c63b..a334a113507 100644 --- a/include/grpc/load_reporting.h +++ b/include/grpc/load_reporting.h @@ -35,7 +35,6 @@ #define GRPC_LOAD_REPORTING_H #include -#include #ifdef __cplusplus extern "C" { @@ -50,11 +49,12 @@ extern "C" { * gRPC LB system. */ #define GRPC_LB_TOKEN_MD_KEY "lb-token" -/** A sequence of values for load reporting purposes */ -typedef struct grpc_load_reporting_cost_context { - grpc_slice *values; - size_t values_count; -} grpc_load_reporting_cost_context; +/** Metadata key for gRPC LB cost reporting. + * + * The value corresponding to this key is an opaque binary blob reported by the + * backend as part of its trailing metadata containing cost information for the + * call. */ +#define GRPC_LB_COST_MD_KEY "lb-cost-bin" #ifdef __cplusplus } diff --git a/src/core/ext/filters/load_reporting/load_reporting.c b/src/core/ext/filters/load_reporting/load_reporting.c index 3b5d2103c1f..4e9d0937ae0 100644 --- a/src/core/ext/filters/load_reporting/load_reporting.c +++ b/src/core/ext/filters/load_reporting/load_reporting.c @@ -47,23 +47,6 @@ #include "src/core/lib/surface/call.h" #include "src/core/lib/surface/channel_init.h" -static void destroy_lr_cost_context(void *c) { - grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_load_reporting_cost_context *cost_ctx = c; - for (size_t i = 0; i < cost_ctx->values_count; ++i) { - grpc_slice_unref_internal(&exec_ctx, cost_ctx->values[i]); - } - grpc_exec_ctx_finish(&exec_ctx); - gpr_free(cost_ctx->values); - gpr_free(cost_ctx); -} - -void grpc_call_set_load_reporting_cost_context( - grpc_call *call, grpc_load_reporting_cost_context *ctx) { - grpc_call_context_set(call, GRPC_CONTEXT_LR_COST, ctx, - destroy_lr_cost_context); -} - static bool is_load_reporting_enabled(const grpc_channel_args *a) { return grpc_channel_arg_get_bool( grpc_channel_args_find(a, GRPC_ARG_ENABLE_LOAD_REPORTING), false); diff --git a/src/core/ext/filters/load_reporting/load_reporting_filter.c b/src/core/ext/filters/load_reporting/load_reporting_filter.c index 57b25d06518..75a9a566871 100644 --- a/src/core/ext/filters/load_reporting/load_reporting_filter.c +++ b/src/core/ext/filters/load_reporting/load_reporting_filter.c @@ -48,6 +48,8 @@ typedef struct call_data { intptr_t id; /**< an id unique to the call */ + bool have_trailing_md_string; + grpc_slice trailing_md_string; bool have_initial_md_string; grpc_slice initial_md_string; bool have_service_method; @@ -140,6 +142,9 @@ static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, if (calld->have_initial_md_string) { grpc_slice_unref_internal(exec_ctx, calld->initial_md_string); } + if (calld->have_trailing_md_string) { + grpc_slice_unref_internal(exec_ctx, calld->trailing_md_string); + } if (calld->have_service_method) { grpc_slice_unref_internal(exec_ctx, calld->service_method); } @@ -183,6 +188,18 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, */ } +static grpc_filtered_mdelem lr_trailing_md_filter(grpc_exec_ctx *exec_ctx, + void *user_data, + grpc_mdelem md) { + grpc_call_element *elem = user_data; + call_data *calld = elem->call_data; + if (grpc_slice_eq(GRPC_MDKEY(md), GRPC_MDSTR_LB_COST_BIN)) { + calld->trailing_md_string = GRPC_MDVALUE(md); + return GRPC_FILTERED_REMOVE(); + } + return GRPC_FILTERED_MDELEM(md); +} + static void lr_start_transport_stream_op_batch( grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_transport_stream_op_batch *op) { @@ -190,13 +207,21 @@ static void lr_start_transport_stream_op_batch( call_data *calld = elem->call_data; if (op->recv_initial_metadata) { + /* substitute our callback for the higher callback */ calld->recv_initial_metadata = op->payload->recv_initial_metadata.recv_initial_metadata; - /* substitute our callback for the higher callback */ calld->ops_recv_initial_metadata_ready = op->payload->recv_initial_metadata.recv_initial_metadata_ready; op->payload->recv_initial_metadata.recv_initial_metadata_ready = &calld->on_initial_md_ready; + } else if (op->send_trailing_metadata) { + GRPC_LOG_IF_ERROR( + "grpc_metadata_batch_filter", + grpc_metadata_batch_filter( + exec_ctx, + op->payload->send_trailing_metadata.send_trailing_metadata, + lr_trailing_md_filter, elem, + "LR trailing metadata filtering error")); } grpc_call_next_op(exec_ctx, elem, op); diff --git a/src/core/lib/channel/context.h b/src/core/lib/channel/context.h index 2c1174ce7a1..6c931ad28ae 100644 --- a/src/core/lib/channel/context.h +++ b/src/core/lib/channel/context.h @@ -50,9 +50,6 @@ typedef enum { /// Reserved for traffic_class_context. GRPC_CONTEXT_TRAFFIC, - /// Costs for Load Reporting. - GRPC_CONTEXT_LR_COST, - GRPC_CONTEXT_COUNT } grpc_context_index; diff --git a/src/core/lib/transport/static_metadata.c b/src/core/lib/transport/static_metadata.c index 599d4ad1171..862cdaa8e09 100644 --- a/src/core/lib/transport/static_metadata.c +++ b/src/core/lib/transport/static_metadata.c @@ -97,23 +97,23 @@ static uint8_t g_bytes[] = { 101, 105, 102, 45, 110, 111, 110, 101, 45, 109, 97, 116, 99, 104, 105, 102, 45, 114, 97, 110, 103, 101, 105, 102, 45, 117, 110, 109, 111, 100, 105, 102, 105, 101, 100, 45, 115, 105, 110, 99, 101, 108, 97, 115, 116, - 45, 109, 111, 100, 105, 102, 105, 101, 100, 108, 105, 110, 107, 108, 111, - 99, 97, 116, 105, 111, 110, 109, 97, 120, 45, 102, 111, 114, 119, 97, - 114, 100, 115, 112, 114, 111, 120, 121, 45, 97, 117, 116, 104, 101, 110, - 116, 105, 99, 97, 116, 101, 112, 114, 111, 120, 121, 45, 97, 117, 116, - 104, 111, 114, 105, 122, 97, 116, 105, 111, 110, 114, 97, 110, 103, 101, - 114, 101, 102, 101, 114, 101, 114, 114, 101, 102, 114, 101, 115, 104, 114, - 101, 116, 114, 121, 45, 97, 102, 116, 101, 114, 115, 101, 114, 118, 101, - 114, 115, 101, 116, 45, 99, 111, 111, 107, 105, 101, 115, 116, 114, 105, - 99, 116, 45, 116, 114, 97, 110, 115, 112, 111, 114, 116, 45, 115, 101, - 99, 117, 114, 105, 116, 121, 116, 114, 97, 110, 115, 102, 101, 114, 45, - 101, 110, 99, 111, 100, 105, 110, 103, 118, 97, 114, 121, 118, 105, 97, - 119, 119, 119, 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, - 101, 105, 100, 101, 110, 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, - 116, 101, 105, 100, 101, 110, 116, 105, 116, 121, 44, 103, 122, 105, 112, - 100, 101, 102, 108, 97, 116, 101, 44, 103, 122, 105, 112, 105, 100, 101, - 110, 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 44, 103, - 122, 105, 112}; + 45, 109, 111, 100, 105, 102, 105, 101, 100, 108, 98, 45, 99, 111, 115, + 116, 45, 98, 105, 110, 108, 105, 110, 107, 108, 111, 99, 97, 116, 105, + 111, 110, 109, 97, 120, 45, 102, 111, 114, 119, 97, 114, 100, 115, 112, + 114, 111, 120, 121, 45, 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, + 116, 101, 112, 114, 111, 120, 121, 45, 97, 117, 116, 104, 111, 114, 105, + 122, 97, 116, 105, 111, 110, 114, 97, 110, 103, 101, 114, 101, 102, 101, + 114, 101, 114, 114, 101, 102, 114, 101, 115, 104, 114, 101, 116, 114, 121, + 45, 97, 102, 116, 101, 114, 115, 101, 114, 118, 101, 114, 115, 101, 116, + 45, 99, 111, 111, 107, 105, 101, 115, 116, 114, 105, 99, 116, 45, 116, + 114, 97, 110, 115, 112, 111, 114, 116, 45, 115, 101, 99, 117, 114, 105, + 116, 121, 116, 114, 97, 110, 115, 102, 101, 114, 45, 101, 110, 99, 111, + 100, 105, 110, 103, 118, 97, 114, 121, 118, 105, 97, 119, 119, 119, 45, + 97, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 101, 105, 100, 101, + 110, 116, 105, 116, 121, 44, 100, 101, 102, 108, 97, 116, 101, 105, 100, + 101, 110, 116, 105, 116, 121, 44, 103, 122, 105, 112, 100, 101, 102, 108, + 97, 116, 101, 44, 103, 122, 105, 112, 105, 100, 101, 110, 116, 105, 116, + 121, 44, 100, 101, 102, 108, 97, 116, 101, 44, 103, 122, 105, 112}; static void static_ref(void *unused) {} static void static_unref(grpc_exec_ctx *exec_ctx, void *unused) {} @@ -223,6 +223,7 @@ grpc_slice_refcount grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT] = { {&grpc_static_metadata_vtable, &static_sub_refcnt}, {&grpc_static_metadata_vtable, &static_sub_refcnt}, {&grpc_static_metadata_vtable, &static_sub_refcnt}, + {&grpc_static_metadata_vtable, &static_sub_refcnt}, }; const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = { @@ -383,64 +384,67 @@ const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = { {.refcount = &grpc_static_metadata_refcounts[77], .data.refcounted = {g_bytes + 791, 13}}, {.refcount = &grpc_static_metadata_refcounts[78], - .data.refcounted = {g_bytes + 804, 4}}, + .data.refcounted = {g_bytes + 804, 11}}, {.refcount = &grpc_static_metadata_refcounts[79], - .data.refcounted = {g_bytes + 808, 8}}, + .data.refcounted = {g_bytes + 815, 4}}, {.refcount = &grpc_static_metadata_refcounts[80], - .data.refcounted = {g_bytes + 816, 12}}, + .data.refcounted = {g_bytes + 819, 8}}, {.refcount = &grpc_static_metadata_refcounts[81], - .data.refcounted = {g_bytes + 828, 18}}, + .data.refcounted = {g_bytes + 827, 12}}, {.refcount = &grpc_static_metadata_refcounts[82], - .data.refcounted = {g_bytes + 846, 19}}, + .data.refcounted = {g_bytes + 839, 18}}, {.refcount = &grpc_static_metadata_refcounts[83], - .data.refcounted = {g_bytes + 865, 5}}, + .data.refcounted = {g_bytes + 857, 19}}, {.refcount = &grpc_static_metadata_refcounts[84], - .data.refcounted = {g_bytes + 870, 7}}, + .data.refcounted = {g_bytes + 876, 5}}, {.refcount = &grpc_static_metadata_refcounts[85], - .data.refcounted = {g_bytes + 877, 7}}, + .data.refcounted = {g_bytes + 881, 7}}, {.refcount = &grpc_static_metadata_refcounts[86], - .data.refcounted = {g_bytes + 884, 11}}, + .data.refcounted = {g_bytes + 888, 7}}, {.refcount = &grpc_static_metadata_refcounts[87], - .data.refcounted = {g_bytes + 895, 6}}, + .data.refcounted = {g_bytes + 895, 11}}, {.refcount = &grpc_static_metadata_refcounts[88], - .data.refcounted = {g_bytes + 901, 10}}, + .data.refcounted = {g_bytes + 906, 6}}, {.refcount = &grpc_static_metadata_refcounts[89], - .data.refcounted = {g_bytes + 911, 25}}, + .data.refcounted = {g_bytes + 912, 10}}, {.refcount = &grpc_static_metadata_refcounts[90], - .data.refcounted = {g_bytes + 936, 17}}, + .data.refcounted = {g_bytes + 922, 25}}, {.refcount = &grpc_static_metadata_refcounts[91], - .data.refcounted = {g_bytes + 953, 4}}, + .data.refcounted = {g_bytes + 947, 17}}, {.refcount = &grpc_static_metadata_refcounts[92], - .data.refcounted = {g_bytes + 957, 3}}, + .data.refcounted = {g_bytes + 964, 4}}, {.refcount = &grpc_static_metadata_refcounts[93], - .data.refcounted = {g_bytes + 960, 16}}, + .data.refcounted = {g_bytes + 968, 3}}, {.refcount = &grpc_static_metadata_refcounts[94], - .data.refcounted = {g_bytes + 976, 16}}, + .data.refcounted = {g_bytes + 971, 16}}, {.refcount = &grpc_static_metadata_refcounts[95], - .data.refcounted = {g_bytes + 992, 13}}, + .data.refcounted = {g_bytes + 987, 16}}, {.refcount = &grpc_static_metadata_refcounts[96], - .data.refcounted = {g_bytes + 1005, 12}}, + .data.refcounted = {g_bytes + 1003, 13}}, {.refcount = &grpc_static_metadata_refcounts[97], - .data.refcounted = {g_bytes + 1017, 21}}, + .data.refcounted = {g_bytes + 1016, 12}}, + {.refcount = &grpc_static_metadata_refcounts[98], + .data.refcounted = {g_bytes + 1028, 21}}, }; uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 6, 6, 8, 8}; + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 6, 6, 8, 8}; static const int8_t elems_r[] = { - 10, 8, -3, 0, 9, 21, -76, 22, 0, 10, -7, 0, 0, 0, 14, 0, - 13, 12, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, -50, -51, 15, -53, -54, -55, -56, -56, -57, -58, 0, 37, 36, 35, 34, - 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, - 17, 16, 15, 14, 13, 12, 11, 10, 13, 12, 11, 10, 9, 8, 7, 0}; + 10, 8, -3, 0, 9, 21, -77, 22, 0, 10, -7, 0, 0, 0, + 14, 0, 13, 12, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, -50, -51, 16, -53, -54, -55, -56, + -56, -57, -58, -59, 0, 37, 36, 35, 34, 33, 32, 31, 30, 29, + 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, + 14, 13, 12, 11, 10, 13, 12, 11, 10, 9, 8, 7, 0}; static uint32_t elems_phash(uint32_t i) { i -= 42; - uint32_t x = i % 96; - uint32_t y = i / 96; + uint32_t x = i % 97; + uint32_t y = i / 97; uint32_t h = x; if (y < GPR_ARRAY_SIZE(elems_r)) { uint32_t delta = (uint32_t)elems_r[y]; @@ -450,29 +454,30 @@ static uint32_t elems_phash(uint32_t i) { } static const uint16_t elem_keys[] = { - 1009, 1010, 1011, 240, 241, 242, 243, 244, 138, 139, 42, 43, - 429, 430, 431, 911, 912, 913, 712, 713, 1392, 522, 714, 1588, - 1686, 1784, 4822, 4920, 4951, 5116, 5214, 5312, 5410, 1405, 5508, 5606, - 5704, 5802, 5900, 5998, 6096, 6194, 6292, 6390, 6488, 6586, 6684, 6782, - 6880, 6978, 7076, 7174, 7272, 7370, 7468, 7566, 7664, 7762, 7860, 7958, - 8056, 8154, 8252, 8350, 8448, 1074, 1075, 1076, 1077, 8546, 8644, 8742, - 8840, 8938, 9036, 9134, 0, 314, 0, 0, 0, 0, 0, 0, + 1019, 1020, 1021, 242, 243, 244, 245, 246, 139, 140, 42, 43, + 433, 434, 435, 920, 921, 922, 719, 720, 1406, 527, 721, 1604, + 1703, 1802, 4871, 4970, 5001, 5168, 5267, 5366, 5465, 1419, 5564, 5663, + 5762, 5861, 5960, 6059, 6158, 6257, 6356, 6455, 6554, 6653, 6752, 6851, + 6950, 7049, 7148, 7247, 7346, 7445, 7544, 7643, 7742, 7841, 7940, 8039, + 8138, 8237, 8336, 8435, 8534, 8633, 1085, 1086, 1087, 1088, 8732, 8831, + 8930, 9029, 9128, 9227, 9326, 0, 317, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 133, 233, 234, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 132, 231, 232, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + 0}; static const uint8_t elem_idxs[] = { - 73, 76, 74, 19, 20, 21, 22, 23, 15, 16, 17, 18, 11, 12, 13, - 3, 4, 5, 0, 1, 41, 6, 2, 69, 48, 55, 24, 25, 26, 27, + 74, 77, 75, 19, 20, 21, 22, 23, 15, 16, 17, 18, 11, 12, 13, + 3, 4, 5, 0, 1, 41, 6, 2, 70, 48, 55, 24, 25, 26, 27, 28, 29, 30, 7, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 75, 77, 78, 79, 65, 66, 67, 68, 70, 71, - 72, 255, 14, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 8, 9, 10}; + 60, 61, 62, 63, 64, 65, 76, 78, 79, 80, 66, 67, 68, 69, 71, + 72, 73, 255, 14, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 8, 9, 10}; grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b) { if (a == -1 || b == -1) return GRPC_MDNULL; - uint32_t k = (uint32_t)(a * 98 + b); + uint32_t k = (uint32_t)(a * 99 + b); uint32_t h = elems_phash(k); return h < GPR_ARRAY_SIZE(elem_keys) && elem_keys[h] == k ? GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[elem_idxs[h]], @@ -706,71 +711,75 @@ grpc_mdelem_data grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { {.refcount = &grpc_static_metadata_refcounts[20], .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[78], - .data.refcounted = {g_bytes + 804, 4}}, + .data.refcounted = {g_bytes + 804, 11}}, {.refcount = &grpc_static_metadata_refcounts[20], .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[79], - .data.refcounted = {g_bytes + 808, 8}}, + .data.refcounted = {g_bytes + 815, 4}}, {.refcount = &grpc_static_metadata_refcounts[20], .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[80], - .data.refcounted = {g_bytes + 816, 12}}, + .data.refcounted = {g_bytes + 819, 8}}, {.refcount = &grpc_static_metadata_refcounts[20], .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[81], - .data.refcounted = {g_bytes + 828, 18}}, + .data.refcounted = {g_bytes + 827, 12}}, {.refcount = &grpc_static_metadata_refcounts[20], .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[82], - .data.refcounted = {g_bytes + 846, 19}}, + .data.refcounted = {g_bytes + 839, 18}}, {.refcount = &grpc_static_metadata_refcounts[20], .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[83], - .data.refcounted = {g_bytes + 865, 5}}, + .data.refcounted = {g_bytes + 857, 19}}, {.refcount = &grpc_static_metadata_refcounts[20], .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[84], - .data.refcounted = {g_bytes + 870, 7}}, + .data.refcounted = {g_bytes + 876, 5}}, {.refcount = &grpc_static_metadata_refcounts[20], .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[85], - .data.refcounted = {g_bytes + 877, 7}}, + .data.refcounted = {g_bytes + 881, 7}}, {.refcount = &grpc_static_metadata_refcounts[20], .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[86], - .data.refcounted = {g_bytes + 884, 11}}, + .data.refcounted = {g_bytes + 888, 7}}, {.refcount = &grpc_static_metadata_refcounts[20], .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[87], - .data.refcounted = {g_bytes + 895, 6}}, + .data.refcounted = {g_bytes + 895, 11}}, {.refcount = &grpc_static_metadata_refcounts[20], .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[88], - .data.refcounted = {g_bytes + 901, 10}}, + .data.refcounted = {g_bytes + 906, 6}}, {.refcount = &grpc_static_metadata_refcounts[20], .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[89], - .data.refcounted = {g_bytes + 911, 25}}, + .data.refcounted = {g_bytes + 912, 10}}, {.refcount = &grpc_static_metadata_refcounts[20], .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[90], - .data.refcounted = {g_bytes + 936, 17}}, + .data.refcounted = {g_bytes + 922, 25}}, {.refcount = &grpc_static_metadata_refcounts[20], .data.refcounted = {g_bytes + 234, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[16], - .data.refcounted = {g_bytes + 200, 10}}, + {{.refcount = &grpc_static_metadata_refcounts[91], + .data.refcounted = {g_bytes + 947, 17}}, {.refcount = &grpc_static_metadata_refcounts[20], .data.refcounted = {g_bytes + 234, 0}}}, - {{.refcount = &grpc_static_metadata_refcounts[91], - .data.refcounted = {g_bytes + 953, 4}}, + {{.refcount = &grpc_static_metadata_refcounts[16], + .data.refcounted = {g_bytes + 200, 10}}, {.refcount = &grpc_static_metadata_refcounts[20], .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[92], - .data.refcounted = {g_bytes + 957, 3}}, + .data.refcounted = {g_bytes + 964, 4}}, {.refcount = &grpc_static_metadata_refcounts[20], .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[93], - .data.refcounted = {g_bytes + 960, 16}}, + .data.refcounted = {g_bytes + 968, 3}}, + {.refcount = &grpc_static_metadata_refcounts[20], + .data.refcounted = {g_bytes + 234, 0}}}, + {{.refcount = &grpc_static_metadata_refcounts[94], + .data.refcounted = {g_bytes + 971, 16}}, {.refcount = &grpc_static_metadata_refcounts[20], .data.refcounted = {g_bytes + 234, 0}}}, {{.refcount = &grpc_static_metadata_refcounts[10], @@ -783,24 +792,24 @@ grpc_mdelem_data grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT] = { .data.refcounted = {g_bytes + 377, 7}}}, {{.refcount = &grpc_static_metadata_refcounts[10], .data.refcounted = {g_bytes + 90, 20}}, - {.refcount = &grpc_static_metadata_refcounts[94], - .data.refcounted = {g_bytes + 976, 16}}}, + {.refcount = &grpc_static_metadata_refcounts[95], + .data.refcounted = {g_bytes + 987, 16}}}, {{.refcount = &grpc_static_metadata_refcounts[10], .data.refcounted = {g_bytes + 90, 20}}, {.refcount = &grpc_static_metadata_refcounts[30], .data.refcounted = {g_bytes + 373, 4}}}, - {{.refcount = &grpc_static_metadata_refcounts[10], - .data.refcounted = {g_bytes + 90, 20}}, - {.refcount = &grpc_static_metadata_refcounts[95], - .data.refcounted = {g_bytes + 992, 13}}}, {{.refcount = &grpc_static_metadata_refcounts[10], .data.refcounted = {g_bytes + 90, 20}}, {.refcount = &grpc_static_metadata_refcounts[96], - .data.refcounted = {g_bytes + 1005, 12}}}, + .data.refcounted = {g_bytes + 1003, 13}}}, {{.refcount = &grpc_static_metadata_refcounts[10], .data.refcounted = {g_bytes + 90, 20}}, {.refcount = &grpc_static_metadata_refcounts[97], - .data.refcounted = {g_bytes + 1017, 21}}}, + .data.refcounted = {g_bytes + 1016, 12}}}, + {{.refcount = &grpc_static_metadata_refcounts[10], + .data.refcounted = {g_bytes + 90, 20}}, + {.refcount = &grpc_static_metadata_refcounts[98], + .data.refcounted = {g_bytes + 1028, 21}}}, }; -const uint8_t grpc_static_accept_encoding_metadata[8] = {0, 73, 74, 75, - 76, 77, 78, 79}; +const uint8_t grpc_static_accept_encoding_metadata[8] = {0, 74, 75, 76, + 77, 78, 79, 80}; diff --git a/src/core/lib/transport/static_metadata.h b/src/core/lib/transport/static_metadata.h index dcbe418edc5..84fb316fd66 100644 --- a/src/core/lib/transport/static_metadata.h +++ b/src/core/lib/transport/static_metadata.h @@ -44,7 +44,7 @@ #include "src/core/lib/transport/metadata.h" -#define GRPC_STATIC_MDSTR_COUNT 98 +#define GRPC_STATIC_MDSTR_COUNT 99 extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]; /* ":path" */ #define GRPC_MDSTR_PATH (grpc_static_slice_table[0]) @@ -205,47 +205,49 @@ extern const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT]; #define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[76]) /* "last-modified" */ #define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[77]) +/* "lb-cost-bin" */ +#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table[78]) /* "link" */ -#define GRPC_MDSTR_LINK (grpc_static_slice_table[78]) +#define GRPC_MDSTR_LINK (grpc_static_slice_table[79]) /* "location" */ -#define GRPC_MDSTR_LOCATION (grpc_static_slice_table[79]) +#define GRPC_MDSTR_LOCATION (grpc_static_slice_table[80]) /* "max-forwards" */ -#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[80]) +#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[81]) /* "proxy-authenticate" */ -#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[81]) +#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[82]) /* "proxy-authorization" */ -#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[82]) +#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[83]) /* "range" */ -#define GRPC_MDSTR_RANGE (grpc_static_slice_table[83]) +#define GRPC_MDSTR_RANGE (grpc_static_slice_table[84]) /* "referer" */ -#define GRPC_MDSTR_REFERER (grpc_static_slice_table[84]) +#define GRPC_MDSTR_REFERER (grpc_static_slice_table[85]) /* "refresh" */ -#define GRPC_MDSTR_REFRESH (grpc_static_slice_table[85]) +#define GRPC_MDSTR_REFRESH (grpc_static_slice_table[86]) /* "retry-after" */ -#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[86]) +#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[87]) /* "server" */ -#define GRPC_MDSTR_SERVER (grpc_static_slice_table[87]) +#define GRPC_MDSTR_SERVER (grpc_static_slice_table[88]) /* "set-cookie" */ -#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[88]) +#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[89]) /* "strict-transport-security" */ -#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[89]) +#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[90]) /* "transfer-encoding" */ -#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[90]) +#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[91]) /* "vary" */ -#define GRPC_MDSTR_VARY (grpc_static_slice_table[91]) +#define GRPC_MDSTR_VARY (grpc_static_slice_table[92]) /* "via" */ -#define GRPC_MDSTR_VIA (grpc_static_slice_table[92]) +#define GRPC_MDSTR_VIA (grpc_static_slice_table[93]) /* "www-authenticate" */ -#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[93]) +#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[94]) /* "identity,deflate" */ -#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[94]) +#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[95]) /* "identity,gzip" */ -#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[95]) +#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[96]) /* "deflate,gzip" */ -#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[96]) +#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[97]) /* "identity,deflate,gzip" */ #define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \ - (grpc_static_slice_table[97]) + (grpc_static_slice_table[98]) extern const grpc_slice_refcount_vtable grpc_static_metadata_vtable; extern grpc_slice_refcount @@ -257,7 +259,7 @@ extern grpc_slice_refcount #define GRPC_STATIC_METADATA_INDEX(static_slice) \ ((int)((static_slice).refcount - grpc_static_metadata_refcounts)) -#define GRPC_STATIC_MDELEM_COUNT 80 +#define GRPC_STATIC_MDELEM_COUNT 81 extern grpc_mdelem_data grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT]; extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT]; /* "grpc-status": "0" */ @@ -428,78 +430,81 @@ extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT]; /* "lb-token": "" */ #define GRPC_MDELEM_LB_TOKEN_EMPTY \ (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[55], GRPC_MDELEM_STORAGE_STATIC)) +/* "lb-cost-bin": "" */ +#define GRPC_MDELEM_LB_COST_BIN_EMPTY \ + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[56], GRPC_MDELEM_STORAGE_STATIC)) /* "link": "" */ #define GRPC_MDELEM_LINK_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[56], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[57], GRPC_MDELEM_STORAGE_STATIC)) /* "location": "" */ #define GRPC_MDELEM_LOCATION_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[57], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[58], GRPC_MDELEM_STORAGE_STATIC)) /* "max-forwards": "" */ #define GRPC_MDELEM_MAX_FORWARDS_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[58], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[59], GRPC_MDELEM_STORAGE_STATIC)) /* "proxy-authenticate": "" */ #define GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[59], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[60], GRPC_MDELEM_STORAGE_STATIC)) /* "proxy-authorization": "" */ #define GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[60], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[61], GRPC_MDELEM_STORAGE_STATIC)) /* "range": "" */ #define GRPC_MDELEM_RANGE_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[61], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[62], GRPC_MDELEM_STORAGE_STATIC)) /* "referer": "" */ #define GRPC_MDELEM_REFERER_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[62], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[63], GRPC_MDELEM_STORAGE_STATIC)) /* "refresh": "" */ #define GRPC_MDELEM_REFRESH_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[63], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[64], GRPC_MDELEM_STORAGE_STATIC)) /* "retry-after": "" */ #define GRPC_MDELEM_RETRY_AFTER_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[64], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[65], GRPC_MDELEM_STORAGE_STATIC)) /* "server": "" */ #define GRPC_MDELEM_SERVER_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[65], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[66], GRPC_MDELEM_STORAGE_STATIC)) /* "set-cookie": "" */ #define GRPC_MDELEM_SET_COOKIE_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[66], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[67], GRPC_MDELEM_STORAGE_STATIC)) /* "strict-transport-security": "" */ #define GRPC_MDELEM_STRICT_TRANSPORT_SECURITY_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[67], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[68], GRPC_MDELEM_STORAGE_STATIC)) /* "transfer-encoding": "" */ #define GRPC_MDELEM_TRANSFER_ENCODING_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[68], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[69], GRPC_MDELEM_STORAGE_STATIC)) /* "user-agent": "" */ #define GRPC_MDELEM_USER_AGENT_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[69], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[70], GRPC_MDELEM_STORAGE_STATIC)) /* "vary": "" */ #define GRPC_MDELEM_VARY_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[70], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[71], GRPC_MDELEM_STORAGE_STATIC)) /* "via": "" */ #define GRPC_MDELEM_VIA_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[71], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[72], GRPC_MDELEM_STORAGE_STATIC)) /* "www-authenticate": "" */ #define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[72], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[73], GRPC_MDELEM_STORAGE_STATIC)) /* "grpc-accept-encoding": "identity" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[73], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[74], GRPC_MDELEM_STORAGE_STATIC)) /* "grpc-accept-encoding": "deflate" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[74], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[75], GRPC_MDELEM_STORAGE_STATIC)) /* "grpc-accept-encoding": "identity,deflate" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[75], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[76], GRPC_MDELEM_STORAGE_STATIC)) /* "grpc-accept-encoding": "gzip" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_GZIP \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[76], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[77], GRPC_MDELEM_STORAGE_STATIC)) /* "grpc-accept-encoding": "identity,gzip" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[77], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[78], GRPC_MDELEM_STORAGE_STATIC)) /* "grpc-accept-encoding": "deflate,gzip" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE_COMMA_GZIP \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[78], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[79], GRPC_MDELEM_STORAGE_STATIC)) /* "grpc-accept-encoding": "identity,deflate,gzip" */ #define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \ - (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[79], GRPC_MDELEM_STORAGE_STATIC)) + (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[80], GRPC_MDELEM_STORAGE_STATIC)) grpc_mdelem grpc_static_mdelem_for_static_strings(int a, int b); typedef enum { diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index afc9873c148..33ad0ae1423 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -229,17 +229,9 @@ const struct census_context* ServerContext::census_context() const { void ServerContext::SetLoadReportingCosts( const std::vector& cost_data) { if (call_ == nullptr) return; - grpc_load_reporting_cost_context* cost_ctx = - static_cast( - gpr_malloc(sizeof(*cost_ctx))); - cost_ctx->values_count = cost_data.size(); - cost_ctx->values = static_cast( - gpr_malloc(sizeof(*cost_ctx->values) * cost_ctx->values_count)); - for (size_t i = 0; i < cost_ctx->values_count; ++i) { - cost_ctx->values[i] = - grpc_slice_from_copied_buffer(cost_data[i].data(), cost_data[i].size()); + for (const auto& cost_datum : cost_data) { + AddTrailingMetadata(GRPC_LB_COST_MD_KEY, cost_datum); } - grpc_call_set_load_reporting_cost_context(call_, cost_ctx); } } // namespace grpc diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.c b/src/ruby/ext/grpc/rb_grpc_imports.generated.c index 063f92114c0..f189e88198e 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.c +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.c @@ -110,7 +110,6 @@ grpc_channel_register_call_type grpc_channel_register_call_import; grpc_channel_create_registered_call_type grpc_channel_create_registered_call_import; grpc_call_start_batch_type grpc_call_start_batch_import; grpc_call_get_peer_type grpc_call_get_peer_import; -grpc_call_set_load_reporting_cost_context_type grpc_call_set_load_reporting_cost_context_import; grpc_census_call_set_context_type grpc_census_call_set_context_import; grpc_census_call_get_context_type grpc_census_call_get_context_import; grpc_channel_get_target_type grpc_channel_get_target_import; @@ -407,7 +406,6 @@ void grpc_rb_load_imports(HMODULE library) { grpc_channel_create_registered_call_import = (grpc_channel_create_registered_call_type) GetProcAddress(library, "grpc_channel_create_registered_call"); grpc_call_start_batch_import = (grpc_call_start_batch_type) GetProcAddress(library, "grpc_call_start_batch"); grpc_call_get_peer_import = (grpc_call_get_peer_type) GetProcAddress(library, "grpc_call_get_peer"); - grpc_call_set_load_reporting_cost_context_import = (grpc_call_set_load_reporting_cost_context_type) GetProcAddress(library, "grpc_call_set_load_reporting_cost_context"); grpc_census_call_set_context_import = (grpc_census_call_set_context_type) GetProcAddress(library, "grpc_census_call_set_context"); grpc_census_call_get_context_import = (grpc_census_call_get_context_type) GetProcAddress(library, "grpc_census_call_get_context"); grpc_channel_get_target_import = (grpc_channel_get_target_type) GetProcAddress(library, "grpc_channel_get_target"); diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h index e036ff7bd63..dcdc8063a22 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h @@ -281,9 +281,6 @@ extern grpc_call_start_batch_type grpc_call_start_batch_import; typedef char *(*grpc_call_get_peer_type)(grpc_call *call); extern grpc_call_get_peer_type grpc_call_get_peer_import; #define grpc_call_get_peer grpc_call_get_peer_import -typedef void(*grpc_call_set_load_reporting_cost_context_type)(grpc_call *call, struct grpc_load_reporting_cost_context *context); -extern grpc_call_set_load_reporting_cost_context_type grpc_call_set_load_reporting_cost_context_import; -#define grpc_call_set_load_reporting_cost_context grpc_call_set_load_reporting_cost_context_import typedef void(*grpc_census_call_set_context_type)(grpc_call *call, struct census_context *context); extern grpc_census_call_set_context_type grpc_census_call_set_context_import; #define grpc_census_call_set_context grpc_census_call_set_context_import diff --git a/test/core/end2end/fuzzers/hpack.dictionary b/test/core/end2end/fuzzers/hpack.dictionary index 4282c612146..2bb9de34c56 100644 --- a/test/core/end2end/fuzzers/hpack.dictionary +++ b/test/core/end2end/fuzzers/hpack.dictionary @@ -77,6 +77,7 @@ "\x08if-range" "\x13if-unmodified-since" "\x0Dlast-modified" +"\x0Blb-cost-bin" "\x04link" "\x08location" "\x0Cmax-forwards" @@ -153,6 +154,7 @@ "\x00\x13if-unmodified-since\x00" "\x00\x0Dlast-modified\x00" "\x00\x08lb-token\x00" +"\x00\x0Blb-cost-bin\x00" "\x00\x04link\x00" "\x00\x08location\x00" "\x00\x0Cmax-forwards\x00" diff --git a/test/core/end2end/tests/load_reporting_hook.c b/test/core/end2end/tests/load_reporting_hook.c index 72e9db6e214..c021bc07ff0 100644 --- a/test/core/end2end/tests/load_reporting_hook.c +++ b/test/core/end2end/tests/load_reporting_hook.c @@ -129,8 +129,7 @@ static void end_test(grpc_end2end_test_fixture *f) { static void request_response_with_payload( grpc_end2end_test_config config, grpc_end2end_test_fixture f, const char *method_name, const char *request_msg, const char *response_msg, - grpc_metadata *initial_lr_metadata, - grpc_load_reporting_cost_context *cost_ctx) { + grpc_metadata *initial_lr_metadata, grpc_metadata *trailing_lr_metadata) { grpc_slice request_payload_slice = grpc_slice_from_static_string(request_msg); grpc_slice response_payload_slice = grpc_slice_from_static_string(response_msg); @@ -243,8 +242,9 @@ static void request_response_with_payload( op->reserved = NULL; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; - GPR_ASSERT(cost_ctx != NULL); - grpc_call_set_load_reporting_cost_context(s, cost_ctx); + GPR_ASSERT(trailing_lr_metadata != NULL); + op->data.send_status_from_server.trailing_metadata_count = 1; + op->data.send_status_from_server.trailing_metadata = trailing_lr_metadata; op->data.send_status_from_server.status = GRPC_STATUS_OK; grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; @@ -298,21 +298,21 @@ static void test_load_reporting_hook(grpc_end2end_test_config config) { const char *response_msg = "... and the response from the server"; grpc_metadata initial_lr_metadata; + grpc_metadata trailing_lr_metadata; initial_lr_metadata.key = GRPC_MDSTR_LB_TOKEN; initial_lr_metadata.value = grpc_slice_from_static_string("client-token"); memset(&initial_lr_metadata.internal_data, 0, sizeof(initial_lr_metadata.internal_data)); - grpc_load_reporting_cost_context *cost_ctx = gpr_malloc(sizeof(*cost_ctx)); - memset(cost_ctx, 0, sizeof(*cost_ctx)); - cost_ctx->values_count = 1; - cost_ctx->values = - gpr_malloc(sizeof(*cost_ctx->values) * cost_ctx->values_count); - cost_ctx->values[0] = grpc_slice_from_static_string("cost-token"); + trailing_lr_metadata.key = GRPC_MDSTR_LB_COST_BIN; + trailing_lr_metadata.value = grpc_slice_from_static_string("server-token"); + memset(&trailing_lr_metadata.internal_data, 0, + sizeof(trailing_lr_metadata.internal_data)); request_response_with_payload(config, f, method_name, request_msg, - response_msg, &initial_lr_metadata, cost_ctx); + response_msg, &initial_lr_metadata, + &trailing_lr_metadata); end_test(&f); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; diff --git a/tools/codegen/core/gen_static_metadata.py b/tools/codegen/core/gen_static_metadata.py index ead57b2bf6d..360b0f56e92 100755 --- a/tools/codegen/core/gen_static_metadata.py +++ b/tools/codegen/core/gen_static_metadata.py @@ -124,6 +124,7 @@ CONFIG = [ ('if-unmodified-since', ''), ('last-modified', ''), ('lb-token', ''), + ('lb-cost-bin', ''), ('link', ''), ('location', ''), ('max-forwards', ''), From c7fcebe75011567b3ac1a100cbacb82105c902b6 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Sat, 15 Apr 2017 16:37:44 -0700 Subject: [PATCH 418/461] fix bug in which gc of channel sleeps on cv before bg thread signaling has started --- src/ruby/ext/grpc/rb_channel.c | 45 +++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/src/ruby/ext/grpc/rb_channel.c b/src/ruby/ext/grpc/rb_channel.c index 6d12ff9ebd0..aead45c082e 100644 --- a/src/ruby/ext/grpc/rb_channel.c +++ b/src/ruby/ext/grpc/rb_channel.c @@ -92,7 +92,9 @@ static void grpc_rb_channel_safe_destroy(grpc_rb_channel *wrapper); static grpc_completion_queue *channel_polling_cq; static gpr_mu global_connection_polling_mu; +static gpr_cv global_connection_polling_cv; static int abort_channel_polling = 0; +static int channel_polling_thread_started = 0; /* Destroys Channel instances. */ static void grpc_rb_channel_free(void *p) { @@ -479,6 +481,14 @@ static void grpc_rb_channel_safe_destroy(grpc_rb_channel *wrapper) { static void *run_poll_channels_loop_no_gil(void *arg) { grpc_event event; (void)arg; + gpr_log(GPR_DEBUG, "GRPC_RUBY: run_poll_channels_loop_no_gil - begin"); + + gpr_mu_lock(&global_connection_polling_mu); + GPR_ASSERT(!channel_polling_thread_started); + channel_polling_thread_started = 1; + gpr_cv_signal(&global_connection_polling_cv); + gpr_mu_unlock(&global_connection_polling_mu); + for (;;) { event = grpc_completion_queue_next( channel_polling_cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); @@ -510,9 +520,24 @@ static VALUE run_poll_channels_loop(VALUE arg) { gpr_log(GPR_DEBUG, "GRPC_RUBY: run_poll_channels_loop - create connection polling thread"); rb_thread_call_without_gvl(run_poll_channels_loop_no_gil, NULL, grpc_rb_event_unblocking_func, NULL); + return Qnil; } +static void *grpc_rb_wait_until_channel_polling_thread_started(void *arg) { + (void)arg; + gpr_log(GPR_DEBUG, "GRPC_RUBY: wait for channel polling thread to start"); + gpr_mu_lock(&global_connection_polling_mu); + while (!channel_polling_thread_started && !abort_channel_polling) { + gpr_cv_wait(&global_connection_polling_cv, &global_connection_polling_mu, + gpr_inf_future(GPR_CLOCK_REALTIME)); + } + gpr_mu_unlock(&global_connection_polling_mu); + + return NULL; +} + + /* Temporary fix for * https://github.com/GoogleCloudPlatform/google-cloud-ruby/issues/899. * Transports in idle channels can get destroyed. Normally c-core re-connects, @@ -524,12 +549,30 @@ static VALUE run_poll_channels_loop(VALUE arg) { * TODO(apolcyn) remove this when core handles new RPCs on dead connections. */ void grpc_rb_channel_polling_thread_start() { + VALUE background_thread = Qnil; + GPR_ASSERT(!abort_channel_polling); + GPR_ASSERT(!channel_polling_thread_started); GPR_ASSERT(channel_polling_cq == NULL); gpr_mu_init(&global_connection_polling_mu); + gpr_cv_init(&global_connection_polling_cv); + channel_polling_cq = grpc_completion_queue_create(NULL); - rb_thread_create(run_poll_channels_loop, NULL); + background_thread = rb_thread_create(run_poll_channels_loop, NULL); + + if (!RTEST(background_thread)) { + gpr_log(GPR_DEBUG, "GRPC_RUBY: failed to spawn channel polling thread"); + gpr_mu_lock(&global_connection_polling_mu); + abort_channel_polling = 1; + gpr_mu_unlock(&global_connection_polling_mu); + return; + } + + // Drop the gil before sleeping on a gpr_cv so that the background thread + // signaling it can acquire the gil and then start, if it hasn't already. + rb_thread_call_without_gvl(grpc_rb_wait_until_channel_polling_thread_started, NULL, + grpc_rb_event_unblocking_func, NULL); } static void Init_grpc_propagate_masks() { From d1143abaa8ca7f52ca4fb0b56e24401d69dcea95 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Sun, 16 Apr 2017 10:26:44 -0700 Subject: [PATCH 419/461] tweak class init test to reveal bug in misordered startup --- src/ruby/end2end/grpc_class_init_client.rb | 23 +++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/ruby/end2end/grpc_class_init_client.rb b/src/ruby/end2end/grpc_class_init_client.rb index b321016b212..5fad1353be1 100755 --- a/src/ruby/end2end/grpc_class_init_client.rb +++ b/src/ruby/end2end/grpc_class_init_client.rb @@ -29,7 +29,8 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# Try to catch if native gRPC class constructors are missing a 'grpc_init' +# For GRPC::Core classes, which use the grpc c-core, object init +# is interesting because it's related to overall library init. require_relative './end2end_common' @@ -43,15 +44,35 @@ def main case grpc_class when 'channel' + thd = Thread.new do + GRPC::Core::Channel.new('dummy_host', nil, :this_channel_is_insecure) + end GRPC::Core::Channel.new('dummy_host', nil, :this_channel_is_insecure) + thd.join when 'server' + thd = Thread.new do + GRPC::Core::Server.new({}) + end GRPC::Core::Server.new({}) + thd.join when 'channel_credentials' + thd = Thread.new do + GRPC::Core::ChannelCredentials.new + end GRPC::Core::ChannelCredentials.new + thd.join when 'call_credentials' + thd = Thread.new do + GRPC::Core::CallCredentials.new(proc { |noop| noop }) + end GRPC::Core::CallCredentials.new(proc { |noop| noop }) + thd.join when 'compression_options' + thd = Thread.new do + GRPC::Core::CompressionOptions.new + end GRPC::Core::CompressionOptions.new + thd.join else fail "bad --grpc_class=#{grpc_class} param" end From deeed7f12bf8c63057e4ad4963b17d0e97c830a9 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Sun, 16 Apr 2017 13:31:58 -0700 Subject: [PATCH 420/461] don't hold the gil while waiting for bg thread to start --- src/ruby/end2end/grpc_class_init_client.rb | 26 ++++++++---------- src/ruby/ext/grpc/rb_channel.c | 32 ++++++++++++++-------- 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/src/ruby/end2end/grpc_class_init_client.rb b/src/ruby/end2end/grpc_class_init_client.rb index 5fad1353be1..ee79292119a 100755 --- a/src/ruby/end2end/grpc_class_init_client.rb +++ b/src/ruby/end2end/grpc_class_init_client.rb @@ -42,40 +42,36 @@ def main end end.parse! + test_proc = nil + case grpc_class when 'channel' - thd = Thread.new do + test_proc = proc do GRPC::Core::Channel.new('dummy_host', nil, :this_channel_is_insecure) end - GRPC::Core::Channel.new('dummy_host', nil, :this_channel_is_insecure) - thd.join when 'server' - thd = Thread.new do + test_proc = proc do GRPC::Core::Server.new({}) end - GRPC::Core::Server.new({}) - thd.join when 'channel_credentials' - thd = Thread.new do + test_proc = proc do GRPC::Core::ChannelCredentials.new end - GRPC::Core::ChannelCredentials.new - thd.join when 'call_credentials' - thd = Thread.new do + test_proc = proc do GRPC::Core::CallCredentials.new(proc { |noop| noop }) end - GRPC::Core::CallCredentials.new(proc { |noop| noop }) - thd.join when 'compression_options' - thd = Thread.new do + test_proc = proc do GRPC::Core::CompressionOptions.new end - GRPC::Core::CompressionOptions.new - thd.join else fail "bad --grpc_class=#{grpc_class} param" end + + th = Thread.new { test_proc.call } + test_proc.call + th.join end main diff --git a/src/ruby/ext/grpc/rb_channel.c b/src/ruby/ext/grpc/rb_channel.c index aead45c082e..fb610f548eb 100644 --- a/src/ruby/ext/grpc/rb_channel.c +++ b/src/ruby/ext/grpc/rb_channel.c @@ -89,6 +89,8 @@ typedef struct grpc_rb_channel { static void grpc_rb_channel_try_register_connection_polling( grpc_rb_channel *wrapper); static void grpc_rb_channel_safe_destroy(grpc_rb_channel *wrapper); +static void *wait_until_channel_polling_thread_started_no_gil(void*); +static void wait_until_channel_polling_thread_started_unblocking_func(void*); static grpc_completion_queue *channel_polling_cq; static gpr_mu global_connection_polling_mu; @@ -169,6 +171,8 @@ static VALUE grpc_rb_channel_init(int argc, VALUE *argv, VALUE self) { MEMZERO(&args, grpc_channel_args, 1); grpc_ruby_once_init(); + rb_thread_call_without_gvl(wait_until_channel_polling_thread_started_no_gil, NULL, + wait_until_channel_polling_thread_started_unblocking_func, NULL); /* "3" == 3 mandatory args */ rb_scan_args(argc, argv, "3", &target, &channel_args, &credentials); @@ -440,6 +444,7 @@ static void grpc_rb_channel_try_register_connection_polling( } gpr_mu_lock(&global_connection_polling_mu); + GPR_ASSERT(channel_polling_thread_started || abort_channel_polling); conn_state = grpc_channel_check_connectivity_state(wrapper->wrapped, 0); if (conn_state != wrapper->current_connectivity_state) { wrapper->current_connectivity_state = conn_state; @@ -473,7 +478,7 @@ static void grpc_rb_channel_safe_destroy(grpc_rb_channel *wrapper) { } // Note this loop breaks out with a single call of -// "grpc_rb_event_unblocking_func". +// "run_poll_channels_loop_no_gil". // This assumes that a ruby call the unblocking func // indicates process shutdown. // In the worst case, this stops polling channel connectivity @@ -486,7 +491,7 @@ static void *run_poll_channels_loop_no_gil(void *arg) { gpr_mu_lock(&global_connection_polling_mu); GPR_ASSERT(!channel_polling_thread_started); channel_polling_thread_started = 1; - gpr_cv_signal(&global_connection_polling_cv); + gpr_cv_broadcast(&global_connection_polling_cv); gpr_mu_unlock(&global_connection_polling_mu); for (;;) { @@ -505,10 +510,10 @@ static void *run_poll_channels_loop_no_gil(void *arg) { } // Notify the channel polling loop to cleanup and shutdown. -static void grpc_rb_event_unblocking_func(void *arg) { +static void run_poll_channels_loop_unblocking_func(void *arg) { (void)arg; gpr_mu_lock(&global_connection_polling_mu); - gpr_log(GPR_DEBUG, "GRPC_RUBY: grpc_rb_event_unblocking_func - begin aborting connection polling"); + gpr_log(GPR_DEBUG, "GRPC_RUBY: run_poll_channels_loop_unblocking_func - begin aborting connection polling"); abort_channel_polling = 1; grpc_completion_queue_shutdown(channel_polling_cq); gpr_mu_unlock(&global_connection_polling_mu); @@ -519,12 +524,12 @@ static VALUE run_poll_channels_loop(VALUE arg) { (void)arg; gpr_log(GPR_DEBUG, "GRPC_RUBY: run_poll_channels_loop - create connection polling thread"); rb_thread_call_without_gvl(run_poll_channels_loop_no_gil, NULL, - grpc_rb_event_unblocking_func, NULL); + run_poll_channels_loop_unblocking_func, NULL); return Qnil; } -static void *grpc_rb_wait_until_channel_polling_thread_started(void *arg) { +static void *wait_until_channel_polling_thread_started_no_gil(void *arg) { (void)arg; gpr_log(GPR_DEBUG, "GRPC_RUBY: wait for channel polling thread to start"); gpr_mu_lock(&global_connection_polling_mu); @@ -537,6 +542,14 @@ static void *grpc_rb_wait_until_channel_polling_thread_started(void *arg) { return NULL; } +static void wait_until_channel_polling_thread_started_unblocking_func(void* arg) { + (void)arg; + gpr_mu_lock(&global_connection_polling_mu); + gpr_log(GPR_DEBUG, "GRPC_RUBY: wait_until_channel_polling_thread_started_unblocking_func - begin aborting connection polling"); + abort_channel_polling = 1; + gpr_cv_broadcast(&global_connection_polling_cv); + gpr_mu_unlock(&global_connection_polling_mu); +} /* Temporary fix for * https://github.com/GoogleCloudPlatform/google-cloud-ruby/issues/899. @@ -565,14 +578,9 @@ void grpc_rb_channel_polling_thread_start() { gpr_log(GPR_DEBUG, "GRPC_RUBY: failed to spawn channel polling thread"); gpr_mu_lock(&global_connection_polling_mu); abort_channel_polling = 1; + gpr_cv_broadcast(&global_connection_polling_cv); gpr_mu_unlock(&global_connection_polling_mu); - return; } - - // Drop the gil before sleeping on a gpr_cv so that the background thread - // signaling it can acquire the gil and then start, if it hasn't already. - rb_thread_call_without_gvl(grpc_rb_wait_until_channel_polling_thread_started, NULL, - grpc_rb_event_unblocking_func, NULL); } static void Init_grpc_propagate_masks() { From a1f76425596c05a12513ef9656983cdf0613aeb3 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 17 Apr 2017 12:04:46 -0700 Subject: [PATCH 421/461] Public functions must be prefixed with grpc_ --- .../ext/transport/chttp2/transport/chttp2_transport.c | 4 ++-- src/core/ext/transport/chttp2/transport/frame_data.c | 10 ++++------ src/core/ext/transport/chttp2/transport/frame_data.h | 10 ++++------ 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 9269611dd9d..5c5175f5668 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -1679,7 +1679,7 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx *exec_ctx, grpc_slice_buffer_swap(&s->unprocessed_incoming_frames_buffer, &s->frame_storage); } - error = deframe_unprocessed_incoming_frames( + error = grpc_deframe_unprocessed_incoming_frames( exec_ctx, &s->data_parser, s, &s->unprocessed_incoming_frames_buffer, NULL, s->recv_message); if (error != GRPC_ERROR_NONE) { @@ -2627,7 +2627,7 @@ static grpc_error *incoming_byte_stream_pull(grpc_exec_ctx *exec_ctx, grpc_chttp2_stream *s = bs->stream; if (s->unprocessed_incoming_frames_buffer.length > 0) { - grpc_error *error = deframe_unprocessed_incoming_frames( + grpc_error *error = grpc_deframe_unprocessed_incoming_frames( exec_ctx, &s->data_parser, s, &s->unprocessed_incoming_frames_buffer, slice, NULL); if (error != GRPC_ERROR_NONE) { diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c index 5d382d80a8b..9aba3ea445d 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.c +++ b/src/core/ext/transport/chttp2/transport/frame_data.c @@ -112,12 +112,10 @@ void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer *inbuf, stats->data_bytes += write_bytes; } -grpc_error *deframe_unprocessed_incoming_frames(grpc_exec_ctx *exec_ctx, - grpc_chttp2_data_parser *p, - grpc_chttp2_stream *s, - grpc_slice_buffer *slices, - grpc_slice *slice_out, - grpc_byte_stream **stream_out) { +grpc_error *grpc_deframe_unprocessed_incoming_frames( + grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *p, grpc_chttp2_stream *s, + grpc_slice_buffer *slices, grpc_slice *slice_out, + grpc_byte_stream **stream_out) { grpc_error *error = GRPC_ERROR_NONE; grpc_chttp2_transport *t = s->t; diff --git a/src/core/ext/transport/chttp2/transport/frame_data.h b/src/core/ext/transport/chttp2/transport/frame_data.h index 2fb8983c38e..9ed4ad0f218 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.h +++ b/src/core/ext/transport/chttp2/transport/frame_data.h @@ -90,11 +90,9 @@ void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer *inbuf, grpc_transport_one_way_stats *stats, grpc_slice_buffer *outbuf); -grpc_error *deframe_unprocessed_incoming_frames(grpc_exec_ctx *exec_ctx, - grpc_chttp2_data_parser *p, - grpc_chttp2_stream *s, - grpc_slice_buffer *slices, - grpc_slice *slice_out, - grpc_byte_stream **stream_out); +grpc_error *grpc_deframe_unprocessed_incoming_frames( + grpc_exec_ctx *exec_ctx, grpc_chttp2_data_parser *p, grpc_chttp2_stream *s, + grpc_slice_buffer *slices, grpc_slice *slice_out, + grpc_byte_stream **stream_out); #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_DATA_H */ From 7cc31f1d69bee3dc451d736a0a22f17b07e029e2 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Mon, 17 Apr 2017 15:11:05 -0700 Subject: [PATCH 422/461] Fix python artifact build --- PYTHON-MANIFEST.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PYTHON-MANIFEST.in b/PYTHON-MANIFEST.in index 846530532df..bb76b38f9fb 100644 --- a/PYTHON-MANIFEST.in +++ b/PYTHON-MANIFEST.in @@ -7,7 +7,7 @@ graft include/grpc graft third_party/boringssl graft third_party/nanopb graft third_party/zlib -graft third_party/c-ares +graft third_party/cares include src/python/grpcio/_spawn_patch.py include src/python/grpcio/commands.py include src/python/grpcio/grpc_version.py From 50810d713996499490a3ecf23aa377a16893c8f0 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Mon, 17 Apr 2017 17:01:49 -0700 Subject: [PATCH 423/461] Revert a change in BoringSSL 8.1 --- src/objective-c/BoringSSL.podspec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/objective-c/BoringSSL.podspec b/src/objective-c/BoringSSL.podspec index 7880aad10ba..7403f3288c6 100644 --- a/src/objective-c/BoringSSL.podspec +++ b/src/objective-c/BoringSSL.podspec @@ -31,7 +31,7 @@ Pod::Spec.new do |s| s.name = 'BoringSSL' - version = '8.1' + version = '8.2' s.version = version s.summary = 'BoringSSL is a fork of OpenSSL that is designed to meet Google’s needs.' # Adapted from the homepage: @@ -113,7 +113,6 @@ Pod::Spec.new do |s| s.subspec 'Interface' do |ss| ss.header_mappings_dir = 'include/openssl' ss.source_files = 'include/openssl/*.h' - ss.exclude_files = 'include/openssl/arm_arch.h' end s.subspec 'Implementation' do |ss| ss.header_mappings_dir = '.' From f88ee4f8c5139e12845c4fef7533b1111d48a15c Mon Sep 17 00:00:00 2001 From: Noah Eisen Date: Mon, 17 Apr 2017 18:14:39 -0700 Subject: [PATCH 424/461] Fix error refcount debug logging --- src/core/lib/iomgr/error.c | 15 +++++++++++---- src/core/lib/iomgr/error.h | 26 +++++++++++++------------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/core/lib/iomgr/error.c b/src/core/lib/iomgr/error.c index fbbca6b4939..5f2c989aad0 100644 --- a/src/core/lib/iomgr/error.c +++ b/src/core/lib/iomgr/error.c @@ -217,8 +217,14 @@ static uint8_t get_placement(grpc_error **err, size_t size) { if ((*err)->arena_size + slots > (*err)->arena_capacity) { return UINT8_MAX; } +#ifdef GRPC_ERROR_REFCOUNT_DEBUG + grpc_error *orig = *err; +#endif *err = gpr_realloc( *err, sizeof(grpc_error) + (*err)->arena_capacity * sizeof(intptr_t)); +#ifdef GRPC_ERROR_REFCOUNT_DEBUG + if (*err != orig) gpr_log(GPR_DEBUG, "realloc %p -> %p", orig, *err); +#endif } uint8_t placement = (*err)->arena_size; (*err)->arena_size = (uint8_t)((*err)->arena_size + slots); @@ -313,7 +319,7 @@ static void internal_add_error(grpc_error **err, grpc_error *new) { // It is very common to include and extra int and string in an error #define SURPLUS_CAPACITY (2 * SLOTS_PER_INT + SLOTS_PER_TIME) -grpc_error *grpc_error_create(grpc_slice file, int line, grpc_slice desc, +grpc_error *grpc_error_create(const char *file, int line, grpc_slice desc, grpc_error **referencing, size_t num_referencing) { GPR_TIMER_BEGIN("grpc_error_create", 0); @@ -339,7 +345,8 @@ grpc_error *grpc_error_create(grpc_slice file, int line, grpc_slice desc, memset(err->times, UINT8_MAX, GRPC_ERROR_TIME_MAX); internal_set_int(&err, GRPC_ERROR_INT_FILE_LINE, line); - internal_set_str(&err, GRPC_ERROR_STR_FILE, file); + internal_set_str(&err, GRPC_ERROR_STR_FILE, + grpc_slice_from_static_string(file)); internal_set_str(&err, GRPC_ERROR_STR_DESCRIPTION, desc); for (size_t i = 0; i < num_referencing; ++i) { @@ -756,7 +763,7 @@ grpc_error *grpc_os_error(const char *file, int line, int err, return grpc_error_set_str( grpc_error_set_str( grpc_error_set_int( - grpc_error_create(grpc_slice_from_static_string(file), line, + grpc_error_create(file, line, grpc_slice_from_static_string("OS Error"), NULL, 0), GRPC_ERROR_INT_ERRNO, err), @@ -772,7 +779,7 @@ grpc_error *grpc_wsa_error(const char *file, int line, int err, grpc_error *error = grpc_error_set_str( grpc_error_set_str( grpc_error_set_int( - grpc_error_create(grpc_slice_from_static_string(file), line, + grpc_error_create(file, line, grpc_slice_from_static_string("OS Error"), NULL, 0), GRPC_ERROR_INT_WSA_ERROR, err), diff --git a/src/core/lib/iomgr/error.h b/src/core/lib/iomgr/error.h index 2a44fcfe25e..34b24d92638 100644 --- a/src/core/lib/iomgr/error.h +++ b/src/core/lib/iomgr/error.h @@ -138,7 +138,7 @@ typedef enum { const char *grpc_error_string(grpc_error *error); /// Create an error - but use GRPC_ERROR_CREATE instead -grpc_error *grpc_error_create(grpc_slice file, int line, grpc_slice desc, +grpc_error *grpc_error_create(const char *file, int line, grpc_slice desc, grpc_error **referencing, size_t num_referencing); /// Create an error (this is the preferred way of generating an error that is /// not due to a system call - for system calls, use GRPC_OS_ERROR or @@ -148,21 +148,21 @@ grpc_error *grpc_error_create(grpc_slice file, int line, grpc_slice desc, /// err = grpc_error_create(x, y, z, r, nr) is equivalent to: /// err = grpc_error_create(x, y, z, NULL, 0); /// for (i=0; i Date: Tue, 18 Apr 2017 12:31:49 +0200 Subject: [PATCH 425/461] fix markdown --- doc/server_side_auth.md | 4 ++-- examples/cpp/README.md | 2 +- examples/cpp/cpptutorial.md | 2 +- examples/csharp/route_guide/README.md | 2 +- .../dynamic_codegen/route_guide/README.md | 2 +- .../node/static_codegen/route_guide/README.md | 2 +- examples/objective-c/auth_sample/README.md | 2 +- examples/objective-c/helloworld/README.md | 2 +- examples/objective-c/route_guide/README.md | 2 +- examples/php/route_guide/README.md | 2 +- .../ruby/errors_and_cancellation/README.md | 2 +- examples/ruby/route_guide/README.md | 2 +- tools/grift/README.md | 12 ++++------ tools/run_tests/README.md | 24 +++++++++---------- vsprojects/README.md | 6 ++--- 15 files changed, 33 insertions(+), 35 deletions(-) diff --git a/doc/server_side_auth.md b/doc/server_side_auth.md index 288c6e9cb38..d260237928d 100644 --- a/doc/server_side_auth.md +++ b/doc/server_side_auth.md @@ -13,7 +13,7 @@ The contents of the *auth properties* are populated by an *auth interceptor*. Th WARNING: AuthContext is the only reliable source of truth when it comes to authenticating RPCs. Using any other call/context properties for authentication purposes is wrong and inherently unsafe. -####Example AuthContext contents +#### Example AuthContext contents For secure channel using mutual TLS authentication with both client and server certificates (test certificates from this repository are used). @@ -45,7 +45,7 @@ gRPC comes with some basic "interceptors" already built-in. WARNING: While there is a public API that allows anyone to write their own custom interceptor, please think twice before using it. There are legitimate uses for custom interceptors but you should keep in mind that as auth interceptors essentially decide which RPCs are authenticated and which are not, their code is very sensitive from the security perspective and getting things wrong might have serious consequences. If unsure, we strongly recommend to rely on official & proven interceptors that come with gRPC. -####Available auth interceptors +#### Available auth interceptors - TLS/SSL certificate authentication (built into gRPC's security layer, automatically used whenever you use a secure connection) - (coming soon) JWT auth token authentication - more will be added over time diff --git a/examples/cpp/README.md b/examples/cpp/README.md index 783935cd53d..8e2bb5d13b1 100644 --- a/examples/cpp/README.md +++ b/examples/cpp/README.md @@ -1,4 +1,4 @@ -#gRPC in 3 minutes (C++) +# gRPC in 3 minutes (C++) ## Installation diff --git a/examples/cpp/cpptutorial.md b/examples/cpp/cpptutorial.md index ae84aba9163..7d98367da43 100644 --- a/examples/cpp/cpptutorial.md +++ b/examples/cpp/cpptutorial.md @@ -1,4 +1,4 @@ -#gRPC Basics: C++ +# gRPC Basics: C++ This tutorial provides a basic C++ programmer's introduction to working with gRPC. By walking through this example you'll learn how to: diff --git a/examples/csharp/route_guide/README.md b/examples/csharp/route_guide/README.md index a9aa87a83df..98073b02963 100644 --- a/examples/csharp/route_guide/README.md +++ b/examples/csharp/route_guide/README.md @@ -1,4 +1,4 @@ -#gRPC Basics: C# sample code +# gRPC Basics: C# sample code The files in this folder are the samples used in [gRPC Basics: C#][], a detailed tutorial for using gRPC in C#. diff --git a/examples/node/dynamic_codegen/route_guide/README.md b/examples/node/dynamic_codegen/route_guide/README.md index 22bcf789863..7ec519c76bb 100644 --- a/examples/node/dynamic_codegen/route_guide/README.md +++ b/examples/node/dynamic_codegen/route_guide/README.md @@ -1,4 +1,4 @@ -#gRPC Basics: Node.js sample code +# gRPC Basics: Node.js sample code The files in this folder are the samples used in [gRPC Basics: Node.js][], a detailed tutorial for using gRPC in Node.js. diff --git a/examples/node/static_codegen/route_guide/README.md b/examples/node/static_codegen/route_guide/README.md index 22bcf789863..7ec519c76bb 100644 --- a/examples/node/static_codegen/route_guide/README.md +++ b/examples/node/static_codegen/route_guide/README.md @@ -1,4 +1,4 @@ -#gRPC Basics: Node.js sample code +# gRPC Basics: Node.js sample code The files in this folder are the samples used in [gRPC Basics: Node.js][], a detailed tutorial for using gRPC in Node.js. diff --git a/examples/objective-c/auth_sample/README.md b/examples/objective-c/auth_sample/README.md index c560b7af65b..b75dcab2de4 100644 --- a/examples/objective-c/auth_sample/README.md +++ b/examples/objective-c/auth_sample/README.md @@ -1,3 +1,3 @@ -#OAuth2 on gRPC: Objective-C +# OAuth2 on gRPC: Objective-C This is the supporting code for the tutorial "[OAuth2 on gRPC: Objective-C](http://www.grpc.io/docs/tutorials/auth/oauth2-objective-c.html)." diff --git a/examples/objective-c/helloworld/README.md b/examples/objective-c/helloworld/README.md index fdff938a978..365bea14228 100644 --- a/examples/objective-c/helloworld/README.md +++ b/examples/objective-c/helloworld/README.md @@ -1,4 +1,4 @@ -#gRPC in 3 minutes (Objective-C) +# gRPC in 3 minutes (Objective-C) ## Installation diff --git a/examples/objective-c/route_guide/README.md b/examples/objective-c/route_guide/README.md index 6a6f7c0d338..b99bf546fb7 100644 --- a/examples/objective-c/route_guide/README.md +++ b/examples/objective-c/route_guide/README.md @@ -1,4 +1,4 @@ -#gRPC Basics: Objective-C +# gRPC Basics: Objective-C This is the supporting code for the tutorial "[gRPC Basics: Objective-C](http://www.grpc.io/docs/tutorials/basic/objective-c.html)." diff --git a/examples/php/route_guide/README.md b/examples/php/route_guide/README.md index 26f1704f122..5b2cc05efc7 100644 --- a/examples/php/route_guide/README.md +++ b/examples/php/route_guide/README.md @@ -1,4 +1,4 @@ -#gRPC Basics: PHP sample code +# gRPC Basics: PHP sample code The files in this folder are the samples used in [gRPC Basics: PHP][], a detailed tutorial for using gRPC in PHP. diff --git a/examples/ruby/errors_and_cancellation/README.md b/examples/ruby/errors_and_cancellation/README.md index 126518c4aab..661bd84792f 100644 --- a/examples/ruby/errors_and_cancellation/README.md +++ b/examples/ruby/errors_and_cancellation/README.md @@ -1,4 +1,4 @@ -#Errors and Cancelletion code samples for grpc-ruby +# Errors and Cancelletion code samples for grpc-ruby The examples in this directory show use of grpc errors. diff --git a/examples/ruby/route_guide/README.md b/examples/ruby/route_guide/README.md index 3c353d1d976..b2514630a96 100644 --- a/examples/ruby/route_guide/README.md +++ b/examples/ruby/route_guide/README.md @@ -1,4 +1,4 @@ -#gRPC Basics: Ruby sample code +# gRPC Basics: Ruby sample code The files in this folder are the samples used in [gRPC Basics: Ruby][], a detailed tutorial for using gRPC in Ruby. diff --git a/tools/grift/README.md b/tools/grift/README.md index 7cbbdc567bf..2b5fa5ae14b 100644 --- a/tools/grift/README.md +++ b/tools/grift/README.md @@ -1,6 +1,4 @@ -Copyright 2016 Google Inc. - -#Documentation +# Documentation grift is integration of [Apache Thrift](https://github.com/apache/thrift.git) Serializer with gRPC. @@ -8,19 +6,19 @@ This integration allows you to use grpc to send thrift messages in C++ and java. grift uses Compact Protocol to serialize thrift messages. -##generating grpc plugins for thrift services +## generating grpc plugins for thrift services -###CPP +### C++ ```sh $ thrift --gen cpp ``` -###JAVA +### Java ```sh $ thrift --gen java ``` -#Installation +# Installation Before Installing thrift make sure to apply this [patch](grpc_plugins_generator.patch) to third_party/thrift. Go to third_party/thrift and follow the [INSTALLATION](https://github.com/apache/thrift.git) instructions to install thrift with commit id bcad91771b7f0bff28a1cac1981d7ef2b9bcef3c. \ No newline at end of file diff --git a/tools/run_tests/README.md b/tools/run_tests/README.md index e709ddd2c02..05d33fd6b1c 100644 --- a/tools/run_tests/README.md +++ b/tools/run_tests/README.md @@ -1,44 +1,44 @@ -#Overview +# Overview This directory contains scripts that facilitate building and running tests. We are using python scripts as entrypoint for our tests because that gives us the opportunity to run tests using the same commandline regardless of the platform you are using. -#Unit tests (run_tests.py) +# Unit tests (run_tests.py) Builds gRPC in given language and runs unit tests. Use `tools/run_tests/run_tests.py --help` for more help. -######Example +###### Example `tools/run_tests/run_tests.py -l csharp -c dbg` -######Useful options (among many others) +###### Useful options (among many others) - `--use_docker` Builds a docker container containing all the prerequisites for given language and runs the tests under that container. - `--build_only` Only build, do not run the tests. -#Interop tests (run_interop_tests.py) +# Interop tests (run_interop_tests.py) Runs tests for cross-platform/cross-language interoperability. For more details, see [Interop tests descriptions](/doc/interop-test-descriptions.md) The script is also capable of running interop tests for grpc-java and grpc-go, using sources checked out alongside the ones of the grpc repository. -######Example +###### Example `tools/run_tests/run_interop_tests.py -l csharp -s c++ --use_docker` (run interop tests with C# client and C++ server) Note: if you see an error like `no space left on device` when running the interop tests using Docker, make sure that Docker is building the image files in a location with sufficient disk space. -#Performance benchmarks (run_performance_tests.py) +# Performance benchmarks (run_performance_tests.py) Runs predefined benchmark scenarios for given languages. Besides the simple configuration of running all the scenarios locally, the script also supports orchestrating test runs with client and server running on different machines and uploading the results to BigQuery. -######Example +###### Example `tools/run_tests/run_peformance_tests.py -l c++ node` -######Useful options +###### Useful options - `--regex` use regex to select particular scenarios to run. -#Stress tests (run_stress_tests.py) +# Stress tests (run_stress_tests.py) Runs modified interop tests clients and servers under heavy load for an extended period of time to discover potential stability issues. The tests are internally using Kubernetes to run the client and server on GKE and upload statistics to BigQuery. @@ -47,10 +47,10 @@ The tests are internally using Kubernetes to run the client and server on GKE an The directory `tools/run_tests/stress_test/configs/` contains the config files for several scenarios -#Artifacts & Packages (task_runner.py) +# Artifacts & Packages (task_runner.py) A generalized framework for running predefined tasks based on their labels. We use this to building binary artifacts & distrib packages and testing them) -######Example +###### Example `tools/run_tests/task_runner.py -f python artifact linux x64` (build tasks with labels `python`, `artifact`, `linux`, and `x64`) diff --git a/vsprojects/README.md b/vsprojects/README.md index f1663d25485..1f0cdc24ba7 100644 --- a/vsprojects/README.md +++ b/vsprojects/README.md @@ -1,10 +1,10 @@ -#Pre-generated MS Visual Studio project & solution files +# Pre-generated MS Visual Studio project & solution files Versions 2013 and 2015 are both supported. You can use [their respective community editions](https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx). -#Building +# Building We are using [NuGet](http://www.nuget.org) to pull zlib and openssl dependencies. If you don't have Visual Studio NuGet plugin installed, you'll need to download nuget.exe from the web and manually restore the NuGet packages. @@ -19,7 +19,7 @@ After that, you can build the solution using one of these options: 1. open `grpc.sln` with Visual Studio and hit "Build". 2. build from commandline using `msbuild grpc.sln /p:Configuration=Debug` -#C/C++ Test Dependencies +# C/C++ Test Dependencies * gtest isn't available as a git repo like the other dependencies. download it and add it to `/third_party/gtest/` (the folder will end up with `/build-aux/`, `/cmake/`, `/codegear/`, etc. folders in it). * if using vs2013: open/import the gtest solution in `/msvc/`, and save over the first solution (you will have to change it from read-only). change all projects to use `/MDd` (Property Pages - C/C++ - Code Generation - Runtime Library) and build. This is a "multithreaded debug" setting and it needs to match grpc. * build all From ed94e39ee8f5efd65330d72eb0bc5603efe12091 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 18 Apr 2017 14:25:17 +0200 Subject: [PATCH 426/461] setting handler is a race --- .../Grpc.Core.Tests/AppDomainUnloadTest.cs | 8 ++++---- .../Grpc.Core.Tests/UserAgentStringTest.cs | 19 ++++++++++--------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/AppDomainUnloadTest.cs b/src/csharp/Grpc.Core.Tests/AppDomainUnloadTest.cs index d7ebdb4201e..7858e77b278 100644 --- a/src/csharp/Grpc.Core.Tests/AppDomainUnloadTest.cs +++ b/src/csharp/Grpc.Core.Tests/AppDomainUnloadTest.cs @@ -72,10 +72,6 @@ namespace Grpc.Core.Tests public AppDomainTestClass() { var helper = new MockServiceHelper(Host); - var server = helper.GetServer(); - server.Start(); - var channel = helper.GetChannel(); - var readyToShutdown = new TaskCompletionSource(); helper.DuplexStreamingHandler = new DuplexStreamingServerMethod(async (requestStream, responseStream, context) => { @@ -83,6 +79,10 @@ namespace Grpc.Core.Tests await requestStream.ToListAsync(); }); + var server = helper.GetServer(); + server.Start(); + var channel = helper.GetChannel(); + var call = Calls.AsyncDuplexStreamingCall(helper.CreateDuplexStreamingCall()); readyToShutdown.Task.Wait(); // make sure handler is running } diff --git a/src/csharp/Grpc.Core.Tests/UserAgentStringTest.cs b/src/csharp/Grpc.Core.Tests/UserAgentStringTest.cs index cc830086a67..74b4997f69e 100644 --- a/src/csharp/Grpc.Core.Tests/UserAgentStringTest.cs +++ b/src/csharp/Grpc.Core.Tests/UserAgentStringTest.cs @@ -63,10 +63,6 @@ namespace Grpc.Core.Tests public void DefaultUserAgentString() { helper = new MockServiceHelper(Host); - server = helper.GetServer(); - server.Start(); - channel = helper.GetChannel(); - helper.UnaryHandler = new UnaryServerMethod((request, context) => { var userAgentString = context.RequestHeaders.First(m => (m.Key == "user-agent")).Value; @@ -75,6 +71,11 @@ namespace Grpc.Core.Tests Assert.IsTrue(parts[1].StartsWith("grpc-c/")); return Task.FromResult("PASS"); }); + + server = helper.GetServer(); + server.Start(); + channel = helper.GetChannel(); + Assert.AreEqual("PASS", Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "")); } @@ -83,11 +84,6 @@ namespace Grpc.Core.Tests { helper = new MockServiceHelper(Host, channelOptions: new[] { new ChannelOption(ChannelOptions.PrimaryUserAgentString, "XYZ") }); - server = helper.GetServer(); - server.Start(); - channel = helper.GetChannel(); - - channel = helper.GetChannel(); helper.UnaryHandler = new UnaryServerMethod((request, context) => { var userAgentString = context.RequestHeaders.First(m => (m.Key == "user-agent")).Value; @@ -95,6 +91,11 @@ namespace Grpc.Core.Tests Assert.AreEqual("XYZ", parts[0]); return Task.FromResult("PASS"); }); + + server = helper.GetServer(); + server.Start(); + channel = helper.GetChannel(); + Assert.AreEqual("PASS", Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "")); } } From 6bc701659c63f45a3b90a958b7b7174caed390c1 Mon Sep 17 00:00:00 2001 From: yang-g Date: Mon, 17 Apr 2017 14:51:32 -0700 Subject: [PATCH 427/461] Remove status_helper as it is not needed any more --- BUILD | 1 - CMakeLists.txt | 4 -- Makefile | 4 -- build.yaml | 1 - include/grpc++/impl/codegen/call.h | 3 +- include/grpc++/impl/codegen/status_helper.h | 47 ------------------- tools/doxygen/Doxyfile.c++ | 1 - tools/doxygen/Doxyfile.c++.internal | 1 - .../generated/sources_and_headers.json | 2 - vsprojects/vcxproj/grpc++/grpc++.vcxproj | 1 - .../vcxproj/grpc++/grpc++.vcxproj.filters | 3 -- .../grpc++_test_util/grpc++_test_util.vcxproj | 1 - .../grpc++_test_util.vcxproj.filters | 3 -- .../grpc++_unsecure/grpc++_unsecure.vcxproj | 1 - .../grpc++_unsecure.vcxproj.filters | 3 -- .../codegen_test_full.vcxproj | 1 - .../codegen_test_full.vcxproj.filters | 3 -- .../codegen_test_minimal.vcxproj | 1 - .../codegen_test_minimal.vcxproj.filters | 3 -- .../grpc_tool_test/grpc_tool_test.vcxproj | 1 - .../grpc_tool_test.vcxproj.filters | 3 -- .../proto_utils_test/proto_utils_test.vcxproj | 1 - .../proto_utils_test.vcxproj.filters | 3 -- 23 files changed, 1 insertion(+), 91 deletions(-) delete mode 100644 include/grpc++/impl/codegen/status_helper.h diff --git a/BUILD b/BUILD index 542c43f6321..70bd4062a49 100644 --- a/BUILD +++ b/BUILD @@ -1362,7 +1362,6 @@ grpc_cc_library( "include/grpc++/impl/codegen/slice.h", "include/grpc++/impl/codegen/status.h", "include/grpc++/impl/codegen/status_code_enum.h", - "include/grpc++/impl/codegen/status_helper.h", "include/grpc++/impl/codegen/string_ref.h", "include/grpc++/impl/codegen/stub_options.h", "include/grpc++/impl/codegen/sync_stream.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index a6a2af65d5d..340806d8efa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2456,7 +2456,6 @@ foreach(_hdr include/grpc++/impl/codegen/slice.h include/grpc++/impl/codegen/status.h include/grpc++/impl/codegen/status_code_enum.h - include/grpc++/impl/codegen/status_helper.h include/grpc++/impl/codegen/string_ref.h include/grpc++/impl/codegen/stub_options.h include/grpc++/impl/codegen/sync_stream.h @@ -2849,7 +2848,6 @@ foreach(_hdr include/grpc++/impl/codegen/slice.h include/grpc++/impl/codegen/status.h include/grpc++/impl/codegen/status_code_enum.h - include/grpc++/impl/codegen/status_helper.h include/grpc++/impl/codegen/string_ref.h include/grpc++/impl/codegen/stub_options.h include/grpc++/impl/codegen/sync_stream.h @@ -3239,7 +3237,6 @@ foreach(_hdr include/grpc++/impl/codegen/slice.h include/grpc++/impl/codegen/status.h include/grpc++/impl/codegen/status_code_enum.h - include/grpc++/impl/codegen/status_helper.h include/grpc++/impl/codegen/string_ref.h include/grpc++/impl/codegen/stub_options.h include/grpc++/impl/codegen/sync_stream.h @@ -3547,7 +3544,6 @@ foreach(_hdr include/grpc++/impl/codegen/slice.h include/grpc++/impl/codegen/status.h include/grpc++/impl/codegen/status_code_enum.h - include/grpc++/impl/codegen/status_helper.h include/grpc++/impl/codegen/string_ref.h include/grpc++/impl/codegen/stub_options.h include/grpc++/impl/codegen/sync_stream.h diff --git a/Makefile b/Makefile index 8898939af9e..1e9a6647445 100644 --- a/Makefile +++ b/Makefile @@ -4310,7 +4310,6 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/impl/codegen/slice.h \ include/grpc++/impl/codegen/status.h \ include/grpc++/impl/codegen/status_code_enum.h \ - include/grpc++/impl/codegen/status_helper.h \ include/grpc++/impl/codegen/string_ref.h \ include/grpc++/impl/codegen/stub_options.h \ include/grpc++/impl/codegen/sync_stream.h \ @@ -4711,7 +4710,6 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/impl/codegen/slice.h \ include/grpc++/impl/codegen/status.h \ include/grpc++/impl/codegen/status_code_enum.h \ - include/grpc++/impl/codegen/status_helper.h \ include/grpc++/impl/codegen/string_ref.h \ include/grpc++/impl/codegen/stub_options.h \ include/grpc++/impl/codegen/sync_stream.h \ @@ -5094,7 +5092,6 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/impl/codegen/slice.h \ include/grpc++/impl/codegen/status.h \ include/grpc++/impl/codegen/status_code_enum.h \ - include/grpc++/impl/codegen/status_helper.h \ include/grpc++/impl/codegen/string_ref.h \ include/grpc++/impl/codegen/stub_options.h \ include/grpc++/impl/codegen/sync_stream.h \ @@ -5407,7 +5404,6 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/impl/codegen/slice.h \ include/grpc++/impl/codegen/status.h \ include/grpc++/impl/codegen/status_code_enum.h \ - include/grpc++/impl/codegen/status_helper.h \ include/grpc++/impl/codegen/string_ref.h \ include/grpc++/impl/codegen/stub_options.h \ include/grpc++/impl/codegen/sync_stream.h \ diff --git a/build.yaml b/build.yaml index f4461e40ef1..f23de87d11c 100644 --- a/build.yaml +++ b/build.yaml @@ -939,7 +939,6 @@ filegroups: - include/grpc++/impl/codegen/slice.h - include/grpc++/impl/codegen/status.h - include/grpc++/impl/codegen/status_code_enum.h - - include/grpc++/impl/codegen/status_helper.h - include/grpc++/impl/codegen/string_ref.h - include/grpc++/impl/codegen/stub_options.h - include/grpc++/impl/codegen/sync_stream.h diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h index dd63c21ff17..e245eed0040 100644 --- a/include/grpc++/impl/codegen/call.h +++ b/include/grpc++/impl/codegen/call.h @@ -47,7 +47,6 @@ #include #include #include -#include #include #include @@ -468,7 +467,7 @@ class CallOpServerSendStatus { trailing_metadata_ = FillMetadataArray( trailing_metadata, &trailing_metadata_count_, send_error_details_); send_status_available_ = true; - send_status_code_ = static_cast(GetCanonicalCode(status)); + send_status_code_ = static_cast(status.error_code()); send_error_message_ = status.error_message(); } diff --git a/include/grpc++/impl/codegen/status_helper.h b/include/grpc++/impl/codegen/status_helper.h deleted file mode 100644 index bfe45d9e5b1..00000000000 --- a/include/grpc++/impl/codegen/status_helper.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * - * Copyright 2016, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPCXX_IMPL_CODEGEN_STATUS_HELPER_H -#define GRPCXX_IMPL_CODEGEN_STATUS_HELPER_H - -#include - -namespace grpc { - -inline StatusCode GetCanonicalCode(const Status& status) { - return status.error_code(); -} - -} // namespace grpc - -#endif // GRPCXX_IMPL_CODEGEN_STATUS_HELPER_H diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 1864dd9e908..1d2aa959557 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -835,7 +835,6 @@ include/grpc++/impl/codegen/service_type.h \ include/grpc++/impl/codegen/slice.h \ include/grpc++/impl/codegen/status.h \ include/grpc++/impl/codegen/status_code_enum.h \ -include/grpc++/impl/codegen/status_helper.h \ include/grpc++/impl/codegen/string_ref.h \ include/grpc++/impl/codegen/stub_options.h \ include/grpc++/impl/codegen/sync_stream.h \ diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index ca3514bc61e..88a9736d5b5 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -836,7 +836,6 @@ include/grpc++/impl/codegen/service_type.h \ include/grpc++/impl/codegen/slice.h \ include/grpc++/impl/codegen/status.h \ include/grpc++/impl/codegen/status_code_enum.h \ -include/grpc++/impl/codegen/status_helper.h \ include/grpc++/impl/codegen/string_ref.h \ include/grpc++/impl/codegen/stub_options.h \ include/grpc++/impl/codegen/sync_stream.h \ diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index aa4869e1c8a..c8011fdb89b 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -8910,7 +8910,6 @@ "include/grpc++/impl/codegen/slice.h", "include/grpc++/impl/codegen/status.h", "include/grpc++/impl/codegen/status_code_enum.h", - "include/grpc++/impl/codegen/status_helper.h", "include/grpc++/impl/codegen/string_ref.h", "include/grpc++/impl/codegen/stub_options.h", "include/grpc++/impl/codegen/sync_stream.h", @@ -8945,7 +8944,6 @@ "include/grpc++/impl/codegen/slice.h", "include/grpc++/impl/codegen/status.h", "include/grpc++/impl/codegen/status_code_enum.h", - "include/grpc++/impl/codegen/status_helper.h", "include/grpc++/impl/codegen/string_ref.h", "include/grpc++/impl/codegen/stub_options.h", "include/grpc++/impl/codegen/sync_stream.h", diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj b/vsprojects/vcxproj/grpc++/grpc++.vcxproj index d62b5541ce0..424af0d9e72 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj @@ -328,7 +328,6 @@ - diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters index ef3862daa8d..a2f74655d0f 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters @@ -708,9 +708,6 @@ include\grpc++\impl\codegen - - include\grpc++\impl\codegen - include\grpc++\impl\codegen diff --git a/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj b/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj index c060f98b34a..165ebe64f59 100644 --- a/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj +++ b/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj @@ -172,7 +172,6 @@ - diff --git a/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj.filters b/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj.filters index 0623e421b21..d9aa1e3cc92 100644 --- a/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_test_util/grpc++_test_util.vcxproj.filters @@ -111,9 +111,6 @@ include\grpc++\impl\codegen - - include\grpc++\impl\codegen - include\grpc++\impl\codegen diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj index 67276887691..3f8a2f27572 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -328,7 +328,6 @@ - diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index d39756b269d..929501a56ce 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -693,9 +693,6 @@ include\grpc++\impl\codegen - - include\grpc++\impl\codegen - include\grpc++\impl\codegen diff --git a/vsprojects/vcxproj/test/codegen_test_full/codegen_test_full.vcxproj b/vsprojects/vcxproj/test/codegen_test_full/codegen_test_full.vcxproj index e3f081ba2ab..ccb0b521eff 100644 --- a/vsprojects/vcxproj/test/codegen_test_full/codegen_test_full.vcxproj +++ b/vsprojects/vcxproj/test/codegen_test_full/codegen_test_full.vcxproj @@ -185,7 +185,6 @@ - diff --git a/vsprojects/vcxproj/test/codegen_test_full/codegen_test_full.vcxproj.filters b/vsprojects/vcxproj/test/codegen_test_full/codegen_test_full.vcxproj.filters index 09e7c70e74a..18b331ccb1e 100644 --- a/vsprojects/vcxproj/test/codegen_test_full/codegen_test_full.vcxproj.filters +++ b/vsprojects/vcxproj/test/codegen_test_full/codegen_test_full.vcxproj.filters @@ -96,9 +96,6 @@ include\grpc++\impl\codegen - - include\grpc++\impl\codegen - include\grpc++\impl\codegen diff --git a/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj b/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj index 2cd226c6d80..857f6a3086a 100644 --- a/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj +++ b/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj @@ -185,7 +185,6 @@ - diff --git a/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj.filters b/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj.filters index 66afc8f2fc1..31680cdc413 100644 --- a/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj.filters +++ b/vsprojects/vcxproj/test/codegen_test_minimal/codegen_test_minimal.vcxproj.filters @@ -99,9 +99,6 @@ include\grpc++\impl\codegen - - include\grpc++\impl\codegen - include\grpc++\impl\codegen diff --git a/vsprojects/vcxproj/test/grpc_tool_test/grpc_tool_test.vcxproj b/vsprojects/vcxproj/test/grpc_tool_test/grpc_tool_test.vcxproj index d83a496e3b8..6133d7e2901 100644 --- a/vsprojects/vcxproj/test/grpc_tool_test/grpc_tool_test.vcxproj +++ b/vsprojects/vcxproj/test/grpc_tool_test/grpc_tool_test.vcxproj @@ -186,7 +186,6 @@ - diff --git a/vsprojects/vcxproj/test/grpc_tool_test/grpc_tool_test.vcxproj.filters b/vsprojects/vcxproj/test/grpc_tool_test/grpc_tool_test.vcxproj.filters index 64e3caf7406..08ea8e9dae4 100644 --- a/vsprojects/vcxproj/test/grpc_tool_test/grpc_tool_test.vcxproj.filters +++ b/vsprojects/vcxproj/test/grpc_tool_test/grpc_tool_test.vcxproj.filters @@ -90,9 +90,6 @@ include\grpc++\impl\codegen - - include\grpc++\impl\codegen - include\grpc++\impl\codegen diff --git a/vsprojects/vcxproj/test/proto_utils_test/proto_utils_test.vcxproj b/vsprojects/vcxproj/test/proto_utils_test/proto_utils_test.vcxproj index 13a5bb49100..397e7b6901f 100644 --- a/vsprojects/vcxproj/test/proto_utils_test/proto_utils_test.vcxproj +++ b/vsprojects/vcxproj/test/proto_utils_test/proto_utils_test.vcxproj @@ -185,7 +185,6 @@ - diff --git a/vsprojects/vcxproj/test/proto_utils_test/proto_utils_test.vcxproj.filters b/vsprojects/vcxproj/test/proto_utils_test/proto_utils_test.vcxproj.filters index 189a3367141..2f5a2a065f3 100644 --- a/vsprojects/vcxproj/test/proto_utils_test/proto_utils_test.vcxproj.filters +++ b/vsprojects/vcxproj/test/proto_utils_test/proto_utils_test.vcxproj.filters @@ -81,9 +81,6 @@ include\grpc++\impl\codegen - - include\grpc++\impl\codegen - include\grpc++\impl\codegen From d28078869a0b0890aa1532f5ff85f1127286abcd Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Tue, 18 Apr 2017 10:49:17 -0700 Subject: [PATCH 428/461] Revert umbrella header too --- src/objective-c/BoringSSL.podspec | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/objective-c/BoringSSL.podspec b/src/objective-c/BoringSSL.podspec index 7403f3288c6..651bd4977d8 100644 --- a/src/objective-c/BoringSSL.podspec +++ b/src/objective-c/BoringSSL.podspec @@ -149,6 +149,11 @@ Pod::Spec.new do |s| #include "ssl.h" #include "crypto.h" #include "aes.h" + /* The following macros are defined by base.h. The latter is the first file included by the + other headers. */ + #if defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64) + # include "arm_arch.h" + #endif #include "asn1.h" #include "asn1_mac.h" #include "asn1t.h" From 76c840036f2a1a57a6b7af194af3403a162ae391 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 18 Apr 2017 11:05:00 -0700 Subject: [PATCH 429/461] Node benchmarks: allow arbitrary message size, add CPU usage stats --- src/node/performance/benchmark_client.js | 16 ++++++++++++---- src/node/performance/benchmark_client_express.js | 10 ++++++---- src/node/performance/benchmark_server.js | 15 +++++++++++---- src/node/performance/benchmark_server_express.js | 8 +++++--- 4 files changed, 34 insertions(+), 15 deletions(-) diff --git a/src/node/performance/benchmark_client.js b/src/node/performance/benchmark_client.js index 5ef5260a96d..e7c426b2ff5 100644 --- a/src/node/performance/benchmark_client.js +++ b/src/node/performance/benchmark_client.js @@ -88,7 +88,10 @@ function timeDiffToNanos(time_diff) { */ function BenchmarkClient(server_targets, channels, histogram_params, security_params) { - var options = {}; + var options = { + "grpc.max_receive_message_length": -1, + "grpc.max_send_message_length": -1 + }; var creds; if (security_params) { var ca_path; @@ -180,6 +183,8 @@ BenchmarkClient.prototype.startClosedLoop = function( self.last_wall_time = process.hrtime(); + self.last_usage = process.cpuUsage(); + var makeCall; var argument; @@ -270,6 +275,8 @@ BenchmarkClient.prototype.startPoisson = function( self.last_wall_time = process.hrtime(); + self.last_usage = process.cpuUsage(); + var makeCall; var argument; @@ -354,9 +361,11 @@ BenchmarkClient.prototype.startPoisson = function( */ BenchmarkClient.prototype.mark = function(reset) { var wall_time_diff = process.hrtime(this.last_wall_time); + var usage_diff = process.cpuUsage(this.last_usage); var histogram = this.histogram; if (reset) { this.last_wall_time = process.hrtime(); + this.last_usage = process.cpuUsage(); this.histogram = new Histogram(histogram.resolution, histogram.max_possible); } @@ -371,9 +380,8 @@ BenchmarkClient.prototype.mark = function(reset) { count: histogram.getCount() }, time_elapsed: wall_time_diff[0] + wall_time_diff[1] / 1e9, - // Not sure how to measure these values - time_user: 0, - time_system: 0 + time_user: usage_diff.user / 1000000, + time_system: usage_diff.system / 1000000 }; }; diff --git a/src/node/performance/benchmark_client_express.js b/src/node/performance/benchmark_client_express.js index e749956599d..157bf1b6dec 100644 --- a/src/node/performance/benchmark_client_express.js +++ b/src/node/performance/benchmark_client_express.js @@ -95,7 +95,6 @@ function BenchmarkClient(server_targets, channels, histogram_params, var host_port; host_port = server_targets[i % server_targets.length].split(':'); var new_options = _.assign({hostname: host_port[0], port: +host_port[1]}, options); - new_options.agent = new protocol.Agent(new_options); this.client_options[i] = new_options; } @@ -137,6 +136,7 @@ BenchmarkClient.prototype.startClosedLoop = function( } self.last_wall_time = process.hrtime(); + self.last_usage = process.cpuUsage(); var argument = { response_size: resp_size, @@ -207,6 +207,7 @@ BenchmarkClient.prototype.startPoisson = function( } self.last_wall_time = process.hrtime(); + self.last_usage = process.cpuUsage(); var argument = { response_size: resp_size, @@ -264,9 +265,11 @@ BenchmarkClient.prototype.startPoisson = function( */ BenchmarkClient.prototype.mark = function(reset) { var wall_time_diff = process.hrtime(this.last_wall_time); + var usage_diff = process.cpuUsage(this.last_usage); var histogram = this.histogram; if (reset) { this.last_wall_time = process.hrtime(); + this.last_usage = process.cpuUsage(); this.histogram = new Histogram(histogram.resolution, histogram.max_possible); } @@ -281,9 +284,8 @@ BenchmarkClient.prototype.mark = function(reset) { count: histogram.getCount() }, time_elapsed: wall_time_diff[0] + wall_time_diff[1] / 1e9, - // Not sure how to measure these values - time_user: 0, - time_system: 0 + time_user: usage_diff.user / 1000000, + time_system: usage_diff.system / 1000000 }; }; diff --git a/src/node/performance/benchmark_server.js b/src/node/performance/benchmark_server.js index ea85029d980..a4d5ee1c26c 100644 --- a/src/node/performance/benchmark_server.js +++ b/src/node/performance/benchmark_server.js @@ -132,7 +132,12 @@ function BenchmarkServer(host, port, tls, generic, response_size) { server_creds = grpc.ServerCredentials.createInsecure(); } - var server = new grpc.Server(); + var options = { + "grpc.max_receive_message_length": -1, + "grpc.max_send_message_length": -1 + }; + + var server = new grpc.Server(options); this.port = server.bind(host + ':' + port, server_creds); if (generic) { server.addService(genericService, { @@ -156,6 +161,7 @@ util.inherits(BenchmarkServer, EventEmitter); BenchmarkServer.prototype.start = function() { this.server.start(); this.last_wall_time = process.hrtime(); + this.last_usage = process.cpuUsage(); this.emit('started'); }; @@ -175,14 +181,15 @@ BenchmarkServer.prototype.getPort = function() { */ BenchmarkServer.prototype.mark = function(reset) { var wall_time_diff = process.hrtime(this.last_wall_time); + var usage_diff = process.cpuUsage(this.last_usage); if (reset) { this.last_wall_time = process.hrtime(); + this.last_usage = process.cpuUsage(); } return { time_elapsed: wall_time_diff[0] + wall_time_diff[1] / 1e9, - // Not sure how to measure these values - time_user: 0, - time_system: 0 + time_user: usage_diff.user / 1000000, + time_system: usage_diff.system / 1000000 }; }; diff --git a/src/node/performance/benchmark_server_express.js b/src/node/performance/benchmark_server_express.js index 4b695eb467d..fab4f5307c1 100644 --- a/src/node/performance/benchmark_server_express.js +++ b/src/node/performance/benchmark_server_express.js @@ -81,6 +81,7 @@ BenchmarkServer.prototype.start = function() { var self = this; this.server.listen(this.input_port, this.input_hostname, function() { self.last_wall_time = process.hrtime(); + self.last_usage = process.cpuUsage(); self.emit('started'); }); }; @@ -91,14 +92,15 @@ BenchmarkServer.prototype.getPort = function() { BenchmarkServer.prototype.mark = function(reset) { var wall_time_diff = process.hrtime(this.last_wall_time); + var usage_diff = process.cpuUsage(this.last_usage); if (reset) { this.last_wall_time = process.hrtime(); + this.last_usage = process.cpuUsage(); } return { time_elapsed: wall_time_diff[0] + wall_time_diff[1] / 1e9, - // Not sure how to measure these values - time_user: 0, - time_system: 0 + time_user: usage_diff.user / 1000000, + time_system: usage_diff.system / 1000000 }; }; From bf33410411b888e5edbcad3fcfcf29208d166f68 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Tue, 18 Apr 2017 11:11:28 -0700 Subject: [PATCH 430/461] Add Node and Express benchmarks for various response sizes --- .../run_tests/performance/scenario_config.py | 41 ++++++++++++++++--- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/tools/run_tests/performance/scenario_config.py b/tools/run_tests/performance/scenario_config.py index 200da5e36db..ce0808829fd 100644 --- a/tools/run_tests/performance/scenario_config.py +++ b/tools/run_tests/performance/scenario_config.py @@ -513,7 +513,22 @@ class NodeLanguage: 'node_protobuf_unary_ping_pong_1MB', rpc_type='UNARY', client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER', req_size=1024*1024, resp_size=1024*1024, - categories=[SCALABLE, SMOKETEST]) + categories=[SCALABLE]) + + sizes = [('1B', 1), ('1KB', 1024), ('10KB', 10 * 1024), + ('1MB', 1024 * 1024), ('10MB', 10 * 1024 * 1024), + ('100MB', 100 * 1024 * 1024)] + + for size_name, size in sizes: + for secure in (True, False): + yield _ping_pong_scenario( + 'node_protobuf_unary_ping_pong_%s_resp_%s' % + (size_name, 'secure' if secure else 'insecure'), + rpc_type='UNARY', + client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER', + req_size=0, resp_size=size, + secure=secure, + categories=[SCALABLE]) # TODO(murgatroid99): fix bugs with this scenario and re-enable it # yield _ping_pong_scenario( @@ -528,11 +543,10 @@ class NodeLanguage: # client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER', # unconstrained_client='async') - # TODO(jtattermusch): make this scenario work - #yield _ping_pong_scenario( - # 'node_to_cpp_protobuf_async_unary_ping_pong', rpc_type='UNARY', - # client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER', - # server_language='c++', async_server_threads=1) + yield _ping_pong_scenario( + 'node_to_cpp_protobuf_async_unary_ping_pong', rpc_type='UNARY', + client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER', + server_language='c++', async_server_threads=1) # TODO(jtattermusch): make this scenario work #yield _ping_pong_scenario( @@ -829,6 +843,21 @@ class NodeExpressLanguage: unconstrained_client='async', categories=[SCALABLE, SMOKETEST]) + sizes = [('1B', 1), ('1KB', 1024), ('10KB', 10 * 1024), + ('1MB', 1024 * 1024), ('10MB', 10 * 1024 * 1024), + ('100MB', 100 * 1024 * 1024)] + + for size_name, size in sizes: + for secure in (True, False): + yield _ping_pong_scenario( + 'node_express_json_unary_ping_pong_%s_resp_%s' % + (size_name, 'secure' if secure else 'insecure'), + rpc_type='UNARY', + client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER', + req_size=0, resp_size=size, + secure=secure, + categories=[SCALABLE]) + def __str__(self): return 'node_express' From c602dde4426ae711992596940a932bd08e391ada Mon Sep 17 00:00:00 2001 From: Matt Kwong Date: Tue, 11 Apr 2017 17:29:12 -0700 Subject: [PATCH 431/461] Keep _grpcio_metadata.py in GitHub repo --- src/python/grpcio/.gitignore | 1 - src/python/grpcio/grpc/_grpcio_metadata.py | 32 +++++++++++++++++ .../grpcio/grpc/_grpcio_metadata.py.template | 34 +++++++++++++++++++ 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 src/python/grpcio/grpc/_grpcio_metadata.py create mode 100644 templates/src/python/grpcio/grpc/_grpcio_metadata.py.template diff --git a/src/python/grpcio/.gitignore b/src/python/grpcio/.gitignore index 3309795948c..d0ee1e10fdd 100644 --- a/src/python/grpcio/.gitignore +++ b/src/python/grpcio/.gitignore @@ -11,7 +11,6 @@ dist/ .cache/ nosetests.xml doc/ -_grpcio_metadata.py htmlcov/ grpc/_cython/_credentials poison.c diff --git a/src/python/grpcio/grpc/_grpcio_metadata.py b/src/python/grpcio/grpc/_grpcio_metadata.py new file mode 100644 index 00000000000..a0cb0dd067f --- /dev/null +++ b/src/python/grpcio/grpc/_grpcio_metadata.py @@ -0,0 +1,32 @@ +# Copyright 2017, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!! + +__version__ = """1.4.0.dev0""" diff --git a/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template b/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template new file mode 100644 index 00000000000..3d325b4d3d8 --- /dev/null +++ b/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template @@ -0,0 +1,34 @@ +%YAML 1.2 +--- | + # Copyright 2017, Google Inc. + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions are + # met: + # + # * Redistributions of source code must retain the above copyright + # notice, this list of conditions and the following disclaimer. + # * Redistributions in binary form must reproduce the above + # copyright notice, this list of conditions and the following disclaimer + # in the documentation and/or other materials provided with the + # distribution. + # * Neither the name of Google Inc. nor the names of its + # contributors may be used to endorse or promote products derived from + # this software without specific prior written permission. + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!! + + __version__ = """${settings.python_version.pep440()}""" From 68f6a6732771e0265bb656d189de4b76d8268033 Mon Sep 17 00:00:00 2001 From: Mehrdad Afshari Date: Wed, 12 Apr 2017 14:19:49 -0700 Subject: [PATCH 432/461] Always generate body for python code elements Since #... class Service: class NextService: #... without a body or `pass` under `Service` is invalid Python, we ensure a `pass` statement is always emitted to make the generated code valid. --- src/compiler/python_generator.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc index 2649c1688d4..50ee54abffe 100644 --- a/src/compiler/python_generator.cc +++ b/src/compiler/python_generator.cc @@ -101,6 +101,14 @@ PrivateGenerator::PrivateGenerator(const GeneratorConfiguration& config, void PrivateGenerator::PrintAllComments(StringVector comments, grpc_generator::Printer* out) { if (comments.empty()) { + // Python requires code structures like class and def to have + // a body, even if it is just "pass" or a docstring. We need + // to ensure not to generate empty bodies. We could do something + // smarter and more sophisticated, but at the moment, if there is + // no docstring to print, we simply emit "pass" to ensure validity + // of the generated code. + out->Print("# missing associated documentation comment in .proto file\n"); + out->Print("pass\n"); return; } out->Print("\"\"\""); From 9354720625ee2193e3ea22546e13756204365cdd Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 18 Apr 2017 19:42:27 +0000 Subject: [PATCH 433/461] Fix infinite streams in qps_test --- test/cpp/qps/client_sync.cc | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index a020adde511..da17f6bf7bb 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -153,16 +153,22 @@ class SynchronousStreamingClient final : public SynchronousClient { StartThreads(num_threads_); } ~SynchronousStreamingClient() { + std::vector cleanup_threads; for (size_t i = 0; i < num_threads_; i++) { - auto stream = &stream_[i]; - if (*stream) { - (*stream)->WritesDone(); - Status s = (*stream)->Finish(); - if (!s.ok()) { - gpr_log(GPR_ERROR, "Stream %" PRIuPTR " received an error %s", i, - s.error_message().c_str()); + cleanup_threads.emplace_back([this, i]() { + auto stream = &stream_[i]; + if (*stream) { + (*stream)->WritesDone(); + Status s = (*stream)->Finish(); + if (!s.ok()) { + gpr_log(GPR_ERROR, "Stream %" PRIuPTR " received an error %s", i, + s.error_message().c_str()); + } } - } + }); + } + for (size_t i=0; i Date: Tue, 18 Apr 2017 19:43:14 +0000 Subject: [PATCH 434/461] Initial thread manager fixes --- include/grpc++/server_builder.h | 4 +- src/cpp/server/server_cc.cc | 13 ++---- src/cpp/thread_manager/thread_manager.cc | 57 +++++++++++++++--------- src/cpp/thread_manager/thread_manager.h | 4 +- 4 files changed, 43 insertions(+), 35 deletions(-) diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h index d707100a522..e15a5acbe1c 100644 --- a/include/grpc++/server_builder.h +++ b/include/grpc++/server_builder.h @@ -197,8 +197,8 @@ class ServerBuilder { SyncServerSettings() : num_cqs(1), min_pollers(1), - max_pollers(INT_MAX), - cq_timeout_msec(1000) {} + max_pollers(2), + cq_timeout_msec(10000) {} // Number of server completion queues to create to listen to incoming RPCs. int num_cqs; diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index 62ded0d239f..6fea908b66b 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -328,15 +328,9 @@ class Server::SyncRequestThreadManager : public ThreadManager { } } - void ShutdownAndDrainCompletionQueue() { + void Shutdown() override { server_cq_->Shutdown(); - - // Drain any pending items from the queue - void* tag; - bool ok; - while (server_cq_->Next(&tag, &ok)) { - // Nothing to be done here - } +ThreadManager::Shutdown(); } void Start() { @@ -415,7 +409,7 @@ Server::~Server() { } else if (!started_) { // Shutdown the completion queues for (auto it = sync_req_mgrs_.begin(); it != sync_req_mgrs_.end(); it++) { - (*it)->ShutdownAndDrainCompletionQueue(); + (*it)->Shutdown(); } } } @@ -579,7 +573,6 @@ void Server::ShutdownInternal(gpr_timespec deadline) { // Wait for threads in all ThreadManagers to terminate for (auto it = sync_req_mgrs_.begin(); it != sync_req_mgrs_.end(); it++) { (*it)->Wait(); - (*it)->ShutdownAndDrainCompletionQueue(); } // Drain the shutdown queue (if the previous call to AsyncNext() timed out diff --git a/src/cpp/thread_manager/thread_manager.cc b/src/cpp/thread_manager/thread_manager.cc index 1450d009e4f..b6d57545113 100644 --- a/src/cpp/thread_manager/thread_manager.cc +++ b/src/cpp/thread_manager/thread_manager.cc @@ -98,11 +98,12 @@ void ThreadManager::MarkAsCompleted(WorkerThread* thd) { } void ThreadManager::CleanupCompletedThreads() { - std::unique_lock lock(list_mu_); - for (auto thd = completed_threads_.begin(); thd != completed_threads_.end(); - thd = completed_threads_.erase(thd)) { - delete *thd; + std::list completed_threads; + { + std::unique_lock lock(list_mu_); + completed_threads.swap(completed_threads_); } + for (auto thd : completed_threads) delete thd; } void ThreadManager::Initialize() { @@ -114,9 +115,10 @@ void ThreadManager::Initialize() { // If the number of pollers (i.e threads currently blocked in PollForWork()) is // less than max threshold (i.e max_pollers_) and the total number of threads is // below the maximum threshold, we can let the current thread continue as poller -bool ThreadManager::MaybeContinueAsPoller() { +bool ThreadManager::MaybeContinueAsPoller(bool work_found) { std::unique_lock lock(mu_); - if (shutdown_ || num_pollers_ > max_pollers_) { + gpr_log(GPR_DEBUG, "s=%d wf=%d np=%d mp=%d", shutdown_, work_found, num_pollers_, max_pollers_); + if (shutdown_ || (!work_found && num_pollers_ > max_pollers_)) { return false; } @@ -133,6 +135,8 @@ void ThreadManager::MaybeCreatePoller() { num_pollers_++; num_threads_++; + lock.unlock(); + // Create a new thread (which ends up calling the MainWorkLoop() function new WorkerThread(this); } @@ -153,25 +157,36 @@ void ThreadManager::MainWorkLoop() { 4. Do the actual work (DoWork()) 5. After doing the work, see it this thread can resume polling work (i.e see MaybeContinueAsPoller() for more details) */ - do { - WorkStatus work_status = PollForWork(&tag, &ok); + WorkStatus work_status; + while (true) { + bool done = false; + work_status = PollForWork(&tag, &ok); - { - std::unique_lock lock(mu_); - num_pollers_--; - - if (work_status == TIMEOUT && num_pollers_ > min_pollers_) { - break; + std::unique_lock lock(mu_); + num_pollers_--; + gpr_log(GPR_DEBUG, "%p: work_status:%d num_pollers:%d min_pollers:%d max_pollers:%d num_threads:%d shutdown:%d", this, work_status, num_pollers_, min_pollers_, max_pollers_, num_threads_, shutdown_); + switch (work_status) { + case TIMEOUT: + if (shutdown_ || num_pollers_ >= max_pollers_) done = true; + break; + case SHUTDOWN: done = true; break; + case WORK_FOUND: + if (!shutdown_ && num_pollers_ < min_pollers_) { + num_pollers_++; + num_threads_++; + lock.unlock(); + new WorkerThread(this); + } else { + lock.unlock(); } - } - - // Note that MaybeCreatePoller does check for shutdown and creates a new - // thread only if ThreadManager is not shutdown - if (work_status == WORK_FOUND) { - MaybeCreatePoller(); DoWork(tag, ok); + lock.lock(); + if (shutdown_) done = true; + break; } - } while (MaybeContinueAsPoller()); +if (done) break; + num_pollers_++; + }; CleanupCompletedThreads(); diff --git a/src/cpp/thread_manager/thread_manager.h b/src/cpp/thread_manager/thread_manager.h index 9c0569c62c1..7d832ad16a6 100644 --- a/src/cpp/thread_manager/thread_manager.h +++ b/src/cpp/thread_manager/thread_manager.h @@ -89,7 +89,7 @@ class ThreadManager { // Mark the ThreadManager as shutdown and begin draining the work. This is a // non-blocking call and the caller should call Wait(), a blocking call which // returns only once the shutdown is complete - void Shutdown(); + virtual void Shutdown(); // Has Shutdown() been called bool IsShutdown(); @@ -128,7 +128,7 @@ class ThreadManager { // Returns true if the current thread can resume as a poller. i.e if the // current number of pollers is less than the max_pollers. - bool MaybeContinueAsPoller(); + bool MaybeContinueAsPoller(bool work_found); void MarkAsCompleted(WorkerThread* thd); void CleanupCompletedThreads(); From a3e87894f2cc921d2c5bbdab250fa23a1ba8b52d Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 18 Apr 2017 13:08:08 -0700 Subject: [PATCH 435/461] Fix, restore draining --- src/cpp/server/server_cc.cc | 12 +++- src/cpp/thread_manager/thread_manager.cc | 88 ++++++++++-------------- src/cpp/thread_manager/thread_manager.h | 6 +- 3 files changed, 50 insertions(+), 56 deletions(-) diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index 6fea908b66b..423f347acd2 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -330,7 +330,17 @@ class Server::SyncRequestThreadManager : public ThreadManager { void Shutdown() override { server_cq_->Shutdown(); -ThreadManager::Shutdown(); + ThreadManager::Shutdown(); + } + + void Wait() override { + ThreadManager::Wait(); + // Drain any pending items from the queue + void* tag; + bool ok; + while (server_cq_->Next(&tag, &ok)) { + // Do nothing + } } void Start() { diff --git a/src/cpp/thread_manager/thread_manager.cc b/src/cpp/thread_manager/thread_manager.cc index b6d57545113..39b9691b5f5 100644 --- a/src/cpp/thread_manager/thread_manager.cc +++ b/src/cpp/thread_manager/thread_manager.cc @@ -100,6 +100,8 @@ void ThreadManager::MarkAsCompleted(WorkerThread* thd) { void ThreadManager::CleanupCompletedThreads() { std::list completed_threads; { + // swap out the completed threads list: allows other threads to clean up + // more quickly std::unique_lock lock(list_mu_); completed_threads.swap(completed_threads_); } @@ -112,20 +114,6 @@ void ThreadManager::Initialize() { } } -// If the number of pollers (i.e threads currently blocked in PollForWork()) is -// less than max threshold (i.e max_pollers_) and the total number of threads is -// below the maximum threshold, we can let the current thread continue as poller -bool ThreadManager::MaybeContinueAsPoller(bool work_found) { - std::unique_lock lock(mu_); - gpr_log(GPR_DEBUG, "s=%d wf=%d np=%d mp=%d", shutdown_, work_found, num_pollers_, max_pollers_); - if (shutdown_ || (!work_found && num_pollers_ > max_pollers_)) { - return false; - } - - num_pollers_++; - return true; -} - // Create a new poller if the current number of pollers i.e num_pollers_ (i.e // threads currently blocked in PollForWork()) is below the threshold (i.e // min_pollers_) and the total number of threads is below the maximum threshold @@ -143,48 +131,48 @@ void ThreadManager::MaybeCreatePoller() { } void ThreadManager::MainWorkLoop() { - void* tag; - bool ok; - - /* - 1. Poll for work (i.e PollForWork()) - 2. After returning from PollForWork, reduce the number of pollers by 1. If - PollForWork() returned a TIMEOUT, then it may indicate that we have more - polling threads than needed. Check if the number of pollers is greater - than min_pollers and if so, terminate the thread. - 3. Since we are short of one poller now, see if a new poller has to be - created (i.e see MaybeCreatePoller() for more details) - 4. Do the actual work (DoWork()) - 5. After doing the work, see it this thread can resume polling work (i.e - see MaybeContinueAsPoller() for more details) */ - WorkStatus work_status; while (true) { - bool done = false; - work_status = PollForWork(&tag, &ok); + void* tag; + bool ok; + WorkStatus work_status = PollForWork(&tag, &ok); std::unique_lock lock(mu_); + // Reduce the number of pollers by 1 and check what happened with the poll num_pollers_--; - gpr_log(GPR_DEBUG, "%p: work_status:%d num_pollers:%d min_pollers:%d max_pollers:%d num_threads:%d shutdown:%d", this, work_status, num_pollers_, min_pollers_, max_pollers_, num_threads_, shutdown_); + bool done = false; switch (work_status) { - case TIMEOUT: - if (shutdown_ || num_pollers_ >= max_pollers_) done = true; - break; - case SHUTDOWN: done = true; break; - case WORK_FOUND: - if (!shutdown_ && num_pollers_ < min_pollers_) { - num_pollers_++; - num_threads_++; - lock.unlock(); - new WorkerThread(this); - } else { - lock.unlock(); - } - DoWork(tag, ok); - lock.lock(); - if (shutdown_) done = true; - break; + case TIMEOUT: + // If we timed out and we have more pollers than we need (or we are + // shutdown), finish this thread + if (shutdown_ || num_pollers_ > max_pollers_) done = true; + break; + case SHUTDOWN: + // If the thread manager is shutdown, finish this thread + done = true; + break; + case WORK_FOUND: + // If we got work and there are now insufficient pollers, start a new + // one + if (!shutdown_ && num_pollers_ < min_pollers_) { + num_pollers_++; + num_threads_++; + lock.unlock(); + new WorkerThread(this); + } else { + lock.unlock(); + } + DoWork(tag, ok); + lock.lock(); + // If we're shutdown, we should finish at this point. + // If not, there's a chance that we'll exceed the max poller count: that + // is explicitly ok - we'll decrease after one poll timeout, and prevent + // some thrashing starting up and shutting down threads + if (shutdown_) done = true; + break; } -if (done) break; + // If we decided to finish the thread, break out of the while loop + if (done) break; + // ... otherwise increase poller count and continue num_pollers_++; }; diff --git a/src/cpp/thread_manager/thread_manager.h b/src/cpp/thread_manager/thread_manager.h index 7d832ad16a6..c9435011f95 100644 --- a/src/cpp/thread_manager/thread_manager.h +++ b/src/cpp/thread_manager/thread_manager.h @@ -96,7 +96,7 @@ class ThreadManager { // A blocking call that returns only after the ThreadManager has shutdown and // all the threads have drained all the outstanding work - void Wait(); + virtual void Wait(); private: // Helper wrapper class around std::thread. This takes a ThreadManager object @@ -126,10 +126,6 @@ class ThreadManager { // minimum number of pollers needed (i.e min_pollers). void MaybeCreatePoller(); - // Returns true if the current thread can resume as a poller. i.e if the - // current number of pollers is less than the max_pollers. - bool MaybeContinueAsPoller(bool work_found); - void MarkAsCompleted(WorkerThread* thd); void CleanupCompletedThreads(); From 4818150728ba9edf84231a726048763cf555a81a Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 18 Apr 2017 13:09:54 -0700 Subject: [PATCH 436/461] Better commentary --- src/cpp/thread_manager/thread_manager.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cpp/thread_manager/thread_manager.cc b/src/cpp/thread_manager/thread_manager.cc index 39b9691b5f5..73c59eeff00 100644 --- a/src/cpp/thread_manager/thread_manager.cc +++ b/src/cpp/thread_manager/thread_manager.cc @@ -156,12 +156,16 @@ void ThreadManager::MainWorkLoop() { if (!shutdown_ && num_pollers_ < min_pollers_) { num_pollers_++; num_threads_++; + // Drop lock before spawning thread to avoid contention lock.unlock(); new WorkerThread(this); } else { + // Drop lock for consistency with above branch lock.unlock(); } + // Lock is always released at this point - do the application work DoWork(tag, ok); + // Take the lock again to check post conditions lock.lock(); // If we're shutdown, we should finish at this point. // If not, there's a chance that we'll exceed the max poller count: that From 35f27cd457207e6d51304a40d736dca53285e79f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 18 Apr 2017 13:14:45 -0700 Subject: [PATCH 437/461] More cleanup --- src/cpp/thread_manager/thread_manager.cc | 19 +++++-------------- src/cpp/thread_manager/thread_manager.h | 4 ---- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/cpp/thread_manager/thread_manager.cc b/src/cpp/thread_manager/thread_manager.cc index 73c59eeff00..ebcc4dd3787 100644 --- a/src/cpp/thread_manager/thread_manager.cc +++ b/src/cpp/thread_manager/thread_manager.cc @@ -109,22 +109,13 @@ void ThreadManager::CleanupCompletedThreads() { } void ThreadManager::Initialize() { - for (int i = 0; i < min_pollers_; i++) { - MaybeCreatePoller(); + { + std::unique_lock lock(mu_); + num_pollers_ = min_pollers_; + num_threads_ = min_pollers_; } -} - -// Create a new poller if the current number of pollers i.e num_pollers_ (i.e -// threads currently blocked in PollForWork()) is below the threshold (i.e -// min_pollers_) and the total number of threads is below the maximum threshold -void ThreadManager::MaybeCreatePoller() { - std::unique_lock lock(mu_); - if (!shutdown_ && num_pollers_ < min_pollers_) { - num_pollers_++; - num_threads_++; - - lock.unlock(); + for (int i = 0; i < min_pollers_; i++) { // Create a new thread (which ends up calling the MainWorkLoop() function new WorkerThread(this); } diff --git a/src/cpp/thread_manager/thread_manager.h b/src/cpp/thread_manager/thread_manager.h index c9435011f95..d1050f6dede 100644 --- a/src/cpp/thread_manager/thread_manager.h +++ b/src/cpp/thread_manager/thread_manager.h @@ -122,10 +122,6 @@ class ThreadManager { // The main funtion in ThreadManager void MainWorkLoop(); - // Create a new poller if the number of current pollers is less than the - // minimum number of pollers needed (i.e min_pollers). - void MaybeCreatePoller(); - void MarkAsCompleted(WorkerThread* thd); void CleanupCompletedThreads(); From 25e3c6da76a95bcd35fc675ad8a176060ebd59dc Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 18 Apr 2017 13:57:38 -0700 Subject: [PATCH 438/461] Fix EINTR forever --- tools/profiling/microbenchmarks/bm_diff.py | 91 ++++++++++++---------- 1 file changed, 49 insertions(+), 42 deletions(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index ba0c225f6cc..f1b6ef1ab94 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -192,52 +192,59 @@ class Benchmark: return [self.final[f] if f in self.final else '' for f in flds] -def read_file(filename): +def eintr_be_gone(fn): + """Run fn until it doesn't stop because of EINTR""" while True: try: - with open(filename) as f: - return f.read() + return fn() except IOError, e: if e.errno != errno.EINTR: raise + def read_json(filename): - return json.loads(read_file(filename)) - -benchmarks = collections.defaultdict(Benchmark) - -for bm in args.benchmarks: - for loop in range(0, args.loops): - js_new_ctr = read_json('%s.counters.new.%d.json' % (bm, loop)) - js_new_opt = read_json('%s.opt.new.%d.json' % (bm, loop)) - js_old_ctr = read_json('%s.counters.old.%d.json' % (bm, loop)) - js_old_opt = read_json('%s.opt.old.%d.json' % (bm, loop)) - - for row in bm_json.expand_json(js_new_ctr, js_new_opt): - print row - name = row['cpp_name'] - if name.endswith('_mean') or name.endswith('_stddev'): continue - benchmarks[name].add_sample(row, True) - for row in bm_json.expand_json(js_old_ctr, js_old_opt): - print row - name = row['cpp_name'] - if name.endswith('_mean') or name.endswith('_stddev'): continue - benchmarks[name].add_sample(row, False) - -really_interesting = set() -for name, bm in benchmarks.items(): - print name - really_interesting.update(bm.process()) -fields = [f for f in args.track if f in really_interesting] - -headers = ['Benchmark'] + fields -rows = [] -for name in sorted(benchmarks.keys()): - if benchmarks[name].skip(): continue - rows.append([name] + benchmarks[name].row(fields)) -if rows: - text = 'Performance differences noted:\n' + tabulate.tabulate(rows, headers=headers, floatfmt='+.2f') -else: - text = 'No significant performance differences' -comment_on_pr.comment_on_pr('```\n%s\n```' % text) -print text + with open(filename) as f: return json.loads(f.read()) + + +def finalize(): + benchmarks = collections.defaultdict(Benchmark) + + for bm in args.benchmarks: + for loop in range(0, args.loops): + js_new_ctr = read_json('%s.counters.new.%d.json' % (bm, loop)) + js_new_opt = read_json('%s.opt.new.%d.json' % (bm, loop)) + js_old_ctr = read_json('%s.counters.old.%d.json' % (bm, loop)) + js_old_opt = read_json('%s.opt.old.%d.json' % (bm, loop)) + + for row in bm_json.expand_json(js_new_ctr, js_new_opt): + print row + name = row['cpp_name'] + if name.endswith('_mean') or name.endswith('_stddev'): continue + benchmarks[name].add_sample(row, True) + for row in bm_json.expand_json(js_old_ctr, js_old_opt): + print row + name = row['cpp_name'] + if name.endswith('_mean') or name.endswith('_stddev'): continue + benchmarks[name].add_sample(row, False) + + really_interesting = set() + for name, bm in benchmarks.items(): + print name + really_interesting.update(bm.process()) + fields = [f for f in args.track if f in really_interesting] + + headers = ['Benchmark'] + fields + rows = [] + for name in sorted(benchmarks.keys()): + if benchmarks[name].skip(): continue + rows.append([name] + benchmarks[name].row(fields)) + if rows: + text = 'Performance differences noted:\n' + tabulate.tabulate(rows, headers=headers, floatfmt='+.2f') + else: + text = 'No significant performance differences' + comment_on_pr.comment_on_pr('```\n%s\n```' % text) + print text + + +eintr_be_gone(finalize) + From b702ce2117d2f44e0760b73ede23b65a17f4ef2a Mon Sep 17 00:00:00 2001 From: Ken Payson Date: Thu, 13 Apr 2017 19:09:00 -0700 Subject: [PATCH 439/461] Fix PHP interop tests --- third_party/protobuf | 2 +- tools/distrib/python/grpcio_tools/protoc_lib_deps.py | 2 +- tools/run_tests/run_tests_matrix.py | 11 +---------- tools/run_tests/sanity/check_submodules.sh | 2 +- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/third_party/protobuf b/third_party/protobuf index 4a0dd03e52e..593e917c176 160000 --- a/third_party/protobuf +++ b/third_party/protobuf @@ -1 +1 @@ -Subproject commit 4a0dd03e52e09332c8fd0f8f26a8e0ae9f911182 +Subproject commit 593e917c176b5bc5aafa57bf9f6030d749d91cd5 diff --git a/tools/distrib/python/grpcio_tools/protoc_lib_deps.py b/tools/distrib/python/grpcio_tools/protoc_lib_deps.py index 7e8cd987d5d..c2aa6198b3d 100644 --- a/tools/distrib/python/grpcio_tools/protoc_lib_deps.py +++ b/tools/distrib/python/grpcio_tools/protoc_lib_deps.py @@ -29,7 +29,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # AUTO-GENERATED BY make_grpcio_tools.py! -CC_FILES=['google/protobuf/compiler/zip_writer.cc', 'google/protobuf/compiler/subprocess.cc', 'google/protobuf/compiler/ruby/ruby_generator.cc', 'google/protobuf/compiler/python/python_generator.cc', 'google/protobuf/compiler/plugin.pb.cc', 'google/protobuf/compiler/plugin.cc', 'google/protobuf/compiler/php/php_generator.cc', 'google/protobuf/compiler/objectivec/objectivec_primitive_field.cc', 'google/protobuf/compiler/objectivec/objectivec_oneof.cc', 'google/protobuf/compiler/objectivec/objectivec_message_field.cc', 'google/protobuf/compiler/objectivec/objectivec_message.cc', 'google/protobuf/compiler/objectivec/objectivec_map_field.cc', 'google/protobuf/compiler/objectivec/objectivec_helpers.cc', 'google/protobuf/compiler/objectivec/objectivec_generator.cc', 'google/protobuf/compiler/objectivec/objectivec_file.cc', 'google/protobuf/compiler/objectivec/objectivec_field.cc', 'google/protobuf/compiler/objectivec/objectivec_extension.cc', 'google/protobuf/compiler/objectivec/objectivec_enum_field.cc', 'google/protobuf/compiler/objectivec/objectivec_enum.cc', 'google/protobuf/compiler/js/well_known_types_embed.cc', 'google/protobuf/compiler/js/js_generator.cc', 'google/protobuf/compiler/javanano/javanano_primitive_field.cc', 'google/protobuf/compiler/javanano/javanano_message_field.cc', 'google/protobuf/compiler/javanano/javanano_message.cc', 'google/protobuf/compiler/javanano/javanano_map_field.cc', 'google/protobuf/compiler/javanano/javanano_helpers.cc', 'google/protobuf/compiler/javanano/javanano_generator.cc', 'google/protobuf/compiler/javanano/javanano_file.cc', 'google/protobuf/compiler/javanano/javanano_field.cc', 'google/protobuf/compiler/javanano/javanano_extension.cc', 'google/protobuf/compiler/javanano/javanano_enum_field.cc', 'google/protobuf/compiler/javanano/javanano_enum.cc', 'google/protobuf/compiler/java/java_string_field_lite.cc', 'google/protobuf/compiler/java/java_string_field.cc', 'google/protobuf/compiler/java/java_shared_code_generator.cc', 'google/protobuf/compiler/java/java_service.cc', 'google/protobuf/compiler/java/java_primitive_field_lite.cc', 'google/protobuf/compiler/java/java_primitive_field.cc', 'google/protobuf/compiler/java/java_name_resolver.cc', 'google/protobuf/compiler/java/java_message_lite.cc', 'google/protobuf/compiler/java/java_message_field_lite.cc', 'google/protobuf/compiler/java/java_message_field.cc', 'google/protobuf/compiler/java/java_message_builder_lite.cc', 'google/protobuf/compiler/java/java_message_builder.cc', 'google/protobuf/compiler/java/java_message.cc', 'google/protobuf/compiler/java/java_map_field_lite.cc', 'google/protobuf/compiler/java/java_map_field.cc', 'google/protobuf/compiler/java/java_lazy_message_field_lite.cc', 'google/protobuf/compiler/java/java_lazy_message_field.cc', 'google/protobuf/compiler/java/java_helpers.cc', 'google/protobuf/compiler/java/java_generator_factory.cc', 'google/protobuf/compiler/java/java_generator.cc', 'google/protobuf/compiler/java/java_file.cc', 'google/protobuf/compiler/java/java_field.cc', 'google/protobuf/compiler/java/java_extension_lite.cc', 'google/protobuf/compiler/java/java_extension.cc', 'google/protobuf/compiler/java/java_enum_lite.cc', 'google/protobuf/compiler/java/java_enum_field_lite.cc', 'google/protobuf/compiler/java/java_enum_field.cc', 'google/protobuf/compiler/java/java_enum.cc', 'google/protobuf/compiler/java/java_doc_comment.cc', 'google/protobuf/compiler/java/java_context.cc', 'google/protobuf/compiler/csharp/csharp_wrapper_field.cc', 'google/protobuf/compiler/csharp/csharp_source_generator_base.cc', 'google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc', 'google/protobuf/compiler/csharp/csharp_repeated_message_field.cc', 'google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc', 'google/protobuf/compiler/csharp/csharp_reflection_class.cc', 'google/protobuf/compiler/csharp/csharp_primitive_field.cc', 'google/protobuf/compiler/csharp/csharp_message_field.cc', 'google/protobuf/compiler/csharp/csharp_message.cc', 'google/protobuf/compiler/csharp/csharp_map_field.cc', 'google/protobuf/compiler/csharp/csharp_helpers.cc', 'google/protobuf/compiler/csharp/csharp_generator.cc', 'google/protobuf/compiler/csharp/csharp_field_base.cc', 'google/protobuf/compiler/csharp/csharp_enum_field.cc', 'google/protobuf/compiler/csharp/csharp_enum.cc', 'google/protobuf/compiler/csharp/csharp_doc_comment.cc', 'google/protobuf/compiler/cpp/cpp_string_field.cc', 'google/protobuf/compiler/cpp/cpp_service.cc', 'google/protobuf/compiler/cpp/cpp_primitive_field.cc', 'google/protobuf/compiler/cpp/cpp_message_field.cc', 'google/protobuf/compiler/cpp/cpp_message.cc', 'google/protobuf/compiler/cpp/cpp_map_field.cc', 'google/protobuf/compiler/cpp/cpp_helpers.cc', 'google/protobuf/compiler/cpp/cpp_generator.cc', 'google/protobuf/compiler/cpp/cpp_file.cc', 'google/protobuf/compiler/cpp/cpp_field.cc', 'google/protobuf/compiler/cpp/cpp_extension.cc', 'google/protobuf/compiler/cpp/cpp_enum_field.cc', 'google/protobuf/compiler/cpp/cpp_enum.cc', 'google/protobuf/compiler/command_line_interface.cc', 'google/protobuf/compiler/code_generator.cc', 'google/protobuf/wrappers.pb.cc', 'google/protobuf/wire_format.cc', 'google/protobuf/util/type_resolver_util.cc', 'google/protobuf/util/time_util.cc', 'google/protobuf/util/message_differencer.cc', 'google/protobuf/util/json_util.cc', 'google/protobuf/util/internal/utility.cc', 'google/protobuf/util/internal/type_info_test_helper.cc', 'google/protobuf/util/internal/type_info.cc', 'google/protobuf/util/internal/protostream_objectwriter.cc', 'google/protobuf/util/internal/protostream_objectsource.cc', 'google/protobuf/util/internal/proto_writer.cc', 'google/protobuf/util/internal/object_writer.cc', 'google/protobuf/util/internal/json_stream_parser.cc', 'google/protobuf/util/internal/json_objectwriter.cc', 'google/protobuf/util/internal/json_escaping.cc', 'google/protobuf/util/internal/field_mask_utility.cc', 'google/protobuf/util/internal/error_listener.cc', 'google/protobuf/util/internal/default_value_objectwriter.cc', 'google/protobuf/util/internal/datapiece.cc', 'google/protobuf/util/field_mask_util.cc', 'google/protobuf/util/field_comparator.cc', 'google/protobuf/util/delimited_message_util.cc', 'google/protobuf/unknown_field_set.cc', 'google/protobuf/type.pb.cc', 'google/protobuf/timestamp.pb.cc', 'google/protobuf/text_format.cc', 'google/protobuf/stubs/substitute.cc', 'google/protobuf/stubs/mathlimits.cc', 'google/protobuf/struct.pb.cc', 'google/protobuf/source_context.pb.cc', 'google/protobuf/service.cc', 'google/protobuf/reflection_ops.cc', 'google/protobuf/message.cc', 'google/protobuf/map_field.cc', 'google/protobuf/io/zero_copy_stream_impl.cc', 'google/protobuf/io/tokenizer.cc', 'google/protobuf/io/strtod.cc', 'google/protobuf/io/printer.cc', 'google/protobuf/io/gzip_stream.cc', 'google/protobuf/generated_message_reflection.cc', 'google/protobuf/field_mask.pb.cc', 'google/protobuf/extension_set_heavy.cc', 'google/protobuf/empty.pb.cc', 'google/protobuf/dynamic_message.cc', 'google/protobuf/duration.pb.cc', 'google/protobuf/descriptor_database.cc', 'google/protobuf/descriptor.pb.cc', 'google/protobuf/descriptor.cc', 'google/protobuf/compiler/parser.cc', 'google/protobuf/compiler/importer.cc', 'google/protobuf/api.pb.cc', 'google/protobuf/any.pb.cc', 'google/protobuf/any.cc', 'google/protobuf/wire_format_lite.cc', 'google/protobuf/stubs/time.cc', 'google/protobuf/stubs/strutil.cc', 'google/protobuf/stubs/structurally_valid.cc', 'google/protobuf/stubs/stringprintf.cc', 'google/protobuf/stubs/stringpiece.cc', 'google/protobuf/stubs/statusor.cc', 'google/protobuf/stubs/status.cc', 'google/protobuf/stubs/once.cc', 'google/protobuf/stubs/int128.cc', 'google/protobuf/stubs/common.cc', 'google/protobuf/stubs/bytestream.cc', 'google/protobuf/stubs/atomicops_internals_x86_msvc.cc', 'google/protobuf/stubs/atomicops_internals_x86_gcc.cc', 'google/protobuf/repeated_field.cc', 'google/protobuf/message_lite.cc', 'google/protobuf/io/zero_copy_stream_impl_lite.cc', 'google/protobuf/io/zero_copy_stream.cc', 'google/protobuf/io/coded_stream.cc', 'google/protobuf/generated_message_util.cc', 'google/protobuf/extension_set.cc', 'google/protobuf/arenastring.cc', 'google/protobuf/arena.cc', 'google/protobuf/compiler/js/embed.cc'] +CC_FILES=['google/protobuf/compiler/zip_writer.cc', 'google/protobuf/compiler/subprocess.cc', 'google/protobuf/compiler/ruby/ruby_generator.cc', 'google/protobuf/compiler/python/python_generator.cc', 'google/protobuf/compiler/plugin.pb.cc', 'google/protobuf/compiler/plugin.cc', 'google/protobuf/compiler/php/php_generator.cc', 'google/protobuf/compiler/objectivec/objectivec_primitive_field.cc', 'google/protobuf/compiler/objectivec/objectivec_oneof.cc', 'google/protobuf/compiler/objectivec/objectivec_message_field.cc', 'google/protobuf/compiler/objectivec/objectivec_message.cc', 'google/protobuf/compiler/objectivec/objectivec_map_field.cc', 'google/protobuf/compiler/objectivec/objectivec_helpers.cc', 'google/protobuf/compiler/objectivec/objectivec_generator.cc', 'google/protobuf/compiler/objectivec/objectivec_file.cc', 'google/protobuf/compiler/objectivec/objectivec_field.cc', 'google/protobuf/compiler/objectivec/objectivec_extension.cc', 'google/protobuf/compiler/objectivec/objectivec_enum_field.cc', 'google/protobuf/compiler/objectivec/objectivec_enum.cc', 'google/protobuf/compiler/js/well_known_types_embed.cc', 'google/protobuf/compiler/js/js_generator.cc', 'google/protobuf/compiler/javanano/javanano_primitive_field.cc', 'google/protobuf/compiler/javanano/javanano_message_field.cc', 'google/protobuf/compiler/javanano/javanano_message.cc', 'google/protobuf/compiler/javanano/javanano_map_field.cc', 'google/protobuf/compiler/javanano/javanano_helpers.cc', 'google/protobuf/compiler/javanano/javanano_generator.cc', 'google/protobuf/compiler/javanano/javanano_file.cc', 'google/protobuf/compiler/javanano/javanano_field.cc', 'google/protobuf/compiler/javanano/javanano_extension.cc', 'google/protobuf/compiler/javanano/javanano_enum_field.cc', 'google/protobuf/compiler/javanano/javanano_enum.cc', 'google/protobuf/compiler/java/java_string_field_lite.cc', 'google/protobuf/compiler/java/java_string_field.cc', 'google/protobuf/compiler/java/java_shared_code_generator.cc', 'google/protobuf/compiler/java/java_service.cc', 'google/protobuf/compiler/java/java_primitive_field_lite.cc', 'google/protobuf/compiler/java/java_primitive_field.cc', 'google/protobuf/compiler/java/java_name_resolver.cc', 'google/protobuf/compiler/java/java_message_lite.cc', 'google/protobuf/compiler/java/java_message_field_lite.cc', 'google/protobuf/compiler/java/java_message_field.cc', 'google/protobuf/compiler/java/java_message_builder_lite.cc', 'google/protobuf/compiler/java/java_message_builder.cc', 'google/protobuf/compiler/java/java_message.cc', 'google/protobuf/compiler/java/java_map_field_lite.cc', 'google/protobuf/compiler/java/java_map_field.cc', 'google/protobuf/compiler/java/java_lazy_message_field_lite.cc', 'google/protobuf/compiler/java/java_lazy_message_field.cc', 'google/protobuf/compiler/java/java_helpers.cc', 'google/protobuf/compiler/java/java_generator_factory.cc', 'google/protobuf/compiler/java/java_generator.cc', 'google/protobuf/compiler/java/java_file.cc', 'google/protobuf/compiler/java/java_field.cc', 'google/protobuf/compiler/java/java_extension_lite.cc', 'google/protobuf/compiler/java/java_extension.cc', 'google/protobuf/compiler/java/java_enum_lite.cc', 'google/protobuf/compiler/java/java_enum_field_lite.cc', 'google/protobuf/compiler/java/java_enum_field.cc', 'google/protobuf/compiler/java/java_enum.cc', 'google/protobuf/compiler/java/java_doc_comment.cc', 'google/protobuf/compiler/java/java_context.cc', 'google/protobuf/compiler/csharp/csharp_wrapper_field.cc', 'google/protobuf/compiler/csharp/csharp_source_generator_base.cc', 'google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc', 'google/protobuf/compiler/csharp/csharp_repeated_message_field.cc', 'google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc', 'google/protobuf/compiler/csharp/csharp_reflection_class.cc', 'google/protobuf/compiler/csharp/csharp_primitive_field.cc', 'google/protobuf/compiler/csharp/csharp_message_field.cc', 'google/protobuf/compiler/csharp/csharp_message.cc', 'google/protobuf/compiler/csharp/csharp_map_field.cc', 'google/protobuf/compiler/csharp/csharp_helpers.cc', 'google/protobuf/compiler/csharp/csharp_generator.cc', 'google/protobuf/compiler/csharp/csharp_field_base.cc', 'google/protobuf/compiler/csharp/csharp_enum_field.cc', 'google/protobuf/compiler/csharp/csharp_enum.cc', 'google/protobuf/compiler/csharp/csharp_doc_comment.cc', 'google/protobuf/compiler/cpp/cpp_string_field.cc', 'google/protobuf/compiler/cpp/cpp_service.cc', 'google/protobuf/compiler/cpp/cpp_primitive_field.cc', 'google/protobuf/compiler/cpp/cpp_message_field.cc', 'google/protobuf/compiler/cpp/cpp_message.cc', 'google/protobuf/compiler/cpp/cpp_map_field.cc', 'google/protobuf/compiler/cpp/cpp_helpers.cc', 'google/protobuf/compiler/cpp/cpp_generator.cc', 'google/protobuf/compiler/cpp/cpp_file.cc', 'google/protobuf/compiler/cpp/cpp_field.cc', 'google/protobuf/compiler/cpp/cpp_extension.cc', 'google/protobuf/compiler/cpp/cpp_enum_field.cc', 'google/protobuf/compiler/cpp/cpp_enum.cc', 'google/protobuf/compiler/command_line_interface.cc', 'google/protobuf/compiler/code_generator.cc', 'google/protobuf/wrappers.pb.cc', 'google/protobuf/wire_format.cc', 'google/protobuf/util/type_resolver_util.cc', 'google/protobuf/util/time_util.cc', 'google/protobuf/util/message_differencer.cc', 'google/protobuf/util/json_util.cc', 'google/protobuf/util/internal/utility.cc', 'google/protobuf/util/internal/type_info_test_helper.cc', 'google/protobuf/util/internal/type_info.cc', 'google/protobuf/util/internal/protostream_objectwriter.cc', 'google/protobuf/util/internal/protostream_objectsource.cc', 'google/protobuf/util/internal/proto_writer.cc', 'google/protobuf/util/internal/object_writer.cc', 'google/protobuf/util/internal/json_stream_parser.cc', 'google/protobuf/util/internal/json_objectwriter.cc', 'google/protobuf/util/internal/json_escaping.cc', 'google/protobuf/util/internal/field_mask_utility.cc', 'google/protobuf/util/internal/error_listener.cc', 'google/protobuf/util/internal/default_value_objectwriter.cc', 'google/protobuf/util/internal/datapiece.cc', 'google/protobuf/util/field_mask_util.cc', 'google/protobuf/util/field_comparator.cc', 'google/protobuf/unknown_field_set.cc', 'google/protobuf/type.pb.cc', 'google/protobuf/timestamp.pb.cc', 'google/protobuf/text_format.cc', 'google/protobuf/stubs/substitute.cc', 'google/protobuf/stubs/mathlimits.cc', 'google/protobuf/struct.pb.cc', 'google/protobuf/source_context.pb.cc', 'google/protobuf/service.cc', 'google/protobuf/reflection_ops.cc', 'google/protobuf/message.cc', 'google/protobuf/map_field.cc', 'google/protobuf/io/zero_copy_stream_impl.cc', 'google/protobuf/io/tokenizer.cc', 'google/protobuf/io/strtod.cc', 'google/protobuf/io/printer.cc', 'google/protobuf/io/gzip_stream.cc', 'google/protobuf/generated_message_reflection.cc', 'google/protobuf/field_mask.pb.cc', 'google/protobuf/extension_set_heavy.cc', 'google/protobuf/empty.pb.cc', 'google/protobuf/dynamic_message.cc', 'google/protobuf/duration.pb.cc', 'google/protobuf/descriptor_database.cc', 'google/protobuf/descriptor.pb.cc', 'google/protobuf/descriptor.cc', 'google/protobuf/compiler/parser.cc', 'google/protobuf/compiler/importer.cc', 'google/protobuf/api.pb.cc', 'google/protobuf/any.pb.cc', 'google/protobuf/any.cc', 'google/protobuf/wire_format_lite.cc', 'google/protobuf/stubs/time.cc', 'google/protobuf/stubs/strutil.cc', 'google/protobuf/stubs/structurally_valid.cc', 'google/protobuf/stubs/stringprintf.cc', 'google/protobuf/stubs/stringpiece.cc', 'google/protobuf/stubs/statusor.cc', 'google/protobuf/stubs/status.cc', 'google/protobuf/stubs/once.cc', 'google/protobuf/stubs/int128.cc', 'google/protobuf/stubs/common.cc', 'google/protobuf/stubs/bytestream.cc', 'google/protobuf/stubs/atomicops_internals_x86_msvc.cc', 'google/protobuf/stubs/atomicops_internals_x86_gcc.cc', 'google/protobuf/repeated_field.cc', 'google/protobuf/message_lite.cc', 'google/protobuf/io/zero_copy_stream_impl_lite.cc', 'google/protobuf/io/zero_copy_stream.cc', 'google/protobuf/io/coded_stream.cc', 'google/protobuf/generated_message_util.cc', 'google/protobuf/extension_set.cc', 'google/protobuf/arenastring.cc', 'google/protobuf/arena.cc', 'google/protobuf/compiler/js/embed.cc'] PROTO_FILES=['google/protobuf/wrappers.proto', 'google/protobuf/type.proto', 'google/protobuf/timestamp.proto', 'google/protobuf/struct.proto', 'google/protobuf/source_context.proto', 'google/protobuf/field_mask.proto', 'google/protobuf/empty.proto', 'google/protobuf/duration.proto', 'google/protobuf/descriptor.proto', 'google/protobuf/compiler/plugin.proto', 'google/protobuf/api.proto', 'google/protobuf/any.proto'] CC_INCLUDE='third_party/protobuf/src' diff --git a/tools/run_tests/run_tests_matrix.py b/tools/run_tests/run_tests_matrix.py index a00d84fd9a7..7932b97811b 100755 --- a/tools/run_tests/run_tests_matrix.py +++ b/tools/run_tests/run_tests_matrix.py @@ -198,7 +198,7 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS) extra_args=extra_args, inner_jobs=inner_jobs) - for compiler in ['gcc4.8', 'gcc5.3', 'gcc_musl', + for compiler in ['gcc4.8', 'gcc5.3', 'clang3.5', 'clang3.6', 'clang3.7']: test_jobs += _generate_jobs(languages=['c++'], configs=['dbg'], @@ -257,15 +257,6 @@ def _create_portability_test_jobs(extra_args=[], inner_jobs=_DEFAULT_INNER_JOBS) extra_args=extra_args, inner_jobs=inner_jobs) - test_jobs += _generate_jobs(languages=['python'], - configs=['dbg'], - platforms=['linux'], - arch='default', - compiler='python_alpine', - labels=['portability'], - extra_args=extra_args, - inner_jobs=inner_jobs) - test_jobs += _generate_jobs(languages=['csharp'], configs=['dbg'], platforms=['linux'], diff --git a/tools/run_tests/sanity/check_submodules.sh b/tools/run_tests/sanity/check_submodules.sh index eaf5a0580e5..c5a0dbbef32 100755 --- a/tools/run_tests/sanity/check_submodules.sh +++ b/tools/run_tests/sanity/check_submodules.sh @@ -46,7 +46,7 @@ cat << EOF | awk '{ print $1 }' | sort > $want_submodules 886e7d75368e3f4fab3f4d0d3584e4abfc557755 third_party/boringssl-with-bazel (version_for_cocoapods_7.0-857-g886e7d7) 30dbc81fb5ffdc98ea9b14b1918bfe4e8779b26e third_party/gflags (v2.2.0) ec44c6c1675c25b9827aacd08c02433cccde7780 third_party/googletest (release-1.8.0) - 4a0dd03e52e09332c8fd0f8f26a8e0ae9f911182 third_party/protobuf (v3.1.0-alpha-1-548-g4a0dd03e) + 593e917c176b5bc5aafa57bf9f6030d749d91cd5 third_party/protobuf (v3.1.0-alpha-1-326-g593e917) bcad91771b7f0bff28a1cac1981d7ef2b9bcef3c third_party/thrift (bcad917) 50893291621658f355bc5b4d450a8d06a563053d third_party/zlib (v1.2.8) 7691f773af79bf75a62d1863fd0f13ebf9dc51b1 third_party/cares/cares (1.12.0) From 7fadeae2a68642e829ba1bd448427dfac22b7200 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 18 Apr 2017 14:38:56 -0700 Subject: [PATCH 440/461] Fix a couple leaks --- src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c index ff8d3193098..291a1f1b0b7 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c @@ -1122,6 +1122,7 @@ static void lb_call_init_locked(grpc_exec_ctx *exec_ctx, glb_policy->base.interested_parties, GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD, &host, glb_policy->deadline, NULL); + grpc_slice_unref_internal(exec_ctx, host); grpc_metadata_array_init(&glb_policy->lb_initial_metadata_recv); grpc_metadata_array_init(&glb_policy->lb_trailing_metadata_recv); @@ -1293,6 +1294,7 @@ static void lb_on_response_received_locked(grpc_exec_ctx *exec_ctx, void *arg, "Received empty server list. Picks will stay pending until a " "response with > 0 servers is received"); } + grpc_grpclb_destroy_serverlist(glb_policy->serverlist); } } else { /* serverlist == NULL */ gpr_log(GPR_ERROR, "Invalid LB response received: '%s'. Ignoring.", From 72c4d0001948d5fe2199fcd4589ae1ab71e5f8d7 Mon Sep 17 00:00:00 2001 From: Makarand Dharmapurikar Date: Tue, 18 Apr 2017 14:51:43 -0700 Subject: [PATCH 441/461] fix bazel build for osx add config setting for building c-ares on osx --- third_party/cares/cares.BUILD | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/third_party/cares/cares.BUILD b/third_party/cares/cares.BUILD index 48096aa0551..3583720ef3d 100644 --- a/third_party/cares/cares.BUILD +++ b/third_party/cares/cares.BUILD @@ -1,3 +1,8 @@ +config_setting( + name = "darwin", + values = {"cpu": "darwin"}, +) + cc_library( name = "ares", srcs = [ @@ -53,7 +58,6 @@ cc_library( ], hdrs = [ "ares_build.h", - "config_linux/ares_config.h", "cares/ares.h", "cares/ares_data.h", "cares/ares_dns.h", @@ -75,12 +79,17 @@ cc_library( "cares/bitncmp.h", "cares/config-win32.h", "cares/setup_once.h", - ], + ] + select({ + ":darwin": ["config_darwin/ares_config.h"], + "//conditions:default": ["config_linux/ares_config.h"], + }), includes = [ ".", - "config_linux", - "cares", - ], + "cares" + ] + select({ + ":darwin": ["config_darwin"], + "//conditions:default": ["config_linux"], + }), linkstatic = 1, visibility = [ "//visibility:public", From 32041c439908ddd88332fb9d78da0b50a8e81e95 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Mon, 17 Apr 2017 15:11:05 -0700 Subject: [PATCH 442/461] Fix python artifact build --- PYTHON-MANIFEST.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PYTHON-MANIFEST.in b/PYTHON-MANIFEST.in index 846530532df..bb76b38f9fb 100644 --- a/PYTHON-MANIFEST.in +++ b/PYTHON-MANIFEST.in @@ -7,7 +7,7 @@ graft include/grpc graft third_party/boringssl graft third_party/nanopb graft third_party/zlib -graft third_party/c-ares +graft third_party/cares include src/python/grpcio/_spawn_patch.py include src/python/grpcio/commands.py include src/python/grpcio/grpc_version.py From f659ee5ff152b05c8c5956d3ca2a4ab6fb8b2cc8 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 18 Apr 2017 17:07:16 -0700 Subject: [PATCH 443/461] Move comment --- src/cpp/thread_manager/thread_manager.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cpp/thread_manager/thread_manager.cc b/src/cpp/thread_manager/thread_manager.cc index ebcc4dd3787..a463a4388a4 100644 --- a/src/cpp/thread_manager/thread_manager.cc +++ b/src/cpp/thread_manager/thread_manager.cc @@ -159,15 +159,15 @@ void ThreadManager::MainWorkLoop() { // Take the lock again to check post conditions lock.lock(); // If we're shutdown, we should finish at this point. - // If not, there's a chance that we'll exceed the max poller count: that - // is explicitly ok - we'll decrease after one poll timeout, and prevent - // some thrashing starting up and shutting down threads if (shutdown_) done = true; break; } // If we decided to finish the thread, break out of the while loop if (done) break; // ... otherwise increase poller count and continue + // There's a chance that we'll exceed the max poller count: that is + // explicitly ok - we'll decrease after one poll timeout, and prevent + // some thrashing starting up and shutting down threads num_pollers_++; }; From f26caeedc64640d4c138616cdb4ba8966d50085f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 19 Apr 2017 06:48:05 -0700 Subject: [PATCH 444/461] clang-format --- test/cpp/qps/client_sync.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index da17f6bf7bb..f8ce2cccbea 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -167,7 +167,7 @@ class SynchronousStreamingClient final : public SynchronousClient { } }); } - for (size_t i=0; i Date: Wed, 19 Apr 2017 06:49:29 -0700 Subject: [PATCH 445/461] clang-format --- include/grpc++/server_builder.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h index e15a5acbe1c..7ac23349c84 100644 --- a/include/grpc++/server_builder.h +++ b/include/grpc++/server_builder.h @@ -195,10 +195,7 @@ class ServerBuilder { struct SyncServerSettings { SyncServerSettings() - : num_cqs(1), - min_pollers(1), - max_pollers(2), - cq_timeout_msec(10000) {} + : num_cqs(1), min_pollers(1), max_pollers(2), cq_timeout_msec(10000) {} // Number of server completion queues to create to listen to incoming RPCs. int num_cqs; From bea92ba0e11dd7ffe552eed8b0fea0970f5d0393 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 19 Apr 2017 08:33:31 -0700 Subject: [PATCH 446/461] Fix bins/opt/end2end_test --gtest_filter=ProxyEnd2end/ProxyEnd2endTest.RpcDeadlineExpires/1 GRPC_POLL_STRATEGY=poll --- src/core/lib/surface/call.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 3e96d097985..a42fe7ef3c9 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -346,6 +346,8 @@ grpc_error *grpc_call_create(grpc_exec_ctx *exec_ctx, gpr_timespec send_deadline = gpr_convert_clock_type(args->send_deadline, GPR_CLOCK_MONOTONIC); + bool immediately_cancel = false; + if (args->parent_call != NULL) { child_call *cc = call->child_call = gpr_arena_alloc(arena, sizeof(child_call)); @@ -386,8 +388,7 @@ grpc_error *grpc_call_create(grpc_exec_ctx *exec_ctx, if (args->propagation_mask & GRPC_PROPAGATE_CANCELLATION) { call->cancellation_is_inherited = 1; if (gpr_atm_acq_load(&args->parent_call->received_final_op_atm)) { - cancel_with_error(exec_ctx, call, STATUS_FROM_API_OVERRIDE, - GRPC_ERROR_CANCELLED); + immediately_cancel = true; } } @@ -422,6 +423,10 @@ grpc_error *grpc_call_create(grpc_exec_ctx *exec_ctx, cancel_with_error(exec_ctx, call, STATUS_FROM_SURFACE, GRPC_ERROR_REF(error)); } + if (immediately_cancel) { + cancel_with_error(exec_ctx, call, STATUS_FROM_API_OVERRIDE, + GRPC_ERROR_CANCELLED); + } if (args->cq != NULL) { GPR_ASSERT( args->pollset_set_alternative == NULL && From ad7f066b16bcd62cf36bf78f78ae0ae0f8ca242e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 19 Apr 2017 09:16:45 -0700 Subject: [PATCH 447/461] Allow >100% increases, add more jobs to reduce noise --- tools/profiling/microbenchmarks/bm_diff.py | 3 +-- tools/profiling/microbenchmarks/speedup.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py index f1b6ef1ab94..09b62ae1c90 100755 --- a/tools/profiling/microbenchmarks/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff.py @@ -98,7 +98,7 @@ argp.add_argument('-t', '--track', argp.add_argument('-b', '--benchmarks', nargs='+', choices=_AVAILABLE_BENCHMARK_TESTS, default=['bm_cq']) argp.add_argument('-d', '--diff_base', type=str) argp.add_argument('-r', '--repetitions', type=int, default=1) -argp.add_argument('-l', '--loops', type=int, default=12) +argp.add_argument('-l', '--loops', type=int, default=20) argp.add_argument('-j', '--jobs', type=int, default=multiprocessing.cpu_count()) args = argp.parse_args() @@ -247,4 +247,3 @@ def finalize(): eintr_be_gone(finalize) - diff --git a/tools/profiling/microbenchmarks/speedup.py b/tools/profiling/microbenchmarks/speedup.py index 8f9023d2c89..b3888e5ea8c 100644 --- a/tools/profiling/microbenchmarks/speedup.py +++ b/tools/profiling/microbenchmarks/speedup.py @@ -53,7 +53,7 @@ def speedup(new, old): return -(pct - 1) else: pct = 1 - while pct < 101: + while pct < 100000: sp, pp = cmp(new, scale(old, 1 + pct/100.0)) if sp < 0: break if pp > _THRESHOLD: break From e530845d91c118e3176d116d58420c9e3afa44b0 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 19 Apr 2017 09:18:57 -0700 Subject: [PATCH 448/461] Also increase threshold for significant differences --- tools/profiling/microbenchmarks/speedup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/profiling/microbenchmarks/speedup.py b/tools/profiling/microbenchmarks/speedup.py index b3888e5ea8c..5a1ed3f2cf5 100644 --- a/tools/profiling/microbenchmarks/speedup.py +++ b/tools/profiling/microbenchmarks/speedup.py @@ -30,7 +30,7 @@ from scipy import stats import math -_THRESHOLD = 0.0001 +_THRESHOLD = 0.00001 def scale(a, mul): return [x*mul for x in a] From 0dd38b5cb950bd67d74113fc455f67c999635dca Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 19 Apr 2017 09:45:47 -0700 Subject: [PATCH 449/461] Fix broken merge --- src/node/ext/call.cc | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/src/node/ext/call.cc b/src/node/ext/call.cc index a51ad836cd1..fd3463b874e 100644 --- a/src/node/ext/call.cc +++ b/src/node/ext/call.cc @@ -248,13 +248,9 @@ class SendMessageOp : public Op { out->data.send_message.send_message = send_message; return true; } -<<<<<<< HEAD - bool IsFinalOp() { return false; } -======= bool IsFinalOp() { return false; } void OnComplete(bool success) {} ->>>>>>> e412a180602753972ac496560322e224a5db987f protected: std::string GetTypeString() const { return "send_message"; } @@ -269,15 +265,10 @@ class SendClientCloseOp : public Op { EscapableHandleScope scope; return scope.Escape(Nan::True()); } -<<<<<<< HEAD - bool ParseOp(Local value, grpc_op *out) { return true; } - bool IsFinalOp() { return false; } -======= bool ParseOp(Local value, grpc_op *out) { return true; } bool IsFinalOp() { return false; } void OnComplete(bool success) {} ->>>>>>> e412a180602753972ac496560322e224a5db987f protected: std::string GetTypeString() const { return "client_close"; } @@ -341,13 +332,9 @@ class SendServerStatusOp : public Op { out->data.send_status_from_server.status_details = &this->details; return true; } -<<<<<<< HEAD - bool IsFinalOp() { return true; } -======= bool IsFinalOp() { return true; } void OnComplete(bool success) {} ->>>>>>> e412a180602753972ac496560322e224a5db987f protected: std::string GetTypeString() const { return "send_status"; } @@ -372,12 +359,9 @@ class GetMetadataOp : public Op { out->data.recv_initial_metadata.recv_initial_metadata = &recv_metadata; return true; } -<<<<<<< HEAD - bool IsFinalOp() { return false; } -======= + bool IsFinalOp() { return false; } void OnComplete(bool success) {} ->>>>>>> e412a180602753972ac496560322e224a5db987f protected: std::string GetTypeString() const { return "metadata"; } @@ -403,12 +387,9 @@ class ReadMessageOp : public Op { out->data.recv_message.recv_message = &recv_message; return true; } -<<<<<<< HEAD - bool IsFinalOp() { return false; } -======= + bool IsFinalOp() { return false; } void OnComplete(bool success) {} ->>>>>>> e412a180602753972ac496560322e224a5db987f protected: std::string GetTypeString() const { return "read"; } @@ -441,13 +422,9 @@ class ClientStatusOp : public Op { ParseMetadata(&metadata_array)); return scope.Escape(status_obj); } -<<<<<<< HEAD - bool IsFinalOp() { return true; } -======= bool IsFinalOp() { return true; } void OnComplete(bool success) {} ->>>>>>> e412a180602753972ac496560322e224a5db987f protected: std::string GetTypeString() const { return "status"; } @@ -469,12 +446,9 @@ class ServerCloseResponseOp : public Op { out->data.recv_close_on_server.cancelled = &cancelled; return true; } -<<<<<<< HEAD - bool IsFinalOp() { return false; } -======= + bool IsFinalOp() { return false; } void OnComplete(bool success) {} ->>>>>>> e412a180602753972ac496560322e224a5db987f protected: std::string GetTypeString() const { return "cancelled"; } From 5b1c5f22f4cce36028346b11aa85767a03e62c02 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 19 Apr 2017 09:52:18 -0700 Subject: [PATCH 450/461] Extend clang-format to C#, Node, Ruby --- src/csharp/ext/grpc_csharp_ext.c | 277 +++++++++--------- src/node/ext/byte_buffer.cc | 4 +- src/node/ext/byte_buffer.h | 2 +- src/node/ext/call.cc | 255 ++++++---------- src/node/ext/call.h | 3 +- src/node/ext/call_credentials.cc | 77 +++-- src/node/ext/call_credentials.h | 4 +- src/node/ext/channel.cc | 58 ++-- src/node/ext/channel.h | 2 +- src/node/ext/channel_credentials.cc | 29 +- src/node/ext/channel_credentials.h | 2 +- src/node/ext/completion_queue.h | 2 +- src/node/ext/node_grpc.cc | 85 +++--- src/node/ext/server.cc | 30 +- src/node/ext/server.h | 2 +- src/node/ext/server_credentials.cc | 22 +- src/node/ext/server_credentials.h | 2 +- src/node/ext/server_uv.cc | 33 +-- src/node/ext/slice.cc | 36 ++- src/node/ext/slice.h | 7 +- src/node/ext/timeval.cc | 2 +- src/ruby/ext/grpc/rb_byte_buffer.c | 14 +- src/ruby/ext/grpc/rb_call.c | 102 ++++--- src/ruby/ext/grpc/rb_call.h | 7 +- src/ruby/ext/grpc/rb_call_credentials.c | 45 +-- src/ruby/ext/grpc/rb_channel.c | 53 ++-- src/ruby/ext/grpc/rb_channel_args.c | 20 +- src/ruby/ext/grpc/rb_channel_credentials.c | 28 +- src/ruby/ext/grpc/rb_completion_queue.c | 16 +- src/ruby/ext/grpc/rb_compression_options.c | 13 +- src/ruby/ext/grpc/rb_event_thread.c | 22 +- src/ruby/ext/grpc/rb_event_thread.h | 3 +- src/ruby/ext/grpc/rb_grpc.c | 23 +- src/ruby/ext/grpc/rb_grpc.h | 4 +- .../clang_format_all_the_things.sh | 2 +- 35 files changed, 607 insertions(+), 679 deletions(-) diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index 27de7bc11f1..88adef03332 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -34,14 +34,14 @@ #include "src/core/lib/support/string.h" #include -#include +#include +#include +#include #include #include -#include +#include #include #include -#include -#include #include @@ -84,7 +84,8 @@ typedef struct grpcsharp_batch_context { int recv_close_on_server_cancelled; } grpcsharp_batch_context; -GPR_EXPORT grpcsharp_batch_context *GPR_CALLTYPE grpcsharp_batch_context_create() { +GPR_EXPORT grpcsharp_batch_context *GPR_CALLTYPE +grpcsharp_batch_context_create() { grpcsharp_batch_context *ctx = gpr_malloc(sizeof(grpcsharp_batch_context)); memset(ctx, 0, sizeof(grpcsharp_batch_context)); return ctx; @@ -96,8 +97,10 @@ typedef struct { grpc_metadata_array request_metadata; } grpcsharp_request_call_context; -GPR_EXPORT grpcsharp_request_call_context *GPR_CALLTYPE grpcsharp_request_call_context_create() { - grpcsharp_request_call_context *ctx = gpr_malloc(sizeof(grpcsharp_request_call_context)); +GPR_EXPORT grpcsharp_request_call_context *GPR_CALLTYPE +grpcsharp_request_call_context_create() { + grpcsharp_request_call_context *ctx = + gpr_malloc(sizeof(grpcsharp_request_call_context)); memset(ctx, 0, sizeof(grpcsharp_request_call_context)); return ctx; } @@ -175,15 +178,15 @@ grpcsharp_metadata_array_count(grpc_metadata_array *array) { return (intptr_t)array->count; } -GPR_EXPORT const char *GPR_CALLTYPE -grpcsharp_metadata_array_get_key(grpc_metadata_array *array, size_t index, size_t *key_length) { +GPR_EXPORT const char *GPR_CALLTYPE grpcsharp_metadata_array_get_key( + grpc_metadata_array *array, size_t index, size_t *key_length) { GPR_ASSERT(index < array->count); *key_length = GRPC_SLICE_LENGTH(array->metadata[index].key); return (char *)GRPC_SLICE_START_PTR(array->metadata[index].key); } -GPR_EXPORT const char *GPR_CALLTYPE -grpcsharp_metadata_array_get_value(grpc_metadata_array *array, size_t index, size_t *value_length) { +GPR_EXPORT const char *GPR_CALLTYPE grpcsharp_metadata_array_get_value( + grpc_metadata_array *array, size_t index, size_t *value_length) { GPR_ASSERT(index < array->count); *value_length = GRPC_SLICE_LENGTH(array->metadata[index].value); return (char *)GRPC_SLICE_START_PTR(array->metadata[index].value); @@ -208,7 +211,8 @@ void grpcsharp_metadata_array_move(grpc_metadata_array *dest, src->metadata = NULL; } -GPR_EXPORT void GPR_CALLTYPE grpcsharp_batch_context_destroy(grpcsharp_batch_context *ctx) { +GPR_EXPORT void GPR_CALLTYPE +grpcsharp_batch_context_destroy(grpcsharp_batch_context *ctx) { if (!ctx) { return; } @@ -231,7 +235,8 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_batch_context_destroy(grpcsharp_batch_con gpr_free(ctx); } -GPR_EXPORT void GPR_CALLTYPE grpcsharp_request_call_context_destroy(grpcsharp_request_call_context *ctx) { +GPR_EXPORT void GPR_CALLTYPE +grpcsharp_request_call_context_destroy(grpcsharp_request_call_context *ctx) { if (!ctx) { return; } @@ -240,8 +245,7 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_request_call_context_destroy(grpcsharp_re to take its ownership. */ grpc_call_details_destroy(&(ctx->call_details)); - grpcsharp_metadata_array_destroy_metadata_only( - &(ctx->request_metadata)); + grpcsharp_metadata_array_destroy_metadata_only(&(ctx->request_metadata)); gpr_free(ctx); } @@ -299,8 +303,10 @@ grpcsharp_batch_context_recv_status_on_client_status( GPR_EXPORT const char *GPR_CALLTYPE grpcsharp_batch_context_recv_status_on_client_details( const grpcsharp_batch_context *ctx, size_t *details_length) { - *details_length = GRPC_SLICE_LENGTH(ctx->recv_status_on_client.status_details); - return (char *)GRPC_SLICE_START_PTR(ctx->recv_status_on_client.status_details); + *details_length = + GRPC_SLICE_LENGTH(ctx->recv_status_on_client.status_details); + return (char *)GRPC_SLICE_START_PTR( + ctx->recv_status_on_client.status_details); } GPR_EXPORT const grpc_metadata_array *GPR_CALLTYPE @@ -309,13 +315,12 @@ grpcsharp_batch_context_recv_status_on_client_trailing_metadata( return &(ctx->recv_status_on_client.trailing_metadata); } -GPR_EXPORT grpc_call *GPR_CALLTYPE grpcsharp_request_call_context_call( - const grpcsharp_request_call_context *ctx) { +GPR_EXPORT grpc_call *GPR_CALLTYPE +grpcsharp_request_call_context_call(const grpcsharp_request_call_context *ctx) { return ctx->call; } -GPR_EXPORT const char *GPR_CALLTYPE -grpcsharp_request_call_context_method( +GPR_EXPORT const char *GPR_CALLTYPE grpcsharp_request_call_context_method( const grpcsharp_request_call_context *ctx, size_t *method_length) { *method_length = GRPC_SLICE_LENGTH(ctx->call_details.method); return (char *)GRPC_SLICE_START_PTR(ctx->call_details.method); @@ -327,8 +332,7 @@ GPR_EXPORT const char *GPR_CALLTYPE grpcsharp_request_call_context_host( return (char *)GRPC_SLICE_START_PTR(ctx->call_details.host); } -GPR_EXPORT gpr_timespec GPR_CALLTYPE -grpcsharp_request_call_context_deadline( +GPR_EXPORT gpr_timespec GPR_CALLTYPE grpcsharp_request_call_context_deadline( const grpcsharp_request_call_context *ctx) { return ctx->call_details.deadline; } @@ -342,7 +346,7 @@ grpcsharp_request_call_context_request_metadata( GPR_EXPORT int32_t GPR_CALLTYPE grpcsharp_batch_context_recv_close_on_server_cancelled( const grpcsharp_batch_context *ctx) { - return (int32_t) ctx->recv_close_on_server_cancelled; + return (int32_t)ctx->recv_close_on_server_cancelled; } /* Init & shutdown */ @@ -389,7 +393,8 @@ grpcsharp_completion_queue_pluck(grpc_completion_queue *cq, void *tag) { GPR_EXPORT grpc_channel *GPR_CALLTYPE -grpcsharp_insecure_channel_create(const char *target, const grpc_channel_args *args) { +grpcsharp_insecure_channel_create(const char *target, + const grpc_channel_args *args) { return grpc_insecure_channel_create(target, args, NULL); } @@ -397,12 +402,10 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_channel_destroy(grpc_channel *channel) { grpc_channel_destroy(channel); } -GPR_EXPORT grpc_call *GPR_CALLTYPE -grpcsharp_channel_create_call(grpc_channel *channel, grpc_call *parent_call, - uint32_t propagation_mask, - grpc_completion_queue *cq, - const char *method, const char *host, - gpr_timespec deadline) { +GPR_EXPORT grpc_call *GPR_CALLTYPE grpcsharp_channel_create_call( + grpc_channel *channel, grpc_call *parent_call, uint32_t propagation_mask, + grpc_completion_queue *cq, const char *method, const char *host, + gpr_timespec deadline) { grpc_slice method_slice = grpc_slice_from_copied_string(method); grpc_slice *host_slice_ptr = NULL; grpc_slice host_slice; @@ -415,18 +418,21 @@ grpcsharp_channel_create_call(grpc_channel *channel, grpc_call *parent_call, } GPR_EXPORT grpc_connectivity_state GPR_CALLTYPE -grpcsharp_channel_check_connectivity_state(grpc_channel *channel, int32_t try_to_connect) { +grpcsharp_channel_check_connectivity_state(grpc_channel *channel, + int32_t try_to_connect) { return grpc_channel_check_connectivity_state(channel, try_to_connect); } GPR_EXPORT void GPR_CALLTYPE grpcsharp_channel_watch_connectivity_state( grpc_channel *channel, grpc_connectivity_state last_observed_state, - gpr_timespec deadline, grpc_completion_queue *cq, grpcsharp_batch_context *ctx) { - grpc_channel_watch_connectivity_state(channel, last_observed_state, - deadline, cq, ctx); + gpr_timespec deadline, grpc_completion_queue *cq, + grpcsharp_batch_context *ctx) { + grpc_channel_watch_connectivity_state(channel, last_observed_state, deadline, + cq, ctx); } -GPR_EXPORT char *GPR_CALLTYPE grpcsharp_channel_get_target(grpc_channel *channel) { +GPR_EXPORT char *GPR_CALLTYPE +grpcsharp_channel_get_target(grpc_channel *channel) { return grpc_channel_get_target(channel); } @@ -444,9 +450,8 @@ grpcsharp_channel_args_create(size_t num_args) { return args; } -GPR_EXPORT void GPR_CALLTYPE -grpcsharp_channel_args_set_string(grpc_channel_args *args, size_t index, - const char *key, const char *value) { +GPR_EXPORT void GPR_CALLTYPE grpcsharp_channel_args_set_string( + grpc_channel_args *args, size_t index, const char *key, const char *value) { GPR_ASSERT(args); GPR_ASSERT(index < args->num_args); args->args[index].type = GRPC_ARG_STRING; @@ -454,9 +459,8 @@ grpcsharp_channel_args_set_string(grpc_channel_args *args, size_t index, args->args[index].value.string = gpr_strdup(value); } -GPR_EXPORT void GPR_CALLTYPE -grpcsharp_channel_args_set_integer(grpc_channel_args *args, size_t index, - const char *key, int value) { +GPR_EXPORT void GPR_CALLTYPE grpcsharp_channel_args_set_integer( + grpc_channel_args *args, size_t index, const char *key, int value) { GPR_ASSERT(args); GPR_ASSERT(index < args->num_args); args->args[index].type = GRPC_ARG_INTEGER; @@ -485,15 +489,18 @@ GPR_EXPORT gpr_timespec GPR_CALLTYPE gprsharp_now(gpr_clock_type clock_type) { return gpr_now(clock_type); } -GPR_EXPORT gpr_timespec GPR_CALLTYPE gprsharp_inf_future(gpr_clock_type clock_type) { +GPR_EXPORT gpr_timespec GPR_CALLTYPE +gprsharp_inf_future(gpr_clock_type clock_type) { return gpr_inf_future(clock_type); } -GPR_EXPORT gpr_timespec GPR_CALLTYPE gprsharp_inf_past(gpr_clock_type clock_type) { +GPR_EXPORT gpr_timespec GPR_CALLTYPE +gprsharp_inf_past(gpr_clock_type clock_type) { return gpr_inf_past(clock_type); } -GPR_EXPORT gpr_timespec GPR_CALLTYPE gprsharp_convert_clock_type(gpr_timespec t, gpr_clock_type target_clock) { +GPR_EXPORT gpr_timespec GPR_CALLTYPE +gprsharp_convert_clock_type(gpr_timespec t, gpr_clock_type target_clock) { return gpr_convert_clock_type(t, target_clock); } @@ -507,9 +514,8 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_cancel(grpc_call *call) { return grpc_call_cancel(call, NULL); } -GPR_EXPORT grpc_call_error GPR_CALLTYPE -grpcsharp_call_cancel_with_status(grpc_call *call, grpc_status_code status, - const char *description) { +GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_cancel_with_status( + grpc_call *call, grpc_status_code status, const char *description) { return grpc_call_cancel_with_status(call, status, description, NULL); } @@ -517,18 +523,16 @@ GPR_EXPORT char *GPR_CALLTYPE grpcsharp_call_get_peer(grpc_call *call) { return grpc_call_get_peer(call); } -GPR_EXPORT void GPR_CALLTYPE gprsharp_free(void *p) { - gpr_free(p); -} +GPR_EXPORT void GPR_CALLTYPE gprsharp_free(void *p) { gpr_free(p); } GPR_EXPORT void GPR_CALLTYPE grpcsharp_call_destroy(grpc_call *call) { grpc_call_destroy(call); } -GPR_EXPORT grpc_call_error GPR_CALLTYPE -grpcsharp_call_start_unary(grpc_call *call, grpcsharp_batch_context *ctx, - const char *send_buffer, size_t send_buffer_len, uint32_t write_flags, - grpc_metadata_array *initial_metadata, uint32_t initial_metadata_flags) { +GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_unary( + grpc_call *call, grpcsharp_batch_context *ctx, const char *send_buffer, + size_t send_buffer_len, uint32_t write_flags, + grpc_metadata_array *initial_metadata, uint32_t initial_metadata_flags) { /* TODO: don't use magic number */ grpc_op ops[6]; memset(ops, 0, sizeof(ops)); @@ -576,11 +580,9 @@ grpcsharp_call_start_unary(grpc_call *call, grpcsharp_batch_context *ctx, NULL); } -GPR_EXPORT grpc_call_error GPR_CALLTYPE -grpcsharp_call_start_client_streaming(grpc_call *call, - grpcsharp_batch_context *ctx, - grpc_metadata_array *initial_metadata, - uint32_t initial_metadata_flags) { +GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_client_streaming( + grpc_call *call, grpcsharp_batch_context *ctx, + grpc_metadata_array *initial_metadata, uint32_t initial_metadata_flags) { /* TODO: don't use magic number */ grpc_op ops[4]; memset(ops, 0, sizeof(ops)); @@ -658,11 +660,9 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_server_streaming( NULL); } -GPR_EXPORT grpc_call_error GPR_CALLTYPE -grpcsharp_call_start_duplex_streaming(grpc_call *call, - grpcsharp_batch_context *ctx, - grpc_metadata_array *initial_metadata, - uint32_t initial_metadata_flags) { +GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_duplex_streaming( + grpc_call *call, grpcsharp_batch_context *ctx, + grpc_metadata_array *initial_metadata, uint32_t initial_metadata_flags) { /* TODO: don't use magic number */ grpc_op ops[2]; memset(ops, 0, sizeof(ops)); @@ -690,7 +690,7 @@ grpcsharp_call_start_duplex_streaming(grpc_call *call, } GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_recv_initial_metadata( - grpc_call *call, grpcsharp_batch_context *ctx) { + grpc_call *call, grpcsharp_batch_context *ctx) { /* TODO: don't use magic number */ grpc_op ops[1]; ops[0].op = GRPC_OP_RECV_INITIAL_METADATA; @@ -700,14 +700,13 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_recv_initial_metadata( ops[0].reserved = NULL; return grpc_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]), ctx, - NULL); + NULL); } -GPR_EXPORT grpc_call_error GPR_CALLTYPE -grpcsharp_call_send_message(grpc_call *call, grpcsharp_batch_context *ctx, - const char *send_buffer, size_t send_buffer_len, - uint32_t write_flags, - int32_t send_empty_initial_metadata) { +GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_message( + grpc_call *call, grpcsharp_batch_context *ctx, const char *send_buffer, + size_t send_buffer_len, uint32_t write_flags, + int32_t send_empty_initial_metadata) { /* TODO: don't use magic number */ grpc_op ops[2]; memset(ops, 0, sizeof(ops)); @@ -724,9 +723,8 @@ grpcsharp_call_send_message(grpc_call *call, grpcsharp_batch_context *ctx, return grpc_call_start_batch(call, ops, nops, ctx, NULL); } -GPR_EXPORT grpc_call_error GPR_CALLTYPE -grpcsharp_call_send_close_from_client(grpc_call *call, - grpcsharp_batch_context *ctx) { +GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_close_from_client( + grpc_call *call, grpcsharp_batch_context *ctx) { /* TODO: don't use magic number */ grpc_op ops[1]; ops[0].op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; @@ -740,14 +738,15 @@ grpcsharp_call_send_close_from_client(grpc_call *call, GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_status_from_server( grpc_call *call, grpcsharp_batch_context *ctx, grpc_status_code status_code, const char *status_details, size_t status_details_len, - grpc_metadata_array *trailing_metadata, - int32_t send_empty_initial_metadata, const char* optional_send_buffer, - size_t optional_send_buffer_len, uint32_t write_flags) { + grpc_metadata_array *trailing_metadata, int32_t send_empty_initial_metadata, + const char *optional_send_buffer, size_t optional_send_buffer_len, + uint32_t write_flags) { /* TODO: don't use magic number */ grpc_op ops[3]; memset(ops, 0, sizeof(ops)); size_t nops = 1; - grpc_slice status_details_slice = grpc_slice_from_copied_buffer(status_details, status_details_len); + grpc_slice status_details_slice = + grpc_slice_from_copied_buffer(status_details, status_details_len); ops[0].op = GRPC_OP_SEND_STATUS_FROM_SERVER; ops[0].data.send_status_from_server.status = status_code; ops[0].data.send_status_from_server.status_details = &status_details_slice; @@ -761,8 +760,8 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_status_from_server( ops[0].reserved = NULL; if (optional_send_buffer) { ops[nops].op = GRPC_OP_SEND_MESSAGE; - ctx->send_message = string_to_byte_buffer(optional_send_buffer, - optional_send_buffer_len); + ctx->send_message = + string_to_byte_buffer(optional_send_buffer, optional_send_buffer_len); ops[nops].data.send_message.send_message = ctx->send_message; ops[nops].flags = write_flags; ops[nops].reserved = NULL; @@ -803,10 +802,9 @@ grpcsharp_call_start_serverside(grpc_call *call, grpcsharp_batch_context *ctx) { NULL); } -GPR_EXPORT grpc_call_error GPR_CALLTYPE -grpcsharp_call_send_initial_metadata(grpc_call *call, - grpcsharp_batch_context *ctx, - grpc_metadata_array *initial_metadata) { +GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_initial_metadata( + grpc_call *call, grpcsharp_batch_context *ctx, + grpc_metadata_array *initial_metadata) { /* TODO: don't use magic number */ grpc_op ops[1]; memset(ops, 0, sizeof(ops)); @@ -823,9 +821,8 @@ grpcsharp_call_send_initial_metadata(grpc_call *call, NULL); } -GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_set_credentials( - grpc_call *call, - grpc_call_credentials *creds) { +GPR_EXPORT grpc_call_error GPR_CALLTYPE +grpcsharp_call_set_credentials(grpc_call *call, grpc_call_credentials *creds) { return grpc_call_set_credentials(call, creds); } @@ -836,14 +833,13 @@ grpcsharp_server_create(const grpc_channel_args *args) { return grpc_server_create(args, NULL); } -GPR_EXPORT void GPR_CALLTYPE -grpcsharp_server_register_completion_queue(grpc_server *server, - grpc_completion_queue *cq) { +GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_register_completion_queue( + grpc_server *server, grpc_completion_queue *cq) { grpc_server_register_completion_queue(server, cq, NULL); } -GPR_EXPORT int32_t GPR_CALLTYPE -grpcsharp_server_add_insecure_http2_port(grpc_server *server, const char *addr) { +GPR_EXPORT int32_t GPR_CALLTYPE grpcsharp_server_add_insecure_http2_port( + grpc_server *server, const char *addr) { return grpc_server_add_insecure_http2_port(server, addr); } @@ -851,14 +847,14 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_start(grpc_server *server) { grpc_server_start(server); } -GPR_EXPORT void GPR_CALLTYPE -grpcsharp_server_shutdown_and_notify_callback(grpc_server *server, - grpc_completion_queue *cq, - grpcsharp_batch_context *ctx) { +GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_shutdown_and_notify_callback( + grpc_server *server, grpc_completion_queue *cq, + grpcsharp_batch_context *ctx) { grpc_server_shutdown_and_notify(server, cq, ctx); } -GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_cancel_all_calls(grpc_server *server) { +GPR_EXPORT void GPR_CALLTYPE +grpcsharp_server_cancel_all_calls(grpc_server *server) { grpc_server_cancel_all_calls(server); } @@ -869,9 +865,8 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_destroy(grpc_server *server) { GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_server_request_call(grpc_server *server, grpc_completion_queue *cq, grpcsharp_request_call_context *ctx) { - return grpc_server_request_call( - server, &(ctx->call), &(ctx->call_details), - &(ctx->request_metadata), cq, cq, ctx); + return grpc_server_request_call(server, &(ctx->call), &(ctx->call_details), + &(ctx->request_metadata), cq, cq, ctx); } /* Security */ @@ -888,8 +883,8 @@ static grpc_ssl_roots_override_result override_ssl_roots_handler( return GRPC_SSL_ROOTS_OVERRIDE_OK; } -GPR_EXPORT void GPR_CALLTYPE grpcsharp_override_default_ssl_roots( - const char *pem_root_certs) { +GPR_EXPORT void GPR_CALLTYPE +grpcsharp_override_default_ssl_roots(const char *pem_root_certs) { /* * This currently wastes ~300kB of memory by keeping a copy of roots * in a static variable, but for desktop/server use, the overhead @@ -916,20 +911,19 @@ grpcsharp_ssl_credentials_create(const char *pem_root_certs, } } -GPR_EXPORT void GPR_CALLTYPE grpcsharp_channel_credentials_release( - grpc_channel_credentials *creds) { +GPR_EXPORT void GPR_CALLTYPE +grpcsharp_channel_credentials_release(grpc_channel_credentials *creds) { grpc_channel_credentials_release(creds); } -GPR_EXPORT void GPR_CALLTYPE grpcsharp_call_credentials_release( - grpc_call_credentials *creds) { +GPR_EXPORT void GPR_CALLTYPE +grpcsharp_call_credentials_release(grpc_call_credentials *creds) { grpc_call_credentials_release(creds); } -GPR_EXPORT grpc_channel *GPR_CALLTYPE -grpcsharp_secure_channel_create(grpc_channel_credentials *creds, - const char *target, - const grpc_channel_args *args) { +GPR_EXPORT grpc_channel *GPR_CALLTYPE grpcsharp_secure_channel_create( + grpc_channel_credentials *creds, const char *target, + const grpc_channel_args *args) { return grpc_secure_channel_create(creds, target, args, NULL); } @@ -962,36 +956,36 @@ grpcsharp_ssl_server_credentials_create( return creds; } -GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_credentials_release( - grpc_server_credentials *creds) { +GPR_EXPORT void GPR_CALLTYPE +grpcsharp_server_credentials_release(grpc_server_credentials *creds) { grpc_server_credentials_release(creds); } -GPR_EXPORT int32_t GPR_CALLTYPE -grpcsharp_server_add_secure_http2_port(grpc_server *server, const char *addr, - grpc_server_credentials *creds) { +GPR_EXPORT int32_t GPR_CALLTYPE grpcsharp_server_add_secure_http2_port( + grpc_server *server, const char *addr, grpc_server_credentials *creds) { return grpc_server_add_secure_http2_port(server, addr, creds); } -GPR_EXPORT grpc_channel_credentials *GPR_CALLTYPE grpcsharp_composite_channel_credentials_create( - grpc_channel_credentials *channel_creds, - grpc_call_credentials *call_creds) { - return grpc_composite_channel_credentials_create(channel_creds, call_creds, NULL); +GPR_EXPORT grpc_channel_credentials *GPR_CALLTYPE +grpcsharp_composite_channel_credentials_create( + grpc_channel_credentials *channel_creds, + grpc_call_credentials *call_creds) { + return grpc_composite_channel_credentials_create(channel_creds, call_creds, + NULL); } -GPR_EXPORT grpc_call_credentials *GPR_CALLTYPE grpcsharp_composite_call_credentials_create( - grpc_call_credentials *creds1, - grpc_call_credentials *creds2) { +GPR_EXPORT grpc_call_credentials *GPR_CALLTYPE +grpcsharp_composite_call_credentials_create(grpc_call_credentials *creds1, + grpc_call_credentials *creds2) { return grpc_composite_call_credentials_create(creds1, creds2, NULL); } - /* Metadata credentials plugin */ GPR_EXPORT void GPR_CALLTYPE grpcsharp_metadata_credentials_notify_from_plugin( - grpc_credentials_plugin_metadata_cb cb, - void *user_data, grpc_metadata_array *metadata, - grpc_status_code status, const char *error_details) { + grpc_credentials_plugin_metadata_cb cb, void *user_data, + grpc_metadata_array *metadata, grpc_status_code status, + const char *error_details) { if (metadata) { cb(user_data, metadata->metadata, metadata->count, status, error_details); } else { @@ -1000,16 +994,17 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_metadata_credentials_notify_from_plugin( } typedef void(GPR_CALLTYPE *grpcsharp_metadata_interceptor_func)( - void *state, const char *service_url, const char *method_name, - grpc_credentials_plugin_metadata_cb cb, - void *user_data, int32_t is_destroy); + void *state, const char *service_url, const char *method_name, + grpc_credentials_plugin_metadata_cb cb, void *user_data, + int32_t is_destroy); static void grpcsharp_get_metadata_handler( void *state, grpc_auth_metadata_context context, grpc_credentials_plugin_metadata_cb cb, void *user_data) { grpcsharp_metadata_interceptor_func interceptor = (grpcsharp_metadata_interceptor_func)(intptr_t)state; - interceptor(state, context.service_url, context.method_name, cb, user_data, 0); + interceptor(state, context.service_url, context.method_name, cb, user_data, + 0); } static void grpcsharp_metadata_credentials_destroy_handler(void *state) { @@ -1018,23 +1013,26 @@ static void grpcsharp_metadata_credentials_destroy_handler(void *state) { interceptor(state, NULL, NULL, NULL, NULL, 1); } -GPR_EXPORT grpc_call_credentials *GPR_CALLTYPE grpcsharp_metadata_credentials_create_from_plugin( - grpcsharp_metadata_interceptor_func metadata_interceptor) { +GPR_EXPORT grpc_call_credentials *GPR_CALLTYPE +grpcsharp_metadata_credentials_create_from_plugin( + grpcsharp_metadata_interceptor_func metadata_interceptor) { grpc_metadata_credentials_plugin plugin; plugin.get_metadata = grpcsharp_get_metadata_handler; plugin.destroy = grpcsharp_metadata_credentials_destroy_handler; - plugin.state = (void*)(intptr_t)metadata_interceptor; + plugin.state = (void *)(intptr_t)metadata_interceptor; plugin.type = ""; return grpc_metadata_credentials_create_from_plugin(plugin, NULL); } /* Auth context */ -GPR_EXPORT grpc_auth_context *GPR_CALLTYPE grpcsharp_call_auth_context(grpc_call *call) { +GPR_EXPORT grpc_auth_context *GPR_CALLTYPE +grpcsharp_call_auth_context(grpc_call *call) { return grpc_call_auth_context(call); } -GPR_EXPORT const char *GPR_CALLTYPE grpcsharp_auth_context_peer_identity_property_name( +GPR_EXPORT const char *GPR_CALLTYPE +grpcsharp_auth_context_peer_identity_property_name( const grpc_auth_context *ctx) { return grpc_auth_context_peer_identity_property_name(ctx); } @@ -1044,12 +1042,13 @@ grpcsharp_auth_context_property_iterator(const grpc_auth_context *ctx) { return grpc_auth_context_property_iterator(ctx); } -GPR_EXPORT const grpc_auth_property *GPR_CALLTYPE grpcsharp_auth_property_iterator_next( - grpc_auth_property_iterator *it) { +GPR_EXPORT const grpc_auth_property *GPR_CALLTYPE +grpcsharp_auth_property_iterator_next(grpc_auth_property_iterator *it) { return grpc_auth_property_iterator_next(it); } -GPR_EXPORT void GPR_CALLTYPE grpcsharp_auth_context_release(grpc_auth_context *ctx) { +GPR_EXPORT void GPR_CALLTYPE +grpcsharp_auth_context_release(grpc_auth_context *ctx) { grpc_auth_context_release(ctx); } diff --git a/src/node/ext/byte_buffer.cc b/src/node/ext/byte_buffer.cc index a99b96bea54..470c7ed9019 100644 --- a/src/node/ext/byte_buffer.cc +++ b/src/node/ext/byte_buffer.cc @@ -33,10 +33,10 @@ #include -#include #include -#include "grpc/grpc.h" +#include #include "grpc/byte_buffer_reader.h" +#include "grpc/grpc.h" #include "grpc/slice.h" #include "byte_buffer.h" diff --git a/src/node/ext/byte_buffer.h b/src/node/ext/byte_buffer.h index e8c4ac90bdd..6cb7a2601bd 100644 --- a/src/node/ext/byte_buffer.h +++ b/src/node/ext/byte_buffer.h @@ -36,8 +36,8 @@ #include -#include #include +#include #include "grpc/grpc.h" namespace grpc { diff --git a/src/node/ext/call.cc b/src/node/ext/call.cc index bd60775aad9..0f192ac90ad 100644 --- a/src/node/ext/call.cc +++ b/src/node/ext/call.cc @@ -31,23 +31,23 @@ * */ +#include #include #include -#include #include -#include "grpc/support/log.h" -#include "grpc/grpc.h" -#include "grpc/grpc_security.h" -#include "grpc/support/alloc.h" -#include "grpc/support/time.h" #include "byte_buffer.h" #include "call.h" +#include "call_credentials.h" #include "channel.h" #include "completion_queue.h" #include "completion_queue_async_worker.h" -#include "call_credentials.h" +#include "grpc/grpc.h" +#include "grpc/grpc_security.h" +#include "grpc/support/alloc.h" +#include "grpc/support/log.h" +#include "grpc/support/time.h" #include "slice.h" #include "timeval.h" @@ -101,20 +101,20 @@ bool CreateMetadataArray(Local metadata, grpc_metadata_array *array) { HandleScope scope; Local keys = Nan::GetOwnPropertyNames(metadata).ToLocalChecked(); for (unsigned int i = 0; i < keys->Length(); i++) { - Local current_key = Nan::To( - Nan::Get(keys, i).ToLocalChecked()).ToLocalChecked(); + Local current_key = + Nan::To(Nan::Get(keys, i).ToLocalChecked()).ToLocalChecked(); Local value_array = Nan::Get(metadata, current_key).ToLocalChecked(); if (!value_array->IsArray()) { return false; } array->capacity += Local::Cast(value_array)->Length(); } - array->metadata = reinterpret_cast( + array->metadata = reinterpret_cast( gpr_zalloc(array->capacity * sizeof(grpc_metadata))); for (unsigned int i = 0; i < keys->Length(); i++) { Local current_key(Nan::To(keys->Get(i)).ToLocalChecked()); - Local values = Local::Cast( - Nan::Get(metadata, current_key).ToLocalChecked()); + Local values = + Local::Cast(Nan::Get(metadata, current_key).ToLocalChecked()); grpc_slice key_slice = CreateSliceFromString(current_key); grpc_slice key_intern_slice = grpc_slice_intern(key_slice); grpc_slice_unref(key_slice); @@ -157,7 +157,7 @@ Local ParseMetadata(const grpc_metadata_array *metadata_array) { size_t length = metadata_array->count; Local metadata_object = Nan::New(); for (unsigned int i = 0; i < length; i++) { - grpc_metadata* elem = &metadata_elements[i]; + grpc_metadata *elem = &metadata_elements[i]; // TODO(murgatroid99): Use zero-copy string construction instead Local key_string = CopyStringFromSlice(elem->key); Local array; @@ -183,17 +183,12 @@ Local Op::GetOpType() const { return scope.Escape(Nan::New(GetTypeString()).ToLocalChecked()); } -Op::~Op() { -} +Op::~Op() {} class SendMetadataOp : public Op { public: - SendMetadataOp() { - grpc_metadata_array_init(&send_metadata); - } - ~SendMetadataOp() { - DestroyMetadataArray(&send_metadata); - } + SendMetadataOp() { grpc_metadata_array_init(&send_metadata); } + ~SendMetadataOp() { DestroyMetadataArray(&send_metadata); } Local GetNodeValue() const { EscapableHandleScope scope; return scope.Escape(Nan::True()); @@ -206,32 +201,26 @@ class SendMetadataOp : public Op { if (maybe_metadata.IsEmpty()) { return false; } - if (!CreateMetadataArray(maybe_metadata.ToLocalChecked(), - &send_metadata)) { + if (!CreateMetadataArray(maybe_metadata.ToLocalChecked(), &send_metadata)) { return false; } out->data.send_initial_metadata.count = send_metadata.count; out->data.send_initial_metadata.metadata = send_metadata.metadata; return true; } - bool IsFinalOp() { - return false; - } - void OnComplete(bool success) { - } + bool IsFinalOp() { return false; } + void OnComplete(bool success) {} + protected: - std::string GetTypeString() const { - return "send_metadata"; - } + std::string GetTypeString() const { return "send_metadata"; } + private: grpc_metadata_array send_metadata; }; class SendMessageOp : public Op { public: - SendMessageOp() { - send_message = NULL; - } + SendMessageOp() { send_message = NULL; } ~SendMessageOp() { if (send_message != NULL) { grpc_byte_buffer_destroy(send_message); @@ -246,8 +235,8 @@ class SendMessageOp : public Op { return false; } Local object_value = Nan::To(value).ToLocalChecked(); - MaybeLocal maybe_flag_value = Nan::Get( - object_value, Nan::New("grpcWriteFlags").ToLocalChecked()); + MaybeLocal maybe_flag_value = + Nan::Get(object_value, Nan::New("grpcWriteFlags").ToLocalChecked()); if (!maybe_flag_value.IsEmpty()) { Local flag_value = maybe_flag_value.ToLocalChecked(); if (flag_value->IsUint32()) { @@ -259,15 +248,12 @@ class SendMessageOp : public Op { out->data.send_message.send_message = send_message; return true; } - bool IsFinalOp() { - return false; - } - void OnComplete(bool success) { - } + bool IsFinalOp() { return false; } + void OnComplete(bool success) {} + protected: - std::string GetTypeString() const { - return "send_message"; - } + std::string GetTypeString() const { return "send_message"; } + private: grpc_byte_buffer *send_message; }; @@ -278,25 +264,17 @@ class SendClientCloseOp : public Op { EscapableHandleScope scope; return scope.Escape(Nan::True()); } - bool ParseOp(Local value, grpc_op *out) { - return true; - } - bool IsFinalOp() { - return false; - } - void OnComplete(bool success) { - } + bool ParseOp(Local value, grpc_op *out) { return true; } + bool IsFinalOp() { return false; } + void OnComplete(bool success) {} + protected: - std::string GetTypeString() const { - return "client_close"; - } + std::string GetTypeString() const { return "client_close"; } }; class SendServerStatusOp : public Op { public: - SendServerStatusOp() { - grpc_metadata_array_init(&status_metadata); - } + SendServerStatusOp() { grpc_metadata_array_init(&status_metadata); } ~SendServerStatusOp() { grpc_slice_unref(details); DestroyMetadataArray(&status_metadata); @@ -310,18 +288,18 @@ class SendServerStatusOp : public Op { return false; } Local server_status = Nan::To(value).ToLocalChecked(); - MaybeLocal maybe_metadata = Nan::Get( - server_status, Nan::New("metadata").ToLocalChecked()); + MaybeLocal maybe_metadata = + Nan::Get(server_status, Nan::New("metadata").ToLocalChecked()); if (maybe_metadata.IsEmpty()) { return false; } if (!maybe_metadata.ToLocalChecked()->IsObject()) { return false; } - Local metadata = Nan::To( - maybe_metadata.ToLocalChecked()).ToLocalChecked(); - MaybeLocal maybe_code = Nan::Get(server_status, - Nan::New("code").ToLocalChecked()); + Local metadata = + Nan::To(maybe_metadata.ToLocalChecked()).ToLocalChecked(); + MaybeLocal maybe_code = + Nan::Get(server_status, Nan::New("code").ToLocalChecked()); if (maybe_code.IsEmpty()) { return false; } @@ -329,16 +307,16 @@ class SendServerStatusOp : public Op { return false; } uint32_t code = Nan::To(maybe_code.ToLocalChecked()).FromJust(); - MaybeLocal maybe_details = Nan::Get( - server_status, Nan::New("details").ToLocalChecked()); + MaybeLocal maybe_details = + Nan::Get(server_status, Nan::New("details").ToLocalChecked()); if (maybe_details.IsEmpty()) { return false; } if (!maybe_details.ToLocalChecked()->IsString()) { return false; } - Local details = Nan::To( - maybe_details.ToLocalChecked()).ToLocalChecked(); + Local details = + Nan::To(maybe_details.ToLocalChecked()).ToLocalChecked(); if (!CreateMetadataArray(metadata, &status_metadata)) { return false; } @@ -352,15 +330,11 @@ class SendServerStatusOp : public Op { out->data.send_status_from_server.status_details = &this->details; return true; } - bool IsFinalOp() { - return true; - } - void OnComplete(bool success) { - } + bool IsFinalOp() { return true; } + void OnComplete(bool success) {} + protected: - std::string GetTypeString() const { - return "send_status"; - } + std::string GetTypeString() const { return "send_status"; } private: grpc_slice details; @@ -369,13 +343,9 @@ class SendServerStatusOp : public Op { class GetMetadataOp : public Op { public: - GetMetadataOp() { - grpc_metadata_array_init(&recv_metadata); - } + GetMetadataOp() { grpc_metadata_array_init(&recv_metadata); } - ~GetMetadataOp() { - grpc_metadata_array_destroy(&recv_metadata); - } + ~GetMetadataOp() { grpc_metadata_array_destroy(&recv_metadata); } Local GetNodeValue() const { EscapableHandleScope scope; @@ -386,16 +356,11 @@ class GetMetadataOp : public Op { out->data.recv_initial_metadata.recv_initial_metadata = &recv_metadata; return true; } - bool IsFinalOp() { - return false; - } - void OnComplete(bool success) { - } + bool IsFinalOp() { return false; } + void OnComplete(bool success) {} protected: - std::string GetTypeString() const { - return "metadata"; - } + std::string GetTypeString() const { return "metadata"; } private: grpc_metadata_array recv_metadata; @@ -403,9 +368,7 @@ class GetMetadataOp : public Op { class ReadMessageOp : public Op { public: - ReadMessageOp() { - recv_message = NULL; - } + ReadMessageOp() { recv_message = NULL; } ~ReadMessageOp() { if (recv_message != NULL) { grpc_byte_buffer_destroy(recv_message); @@ -420,16 +383,11 @@ class ReadMessageOp : public Op { out->data.recv_message.recv_message = &recv_message; return true; } - bool IsFinalOp() { - return false; - } - void OnComplete(bool success) { - } + bool IsFinalOp() { return false; } + void OnComplete(bool success) {} protected: - std::string GetTypeString() const { - return "read"; - } + std::string GetTypeString() const { return "read"; } private: grpc_byte_buffer *recv_message; @@ -437,13 +395,9 @@ class ReadMessageOp : public Op { class ClientStatusOp : public Op { public: - ClientStatusOp() { - grpc_metadata_array_init(&metadata_array); - } + ClientStatusOp() { grpc_metadata_array_init(&metadata_array); } - ~ClientStatusOp() { - grpc_metadata_array_destroy(&metadata_array); - } + ~ClientStatusOp() { grpc_metadata_array_destroy(&metadata_array); } bool ParseOp(Local value, grpc_op *out) { out->data.recv_status_on_client.trailing_metadata = &metadata_array; @@ -456,22 +410,19 @@ class ClientStatusOp : public Op { EscapableHandleScope scope; Local status_obj = Nan::New(); Nan::Set(status_obj, Nan::New("code").ToLocalChecked(), - Nan::New(status)); + Nan::New(status)); Nan::Set(status_obj, Nan::New("details").ToLocalChecked(), - CopyStringFromSlice(status_details)); + CopyStringFromSlice(status_details)); Nan::Set(status_obj, Nan::New("metadata").ToLocalChecked(), ParseMetadata(&metadata_array)); return scope.Escape(status_obj); } - bool IsFinalOp() { - return true; - } - void OnComplete(bool success) { - } + bool IsFinalOp() { return true; } + void OnComplete(bool success) {} + protected: - std::string GetTypeString() const { - return "status"; - } + std::string GetTypeString() const { return "status"; } + private: grpc_metadata_array metadata_array; grpc_status_code status; @@ -489,23 +440,18 @@ class ServerCloseResponseOp : public Op { out->data.recv_close_on_server.cancelled = &cancelled; return true; } - bool IsFinalOp() { - return false; - } - void OnComplete(bool success) { - } + bool IsFinalOp() { return false; } + void OnComplete(bool success) {} protected: - std::string GetTypeString() const { - return "cancelled"; - } + std::string GetTypeString() const { return "cancelled"; } private: int cancelled; }; -tag::tag(Callback *callback, OpVec *ops, Call *call, Local call_value) : - callback(callback), ops(ops), call(call){ +tag::tag(Callback *callback, OpVec *ops, Call *call, Local call_value) + : callback(callback), ops(ops), call(call) { HandleScope scope; call_persist.Reset(call_value); } @@ -560,14 +506,10 @@ void Call::DestroyCall() { } } -Call::Call(grpc_call *call) : wrapped_call(call), - pending_batches(0), - has_final_op_completed(false) { -} +Call::Call(grpc_call *call) + : wrapped_call(call), pending_batches(0), has_final_op_completed(false) {} -Call::~Call() { - DestroyCall(); -} +Call::~Call() { DestroyCall(); } void Call::Init(Local exports) { HandleScope scope; @@ -596,10 +538,10 @@ Local Call::WrapStruct(grpc_call *call) { return scope.Escape(Nan::Null()); } const int argc = 1; - Local argv[argc] = {Nan::New( - reinterpret_cast(call))}; - MaybeLocal maybe_instance = Nan::NewInstance( - constructor->GetFunction(), argc, argv); + Local argv[argc] = { + Nan::New(reinterpret_cast(call))}; + MaybeLocal maybe_instance = + Nan::NewInstance(constructor->GetFunction(), argc, argv); if (maybe_instance.IsEmpty()) { return scope.Escape(Nan::Null()); } else { @@ -631,8 +573,7 @@ NAN_METHOD(Call::New) { if (info[0]->IsExternal()) { Local ext = info[0].As(); // This option is used for wrapping an existing call - grpc_call *call_value = - reinterpret_cast(ext->Value()); + grpc_call *call_value = reinterpret_cast(ext->Value()); call = new Call(call_value); } else { if (!Channel::HasInstance(info[0])) { @@ -648,8 +589,8 @@ NAN_METHOD(Call::New) { // These arguments are at the end because they are optional grpc_call *parent_call = NULL; if (Call::HasInstance(info[4])) { - Call *parent_obj = ObjectWrap::Unwrap( - Nan::To(info[4]).ToLocalChecked()); + Call *parent_obj = + ObjectWrap::Unwrap(Nan::To(info[4]).ToLocalChecked()); parent_call = parent_obj->wrapped_call; } else if (!(info[4]->IsUndefined() || info[4]->IsNull())) { return Nan::ThrowTypeError( @@ -670,22 +611,20 @@ NAN_METHOD(Call::New) { double deadline = Nan::To(info[2]).FromJust(); grpc_channel *wrapped_channel = channel->GetWrappedChannel(); grpc_call *wrapped_call; - grpc_slice method = CreateSliceFromString( - Nan::To(info[1]).ToLocalChecked()); + grpc_slice method = + CreateSliceFromString(Nan::To(info[1]).ToLocalChecked()); if (info[3]->IsString()) { grpc_slice *host = new grpc_slice; - *host = CreateSliceFromString( - Nan::To(info[3]).ToLocalChecked()); + *host = + CreateSliceFromString(Nan::To(info[3]).ToLocalChecked()); wrapped_call = grpc_channel_create_call( - wrapped_channel, parent_call, propagate_flags, - GetCompletionQueue(), method, - host, MillisecondsToTimespec(deadline), NULL); + wrapped_channel, parent_call, propagate_flags, GetCompletionQueue(), + method, host, MillisecondsToTimespec(deadline), NULL); delete host; } else if (info[3]->IsUndefined() || info[3]->IsNull()) { wrapped_call = grpc_channel_create_call( - wrapped_channel, parent_call, propagate_flags, - GetCompletionQueue(), method, - NULL, MillisecondsToTimespec(deadline), NULL); + wrapped_channel, parent_call, propagate_flags, GetCompletionQueue(), + method, NULL, MillisecondsToTimespec(deadline), NULL); } else { return Nan::ThrowTypeError("Call's fourth argument must be a string"); } @@ -699,8 +638,8 @@ NAN_METHOD(Call::New) { } else { const int argc = 4; Local argv[argc] = {info[0], info[1], info[2], info[3]}; - MaybeLocal maybe_instance = Nan::NewInstance( - constructor->GetFunction(), argc, argv); + MaybeLocal maybe_instance = + Nan::NewInstance(constructor->GetFunction(), argc, argv); if (maybe_instance.IsEmpty()) { // There's probably a pending exception return; @@ -773,8 +712,8 @@ NAN_METHOD(Call::StartBatch) { } Callback *callback = new Callback(callback_func); grpc_call_error error = grpc_call_start_batch( - call->wrapped_call, &ops[0], nops, new struct tag( - callback, op_vector.release(), call, info.This()), NULL); + call->wrapped_call, &ops[0], nops, + new struct tag(callback, op_vector.release(), call, info.This()), NULL); if (error != GRPC_CALL_OK) { return Nan::ThrowError(nanErrorWithCode("startBatch failed", error)); } @@ -807,8 +746,8 @@ NAN_METHOD(Call::CancelWithStatus) { "cancelWithStatus's second argument must be a string"); } Call *call = ObjectWrap::Unwrap(info.This()); - grpc_status_code code = static_cast( - Nan::To(info[0]).FromJust()); + grpc_status_code code = + static_cast(Nan::To(info[0]).FromJust()); if (code == GRPC_STATUS_OK) { return Nan::ThrowRangeError( "cancelWithStatus cannot be called with OK status"); diff --git a/src/node/ext/call.h b/src/node/ext/call.h index 340e32682b9..0bd24f56a9a 100644 --- a/src/node/ext/call.h +++ b/src/node/ext/call.h @@ -37,14 +37,13 @@ #include #include -#include #include +#include #include "grpc/grpc.h" #include "grpc/support/log.h" #include "channel.h" - namespace grpc { namespace node { diff --git a/src/node/ext/call_credentials.cc b/src/node/ext/call_credentials.cc index 5bd4bdcd5ab..f88eb829334 100644 --- a/src/node/ext/call_credentials.cc +++ b/src/node/ext/call_credentials.cc @@ -31,17 +31,17 @@ * */ -#include #include +#include #include #include +#include "call.h" +#include "call_credentials.h" #include "grpc/grpc.h" #include "grpc/grpc_security.h" #include "grpc/support/log.h" -#include "call_credentials.h" -#include "call.h" namespace grpc { namespace node { @@ -86,15 +86,15 @@ void CallCredentials::Init(Local exports) { fun_tpl.Reset(tpl); Local ctr = Nan::GetFunction(tpl).ToLocalChecked(); Nan::Set(ctr, Nan::New("createFromPlugin").ToLocalChecked(), - Nan::GetFunction( - Nan::New(CreateFromPlugin)).ToLocalChecked()); + Nan::GetFunction(Nan::New(CreateFromPlugin)) + .ToLocalChecked()); Nan::Set(exports, Nan::New("CallCredentials").ToLocalChecked(), ctr); constructor = new Nan::Callback(ctr); Local callback_tpl = Nan::New(PluginCallback); - plugin_callback = new Callback( - Nan::GetFunction(callback_tpl).ToLocalChecked()); + plugin_callback = + new Callback(Nan::GetFunction(callback_tpl).ToLocalChecked()); } bool CallCredentials::HasInstance(Local val) { @@ -109,9 +109,9 @@ Local CallCredentials::WrapStruct(grpc_call_credentials *credentials) { return scope.Escape(Nan::Null()); } Local argv[argc] = { - Nan::New(reinterpret_cast(credentials))}; - MaybeLocal maybe_instance = Nan::NewInstance( - constructor->GetFunction(), argc, argv); + Nan::New(reinterpret_cast(credentials))}; + MaybeLocal maybe_instance = + Nan::NewInstance(constructor->GetFunction(), argc, argv); if (maybe_instance.IsEmpty()) { return scope.Escape(Nan::Null()); } else { @@ -160,8 +160,6 @@ NAN_METHOD(CallCredentials::Compose) { info.GetReturnValue().Set(WrapStruct(creds)); } - - NAN_METHOD(CallCredentials::CreateFromPlugin) { if (!info[0]->IsFunction()) { return Nan::ThrowTypeError( @@ -170,21 +168,19 @@ NAN_METHOD(CallCredentials::CreateFromPlugin) { grpc_metadata_credentials_plugin plugin; plugin_state *state = new plugin_state; state->callback = new Nan::Callback(info[0].As()); - state->pending_callbacks = new std::queue(); + state->pending_callbacks = new std::queue(); uv_mutex_init(&state->plugin_mutex); - uv_async_init(uv_default_loop(), - &state->plugin_async, - SendPluginCallback); - uv_unref((uv_handle_t*)&state->plugin_async); + uv_async_init(uv_default_loop(), &state->plugin_async, SendPluginCallback); + uv_unref((uv_handle_t *)&state->plugin_async); state->plugin_async.data = state; plugin.get_metadata = plugin_get_metadata; plugin.destroy = plugin_destroy_state; - plugin.state = reinterpret_cast(state); + plugin.state = reinterpret_cast(state); plugin.type = ""; - grpc_call_credentials *creds = grpc_metadata_credentials_create_from_plugin( - plugin, NULL); + grpc_call_credentials *creds = + grpc_metadata_credentials_create_from_plugin(plugin, NULL); info.GetReturnValue().Set(WrapStruct(creds)); } @@ -206,34 +202,35 @@ NAN_METHOD(PluginCallback) { return Nan::ThrowTypeError( "The callback's fourth argument must be an object"); } - grpc_status_code code = static_cast( - Nan::To(info[0]).FromJust()); + grpc_status_code code = + static_cast(Nan::To(info[0]).FromJust()); Utf8String details_utf8_str(info[1]); char *details = *details_utf8_str; grpc_metadata_array array; grpc_metadata_array_init(&array); Local callback_data = Nan::To(info[3]).ToLocalChecked(); - if (!CreateMetadataArray(Nan::To(info[2]).ToLocalChecked(), - &array)){ + if (!CreateMetadataArray(Nan::To(info[2]).ToLocalChecked(), &array)) { return Nan::ThrowError("Failed to parse metadata"); } grpc_credentials_plugin_metadata_cb cb = reinterpret_cast( - Nan::Get(callback_data, - Nan::New("cb").ToLocalChecked() - ).ToLocalChecked().As()->Value()); + Nan::Get(callback_data, Nan::New("cb").ToLocalChecked()) + .ToLocalChecked() + .As() + ->Value()); void *user_data = - Nan::Get(callback_data, - Nan::New("user_data").ToLocalChecked() - ).ToLocalChecked().As()->Value(); + Nan::Get(callback_data, Nan::New("user_data").ToLocalChecked()) + .ToLocalChecked() + .As() + ->Value(); cb(user_data, array.metadata, array.count, code, details); DestroyMetadataArray(&array); } NAUV_WORK_CB(SendPluginCallback) { Nan::HandleScope scope; - plugin_state *state = reinterpret_cast(async->data); - std::queue callbacks; + plugin_state *state = reinterpret_cast(async->data); + std::queue callbacks; uv_mutex_lock(&state->plugin_mutex); state->pending_callbacks->swap(callbacks); uv_mutex_unlock(&state->plugin_mutex); @@ -242,16 +239,14 @@ NAUV_WORK_CB(SendPluginCallback) { callbacks.pop(); Local callback_data = Nan::New(); Nan::Set(callback_data, Nan::New("cb").ToLocalChecked(), - Nan::New(reinterpret_cast(data->cb))); + Nan::New(reinterpret_cast(data->cb))); Nan::Set(callback_data, Nan::New("user_data").ToLocalChecked(), Nan::New(data->user_data)); const int argc = 3; v8::Local argv[argc] = { - Nan::New(data->service_url).ToLocalChecked(), - callback_data, - // Get Local from Nan::Callback* - **plugin_callback - }; + Nan::New(data->service_url).ToLocalChecked(), callback_data, + // Get Local from Nan::Callback* + **plugin_callback}; Nan::Callback *callback = state->callback; callback->Call(argc, argv); delete data; @@ -261,7 +256,7 @@ NAUV_WORK_CB(SendPluginCallback) { void plugin_get_metadata(void *state, grpc_auth_metadata_context context, grpc_credentials_plugin_metadata_cb cb, void *user_data) { - plugin_state *p_state = reinterpret_cast(state); + plugin_state *p_state = reinterpret_cast(state); plugin_callback_data *data = new plugin_callback_data; data->service_url = context.service_url; data->cb = cb; @@ -275,7 +270,7 @@ void plugin_get_metadata(void *state, grpc_auth_metadata_context context, } void plugin_uv_close_cb(uv_handle_t *handle) { - uv_async_t *async = reinterpret_cast(handle); + uv_async_t *async = reinterpret_cast(handle); plugin_state *state = reinterpret_cast(async->data); uv_mutex_destroy(&state->plugin_mutex); delete state->pending_callbacks; @@ -285,7 +280,7 @@ void plugin_uv_close_cb(uv_handle_t *handle) { void plugin_destroy_state(void *ptr) { plugin_state *state = reinterpret_cast(ptr); - uv_close((uv_handle_t*)&state->plugin_async, plugin_uv_close_cb); + uv_close((uv_handle_t *)&state->plugin_async, plugin_uv_close_cb); } } // namespace node diff --git a/src/node/ext/call_credentials.h b/src/node/ext/call_credentials.h index 21a4b8923e2..5a1741c606f 100644 --- a/src/node/ext/call_credentials.h +++ b/src/node/ext/call_credentials.h @@ -36,8 +36,8 @@ #include -#include #include +#include #include #include "grpc/grpc_security.h" @@ -84,7 +84,7 @@ typedef struct plugin_callback_data { typedef struct plugin_state { Nan::Callback *callback; - std::queue *pending_callbacks; + std::queue *pending_callbacks; uv_mutex_t plugin_mutex; // async.data == this uv_async_t plugin_async; diff --git a/src/node/ext/channel.cc b/src/node/ext/channel.cc index 1263cc0d286..be04cf421d6 100644 --- a/src/node/ext/channel.cc +++ b/src/node/ext/channel.cc @@ -35,15 +35,15 @@ #include "grpc/support/log.h" -#include #include -#include "grpc/grpc.h" -#include "grpc/grpc_security.h" +#include #include "call.h" #include "channel.h" +#include "channel_credentials.h" #include "completion_queue.h" #include "completion_queue_async_worker.h" -#include "channel_credentials.h" +#include "grpc/grpc.h" +#include "grpc/grpc_security.h" #include "timeval.h" namespace grpc { @@ -82,8 +82,8 @@ bool ParseChannelArgs(Local args_val, *channel_args_ptr = NULL; return false; } - grpc_channel_args *channel_args = reinterpret_cast( - malloc(sizeof(grpc_channel_args))); + grpc_channel_args *channel_args = + reinterpret_cast(malloc(sizeof(grpc_channel_args))); *channel_args_ptr = channel_args; Local args_hash = Nan::To(args_val).ToLocalChecked(); Local keys = Nan::GetOwnPropertyNames(args_hash).ToLocalChecked(); @@ -104,16 +104,16 @@ bool ParseChannelArgs(Local args_val, } else if (value->IsString()) { Utf8String val_str(value); channel_args->args[i].type = GRPC_ARG_STRING; - channel_args->args[i].value.string = reinterpret_cast( - calloc(val_str.length() + 1,sizeof(char))); - memcpy(channel_args->args[i].value.string, - *val_str, val_str.length() + 1); + channel_args->args[i].value.string = + reinterpret_cast(calloc(val_str.length() + 1, sizeof(char))); + memcpy(channel_args->args[i].value.string, *val_str, + val_str.length() + 1); } else { // The value does not match either of the accepted types return false; } - channel_args->args[i].key = reinterpret_cast( - calloc(key_str.length() + 1, sizeof(char))); + channel_args->args[i].key = + reinterpret_cast(calloc(key_str.length() + 1, sizeof(char))); memcpy(channel_args->args[i].key, *key_str, key_str.length() + 1); } return true; @@ -190,12 +190,13 @@ NAN_METHOD(Channel::New) { grpc_channel_args *channel_args_ptr = NULL; if (!ParseChannelArgs(info[2], &channel_args_ptr)) { DeallocateChannelArgs(channel_args_ptr); - return Nan::ThrowTypeError("Channel options must be an object with " - "string keys and integer or string values"); + return Nan::ThrowTypeError( + "Channel options must be an object with " + "string keys and integer or string values"); } if (creds == NULL) { - wrapped_channel = grpc_insecure_channel_create(*host, channel_args_ptr, - NULL); + wrapped_channel = + grpc_insecure_channel_create(*host, channel_args_ptr, NULL); } else { wrapped_channel = grpc_secure_channel_create(creds, *host, channel_args_ptr, NULL); @@ -208,8 +209,8 @@ NAN_METHOD(Channel::New) { } else { const int argc = 3; Local argv[argc] = {info[0], info[1], info[2]}; - MaybeLocal maybe_instance = Nan::NewInstance( - constructor->GetFunction(), argc, argv); + MaybeLocal maybe_instance = + Nan::NewInstance(constructor->GetFunction(), argc, argv); if (maybe_instance.IsEmpty()) { // There's probably a pending exception return; @@ -232,11 +233,13 @@ NAN_METHOD(Channel::Close) { NAN_METHOD(Channel::GetTarget) { if (!HasInstance(info.This())) { - return Nan::ThrowTypeError("getTarget can only be called on Channel objects"); + return Nan::ThrowTypeError( + "getTarget can only be called on Channel objects"); } Channel *channel = ObjectWrap::Unwrap(info.This()); - info.GetReturnValue().Set(Nan::New( - grpc_channel_get_target(channel->wrapped_channel)).ToLocalChecked()); + info.GetReturnValue().Set( + Nan::New(grpc_channel_get_target(channel->wrapped_channel)) + .ToLocalChecked()); } NAN_METHOD(Channel::GetConnectivityState) { @@ -246,9 +249,8 @@ NAN_METHOD(Channel::GetConnectivityState) { } Channel *channel = ObjectWrap::Unwrap(info.This()); int try_to_connect = (int)info[0]->Equals(Nan::True()); - info.GetReturnValue().Set( - grpc_channel_check_connectivity_state(channel->wrapped_channel, - try_to_connect)); + info.GetReturnValue().Set(grpc_channel_check_connectivity_state( + channel->wrapped_channel, try_to_connect)); } NAN_METHOD(Channel::WatchConnectivityState) { @@ -268,9 +270,8 @@ NAN_METHOD(Channel::WatchConnectivityState) { return Nan::ThrowTypeError( "watchConnectivityState's third argument must be a callback"); } - grpc_connectivity_state last_state = - static_cast( - Nan::To(info[0]).FromJust()); + grpc_connectivity_state last_state = static_cast( + Nan::To(info[0]).FromJust()); double deadline = Nan::To(info[1]).FromJust(); Local callback_func = info[2].As(); Nan::Callback *callback = new Callback(callback_func); @@ -279,8 +280,7 @@ NAN_METHOD(Channel::WatchConnectivityState) { grpc_channel_watch_connectivity_state( channel->wrapped_channel, last_state, MillisecondsToTimespec(deadline), GetCompletionQueue(), - new struct tag(callback, - ops.release(), NULL, Nan::Null())); + new struct tag(callback, ops.release(), NULL, Nan::Null())); CompletionQueueNext(); } diff --git a/src/node/ext/channel.h b/src/node/ext/channel.h index 9ec28e15af0..6d42a5e0406 100644 --- a/src/node/ext/channel.h +++ b/src/node/ext/channel.h @@ -34,8 +34,8 @@ #ifndef NET_GRPC_NODE_CHANNEL_H_ #define NET_GRPC_NODE_CHANNEL_H_ -#include #include +#include #include "grpc/grpc.h" namespace grpc { diff --git a/src/node/ext/channel_credentials.cc b/src/node/ext/channel_credentials.cc index 059bc8a8902..cf1dc318a8f 100644 --- a/src/node/ext/channel_credentials.cc +++ b/src/node/ext/channel_credentials.cc @@ -33,12 +33,12 @@ #include +#include "call.h" +#include "call_credentials.h" +#include "channel_credentials.h" #include "grpc/grpc.h" #include "grpc/grpc_security.h" #include "grpc/support/log.h" -#include "channel_credentials.h" -#include "call_credentials.h" -#include "call.h" namespace grpc { namespace node { @@ -80,12 +80,12 @@ void ChannelCredentials::Init(Local exports) { Nan::SetPrototypeMethod(tpl, "compose", Compose); fun_tpl.Reset(tpl); Local ctr = Nan::GetFunction(tpl).ToLocalChecked(); - Nan::Set(ctr, Nan::New("createSsl").ToLocalChecked(), - Nan::GetFunction( - Nan::New(CreateSsl)).ToLocalChecked()); + Nan::Set( + ctr, Nan::New("createSsl").ToLocalChecked(), + Nan::GetFunction(Nan::New(CreateSsl)).ToLocalChecked()); Nan::Set(ctr, Nan::New("createInsecure").ToLocalChecked(), - Nan::GetFunction( - Nan::New(CreateInsecure)).ToLocalChecked()); + Nan::GetFunction(Nan::New(CreateInsecure)) + .ToLocalChecked()); Nan::Set(exports, Nan::New("ChannelCredentials").ToLocalChecked(), ctr); constructor = new Nan::Callback(ctr); } @@ -100,9 +100,9 @@ Local ChannelCredentials::WrapStruct( EscapableHandleScope scope; const int argc = 1; Local argv[argc] = { - Nan::New(reinterpret_cast(credentials))}; - MaybeLocal maybe_instance = Nan::NewInstance( - constructor->GetFunction(), argc, argv); + Nan::New(reinterpret_cast(credentials))}; + MaybeLocal maybe_instance = + Nan::NewInstance(constructor->GetFunction(), argc, argv); if (maybe_instance.IsEmpty()) { return scope.Escape(Nan::Null()); } else { @@ -179,11 +179,10 @@ NAN_METHOD(ChannelCredentials::Compose) { return Nan::ThrowTypeError( "compose's first argument must be a CallCredentials object"); } - ChannelCredentials *self = ObjectWrap::Unwrap( - info.This()); + ChannelCredentials *self = + ObjectWrap::Unwrap(info.This()); if (self->wrapped_credentials == NULL) { - return Nan::ThrowTypeError( - "Cannot compose insecure credential"); + return Nan::ThrowTypeError("Cannot compose insecure credential"); } CallCredentials *other = ObjectWrap::Unwrap( Nan::To(info[0]).ToLocalChecked()); diff --git a/src/node/ext/channel_credentials.h b/src/node/ext/channel_credentials.h index 89b115267f3..e5c7439de27 100644 --- a/src/node/ext/channel_credentials.h +++ b/src/node/ext/channel_credentials.h @@ -34,8 +34,8 @@ #ifndef NET_GRPC_NODE_CHANNEL_CREDENTIALS_H_ #define NET_GRPC_NODE_CHANNEL_CREDENTIALS_H_ -#include #include +#include #include "grpc/grpc.h" #include "grpc/grpc_security.h" diff --git a/src/node/ext/completion_queue.h b/src/node/ext/completion_queue.h index 9b01028ef17..a3a055c385a 100644 --- a/src/node/ext/completion_queue.h +++ b/src/node/ext/completion_queue.h @@ -31,8 +31,8 @@ * */ -#include #include +#include namespace grpc { namespace node { diff --git a/src/node/ext/node_grpc.cc b/src/node/ext/node_grpc.cc index 122e5e63ee9..076f1ed4242 100644 --- a/src/node/ext/node_grpc.cc +++ b/src/node/ext/node_grpc.cc @@ -33,8 +33,8 @@ #include -#include #include +#include #include #include "grpc/grpc.h" #include "grpc/grpc_security.h" @@ -53,12 +53,12 @@ extern "C" { #include "call_credentials.h" #include "channel.h" #include "channel_credentials.h" -#include "server.h" +#include "completion_queue.h" #include "completion_queue_async_worker.h" +#include "server.h" #include "server_credentials.h" #include "slice.h" #include "timeval.h" -#include "completion_queue.h" using grpc::node::CreateSliceFromString; @@ -188,8 +188,7 @@ void InitOpTypeConstants(Local exports) { Nan::New(GRPC_OP_SEND_INITIAL_METADATA)); Nan::Set(op_type, Nan::New("SEND_INITIAL_METADATA").ToLocalChecked(), SEND_INITIAL_METADATA); - Local SEND_MESSAGE( - Nan::New(GRPC_OP_SEND_MESSAGE)); + Local SEND_MESSAGE(Nan::New(GRPC_OP_SEND_MESSAGE)); Nan::Set(op_type, Nan::New("SEND_MESSAGE").ToLocalChecked(), SEND_MESSAGE); Local SEND_CLOSE_FROM_CLIENT( Nan::New(GRPC_OP_SEND_CLOSE_FROM_CLIENT)); @@ -203,8 +202,7 @@ void InitOpTypeConstants(Local exports) { Nan::New(GRPC_OP_RECV_INITIAL_METADATA)); Nan::Set(op_type, Nan::New("RECV_INITIAL_METADATA").ToLocalChecked(), RECV_INITIAL_METADATA); - Local RECV_MESSAGE( - Nan::New(GRPC_OP_RECV_MESSAGE)); + Local RECV_MESSAGE(Nan::New(GRPC_OP_RECV_MESSAGE)); Nan::Set(op_type, Nan::New("RECV_MESSAGE").ToLocalChecked(), RECV_MESSAGE); Local RECV_STATUS_ON_CLIENT( Nan::New(GRPC_OP_RECV_STATUS_ON_CLIENT)); @@ -252,8 +250,7 @@ void InitConnectivityStateConstants(Local exports) { Nan::New(GRPC_CHANNEL_TRANSIENT_FAILURE)); Nan::Set(channel_state, Nan::New("TRANSIENT_FAILURE").ToLocalChecked(), TRANSIENT_FAILURE); - Local FATAL_FAILURE( - Nan::New(GRPC_CHANNEL_SHUTDOWN)); + Local FATAL_FAILURE(Nan::New(GRPC_CHANNEL_SHUTDOWN)); Nan::Set(channel_state, Nan::New("FATAL_FAILURE").ToLocalChecked(), FATAL_FAILURE); } @@ -282,13 +279,11 @@ void InitLogConstants(Local exports) { NAN_METHOD(MetadataKeyIsLegal) { if (!info[0]->IsString()) { - return Nan::ThrowTypeError( - "headerKeyIsLegal's argument must be a string"); + return Nan::ThrowTypeError("headerKeyIsLegal's argument must be a string"); } Local key = Nan::To(info[0]).ToLocalChecked(); grpc_slice slice = CreateSliceFromString(key); - info.GetReturnValue().Set(static_cast( - grpc_header_key_is_legal(slice))); + info.GetReturnValue().Set(static_cast(grpc_header_key_is_legal(slice))); grpc_slice_unref(slice); } @@ -299,8 +294,8 @@ NAN_METHOD(MetadataNonbinValueIsLegal) { } Local value = Nan::To(info[0]).ToLocalChecked(); grpc_slice slice = CreateSliceFromString(value); - info.GetReturnValue().Set(static_cast( - grpc_header_nonbin_value_is_legal(slice))); + info.GetReturnValue().Set( + static_cast(grpc_header_nonbin_value_is_legal(slice))); grpc_slice_unref(slice); } @@ -311,8 +306,7 @@ NAN_METHOD(MetadataKeyIsBinary) { } Local key = Nan::To(info[0]).ToLocalChecked(); grpc_slice slice = CreateSliceFromString(key); - info.GetReturnValue().Set(static_cast( - grpc_is_binary_header(slice))); + info.GetReturnValue().Set(static_cast(grpc_is_binary_header(slice))); grpc_slice_unref(slice); } @@ -354,11 +348,13 @@ NAUV_WORK_CB(LogMessagesCallback) { args.pop(); Local file = Nan::New(arg->core_args.file).ToLocalChecked(); Local line = Nan::New(arg->core_args.line); - Local severity = Nan::New( - gpr_log_severity_string(arg->core_args.severity)).ToLocalChecked(); + Local severity = + Nan::New(gpr_log_severity_string(arg->core_args.severity)) + .ToLocalChecked(); Local message = Nan::New(arg->core_args.message).ToLocalChecked(); - Local timestamp = Nan::New( - grpc::node::TimespecToMilliseconds(arg->timestamp)).ToLocalChecked(); + Local timestamp = + Nan::New(grpc::node::TimespecToMilliseconds(arg->timestamp)) + .ToLocalChecked(); const int argc = 5; Local argv[argc] = {file, line, severity, message, timestamp}; grpc_logger_state.callback->Call(argc, argv); @@ -388,10 +384,9 @@ void init_logger() { memset(&grpc_logger_state, 0, sizeof(logger_state)); grpc_logger_state.pending_args = new std::queue(); uv_mutex_init(&grpc_logger_state.mutex); - uv_async_init(uv_default_loop(), - &grpc_logger_state.async, + uv_async_init(uv_default_loop(), &grpc_logger_state.async, LogMessagesCallback); - uv_unref((uv_handle_t*)&grpc_logger_state.async); + uv_unref((uv_handle_t *)&grpc_logger_state.async); grpc_logger_state.logger_set = false; gpr_log_verbosity_init(); @@ -416,11 +411,10 @@ NAN_METHOD(SetDefaultLoggerCallback) { NAN_METHOD(SetLogVerbosity) { if (!info[0]->IsUint32()) { - return Nan::ThrowTypeError( - "setLogVerbosity's argument must be a number"); + return Nan::ThrowTypeError("setLogVerbosity's argument must be a number"); } - gpr_log_severity severity = static_cast( - Nan::To(info[0]).FromJust()); + gpr_log_severity severity = + static_cast(Nan::To(info[0]).FromJust()); gpr_set_log_verbosity(severity); } @@ -453,28 +447,25 @@ void init(Local exports) { // Attach a few utility functions directly to the module Nan::Set(exports, Nan::New("metadataKeyIsLegal").ToLocalChecked(), - Nan::GetFunction( - Nan::New(MetadataKeyIsLegal)).ToLocalChecked()); - Nan::Set(exports, Nan::New("metadataNonbinValueIsLegal").ToLocalChecked(), - Nan::GetFunction( - Nan::New(MetadataNonbinValueIsLegal) - ).ToLocalChecked()); + Nan::GetFunction(Nan::New(MetadataKeyIsLegal)) + .ToLocalChecked()); + Nan::Set( + exports, Nan::New("metadataNonbinValueIsLegal").ToLocalChecked(), + Nan::GetFunction(Nan::New(MetadataNonbinValueIsLegal)) + .ToLocalChecked()); Nan::Set(exports, Nan::New("metadataKeyIsBinary").ToLocalChecked(), - Nan::GetFunction( - Nan::New(MetadataKeyIsBinary) - ).ToLocalChecked()); + Nan::GetFunction(Nan::New(MetadataKeyIsBinary)) + .ToLocalChecked()); Nan::Set(exports, Nan::New("setDefaultRootsPem").ToLocalChecked(), - Nan::GetFunction( - Nan::New(SetDefaultRootsPem) - ).ToLocalChecked()); - Nan::Set(exports, Nan::New("setDefaultLoggerCallback").ToLocalChecked(), - Nan::GetFunction( - Nan::New(SetDefaultLoggerCallback) - ).ToLocalChecked()); + Nan::GetFunction(Nan::New(SetDefaultRootsPem)) + .ToLocalChecked()); + Nan::Set( + exports, Nan::New("setDefaultLoggerCallback").ToLocalChecked(), + Nan::GetFunction(Nan::New(SetDefaultLoggerCallback)) + .ToLocalChecked()); Nan::Set(exports, Nan::New("setLogVerbosity").ToLocalChecked(), - Nan::GetFunction( - Nan::New(SetLogVerbosity) - ).ToLocalChecked()); + Nan::GetFunction(Nan::New(SetLogVerbosity)) + .ToLocalChecked()); } NODE_MODULE(grpc_node, init) diff --git a/src/node/ext/server.cc b/src/node/ext/server.cc index 5384305631d..1871a324528 100644 --- a/src/node/ext/server.cc +++ b/src/node/ext/server.cc @@ -111,14 +111,9 @@ class NewCallOp : public Op { return scope.Escape(obj); } - bool ParseOp(Local value, grpc_op *out) { - return true; - } - bool IsFinalOp() { - return false; - } - void OnComplete(bool success) { - } + bool ParseOp(Local value, grpc_op *out) { return true; } + bool IsFinalOp() { return false; } + void OnComplete(bool success) {} grpc_call *call; grpc_call_details details; @@ -128,7 +123,7 @@ class NewCallOp : public Op { std::string GetTypeString() const { return "new_call"; } }; -class TryShutdownOp: public Op { +class TryShutdownOp : public Op { public: TryShutdownOp(Server *server, Local server_value) : server(server) { server_persist.Reset(server_value); @@ -137,19 +132,17 @@ class TryShutdownOp: public Op { EscapableHandleScope scope; return scope.Escape(Nan::New(server_persist)); } - bool ParseOp(Local value, grpc_op *out) { - return true; - } - bool IsFinalOp() { - return false; - } + bool ParseOp(Local value, grpc_op *out) { return true; } + bool IsFinalOp() { return false; } void OnComplete(bool success) { if (success) { server->DestroyWrappedServer(); } } + protected: std::string GetTypeString() const { return "try_shutdown"; } + private: Server *server; Nan::Persistent> @@ -227,10 +220,9 @@ NAN_METHOD(Server::RequestCall) { ops->push_back(unique_ptr(op)); grpc_call_error error = grpc_server_request_call( server->wrapped_server, &op->call, &op->details, &op->request_metadata, - GetCompletionQueue(), - GetCompletionQueue(), - new struct tag(new Callback(info[0].As()), ops.release(), - NULL, Nan::Null())); + GetCompletionQueue(), GetCompletionQueue(), + new struct tag(new Callback(info[0].As()), ops.release(), NULL, + Nan::Null())); if (error != GRPC_CALL_OK) { return Nan::ThrowError(nanErrorWithCode("requestCall failed", error)); } diff --git a/src/node/ext/server.h b/src/node/ext/server.h index c0f2e86554b..2d8cb4c4441 100644 --- a/src/node/ext/server.h +++ b/src/node/ext/server.h @@ -34,8 +34,8 @@ #ifndef NET_GRPC_NODE_SERVER_H_ #define NET_GRPC_NODE_SERVER_H_ -#include #include +#include #include "grpc/grpc.h" namespace grpc { diff --git a/src/node/ext/server_credentials.cc b/src/node/ext/server_credentials.cc index 0ff58bb2092..e070ff1f265 100644 --- a/src/node/ext/server_credentials.cc +++ b/src/node/ext/server_credentials.cc @@ -78,12 +78,12 @@ void ServerCredentials::Init(Local exports) { tpl->SetClassName(Nan::New("ServerCredentials").ToLocalChecked()); tpl->InstanceTemplate()->SetInternalFieldCount(1); Local ctr = tpl->GetFunction(); - Nan::Set(ctr, Nan::New("createSsl").ToLocalChecked(), - Nan::GetFunction( - Nan::New(CreateSsl)).ToLocalChecked()); + Nan::Set( + ctr, Nan::New("createSsl").ToLocalChecked(), + Nan::GetFunction(Nan::New(CreateSsl)).ToLocalChecked()); Nan::Set(ctr, Nan::New("createInsecure").ToLocalChecked(), - Nan::GetFunction( - Nan::New(CreateInsecure)).ToLocalChecked()); + Nan::GetFunction(Nan::New(CreateInsecure)) + .ToLocalChecked()); fun_tpl.Reset(tpl); constructor = new Nan::Callback(ctr); Nan::Set(exports, Nan::New("ServerCredentials").ToLocalChecked(), ctr); @@ -99,9 +99,9 @@ Local ServerCredentials::WrapStruct( Nan::EscapableHandleScope scope; const int argc = 1; Local argv[argc] = { - Nan::New(reinterpret_cast(credentials))}; - MaybeLocal maybe_instance = Nan::NewInstance( - constructor->GetFunction(), argc, argv); + Nan::New(reinterpret_cast(credentials))}; + MaybeLocal maybe_instance = + Nan::NewInstance(constructor->GetFunction(), argc, argv); if (maybe_instance.IsEmpty()) { return scope.Escape(Nan::Null()); } else { @@ -160,13 +160,13 @@ NAN_METHOD(ServerCredentials::CreateSsl) { } Local pair_list = Local::Cast(info[1]); uint32_t key_cert_pair_count = pair_list->Length(); - grpc_ssl_pem_key_cert_pair *key_cert_pairs = new grpc_ssl_pem_key_cert_pair[ - key_cert_pair_count]; + grpc_ssl_pem_key_cert_pair *key_cert_pairs = + new grpc_ssl_pem_key_cert_pair[key_cert_pair_count]; Local key_key = Nan::New("private_key").ToLocalChecked(); Local cert_key = Nan::New("cert_chain").ToLocalChecked(); - for(uint32_t i = 0; i < key_cert_pair_count; i++) { + for (uint32_t i = 0; i < key_cert_pair_count; i++) { Local pair_val = Nan::Get(pair_list, i).ToLocalChecked(); if (!pair_val->IsObject()) { delete[] key_cert_pairs; diff --git a/src/node/ext/server_credentials.h b/src/node/ext/server_credentials.h index bf279e481c6..808088f6e24 100644 --- a/src/node/ext/server_credentials.h +++ b/src/node/ext/server_credentials.h @@ -34,8 +34,8 @@ #ifndef NET_GRPC_NODE_SERVER_CREDENTIALS_H_ #define NET_GRPC_NODE_SERVER_CREDENTIALS_H_ -#include #include +#include #include "grpc/grpc.h" #include "grpc/grpc_security.h" diff --git a/src/node/ext/server_uv.cc b/src/node/ext/server_uv.cc index 789938318eb..709921b7fc1 100644 --- a/src/node/ext/server_uv.cc +++ b/src/node/ext/server_uv.cc @@ -35,8 +35,8 @@ #include "server.h" -#include #include +#include #include "grpc/grpc.h" #include "grpc/support/time.h" @@ -60,22 +60,14 @@ static Callback *shutdown_callback = NULL; class ServerShutdownOp : public Op { public: - ServerShutdownOp(grpc_server *server): server(server) { - } + ServerShutdownOp(grpc_server *server) : server(server) {} - ~ServerShutdownOp() { - } + ~ServerShutdownOp() {} - Local GetNodeValue() const { - return Nan::Null(); - } + Local GetNodeValue() const { return Nan::Null(); } - bool ParseOp(Local value, grpc_op *out) { - return true; - } - bool IsFinalOp() { - return false; - } + bool ParseOp(Local value, grpc_op *out) { return true; } + bool IsFinalOp() { return false; } void OnComplete(bool success) { /* Because cancel_all_calls was called, we assume that shutdown_and_notify completes successfully */ @@ -88,12 +80,9 @@ class ServerShutdownOp : public Op { std::string GetTypeString() const { return "shutdown"; } }; -Server::Server(grpc_server *server) : wrapped_server(server) { -} +Server::Server(grpc_server *server) : wrapped_server(server) {} -Server::~Server() { - this->ShutdownServer(); -} +Server::~Server() { this->ShutdownServer(); } NAN_METHOD(ServerShutdownCallback) { if (!info[0]->IsNull()) { @@ -105,10 +94,10 @@ void Server::ShutdownServer() { Nan::HandleScope scope; if (this->wrapped_server != NULL) { if (shutdown_callback == NULL) { - Localcallback_tpl = + Local callback_tpl = Nan::New(ServerShutdownCallback); - shutdown_callback = new Callback( - Nan::GetFunction(callback_tpl).ToLocalChecked()); + shutdown_callback = + new Callback(Nan::GetFunction(callback_tpl).ToLocalChecked()); } ServerShutdownOp *op = new ServerShutdownOp(this->wrapped_server); diff --git a/src/node/ext/slice.cc b/src/node/ext/slice.cc index 104dd9e22cd..70e73628e79 100644 --- a/src/node/ext/slice.cc +++ b/src/node/ext/slice.cc @@ -31,10 +31,10 @@ * */ -#include -#include #include #include +#include +#include #include "slice.h" @@ -49,19 +49,19 @@ using v8::Value; namespace { void SliceFreeCallback(char *data, void *hint) { - grpc_slice *slice = reinterpret_cast(hint); + grpc_slice *slice = reinterpret_cast(hint); grpc_slice_unref(*slice); delete slice; } void string_destroy_func(void *user_data) { - delete reinterpret_cast(user_data); + delete reinterpret_cast(user_data); } void buffer_destroy_func(void *user_data) { - delete reinterpret_cast(user_data); + delete reinterpret_cast(user_data); } -} // namespace +} // namespace grpc_slice CreateSliceFromString(const Local source) { Nan::HandleScope scope; @@ -73,28 +73,32 @@ grpc_slice CreateSliceFromString(const Local source) { grpc_slice CreateSliceFromBuffer(const Local source) { // Prerequisite: ::node::Buffer::HasInstance(source) Nan::HandleScope scope; - return grpc_slice_new_with_user_data(::node::Buffer::Data(source), - ::node::Buffer::Length(source), - buffer_destroy_func, - new PersistentValue(source)); + return grpc_slice_new_with_user_data( + ::node::Buffer::Data(source), ::node::Buffer::Length(source), + buffer_destroy_func, new PersistentValue(source)); } Local CopyStringFromSlice(const grpc_slice slice) { Nan::EscapableHandleScope scope; if (GRPC_SLICE_LENGTH(slice) == 0) { return scope.Escape(Nan::EmptyString()); } - return scope.Escape(Nan::New( - const_cast(reinterpret_cast(GRPC_SLICE_START_PTR(slice))), - GRPC_SLICE_LENGTH(slice)).ToLocalChecked()); + return scope.Escape( + Nan::New(const_cast(reinterpret_cast( + GRPC_SLICE_START_PTR(slice))), + GRPC_SLICE_LENGTH(slice)) + .ToLocalChecked()); } Local CreateBufferFromSlice(const grpc_slice slice) { Nan::EscapableHandleScope scope; grpc_slice *slice_ptr = new grpc_slice; *slice_ptr = grpc_slice_ref(slice); - return scope.Escape(Nan::NewBuffer( - const_cast(reinterpret_cast(GRPC_SLICE_START_PTR(*slice_ptr))), - GRPC_SLICE_LENGTH(*slice_ptr), SliceFreeCallback, slice_ptr).ToLocalChecked()); + return scope.Escape( + Nan::NewBuffer( + const_cast( + reinterpret_cast(GRPC_SLICE_START_PTR(*slice_ptr))), + GRPC_SLICE_LENGTH(*slice_ptr), SliceFreeCallback, slice_ptr) + .ToLocalChecked()); } } // namespace node diff --git a/src/node/ext/slice.h b/src/node/ext/slice.h index 7dcb1bd45a8..89c8ecaf725 100644 --- a/src/node/ext/slice.h +++ b/src/node/ext/slice.h @@ -31,14 +31,15 @@ * */ -#include -#include #include +#include +#include namespace grpc { namespace node { -typedef Nan::Persistent> PersistentValue; +typedef Nan::Persistent> + PersistentValue; grpc_slice CreateSliceFromString(const v8::Local source); diff --git a/src/node/ext/timeval.cc b/src/node/ext/timeval.cc index 9284db62ef6..741c324c66b 100644 --- a/src/node/ext/timeval.cc +++ b/src/node/ext/timeval.cc @@ -31,8 +31,8 @@ * */ -#include #include +#include #include "grpc/grpc.h" #include "grpc/support/time.h" diff --git a/src/ruby/ext/grpc/rb_byte_buffer.c b/src/ruby/ext/grpc/rb_byte_buffer.c index 65fa2f2cf62..f5be19298fd 100644 --- a/src/ruby/ext/grpc/rb_byte_buffer.c +++ b/src/ruby/ext/grpc/rb_byte_buffer.c @@ -33,15 +33,15 @@ #include -#include "rb_grpc_imports.generated.h" #include "rb_byte_buffer.h" +#include "rb_grpc_imports.generated.h" -#include #include +#include #include #include "rb_grpc.h" -grpc_byte_buffer* grpc_rb_s_to_byte_buffer(char *string, size_t length) { +grpc_byte_buffer *grpc_rb_s_to_byte_buffer(char *string, size_t length) { grpc_slice slice = grpc_slice_from_copied_buffer(string, length); grpc_byte_buffer *buffer = grpc_raw_byte_buffer_create(&slice, 1); grpc_slice_unref(slice); @@ -61,7 +61,7 @@ VALUE grpc_rb_byte_buffer_to_s(grpc_byte_buffer *buffer) { return Qnil; } while (grpc_byte_buffer_reader_next(&reader, &next) != 0) { - rb_str_cat(rb_string, (const char *) GRPC_SLICE_START_PTR(next), + rb_str_cat(rb_string, (const char *)GRPC_SLICE_START_PTR(next), GRPC_SLICE_LENGTH(next)); grpc_slice_unref(next); } @@ -71,7 +71,9 @@ VALUE grpc_rb_byte_buffer_to_s(grpc_byte_buffer *buffer) { VALUE grpc_rb_slice_to_ruby_string(grpc_slice slice) { if (GRPC_SLICE_START_PTR(slice) == NULL) { - rb_raise(rb_eRuntimeError, "attempt to convert uninitialized grpc_slice to ruby string"); + rb_raise(rb_eRuntimeError, + "attempt to convert uninitialized grpc_slice to ruby string"); } - return rb_str_new((char*)GRPC_SLICE_START_PTR(slice), GRPC_SLICE_LENGTH(slice)); + return rb_str_new((char *)GRPC_SLICE_START_PTR(slice), + GRPC_SLICE_LENGTH(slice)); } diff --git a/src/ruby/ext/grpc/rb_call.c b/src/ruby/ext/grpc/rb_call.c index 344cb941ffb..aef7175af9b 100644 --- a/src/ruby/ext/grpc/rb_call.c +++ b/src/ruby/ext/grpc/rb_call.c @@ -33,12 +33,12 @@ #include -#include "rb_grpc_imports.generated.h" #include "rb_call.h" +#include "rb_grpc_imports.generated.h" #include -#include #include +#include #include "rb_byte_buffer.h" #include "rb_call_credentials.h" @@ -113,7 +113,7 @@ static void grpc_rb_call_destroy(void *p) { if (p == NULL) { return; } - destroy_call((grpc_rb_call*)p); + destroy_call((grpc_rb_call *)p); } static size_t md_ary_datasize(const void *p) { @@ -130,7 +130,9 @@ static size_t md_ary_datasize(const void *p) { static const rb_data_type_t grpc_rb_md_ary_data_type = { "grpc_metadata_array", - {GRPC_RB_GC_NOT_MARKED, GRPC_RB_GC_DONT_FREE, md_ary_datasize, + {GRPC_RB_GC_NOT_MARKED, + GRPC_RB_GC_DONT_FREE, + md_ary_datasize, {NULL, NULL}}, NULL, NULL, @@ -140,19 +142,20 @@ static const rb_data_type_t grpc_rb_md_ary_data_type = { * touches a hash object. * TODO(yugui) Directly use st_table and call the free function earlier? */ - 0, + 0, #endif }; /* Describes grpc_call struct for RTypedData */ -static const rb_data_type_t grpc_call_data_type = { - "grpc_call", - {GRPC_RB_GC_NOT_MARKED, grpc_rb_call_destroy, GRPC_RB_MEMSIZE_UNAVAILABLE, - {NULL, NULL}}, - NULL, - NULL, +static const rb_data_type_t grpc_call_data_type = {"grpc_call", + {GRPC_RB_GC_NOT_MARKED, + grpc_rb_call_destroy, + GRPC_RB_MEMSIZE_UNAVAILABLE, + {NULL, NULL}}, + NULL, + NULL, #ifdef RUBY_TYPED_FREE_IMMEDIATELY - RUBY_TYPED_FREE_IMMEDIATELY + RUBY_TYPED_FREE_IMMEDIATELY #endif }; @@ -175,7 +178,7 @@ static VALUE grpc_rb_call_cancel(VALUE self) { grpc_rb_call *call = NULL; grpc_call_error err; if (RTYPEDDATA_DATA(self) == NULL) { - //This call has been closed + // This call has been closed return Qnil; } @@ -196,7 +199,7 @@ static VALUE grpc_rb_call_cancel(VALUE self) { static VALUE grpc_rb_call_close(VALUE self) { grpc_rb_call *call = NULL; TypedData_Get_Struct(self, grpc_rb_call, &grpc_call_data_type, call); - if(call != NULL) { + if (call != NULL) { destroy_call(call); RTYPEDDATA_DATA(self) = NULL; } @@ -238,8 +241,8 @@ static VALUE grpc_rb_call_get_peer_cert(VALUE self) { } { - grpc_auth_property_iterator it = - grpc_auth_context_find_properties_by_name(ctx, GRPC_X509_PEM_CERT_PROPERTY_NAME); + grpc_auth_property_iterator it = grpc_auth_context_find_properties_by_name( + ctx, GRPC_X509_PEM_CERT_PROPERTY_NAME); const grpc_auth_property *prop = grpc_auth_property_iterator_next(&it); if (prop == NULL) { return Qnil; @@ -388,21 +391,22 @@ static int grpc_rb_md_ary_fill_hash_cb(VALUE key, VALUE val, VALUE md_ary_obj) { long i; grpc_slice key_slice; grpc_slice value_slice; - char* tmp_str; + char *tmp_str; if (TYPE(key) == T_SYMBOL) { key_slice = grpc_slice_from_static_string(rb_id2name(SYM2ID(key))); } else if (TYPE(key) == T_STRING) { - key_slice = grpc_slice_from_copied_buffer(RSTRING_PTR(key), RSTRING_LEN(key)); + key_slice = + grpc_slice_from_copied_buffer(RSTRING_PTR(key), RSTRING_LEN(key)); } else { - rb_raise(rb_eTypeError, "grpc_rb_md_ary_fill_hash_cb: bad type for key parameter"); + rb_raise(rb_eTypeError, + "grpc_rb_md_ary_fill_hash_cb: bad type for key parameter"); } if (!grpc_header_key_is_legal(key_slice)) { tmp_str = grpc_slice_to_c_string(key_slice); rb_raise(rb_eArgError, - "'%s' is an invalid header key, must match [a-z0-9-_.]+", - tmp_str); + "'%s' is an invalid header key, must match [a-z0-9-_.]+", tmp_str); return ST_STOP; } @@ -414,13 +418,14 @@ static int grpc_rb_md_ary_fill_hash_cb(VALUE key, VALUE val, VALUE md_ary_obj) { array_length = RARRAY_LEN(val); /* If the value is an array, add capacity for each value in the array */ for (i = 0; i < array_length; i++) { - value_slice = grpc_slice_from_copied_buffer(RSTRING_PTR(rb_ary_entry(val, i)), RSTRING_LEN(rb_ary_entry(val, i))); + value_slice = grpc_slice_from_copied_buffer( + RSTRING_PTR(rb_ary_entry(val, i)), RSTRING_LEN(rb_ary_entry(val, i))); if (!grpc_is_binary_header(key_slice) && !grpc_header_nonbin_value_is_legal(value_slice)) { // The value has invalid characters tmp_str = grpc_slice_to_c_string(value_slice); - rb_raise(rb_eArgError, - "Header value '%s' has invalid characters", tmp_str); + rb_raise(rb_eArgError, "Header value '%s' has invalid characters", + tmp_str); return ST_STOP; } md_ary->metadata[md_ary->count].key = key_slice; @@ -428,21 +433,21 @@ static int grpc_rb_md_ary_fill_hash_cb(VALUE key, VALUE val, VALUE md_ary_obj) { md_ary->count += 1; } } else if (TYPE(val) == T_STRING) { - value_slice = grpc_slice_from_copied_buffer(RSTRING_PTR(val), RSTRING_LEN(val)); + value_slice = + grpc_slice_from_copied_buffer(RSTRING_PTR(val), RSTRING_LEN(val)); if (!grpc_is_binary_header(key_slice) && !grpc_header_nonbin_value_is_legal(value_slice)) { // The value has invalid characters tmp_str = grpc_slice_to_c_string(value_slice); - rb_raise(rb_eArgError, - "Header value '%s' has invalid characters", tmp_str); + rb_raise(rb_eArgError, "Header value '%s' has invalid characters", + tmp_str); return ST_STOP; } md_ary->metadata[md_ary->count].key = key_slice; md_ary->metadata[md_ary->count].value = value_slice; md_ary->count += 1; } else { - rb_raise(rb_eArgError, - "Header values must be of type string or array"); + rb_raise(rb_eArgError, "Header values must be of type string or array"); return ST_STOP; } @@ -474,8 +479,7 @@ static int grpc_rb_md_ary_capacity_hash_cb(VALUE key, VALUE val, /* grpc_rb_md_ary_convert converts a ruby metadata hash into a grpc_metadata_array. */ -void grpc_rb_md_ary_convert(VALUE md_ary_hash, - grpc_metadata_array *md_ary) { +void grpc_rb_md_ary_convert(VALUE md_ary_hash, grpc_metadata_array *md_ary) { VALUE md_ary_obj = Qnil; if (md_ary_hash == Qnil) { return; /* Do nothing if the expected has value is nil */ @@ -511,12 +515,14 @@ VALUE grpc_rb_md_ary_to_h(grpc_metadata_array *md_ary) { rb_hash_aset(result, key, value); } else if (TYPE(value) == T_ARRAY) { /* Add the string to the returned array */ - rb_ary_push(value, grpc_rb_slice_to_ruby_string(md_ary->metadata[i].value)); + rb_ary_push(value, + grpc_rb_slice_to_ruby_string(md_ary->metadata[i].value)); } else { /* Add the current value with this key and the new one to an array */ new_ary = rb_ary_new(); rb_ary_push(new_ary, value); - rb_ary_push(new_ary, grpc_rb_slice_to_ruby_string(md_ary->metadata[i].value)); + rb_ary_push(new_ary, + grpc_rb_slice_to_ruby_string(md_ary->metadata[i].value)); rb_hash_aset(result, key, new_ary); } } @@ -556,10 +562,9 @@ static int grpc_rb_call_check_op_keys_hash_cb(VALUE key, VALUE val, /* grpc_rb_op_update_status_from_server adds the values in a ruby status struct to the 'send_status_from_server' portion of an op. */ -static void grpc_rb_op_update_status_from_server(grpc_op *op, - grpc_metadata_array *md_ary, - grpc_slice *send_status_details, - VALUE status) { +static void grpc_rb_op_update_status_from_server( + grpc_op *op, grpc_metadata_array *md_ary, grpc_slice *send_status_details, + VALUE status) { VALUE code = rb_struct_aref(status, sym_code); VALUE details = rb_struct_aref(status, sym_details); VALUE metadata_hash = rb_struct_aref(status, sym_metadata); @@ -576,7 +581,8 @@ static void grpc_rb_op_update_status_from_server(grpc_op *op, return; } - *send_status_details = grpc_slice_from_copied_buffer(RSTRING_PTR(details), RSTRING_LEN(details)); + *send_status_details = + grpc_slice_from_copied_buffer(RSTRING_PTR(details), RSTRING_LEN(details)); op->data.send_status_from_server.status = NUM2INT(code); op->data.send_status_from_server.status_details = send_status_details; @@ -687,7 +693,8 @@ static void grpc_run_batch_stack_fill_ops(run_batch_stack *st, VALUE ops_hash) { /* N.B. later there is no need to explicitly delete the metadata keys * and values, they are references to data in ruby objects. */ grpc_rb_op_update_status_from_server( - &st->ops[st->op_num], &st->send_trailing_metadata, &st->send_status_details, this_value); + &st->ops[st->op_num], &st->send_trailing_metadata, + &st->send_status_details, this_value); break; case GRPC_OP_RECV_INITIAL_METADATA: st->ops[st->op_num].data.recv_initial_metadata.recv_initial_metadata = @@ -749,12 +756,12 @@ static VALUE grpc_run_batch_stack_build_result(run_batch_stack *st) { case GRPC_OP_RECV_STATUS_ON_CLIENT: rb_struct_aset( result, sym_status, - rb_struct_new(grpc_rb_sStatus, UINT2NUM(st->recv_status), - (GRPC_SLICE_START_PTR(st->recv_status_details) == NULL - ? Qnil - : grpc_rb_slice_to_ruby_string(st->recv_status_details)), - grpc_rb_md_ary_to_h(&st->recv_trailing_metadata), - NULL)); + rb_struct_new( + grpc_rb_sStatus, UINT2NUM(st->recv_status), + (GRPC_SLICE_START_PTR(st->recv_status_details) == NULL + ? Qnil + : grpc_rb_slice_to_ruby_string(st->recv_status_details)), + grpc_rb_md_ary_to_h(&st->recv_trailing_metadata), NULL)); break; case GRPC_OP_RECV_CLOSE_ON_SERVER: rb_struct_aset(result, sym_send_close, Qtrue); @@ -791,7 +798,7 @@ static VALUE grpc_rb_call_run_batch(VALUE self, VALUE ops_hash) { VALUE result = Qnil; VALUE rb_write_flag = rb_ivar_get(self, id_write_flag); unsigned write_flag = 0; - void *tag = (void*)&st; + void *tag = (void *)&st; if (RTYPEDDATA_DATA(self) == NULL) { rb_raise(grpc_rb_eCallError, "Cannot run batch on closed call"); @@ -919,7 +926,8 @@ static void Init_grpc_op_codes() { } static void Init_grpc_metadata_keys() { - VALUE grpc_rb_mMetadataKeys = rb_define_module_under(grpc_rb_mGrpcCore, "MetadataKeys"); + VALUE grpc_rb_mMetadataKeys = + rb_define_module_under(grpc_rb_mGrpcCore, "MetadataKeys"); rb_define_const(grpc_rb_mMetadataKeys, "COMPRESSION_REQUEST_ALGORITHM", rb_str_new2(GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY)); } diff --git a/src/ruby/ext/grpc/rb_call.h b/src/ruby/ext/grpc/rb_call.h index 56becdc5a4e..dc597f7ba73 100644 --- a/src/ruby/ext/grpc/rb_call.h +++ b/src/ruby/ext/grpc/rb_call.h @@ -39,13 +39,13 @@ #include /* Gets the wrapped call from a VALUE. */ -grpc_call* grpc_rb_get_wrapped_call(VALUE v); +grpc_call *grpc_rb_get_wrapped_call(VALUE v); /* Gets the VALUE corresponding to given grpc_call. */ VALUE grpc_rb_wrap_call(grpc_call *c, grpc_completion_queue *q); /* Provides the details of an call error */ -const char* grpc_call_error_detail_of(grpc_call_error err); +const char *grpc_call_error_detail_of(grpc_call_error err); /* Converts a metadata array to a hash. */ VALUE grpc_rb_md_ary_to_h(grpc_metadata_array *md_ary); @@ -53,8 +53,7 @@ VALUE grpc_rb_md_ary_to_h(grpc_metadata_array *md_ary); /* grpc_rb_md_ary_convert converts a ruby metadata hash into a grpc_metadata_array. */ -void grpc_rb_md_ary_convert(VALUE md_ary_hash, - grpc_metadata_array *md_ary); +void grpc_rb_md_ary_convert(VALUE md_ary_hash, grpc_metadata_array *md_ary); /* grpc_rb_eCallError is the ruby class of the exception thrown during call operations. */ diff --git a/src/ruby/ext/grpc/rb_call_credentials.c b/src/ruby/ext/grpc/rb_call_credentials.c index 280f21c9731..d6545502b0f 100644 --- a/src/ruby/ext/grpc/rb_call_credentials.c +++ b/src/ruby/ext/grpc/rb_call_credentials.c @@ -33,8 +33,8 @@ #include -#include "rb_grpc_imports.generated.h" #include "rb_call_credentials.h" +#include "rb_grpc_imports.generated.h" #include @@ -82,20 +82,18 @@ static VALUE grpc_rb_call_credentials_callback(VALUE callback_args) { static VALUE grpc_rb_call_credentials_callback_rescue(VALUE args, VALUE exception_object) { VALUE result = rb_hash_new(); - VALUE backtrace = rb_funcall( - rb_funcall(exception_object, rb_intern("backtrace"), 0), - rb_intern("join"), - 1, rb_str_new2("\n\tfrom ")); - VALUE rb_exception_info = rb_funcall(exception_object, rb_intern("inspect"), 0); + VALUE backtrace = + rb_funcall(rb_funcall(exception_object, rb_intern("backtrace"), 0), + rb_intern("join"), 1, rb_str_new2("\n\tfrom ")); + VALUE rb_exception_info = + rb_funcall(exception_object, rb_intern("inspect"), 0); (void)args; gpr_log(GPR_INFO, "Call credentials callback failed: %s\n%s", - StringValueCStr(rb_exception_info), - StringValueCStr(backtrace)); + StringValueCStr(rb_exception_info), StringValueCStr(backtrace)); rb_hash_aset(result, rb_str_new2("metadata"), Qnil); rb_hash_aset(result, rb_str_new2("status"), INT2NUM(GRPC_STATUS_UNAUTHENTICATED)); - rb_hash_aset(result, rb_str_new2("details"), - rb_exception_info); + rb_hash_aset(result, rb_str_new2("details"), rb_exception_info); return result; } @@ -118,7 +116,8 @@ static void grpc_rb_call_credentials_callback_with_gil(void *param) { result = rb_rescue(grpc_rb_call_credentials_callback, callback_args, grpc_rb_call_credentials_callback_rescue, Qnil); // Both callbacks return a hash, so result should be a hash - grpc_rb_md_ary_convert(rb_hash_aref(result, rb_str_new2("metadata")), &md_ary); + grpc_rb_md_ary_convert(rb_hash_aref(result, rb_str_new2("metadata")), + &md_ary); status = NUM2INT(rb_hash_aref(result, rb_str_new2("status"))); details = rb_hash_aref(result, rb_str_new2("details")); error_details = StringValueCStr(details); @@ -138,7 +137,7 @@ static void grpc_rb_call_credentials_plugin_get_metadata( params->callback = cb; grpc_rb_event_queue_enqueue(grpc_rb_call_credentials_callback_with_gil, - (void*)(params)); + (void *)(params)); } static void grpc_rb_call_credentials_plugin_destroy(void *state) { @@ -172,13 +171,15 @@ static void grpc_rb_call_credentials_mark(void *p) { } static rb_data_type_t grpc_rb_call_credentials_data_type = { - "grpc_call_credentials", - {grpc_rb_call_credentials_mark, grpc_rb_call_credentials_free, - GRPC_RB_MEMSIZE_UNAVAILABLE, {NULL, NULL}}, - NULL, - NULL, + "grpc_call_credentials", + {grpc_rb_call_credentials_mark, + grpc_rb_call_credentials_free, + GRPC_RB_MEMSIZE_UNAVAILABLE, + {NULL, NULL}}, + NULL, + NULL, #ifdef RUBY_TYPED_FREE_IMMEDIATELY - RUBY_TYPED_FREE_IMMEDIATELY + RUBY_TYPED_FREE_IMMEDIATELY #endif }; @@ -188,7 +189,8 @@ static VALUE grpc_rb_call_credentials_alloc(VALUE cls) { grpc_rb_call_credentials *wrapper = ALLOC(grpc_rb_call_credentials); wrapper->wrapped = NULL; wrapper->mark = Qnil; - return TypedData_Wrap_Struct(cls, &grpc_rb_call_credentials_data_type, wrapper); + return TypedData_Wrap_Struct(cls, &grpc_rb_call_credentials_data_type, + wrapper); } /* Creates a wrapping object for a given call credentials. This should only be @@ -230,7 +232,7 @@ static VALUE grpc_rb_call_credentials_init(VALUE self, VALUE proc) { rb_raise(rb_eTypeError, "Argument to CallCredentials#new must be a proc"); return Qnil; } - plugin.state = (void*)proc; + plugin.state = (void *)proc; plugin.type = ""; creds = grpc_metadata_credentials_create_from_plugin(plugin, NULL); @@ -289,7 +291,6 @@ void Init_grpc_call_credentials() { grpc_call_credentials *grpc_rb_get_wrapped_call_credentials(VALUE v) { grpc_rb_call_credentials *wrapper = NULL; TypedData_Get_Struct(v, grpc_rb_call_credentials, - &grpc_rb_call_credentials_data_type, - wrapper); + &grpc_rb_call_credentials_data_type, wrapper); return wrapper->wrapped; } diff --git a/src/ruby/ext/grpc/rb_channel.c b/src/ruby/ext/grpc/rb_channel.c index 05f7160183b..ecfffd1839b 100644 --- a/src/ruby/ext/grpc/rb_channel.c +++ b/src/ruby/ext/grpc/rb_channel.c @@ -34,9 +34,9 @@ #include #include -#include "rb_grpc_imports.generated.h" #include "rb_byte_buffer.h" #include "rb_channel.h" +#include "rb_grpc_imports.generated.h" #include #include @@ -196,14 +196,14 @@ static VALUE grpc_rb_channel_init(int argc, VALUE *argv, VALUE self) { gpr_mu_lock(&wrapper->channel_mu); wrapper->abort_watch_connectivity_state = 0; - wrapper->current_connectivity_state = grpc_channel_check_connectivity_state(wrapper->wrapped, 0); + wrapper->current_connectivity_state = + grpc_channel_check_connectivity_state(wrapper->wrapped, 0); wrapper->safe_to_destroy = 0; wrapper->request_safe_destroy = 0; gpr_cv_broadcast(&wrapper->channel_cv); gpr_mu_unlock(&wrapper->channel_mu); - grpc_rb_channel_try_register_connection_polling(wrapper); if (args.args != NULL) { @@ -245,7 +245,8 @@ static VALUE grpc_rb_channel_get_connectivity_state(int argc, VALUE *argv, rb_raise(rb_eRuntimeError, "closed!"); return Qnil; } - return LONG2NUM(grpc_channel_check_connectivity_state(wrapper->wrapped, grpc_try_to_connect)); + return LONG2NUM(grpc_channel_check_connectivity_state(wrapper->wrapped, + grpc_try_to_connect)); } typedef struct watch_state_stack { @@ -255,22 +256,21 @@ typedef struct watch_state_stack { } watch_state_stack; static void *watch_channel_state_without_gvl(void *arg) { - watch_state_stack *stack = (watch_state_stack*)arg; + watch_state_stack *stack = (watch_state_stack *)arg; gpr_timespec deadline = stack->deadline; grpc_rb_channel *wrapper = stack->wrapper; int last_state = stack->last_state; - void *return_value = (void*)0; + void *return_value = (void *)0; gpr_mu_lock(&wrapper->channel_mu); - while(wrapper->current_connectivity_state == last_state && - !wrapper->request_safe_destroy && - !wrapper->safe_to_destroy && - !wrapper->abort_watch_connectivity_state && - gpr_time_cmp(deadline, gpr_now(GPR_CLOCK_REALTIME)) > 0) { + while (wrapper->current_connectivity_state == last_state && + !wrapper->request_safe_destroy && !wrapper->safe_to_destroy && + !wrapper->abort_watch_connectivity_state && + gpr_time_cmp(deadline, gpr_now(GPR_CLOCK_REALTIME)) > 0) { gpr_cv_wait(&wrapper->channel_cv, &wrapper->channel_mu, deadline); } if (wrapper->current_connectivity_state != last_state) { - return_value = (void*)1; + return_value = (void *)1; } gpr_mu_unlock(&wrapper->channel_mu); @@ -278,7 +278,7 @@ static void *watch_channel_state_without_gvl(void *arg) { } static void watch_channel_state_unblocking_func(void *arg) { - grpc_rb_channel *wrapper = (grpc_rb_channel*)arg; + grpc_rb_channel *wrapper = (grpc_rb_channel *)arg; gpr_log(GPR_DEBUG, "GRPC_RUBY: watch channel state unblocking func called"); gpr_mu_lock(&wrapper->channel_mu); wrapper->abort_watch_connectivity_state = 1; @@ -298,7 +298,7 @@ static VALUE grpc_rb_channel_watch_connectivity_state(VALUE self, VALUE deadline) { grpc_rb_channel *wrapper = NULL; watch_state_stack stack; - void* out; + void *out; TypedData_Get_Struct(self, grpc_rb_channel, &grpc_channel_data_type, wrapper); @@ -308,14 +308,18 @@ static VALUE grpc_rb_channel_watch_connectivity_state(VALUE self, } if (!FIXNUM_P(last_state)) { - rb_raise(rb_eTypeError, "bad type for last_state. want a GRPC::Core::ChannelState constant"); + rb_raise( + rb_eTypeError, + "bad type for last_state. want a GRPC::Core::ChannelState constant"); return Qnil; } stack.wrapper = wrapper; stack.deadline = grpc_rb_time_timeval(deadline, 0); stack.last_state = NUM2LONG(last_state); - out = rb_thread_call_without_gvl(watch_channel_state_without_gvl, &stack, watch_channel_state_unblocking_func, wrapper); + out = + rb_thread_call_without_gvl(watch_channel_state_without_gvl, &stack, + watch_channel_state_unblocking_func, wrapper); if (out) { return Qtrue; } @@ -420,7 +424,7 @@ static VALUE grpc_rb_channel_get_target(VALUE self) { // destroy. // Not safe to call while a channel's connection state is polled. static void grpc_rb_channel_try_register_connection_polling( - grpc_rb_channel *wrapper) { + grpc_rb_channel *wrapper) { grpc_connectivity_state conn_state; gpr_timespec sleep_time = gpr_time_add( gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_millis(20, GPR_TIMESPAN)); @@ -484,11 +488,14 @@ static void *run_poll_channels_loop_no_gil(void *arg) { break; } if (event.type == GRPC_OP_COMPLETE) { - grpc_rb_channel_try_register_connection_polling((grpc_rb_channel *)event.tag); + grpc_rb_channel_try_register_connection_polling( + (grpc_rb_channel *)event.tag); } } grpc_completion_queue_destroy(channel_polling_cq); - gpr_log(GPR_DEBUG, "GRPC_RUBY: run_poll_channels_loop_no_gil - exit connection polling loop"); + gpr_log(GPR_DEBUG, + "GRPC_RUBY: run_poll_channels_loop_no_gil - exit connection polling " + "loop"); return NULL; } @@ -496,7 +503,9 @@ static void *run_poll_channels_loop_no_gil(void *arg) { static void grpc_rb_event_unblocking_func(void *arg) { (void)arg; gpr_mu_lock(&global_connection_polling_mu); - gpr_log(GPR_DEBUG, "GRPC_RUBY: grpc_rb_event_unblocking_func - begin aborting connection polling"); + gpr_log(GPR_DEBUG, + "GRPC_RUBY: grpc_rb_event_unblocking_func - begin aborting " + "connection polling"); abort_channel_polling = 1; grpc_completion_queue_shutdown(channel_polling_cq); gpr_mu_unlock(&global_connection_polling_mu); @@ -505,7 +514,9 @@ static void grpc_rb_event_unblocking_func(void *arg) { // Poll channel connectivity states in background thread without the GIL. static VALUE run_poll_channels_loop(VALUE arg) { (void)arg; - gpr_log(GPR_DEBUG, "GRPC_RUBY: run_poll_channels_loop - create connection polling thread"); + gpr_log( + GPR_DEBUG, + "GRPC_RUBY: run_poll_channels_loop - create connection polling thread"); rb_thread_call_without_gvl(run_poll_channels_loop_no_gil, NULL, grpc_rb_event_unblocking_func, NULL); return Qnil; diff --git a/src/ruby/ext/grpc/rb_channel_args.c b/src/ruby/ext/grpc/rb_channel_args.c index 87c0e0a7055..fa9ddee3728 100644 --- a/src/ruby/ext/grpc/rb_channel_args.c +++ b/src/ruby/ext/grpc/rb_channel_args.c @@ -33,8 +33,8 @@ #include -#include "rb_grpc_imports.generated.h" #include "rb_channel_args.h" +#include "rb_grpc_imports.generated.h" #include @@ -42,9 +42,12 @@ static rb_data_type_t grpc_rb_channel_args_data_type = { "grpc_channel_args", - {GRPC_RB_GC_NOT_MARKED, GRPC_RB_GC_DONT_FREE, GRPC_RB_MEMSIZE_UNAVAILABLE, + {GRPC_RB_GC_NOT_MARKED, + GRPC_RB_GC_DONT_FREE, + GRPC_RB_MEMSIZE_UNAVAILABLE, {NULL, NULL}}, - NULL, NULL, + NULL, + NULL, #ifdef RUBY_TYPED_FREE_IMMEDIATELY RUBY_TYPED_FREE_IMMEDIATELY #endif @@ -137,11 +140,10 @@ static VALUE grpc_rb_hash_convert_to_channel_args0(VALUE as_value) { params->dst->num_args = num_args; params->dst->args = ALLOC_N(grpc_arg, num_args); MEMZERO(params->dst->args, grpc_arg, num_args); - rb_hash_foreach(params->src_hash, - grpc_rb_channel_create_in_process_add_args_hash_cb, - TypedData_Wrap_Struct(grpc_rb_cChannelArgs, - &grpc_rb_channel_args_data_type, - params->dst)); + rb_hash_foreach( + params->src_hash, grpc_rb_channel_create_in_process_add_args_hash_cb, + TypedData_Wrap_Struct(grpc_rb_cChannelArgs, + &grpc_rb_channel_args_data_type, params->dst)); /* reset num_args as grpc_rb_channel_create_in_process_add_args_hash_cb * decrements it during has processing */ params->dst->num_args = num_args; @@ -157,7 +159,7 @@ void grpc_rb_hash_convert_to_channel_args(VALUE src_hash, /* Make a protected call to grpc_rb_hash_convert_channel_args */ params.src_hash = src_hash; params.dst = dst; - rb_protect(grpc_rb_hash_convert_to_channel_args0, (VALUE) & params, &status); + rb_protect(grpc_rb_hash_convert_to_channel_args0, (VALUE)¶ms, &status); if (status != 0) { if (dst->args != NULL) { /* Free any allocated memory before propagating the error */ diff --git a/src/ruby/ext/grpc/rb_channel_credentials.c b/src/ruby/ext/grpc/rb_channel_credentials.c index 5b7aa3417e6..f30426b26da 100644 --- a/src/ruby/ext/grpc/rb_channel_credentials.c +++ b/src/ruby/ext/grpc/rb_channel_credentials.c @@ -35,8 +35,8 @@ #include -#include "rb_grpc_imports.generated.h" #include "rb_channel_credentials.h" +#include "rb_grpc_imports.generated.h" #include #include @@ -91,8 +91,10 @@ static void grpc_rb_channel_credentials_mark(void *p) { static rb_data_type_t grpc_rb_channel_credentials_data_type = { "grpc_channel_credentials", - {grpc_rb_channel_credentials_mark, grpc_rb_channel_credentials_free, - GRPC_RB_MEMSIZE_UNAVAILABLE, {NULL, NULL}}, + {grpc_rb_channel_credentials_mark, + grpc_rb_channel_credentials_free, + GRPC_RB_MEMSIZE_UNAVAILABLE, + {NULL, NULL}}, NULL, NULL, #ifdef RUBY_TYPED_FREE_IMMEDIATELY @@ -106,13 +108,15 @@ static VALUE grpc_rb_channel_credentials_alloc(VALUE cls) { grpc_rb_channel_credentials *wrapper = ALLOC(grpc_rb_channel_credentials); wrapper->wrapped = NULL; wrapper->mark = Qnil; - return TypedData_Wrap_Struct(cls, &grpc_rb_channel_credentials_data_type, wrapper); + return TypedData_Wrap_Struct(cls, &grpc_rb_channel_credentials_data_type, + wrapper); } /* Creates a wrapping object for a given channel credentials. This should only * be called with grpc_channel_credentials objects that are not already * associated with any Ruby object. */ -VALUE grpc_rb_wrap_channel_credentials(grpc_channel_credentials *c, VALUE mark) { +VALUE grpc_rb_wrap_channel_credentials(grpc_channel_credentials *c, + VALUE mark) { VALUE rb_wrapper; grpc_rb_channel_credentials *wrapper; if (c == NULL) { @@ -147,7 +151,8 @@ static ID id_pem_cert_chain; pem_private_key: (optional) PEM encoding of the client's private key pem_cert_chain: (optional) PEM encoding of the client's cert chain Initializes Credential instances. */ -static VALUE grpc_rb_channel_credentials_init(int argc, VALUE *argv, VALUE self) { +static VALUE grpc_rb_channel_credentials_init(int argc, VALUE *argv, + VALUE self) { VALUE pem_root_certs = Qnil; VALUE pem_private_key = Qnil; VALUE pem_cert_chain = Qnil; @@ -170,8 +175,8 @@ static VALUE grpc_rb_channel_credentials_init(int argc, VALUE *argv, VALUE self) } else { key_cert_pair.private_key = RSTRING_PTR(pem_private_key); key_cert_pair.cert_chain = RSTRING_PTR(pem_cert_chain); - creds = grpc_ssl_credentials_create(pem_root_certs_cstr, - &key_cert_pair, NULL); + creds = + grpc_ssl_credentials_create(pem_root_certs_cstr, &key_cert_pair, NULL); } if (creds == NULL) { rb_raise(rb_eRuntimeError, "could not create a credentials, not sure why"); @@ -230,8 +235,8 @@ static VALUE grpc_rb_set_default_roots_pem(VALUE self, VALUE roots) { } void Init_grpc_channel_credentials() { - grpc_rb_cChannelCredentials = - rb_define_class_under(grpc_rb_mGrpcCore, "ChannelCredentials", rb_cObject); + grpc_rb_cChannelCredentials = rb_define_class_under( + grpc_rb_mGrpcCore, "ChannelCredentials", rb_cObject); /* Allocates an object managed by the ruby runtime */ rb_define_alloc_func(grpc_rb_cChannelCredentials, @@ -259,7 +264,6 @@ void Init_grpc_channel_credentials() { grpc_channel_credentials *grpc_rb_get_wrapped_channel_credentials(VALUE v) { grpc_rb_channel_credentials *wrapper = NULL; TypedData_Get_Struct(v, grpc_rb_channel_credentials, - &grpc_rb_channel_credentials_data_type, - wrapper); + &grpc_rb_channel_credentials_data_type, wrapper); return wrapper->wrapped; } diff --git a/src/ruby/ext/grpc/rb_completion_queue.c b/src/ruby/ext/grpc/rb_completion_queue.c index fd75d2f691f..c9d67739a5f 100644 --- a/src/ruby/ext/grpc/rb_completion_queue.c +++ b/src/ruby/ext/grpc/rb_completion_queue.c @@ -33,14 +33,14 @@ #include -#include "rb_grpc_imports.generated.h" #include "rb_completion_queue.h" +#include "rb_grpc_imports.generated.h" #include #include -#include #include +#include #include "rb_grpc.h" /* Used to allow grpc_completion_queue_next call to release the GIL */ @@ -54,14 +54,13 @@ typedef struct next_call_stack { /* Calls grpc_completion_queue_pluck without holding the ruby GIL */ static void *grpc_rb_completion_queue_pluck_no_gil(void *param) { - next_call_stack *const next_call = (next_call_stack*)param; + next_call_stack *const next_call = (next_call_stack *)param; gpr_timespec increment = gpr_time_from_millis(20, GPR_TIMESPAN); gpr_timespec deadline; do { deadline = gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), increment); - next_call->event = grpc_completion_queue_pluck(next_call->cq, - next_call->tag, - deadline, NULL); + next_call->event = grpc_completion_queue_pluck( + next_call->cq, next_call->tag, deadline, NULL); if (next_call->event.type != GRPC_QUEUE_TIMEOUT || gpr_time_cmp(deadline, next_call->timeout) > 0) { break; @@ -81,7 +80,7 @@ void grpc_rb_completion_queue_destroy(grpc_completion_queue *cq) { } static void unblock_func(void *param) { - next_call_stack *const next_call = (next_call_stack*)param; + next_call_stack *const next_call = (next_call_stack *)param; next_call->interrupted = 1; } @@ -111,7 +110,6 @@ grpc_event rb_completion_queue_pluck(grpc_completion_queue *queue, void *tag, (void *)&next_call); /* If an interrupt prevented pluck from returning useful information, then any plucks that did complete must have timed out */ - } while (next_call.interrupted && - next_call.event.type == GRPC_QUEUE_TIMEOUT); + } while (next_call.interrupted && next_call.event.type == GRPC_QUEUE_TIMEOUT); return next_call.event; } diff --git a/src/ruby/ext/grpc/rb_compression_options.c b/src/ruby/ext/grpc/rb_compression_options.c index 6b2467ee461..7de3c3c5281 100644 --- a/src/ruby/ext/grpc/rb_compression_options.c +++ b/src/ruby/ext/grpc/rb_compression_options.c @@ -33,15 +33,15 @@ #include -#include "rb_compression_options.h" #include "rb_byte_buffer.h" +#include "rb_compression_options.h" #include "rb_grpc_imports.generated.h" #include #include -#include #include #include +#include #include #include "rb_grpc.h" @@ -179,15 +179,16 @@ void grpc_rb_compression_options_algorithm_name_to_value_internal( * correct C string out of it. */ algorithm_name_as_string = rb_funcall(algorithm_name, rb_intern("to_s"), 0); - name_slice = grpc_slice_from_copied_buffer(RSTRING_PTR(algorithm_name_as_string), RSTRING_LEN(algorithm_name_as_string)); + name_slice = + grpc_slice_from_copied_buffer(RSTRING_PTR(algorithm_name_as_string), + RSTRING_LEN(algorithm_name_as_string)); /* Raise an error if the name isn't recognized as a compression algorithm by * the algorithm parse function * in GRPC core. */ - if(!grpc_compression_algorithm_parse(name_slice, algorithm_value)) { + if (!grpc_compression_algorithm_parse(name_slice, algorithm_value)) { tmp_str = grpc_slice_to_c_string(name_slice); - rb_raise(rb_eNameError, "Invalid compression algorithm name: %s", - tmp_str); + rb_raise(rb_eNameError, "Invalid compression algorithm name: %s", tmp_str); } grpc_slice_unref(name_slice); diff --git a/src/ruby/ext/grpc/rb_event_thread.c b/src/ruby/ext/grpc/rb_event_thread.c index 9e85bbcfbf2..9a3b56ddfb7 100644 --- a/src/ruby/ext/grpc/rb_event_thread.c +++ b/src/ruby/ext/grpc/rb_event_thread.c @@ -33,20 +33,20 @@ #include -#include "rb_grpc_imports.generated.h" #include "rb_event_thread.h" +#include "rb_grpc_imports.generated.h" #include -#include #include +#include #include #include -#include +#include typedef struct grpc_rb_event { // callback will be called with argument while holding the GVL - void (*callback)(void*); + void (*callback)(void *); void *argument; struct grpc_rb_event *next; @@ -65,8 +65,7 @@ typedef struct grpc_rb_event_queue { static grpc_rb_event_queue event_queue; -void grpc_rb_event_queue_enqueue(void (*callback)(void*), - void *argument) { +void grpc_rb_event_queue_enqueue(void (*callback)(void *), void *argument) { grpc_rb_event *event = gpr_malloc(sizeof(grpc_rb_event)); event->callback = callback; event->argument = argument; @@ -107,8 +106,7 @@ static void *grpc_rb_wait_for_event_no_gil(void *param) { (void)param; gpr_mu_lock(&event_queue.mu); while ((event = grpc_rb_event_queue_dequeue()) == NULL) { - gpr_cv_wait(&event_queue.cv, - &event_queue.mu, + gpr_cv_wait(&event_queue.cv, &event_queue.mu, gpr_inf_future(GPR_CLOCK_REALTIME)); if (event_queue.abort) { gpr_mu_unlock(&event_queue.mu); @@ -132,10 +130,10 @@ static void grpc_rb_event_unblocking_func(void *arg) { static VALUE grpc_rb_event_thread(VALUE arg) { grpc_rb_event *event; (void)arg; - while(true) { - event = (grpc_rb_event*)rb_thread_call_without_gvl( - grpc_rb_wait_for_event_no_gil, NULL, - grpc_rb_event_unblocking_func, NULL); + while (true) { + event = (grpc_rb_event *)rb_thread_call_without_gvl( + grpc_rb_wait_for_event_no_gil, NULL, grpc_rb_event_unblocking_func, + NULL); if (event == NULL) { // Indicates that the thread needs to shut down break; diff --git a/src/ruby/ext/grpc/rb_event_thread.h b/src/ruby/ext/grpc/rb_event_thread.h index 46638bfcf53..d7eff760a17 100644 --- a/src/ruby/ext/grpc/rb_event_thread.h +++ b/src/ruby/ext/grpc/rb_event_thread.h @@ -33,5 +33,4 @@ void grpc_rb_event_queue_thread_start(); -void grpc_rb_event_queue_enqueue(void (*callback)(void*), - void *argument); +void grpc_rb_event_queue_enqueue(void (*callback)(void *), void *argument); diff --git a/src/ruby/ext/grpc/rb_grpc.c b/src/ruby/ext/grpc/rb_grpc.c index 17cd165a91d..d45a5eaef8a 100644 --- a/src/ruby/ext/grpc/rb_grpc.c +++ b/src/ruby/ext/grpc/rb_grpc.c @@ -33,8 +33,8 @@ #include -#include "rb_grpc_imports.generated.h" #include "rb_grpc.h" +#include "rb_grpc_imports.generated.h" #include #include @@ -46,16 +46,18 @@ #include "rb_call_credentials.h" #include "rb_channel.h" #include "rb_channel_credentials.h" +#include "rb_compression_options.h" #include "rb_loader.h" #include "rb_server.h" #include "rb_server_credentials.h" -#include "rb_compression_options.h" static VALUE grpc_rb_cTimeVal = Qnil; static rb_data_type_t grpc_rb_timespec_data_type = { "gpr_timespec", - {GRPC_RB_GC_NOT_MARKED, GRPC_RB_GC_DONT_FREE, GRPC_RB_MEMSIZE_UNAVAILABLE, + {GRPC_RB_GC_NOT_MARKED, + GRPC_RB_GC_DONT_FREE, + GRPC_RB_MEMSIZE_UNAVAILABLE, {NULL, NULL}}, NULL, NULL, @@ -84,8 +86,7 @@ VALUE grpc_rb_cannot_init(VALUE self) { /* Init/Clone func that fails by raising an exception. */ VALUE grpc_rb_cannot_init_copy(VALUE copy, VALUE self) { (void)self; - rb_raise(rb_eTypeError, - "Copy initialization of %s is not supported", + rb_raise(rb_eTypeError, "Copy initialization of %s is not supported", rb_obj_classname(copy)); return Qnil; } @@ -143,8 +144,7 @@ gpr_timespec grpc_rb_time_timeval(VALUE time, int interval) { } t.tv_sec = (int64_t)f; if (f != t.tv_sec) { - rb_raise(rb_eRangeError, "%f out of Time range", - RFLOAT_VALUE(time)); + rb_raise(rb_eRangeError, "%f out of Time range", RFLOAT_VALUE(time)); } t.tv_nsec = (int)(d * 1e9 + 0.5); } @@ -269,9 +269,7 @@ static void Init_grpc_time_consts() { id_tv_nsec = rb_intern("tv_nsec"); } -static void grpc_rb_shutdown(void) { - grpc_shutdown(); -} +static void grpc_rb_shutdown(void) { grpc_shutdown(); } /* Initialize the GRPC module structs */ @@ -316,9 +314,8 @@ void Init_grpc_c() { grpc_rb_mGRPC = rb_define_module("GRPC"); grpc_rb_mGrpcCore = rb_define_module_under(grpc_rb_mGRPC, "Core"); - grpc_rb_sNewServerRpc = - rb_struct_define("NewServerRpc", "method", "host", - "deadline", "metadata", "call", NULL); + grpc_rb_sNewServerRpc = rb_struct_define( + "NewServerRpc", "method", "host", "deadline", "metadata", "call", NULL); grpc_rb_sStatus = rb_struct_define("Status", "code", "details", "metadata", NULL); sym_code = ID2SYM(rb_intern("code")); diff --git a/src/ruby/ext/grpc/rb_grpc.h b/src/ruby/ext/grpc/rb_grpc.h index 6ea6cbd0b6c..2ee1faaca50 100644 --- a/src/ruby/ext/grpc/rb_grpc.h +++ b/src/ruby/ext/grpc/rb_grpc.h @@ -34,8 +34,8 @@ #ifndef GRPC_RB_H_ #define GRPC_RB_H_ -#include #include +#include #include @@ -68,7 +68,7 @@ extern VALUE sym_metadata; /* GRPC_RB_MEMSIZE_UNAVAILABLE is used in rb_data_type_t to indicate that the * number of bytes used by the wrapped struct is not available. */ -#define GRPC_RB_MEMSIZE_UNAVAILABLE (size_t (*)(const void*))(NULL) +#define GRPC_RB_MEMSIZE_UNAVAILABLE (size_t(*)(const void*))(NULL) /* A ruby object alloc func that fails by raising an exception. */ VALUE grpc_rb_cannot_alloc(VALUE cls); diff --git a/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh b/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh index 02e811f664b..82b96e086e0 100755 --- a/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh +++ b/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh @@ -31,7 +31,7 @@ set -e # directories to run against -DIRS="src/core/lib src/core/tsi src/core/ext src/cpp test/core test/cpp include src/compiler" +DIRS="src/core/lib src/core/tsi src/core/ext src/cpp test/core test/cpp include src/compiler src/node src/csharp src/ruby" # file matching patterns to check GLOB="*.h *.c *.cc" From f583975f81e21dbf46dcef178a0aba71f1158ccc Mon Sep 17 00:00:00 2001 From: Mehrdad Afshari Date: Tue, 18 Apr 2017 10:26:40 -0700 Subject: [PATCH 451/461] Include for AF_INET Compilation fails on FreeBSD because not all POSIX compliant systems end up including AF_INET from other header files transitively. AF_INET and AF_INET6 should be provided by . --- src/core/tsi/ssl_transport_security.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/tsi/ssl_transport_security.c b/src/core/tsi/ssl_transport_security.c index 984f745b01d..5f4705db926 100644 --- a/src/core/tsi/ssl_transport_security.c +++ b/src/core/tsi/ssl_transport_security.c @@ -45,6 +45,7 @@ #include #else #include +#include #endif #include From 8f37606f607df0bed1fa9058491e4d658ebd4e1b Mon Sep 17 00:00:00 2001 From: Makarand Dharmapurikar Date: Wed, 19 Apr 2017 10:30:07 -0700 Subject: [PATCH 452/461] disable mongoose --- WORKSPACE | 6 ------ tools/grpcz/BUILD | 1 - tools/grpcz/grpcz_client.cc | 8 ++++++-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 5a3c4de0afb..5ba82f3127b 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -77,12 +77,6 @@ local_repository( path = "third_party/gflags", ) -git_repository( - name = "mongoose_repo", - commit = "4120a97945b41195a6223a600dae8e3b19bed19e", - remote = "https://github.com/makdharma/mongoose.git" -) - new_local_repository( name = "submodule_benchmark", path = "third_party/benchmark", diff --git a/tools/grpcz/BUILD b/tools/grpcz/BUILD index 5e1faf7064f..cac7df2a9da 100644 --- a/tools/grpcz/BUILD +++ b/tools/grpcz/BUILD @@ -58,6 +58,5 @@ cc_binary( deps = [ "//external:gflags", "monitoring_proto", - "@mongoose_repo//:mongoose_lib", ], ) diff --git a/tools/grpcz/grpcz_client.cc b/tools/grpcz/grpcz_client.cc index 47eec8dfc38..a5e66f7b542 100644 --- a/tools/grpcz/grpcz_client.cc +++ b/tools/grpcz/grpcz_client.cc @@ -38,7 +38,7 @@ #include #include "gflags/gflags.h" -#include "mongoose.h" +/* #include "mongoose.h" */ // TODO (makdharma): remove local copies of these protos #include "tools/grpcz/census.grpc.pb.h" @@ -122,8 +122,9 @@ class GrpczClient { std::unique_ptr stub_; }; -static struct mg_serve_http_opts s_http_server_opts; std::unique_ptr g_grpcz_client; +/* +static struct mg_serve_http_opts s_http_server_opts; static void ev_handler(struct mg_connection *nc, int ev, void *p) { if (ev == MG_EV_HTTP_REQUEST) { @@ -141,6 +142,7 @@ static void grpcz_handler(struct mg_connection *nc, int ev, void *ev_data) { mg_printf(nc, "HTTP/1.0 200 OK\r\n\r\n%s", rendered_html.c_str()); nc->flags |= MG_F_SEND_AND_CLOSE; } +*/ int main(int argc, char **argv) { gflags::ParseCommandLineFlags(&argc, &argv, true); @@ -156,6 +158,7 @@ int main(int argc, char **argv) { return 0; } + /* // Set up a mongoose webserver handler struct mg_mgr mgr; mg_mgr_init(&mgr, NULL); @@ -177,5 +180,6 @@ int main(int argc, char **argv) { mg_mgr_poll(&mgr, k_sleep_millis); } mg_mgr_free(&mgr); + */ return 0; } From 91eb28f6bcf377da3cbae6f3a566be5b7645e194 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 19 Apr 2017 15:24:59 -0700 Subject: [PATCH 453/461] Update to avoid ubsan failure --- third_party/zlib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/zlib b/third_party/zlib index 50893291621..cacf7f1d4e3 160000 --- a/third_party/zlib +++ b/third_party/zlib @@ -1 +1 @@ -Subproject commit 50893291621658f355bc5b4d450a8d06a563053d +Subproject commit cacf7f1d4e3d44d871b605da3b647f07d718623f From d1a6423199d3b38007e65d2a9cad492e7ebc25cc Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 19 Apr 2017 15:34:29 -0700 Subject: [PATCH 454/461] Use stdlib to avoid ubsan errors --- test/core/support/time_test.c | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/test/core/support/time_test.c b/test/core/support/time_test.c index 4cb36a788c1..00d0b765036 100644 --- a/test/core/support/time_test.c +++ b/test/core/support/time_test.c @@ -47,32 +47,17 @@ static void to_fp(void *arg, const char *buf, size_t len) { fwrite(buf, 1, len, (FILE *)arg); } -/* Convert gpr_uintmax x to ascii base b (2..16), and write with - (*writer)(arg, ...), zero padding to "chars" digits). */ -static void u_to_s(uintmax_t x, unsigned base, int chars, - void (*writer)(void *arg, const char *buf, size_t len), - void *arg) { - char buf[64]; - char *p = buf + sizeof(buf); - do { - *--p = "0123456789abcdef"[x % base]; - x /= base; - chars--; - } while (x != 0 || chars > 0); - (*writer)(arg, p, (size_t)(buf + sizeof(buf) - p)); -} - /* Convert gpr_intmax x to ascii base b (2..16), and write with (*writer)(arg, ...), zero padding to "chars" digits). */ -static void i_to_s(intmax_t x, unsigned base, int chars, +static void i_to_s(intmax_t x, int base, int chars, void (*writer)(void *arg, const char *buf, size_t len), void *arg) { - if (x < 0) { - (*writer)(arg, "-", 1); - u_to_s((uintmax_t)-x, base, chars - 1, writer, arg); - } else { - u_to_s((uintmax_t)x, base, chars, writer, arg); - } + char buf[64]; + char fmt[32]; + GPR_ASSERT(base == 16 || base == 10); + sprintf(fmt, "%%0%d%s", chars, base == 16 ? PRIxMAX : PRIdMAX); + sprintf(buf, fmt, x); + (*writer)(arg, buf, strlen(buf)); } /* Convert ts to ascii, and write with (*writer)(arg, ...). */ From c96c0f94f964eab1b57b7f6081e3538cd611e963 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Wed, 19 Apr 2017 15:39:13 -0700 Subject: [PATCH 455/461] Remove DEBUG code that is itself buggy (integer overflow) --- src/core/lib/support/stack_lockfree.c | 33 --------------------------- 1 file changed, 33 deletions(-) diff --git a/src/core/lib/support/stack_lockfree.c b/src/core/lib/support/stack_lockfree.c index 9d7c9e5a381..c481a3e0dc5 100644 --- a/src/core/lib/support/stack_lockfree.c +++ b/src/core/lib/support/stack_lockfree.c @@ -72,11 +72,6 @@ typedef union lockfree_node { struct gpr_stack_lockfree { lockfree_node *entries; lockfree_node head; /* An atomic entry describing curr head */ - -#ifndef NDEBUG - /* Bitmap of pushed entries to check for double-push or pop */ - gpr_atm pushed[(INVALID_ENTRY_INDEX + 1) / (8 * sizeof(gpr_atm))]; -#endif }; gpr_stack_lockfree *gpr_stack_lockfree_create(size_t entries) { @@ -91,9 +86,6 @@ gpr_stack_lockfree *gpr_stack_lockfree_create(size_t entries) { /* Clear out all entries */ memset(stack->entries, 0, entries * sizeof(stack->entries[0])); memset(&stack->head, 0, sizeof(stack->head)); -#ifndef NDEBUG - memset(&stack->pushed, 0, sizeof(stack->pushed)); -#endif GPR_ASSERT(sizeof(stack->entries->atm) == sizeof(stack->entries->contents)); @@ -130,19 +122,6 @@ int gpr_stack_lockfree_push(gpr_stack_lockfree *stack, int entry) { newhead.contents.aba_ctr = ++curent.contents.aba_ctr; gpr_atm_no_barrier_store(&stack->entries[entry].atm, curent.atm); -#ifndef NDEBUG - /* Check for double push */ - { - int pushed_index = entry / (int)(8 * sizeof(gpr_atm)); - int pushed_bit = entry % (int)(8 * sizeof(gpr_atm)); - gpr_atm old_val; - - old_val = gpr_atm_no_barrier_fetch_add(&stack->pushed[pushed_index], - ((gpr_atm)1 << pushed_bit)); - GPR_ASSERT((old_val & (((gpr_atm)1) << pushed_bit)) == 0); - } -#endif - do { /* Atomically get the existing head value for use */ head.atm = gpr_atm_no_barrier_load(&(stack->head.atm)); @@ -168,18 +147,6 @@ int gpr_stack_lockfree_pop(gpr_stack_lockfree *stack) { gpr_atm_no_barrier_load(&(stack->entries[head.contents.index].atm)); } while (!gpr_atm_no_barrier_cas(&(stack->head.atm), head.atm, newhead.atm)); -#ifndef NDEBUG - /* Check for valid pop */ - { - int pushed_index = head.contents.index / (8 * sizeof(gpr_atm)); - int pushed_bit = head.contents.index % (8 * sizeof(gpr_atm)); - gpr_atm old_val; - - old_val = gpr_atm_no_barrier_fetch_add(&stack->pushed[pushed_index], - -((gpr_atm)1 << pushed_bit)); - GPR_ASSERT((old_val & (((gpr_atm)1) << pushed_bit)) != 0); - } -#endif return head.contents.index; } From 989aa7f97d91478bfdfd8e66e99e2dabda160e72 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 19 Apr 2017 15:46:43 -0700 Subject: [PATCH 456/461] Fix sanity --- tools/run_tests/sanity/check_submodules.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/run_tests/sanity/check_submodules.sh b/tools/run_tests/sanity/check_submodules.sh index c5a0dbbef32..0a9c1cc046c 100755 --- a/tools/run_tests/sanity/check_submodules.sh +++ b/tools/run_tests/sanity/check_submodules.sh @@ -48,7 +48,7 @@ cat << EOF | awk '{ print $1 }' | sort > $want_submodules ec44c6c1675c25b9827aacd08c02433cccde7780 third_party/googletest (release-1.8.0) 593e917c176b5bc5aafa57bf9f6030d749d91cd5 third_party/protobuf (v3.1.0-alpha-1-326-g593e917) bcad91771b7f0bff28a1cac1981d7ef2b9bcef3c third_party/thrift (bcad917) - 50893291621658f355bc5b4d450a8d06a563053d third_party/zlib (v1.2.8) + cacf7f1d4e3d44d871b605da3b647f07d718623f third_party/zlib (v1.2.11) 7691f773af79bf75a62d1863fd0f13ebf9dc51b1 third_party/cares/cares (1.12.0) EOF From f2af0c3009bc90cee339bfc13f0d0884f35a6854 Mon Sep 17 00:00:00 2001 From: Yuxuan Li Date: Wed, 19 Apr 2017 16:45:38 -0700 Subject: [PATCH 457/461] change to new completion queue api --- test/cpp/microbenchmarks/bm_call_create.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index 4b99a804274..0aac611d43d 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -184,7 +184,7 @@ static void BM_LameChannelCallCreateCore(benchmark::State &state) { channel = grpc_lame_client_channel_create( "localhost:1234", GRPC_STATUS_UNAUTHENTICATED, "blah"); - cq = grpc_completion_queue_create(NULL); + cq = grpc_completion_queue_create_for_next(NULL); void *rc = grpc_channel_register_call( channel, "/grpc.testing.EchoTestService/Echo", NULL, NULL); while (state.KeepRunning()) { @@ -258,7 +258,7 @@ static void BM_LameChannelCallCreateCoreSeparateBatch(benchmark::State &state) { channel = grpc_lame_client_channel_create( "localhost:1234", GRPC_STATUS_UNAUTHENTICATED, "blah"); - cq = grpc_completion_queue_create(NULL); + cq = grpc_completion_queue_create_for_next(NULL); void *rc = grpc_channel_register_call( channel, "/grpc.testing.EchoTestService/Echo", NULL, NULL); while (state.KeepRunning()) { From d47be446d7e571bfd042462c308227eca357bb1f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 19 Apr 2017 17:26:24 -0700 Subject: [PATCH 458/461] Speed up tests --- build.yaml | 8 +- test/core/end2end/gen_build_yaml.py | 52 +- test/core/support/mpscq_test.c | 2 +- tools/run_tests/generated/tests.json | 1416 +++++++++++++------------- 4 files changed, 743 insertions(+), 735 deletions(-) diff --git a/build.yaml b/build.yaml index f23de87d11c..08f30d00fa0 100644 --- a/build.yaml +++ b/build.yaml @@ -1516,6 +1516,7 @@ libs: - global targets: - name: alarm_test + cpu_cost: 0.1 build: test language: c src: @@ -1699,7 +1700,7 @@ targets: dict: test/core/end2end/fuzzers/hpack.dictionary maxlen: 2048 - name: combiner_test - cpu_cost: 30 + cpu_cost: 10 build: test language: c src: @@ -1720,6 +1721,7 @@ targets: - gpr_test_util - gpr - name: concurrent_connectivity_test + cpu_cost: 2.0 build: test language: c src: @@ -1806,6 +1808,7 @@ targets: - gpr_test_util - gpr - name: ev_epoll_linux_test + cpu_cost: 3 build: test language: c src: @@ -1975,6 +1978,7 @@ targets: - gpr_test_util - gpr - name: gpr_cpu_test + cpu_cost: 30 build: test language: c src: @@ -2024,7 +2028,7 @@ targets: - gpr_test_util - gpr - name: gpr_spinlock_test - cpu_cost: 10 + cpu_cost: 3 build: test language: c src: diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py index d1e510d6362..ecc174373a7 100755 --- a/test/core/end2end/gen_build_yaml.py +++ b/test/core/end2end/gen_build_yaml.py @@ -94,12 +94,13 @@ END2END_TESTS = { 'authority_not_supported': default_test_options, 'bad_hostname': default_test_options, 'bad_ping': connectivity_test_options._replace(proxyable=False), - 'binary_metadata': default_test_options, + 'binary_metadata': default_test_options._replace(cpu_cost=LOWCPU), 'resource_quota_server': default_test_options._replace(large_writes=True, - proxyable=False), + proxyable=False, + cpu_cost=LOWCPU), 'call_creds': default_test_options._replace(secure=True), 'cancel_after_accept': default_test_options._replace(cpu_cost=LOWCPU), - 'cancel_after_client_done': default_test_options, + 'cancel_after_client_done': default_test_options._replace(cpu_cost=LOWCPU), 'cancel_after_invoke': default_test_options._replace(cpu_cost=LOWCPU), 'cancel_before_invoke': default_test_options._replace(cpu_cost=LOWCPU), 'cancel_in_a_vacuum': default_test_options._replace(cpu_cost=LOWCPU), @@ -110,46 +111,49 @@ END2END_TESTS = { 'default_host': default_test_options._replace(needs_fullstack=True, needs_dns=True), 'disappearing_server': connectivity_test_options._replace(flaky=True), - 'empty_batch': default_test_options, - 'filter_causes_close': default_test_options, + 'empty_batch': default_test_options._replace(cpu_cost=LOWCPU), + 'filter_causes_close': default_test_options._replace(cpu_cost=LOWCPU), 'filter_call_init_fails': default_test_options, - 'filter_latency': default_test_options, + 'filter_latency': default_test_options._replace(cpu_cost=LOWCPU), 'graceful_server_shutdown': default_test_options._replace(cpu_cost=LOWCPU), 'hpack_size': default_test_options._replace(proxyable=False, - traceable=False), - 'high_initial_seqno': default_test_options, + traceable=False, + cpu_cost=LOWCPU), + 'high_initial_seqno': default_test_options._replace(cpu_cost=LOWCPU), 'idempotent_request': default_test_options, 'invoke_large_request': default_test_options, - 'keepalive_timeout': default_test_options._replace(proxyable=False), + 'keepalive_timeout': default_test_options._replace(proxyable=False, + cpu_cost=LOWCPU), 'large_metadata': default_test_options, - 'max_concurrent_streams': default_test_options._replace(proxyable=False), - 'max_connection_age': default_test_options, + 'max_concurrent_streams': default_test_options._replace( + proxyable=False, cpu_cost=LOWCPU), + 'max_connection_age': default_test_options._replace(cpu_cost=LOWCPU), 'max_connection_idle': connectivity_test_options._replace( - proxyable=False, exclude_iomgrs=['uv']), - 'max_message_length': default_test_options, + proxyable=False, exclude_iomgrs=['uv'], cpu_cost=LOWCPU), + 'max_message_length': default_test_options._replace(cpu_cost=LOWCPU), 'negative_deadline': default_test_options, - 'network_status_change': default_test_options, + 'network_status_change': default_test_options._replace(cpu_cost=LOWCPU), 'no_logging': default_test_options._replace(traceable=False), 'no_op': default_test_options, 'payload': default_test_options, 'load_reporting_hook': default_test_options, - 'ping_pong_streaming': default_test_options, - 'ping': connectivity_test_options._replace(proxyable=False), + 'ping_pong_streaming': default_test_options._replace(cpu_cost=LOWCPU), + 'ping': connectivity_test_options._replace(proxyable=False, cpu_cost=LOWCPU), 'registered_call': default_test_options, 'request_with_flags': default_test_options._replace( proxyable=False, cpu_cost=LOWCPU), - 'request_with_payload': default_test_options, - 'server_finishes_request': default_test_options, - 'shutdown_finishes_calls': default_test_options, - 'shutdown_finishes_tags': default_test_options, - 'simple_cacheable_request': default_test_options, + 'request_with_payload': default_test_options._replace(cpu_cost=LOWCPU), + 'server_finishes_request': default_test_options._replace(cpu_cost=LOWCPU), + 'shutdown_finishes_calls': default_test_options._replace(cpu_cost=LOWCPU), + 'shutdown_finishes_tags': default_test_options._replace(cpu_cost=LOWCPU), + 'simple_cacheable_request': default_test_options._replace(cpu_cost=LOWCPU), 'simple_delayed_request': connectivity_test_options, 'simple_metadata': default_test_options, 'simple_request': default_test_options, - 'streaming_error_response': default_test_options, + 'streaming_error_response': default_test_options._replace(cpu_cost=LOWCPU), 'trailing_metadata': default_test_options, - 'write_buffering': default_test_options, - 'write_buffering_at_end': default_test_options, + 'write_buffering': default_test_options._replace(cpu_cost=LOWCPU), + 'write_buffering_at_end': default_test_options._replace(cpu_cost=LOWCPU), } diff --git a/test/core/support/mpscq_test.c b/test/core/support/mpscq_test.c index 491eb9148be..695066c68e3 100644 --- a/test/core/support/mpscq_test.c +++ b/test/core/support/mpscq_test.c @@ -76,7 +76,7 @@ typedef struct { gpr_event *start; } thd_args; -#define THREAD_ITERATIONS 100000 +#define THREAD_ITERATIONS 10000 static void test_thread(void *args) { thd_args *a = args; diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 6338ea70127..35dfcace7c7 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -9,7 +9,7 @@ "posix", "windows" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -363,7 +363,7 @@ "posix", "windows" ], - "cpu_cost": 30, + "cpu_cost": 10, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -407,7 +407,7 @@ "posix", "windows" ], - "cpu_cost": 1.0, + "cpu_cost": 2.0, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -564,7 +564,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 3, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -779,7 +779,7 @@ "posix", "windows" ], - "cpu_cost": 1.0, + "cpu_cost": 30, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -911,7 +911,7 @@ "posix", "windows" ], - "cpu_cost": 10, + "cpu_cost": 3, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -5846,7 +5846,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -5915,7 +5915,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -6124,7 +6124,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -6170,7 +6170,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -6193,7 +6193,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -6239,7 +6239,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -6262,7 +6262,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -6331,7 +6331,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -6400,7 +6400,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -6423,7 +6423,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -6446,7 +6446,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -6471,7 +6471,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -6517,7 +6517,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -6609,7 +6609,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -6632,7 +6632,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -6701,7 +6701,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -6724,7 +6724,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -6747,7 +6747,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -6770,7 +6770,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -6793,7 +6793,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -6816,7 +6816,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -6908,7 +6908,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -6954,7 +6954,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -6977,7 +6977,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -7069,7 +7069,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -7138,7 +7138,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -7347,7 +7347,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -7393,7 +7393,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -7416,7 +7416,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -7462,7 +7462,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -7485,7 +7485,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -7554,7 +7554,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -7623,7 +7623,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -7646,7 +7646,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -7669,7 +7669,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -7694,7 +7694,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -7740,7 +7740,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -7832,7 +7832,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -7855,7 +7855,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -7924,7 +7924,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -7947,7 +7947,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -7970,7 +7970,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -7993,7 +7993,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -8016,7 +8016,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -8039,7 +8039,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -8131,7 +8131,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -8177,7 +8177,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -8200,7 +8200,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -8288,7 +8288,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -8354,7 +8354,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -8554,7 +8554,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -8598,7 +8598,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -8620,7 +8620,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -8664,7 +8664,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -8686,7 +8686,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -8752,7 +8752,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -8818,7 +8818,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -8840,7 +8840,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -8862,7 +8862,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -8886,7 +8886,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -8930,7 +8930,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -9018,7 +9018,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -9040,7 +9040,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -9106,7 +9106,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -9128,7 +9128,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -9150,7 +9150,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -9172,7 +9172,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -9194,7 +9194,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -9216,7 +9216,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -9304,7 +9304,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -9348,7 +9348,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -9370,7 +9370,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -9438,7 +9438,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -9507,7 +9507,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -9645,7 +9645,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -9691,7 +9691,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -9714,7 +9714,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -9760,7 +9760,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -9783,7 +9783,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -9852,7 +9852,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -9921,7 +9921,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -9944,7 +9944,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -9967,7 +9967,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -10013,7 +10013,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -10105,7 +10105,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -10174,7 +10174,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -10197,7 +10197,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -10220,7 +10220,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -10243,7 +10243,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -10266,7 +10266,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -10289,7 +10289,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -10358,7 +10358,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -10404,7 +10404,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -10427,7 +10427,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -10520,7 +10520,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -10589,7 +10589,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -10798,7 +10798,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -10844,7 +10844,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -10867,7 +10867,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -10913,7 +10913,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -10936,7 +10936,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -11005,7 +11005,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -11074,7 +11074,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -11097,7 +11097,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -11120,7 +11120,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -11145,7 +11145,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -11191,7 +11191,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -11283,7 +11283,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -11306,7 +11306,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -11375,7 +11375,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -11398,7 +11398,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -11421,7 +11421,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -11444,7 +11444,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -11467,7 +11467,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -11490,7 +11490,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -11582,7 +11582,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -11628,7 +11628,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -11651,7 +11651,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -11728,7 +11728,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -11785,7 +11785,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -11956,7 +11956,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -11994,7 +11994,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -12013,7 +12013,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -12051,7 +12051,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -12070,7 +12070,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -12127,7 +12127,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -12184,7 +12184,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -12203,7 +12203,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -12222,7 +12222,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -12241,7 +12241,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -12279,7 +12279,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -12355,7 +12355,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -12374,7 +12374,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -12431,7 +12431,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -12450,7 +12450,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -12469,7 +12469,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -12488,7 +12488,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -12507,7 +12507,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -12526,7 +12526,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -12602,7 +12602,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -12640,7 +12640,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -12659,7 +12659,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -12750,7 +12750,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -12819,7 +12819,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -13028,7 +13028,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -13074,7 +13074,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -13097,7 +13097,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -13143,7 +13143,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -13212,7 +13212,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -13281,7 +13281,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -13304,7 +13304,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -13327,7 +13327,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -13352,7 +13352,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -13398,7 +13398,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -13467,7 +13467,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -13490,7 +13490,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -13559,7 +13559,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -13582,7 +13582,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -13605,7 +13605,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -13628,7 +13628,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -13651,7 +13651,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -13674,7 +13674,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -13766,7 +13766,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -13812,7 +13812,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -13835,7 +13835,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -13929,7 +13929,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -14001,7 +14001,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -14217,7 +14217,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -14265,7 +14265,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -14289,7 +14289,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -14337,7 +14337,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -14361,7 +14361,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -14433,7 +14433,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -14505,7 +14505,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -14529,7 +14529,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -14553,7 +14553,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -14577,7 +14577,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -14625,7 +14625,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -14721,7 +14721,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -14745,7 +14745,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -14817,7 +14817,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -14841,7 +14841,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -14865,7 +14865,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -14889,7 +14889,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -14913,7 +14913,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -14937,7 +14937,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -15033,7 +15033,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -15081,7 +15081,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -15105,7 +15105,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -15199,7 +15199,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -15268,7 +15268,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -15477,7 +15477,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -15523,7 +15523,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -15546,7 +15546,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -15592,7 +15592,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -15615,7 +15615,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -15684,7 +15684,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -15753,7 +15753,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -15776,7 +15776,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -15799,7 +15799,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -15824,7 +15824,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -15870,7 +15870,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -15962,7 +15962,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -15985,7 +15985,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -16054,7 +16054,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -16077,7 +16077,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -16100,7 +16100,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -16123,7 +16123,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -16146,7 +16146,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -16169,7 +16169,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -16261,7 +16261,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -16307,7 +16307,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -16330,7 +16330,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -16424,7 +16424,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -16496,7 +16496,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -16712,7 +16712,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -16760,7 +16760,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -16784,7 +16784,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -16832,7 +16832,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -16856,7 +16856,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -16928,7 +16928,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17000,7 +17000,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17024,7 +17024,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17048,7 +17048,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17072,7 +17072,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17120,7 +17120,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17216,7 +17216,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17240,7 +17240,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17312,7 +17312,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17336,7 +17336,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17360,7 +17360,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17384,7 +17384,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17408,7 +17408,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17432,7 +17432,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17528,7 +17528,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17576,7 +17576,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17600,7 +17600,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17672,7 +17672,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17744,7 +17744,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17912,7 +17912,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17960,7 +17960,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -17984,7 +17984,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -18032,7 +18032,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -18152,7 +18152,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -18176,7 +18176,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -18224,7 +18224,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -18320,7 +18320,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -18368,7 +18368,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -18392,7 +18392,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -18416,7 +18416,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -18440,7 +18440,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -18464,7 +18464,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -18560,7 +18560,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -18608,7 +18608,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -18632,7 +18632,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -18704,7 +18704,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -18776,7 +18776,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -18920,7 +18920,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -18968,7 +18968,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -18992,7 +18992,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -19040,7 +19040,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -19064,7 +19064,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -19136,7 +19136,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -19208,7 +19208,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -19232,7 +19232,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -19256,7 +19256,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -19304,7 +19304,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -19400,7 +19400,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -19472,7 +19472,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -19496,7 +19496,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -19520,7 +19520,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -19544,7 +19544,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -19568,7 +19568,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -19592,7 +19592,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -19664,7 +19664,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -19712,7 +19712,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -19736,7 +19736,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -19808,7 +19808,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -19880,7 +19880,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -20024,7 +20024,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -20072,7 +20072,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -20096,7 +20096,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -20144,7 +20144,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -20216,7 +20216,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -20288,7 +20288,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -20312,7 +20312,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -20336,7 +20336,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -20384,7 +20384,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -20456,7 +20456,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -20528,7 +20528,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -20552,7 +20552,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -20576,7 +20576,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -20600,7 +20600,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -20624,7 +20624,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -20696,7 +20696,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -20744,7 +20744,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -20768,7 +20768,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -20844,7 +20844,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -20922,7 +20922,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -21078,7 +21078,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -21130,7 +21130,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -21156,7 +21156,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -21208,7 +21208,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -21234,7 +21234,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -21312,7 +21312,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -21390,7 +21390,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -21416,7 +21416,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -21442,7 +21442,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -21494,7 +21494,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -21598,7 +21598,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -21676,7 +21676,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -21702,7 +21702,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -21728,7 +21728,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -21754,7 +21754,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -21780,7 +21780,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -21858,7 +21858,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -21910,7 +21910,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -21936,7 +21936,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -22032,7 +22032,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -22101,7 +22101,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -22310,7 +22310,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -22356,7 +22356,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -22379,7 +22379,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -22425,7 +22425,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -22448,7 +22448,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -22517,7 +22517,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -22586,7 +22586,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -22609,7 +22609,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -22632,7 +22632,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -22657,7 +22657,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -22703,7 +22703,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -22795,7 +22795,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -22818,7 +22818,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -22887,7 +22887,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -22910,7 +22910,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -22933,7 +22933,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -22956,7 +22956,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -22979,7 +22979,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -23002,7 +23002,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -23094,7 +23094,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -23140,7 +23140,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -23163,7 +23163,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -23255,7 +23255,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -23324,7 +23324,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -23533,7 +23533,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -23579,7 +23579,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -23602,7 +23602,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -23648,7 +23648,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -23671,7 +23671,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -23740,7 +23740,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -23809,7 +23809,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -23832,7 +23832,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -23855,7 +23855,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -23880,7 +23880,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -23926,7 +23926,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -24018,7 +24018,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -24041,7 +24041,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -24110,7 +24110,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -24133,7 +24133,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -24156,7 +24156,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -24179,7 +24179,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -24202,7 +24202,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -24225,7 +24225,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -24317,7 +24317,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -24363,7 +24363,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -24386,7 +24386,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -24456,7 +24456,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -24528,7 +24528,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -24696,7 +24696,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -24744,7 +24744,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -24768,7 +24768,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -24816,7 +24816,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -24936,7 +24936,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -24960,7 +24960,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -25008,7 +25008,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -25104,7 +25104,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -25152,7 +25152,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -25176,7 +25176,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -25200,7 +25200,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -25224,7 +25224,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -25248,7 +25248,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -25344,7 +25344,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -25392,7 +25392,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -25416,7 +25416,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -25509,7 +25509,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -25578,7 +25578,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -25762,7 +25762,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -25808,7 +25808,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -25831,7 +25831,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -25877,7 +25877,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -25900,7 +25900,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -25969,7 +25969,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -26038,7 +26038,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -26061,7 +26061,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -26084,7 +26084,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -26107,7 +26107,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -26153,7 +26153,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -26245,7 +26245,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -26268,7 +26268,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -26337,7 +26337,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -26360,7 +26360,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -26383,7 +26383,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -26406,7 +26406,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -26429,7 +26429,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -26452,7 +26452,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -26544,7 +26544,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -26590,7 +26590,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -26613,7 +26613,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -26706,7 +26706,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -26752,7 +26752,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -26961,7 +26961,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -27007,7 +27007,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -27030,7 +27030,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -27076,7 +27076,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -27099,7 +27099,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -27168,7 +27168,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -27237,7 +27237,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -27260,7 +27260,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -27283,7 +27283,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -27308,7 +27308,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -27354,7 +27354,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -27446,7 +27446,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -27469,7 +27469,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -27538,7 +27538,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -27561,7 +27561,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -27584,7 +27584,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -27607,7 +27607,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -27630,7 +27630,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -27653,7 +27653,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -27745,7 +27745,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -27791,7 +27791,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -27814,7 +27814,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -27906,7 +27906,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -27952,7 +27952,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -28161,7 +28161,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -28207,7 +28207,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -28230,7 +28230,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -28276,7 +28276,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -28299,7 +28299,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -28368,7 +28368,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -28437,7 +28437,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -28460,7 +28460,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -28483,7 +28483,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -28508,7 +28508,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -28554,7 +28554,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -28646,7 +28646,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -28669,7 +28669,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -28738,7 +28738,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -28761,7 +28761,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -28784,7 +28784,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -28807,7 +28807,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -28830,7 +28830,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -28853,7 +28853,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -28945,7 +28945,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -28991,7 +28991,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -29014,7 +29014,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -29082,7 +29082,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -29128,7 +29128,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -29266,7 +29266,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -29312,7 +29312,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -29335,7 +29335,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -29381,7 +29381,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -29404,7 +29404,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -29473,7 +29473,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -29542,7 +29542,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -29565,7 +29565,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -29588,7 +29588,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -29634,7 +29634,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -29726,7 +29726,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -29795,7 +29795,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -29818,7 +29818,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -29841,7 +29841,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -29864,7 +29864,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -29887,7 +29887,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -29910,7 +29910,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -29979,7 +29979,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -30025,7 +30025,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -30048,7 +30048,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -30141,7 +30141,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -30187,7 +30187,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -30396,7 +30396,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -30442,7 +30442,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -30465,7 +30465,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -30511,7 +30511,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -30534,7 +30534,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -30603,7 +30603,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -30672,7 +30672,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -30695,7 +30695,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -30718,7 +30718,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -30743,7 +30743,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -30789,7 +30789,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -30881,7 +30881,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -30904,7 +30904,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -30973,7 +30973,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -30996,7 +30996,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -31019,7 +31019,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -31042,7 +31042,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -31065,7 +31065,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -31088,7 +31088,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -31180,7 +31180,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -31226,7 +31226,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -31249,7 +31249,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -31326,7 +31326,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -31364,7 +31364,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -31535,7 +31535,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -31573,7 +31573,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -31592,7 +31592,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -31630,7 +31630,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -31649,7 +31649,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -31706,7 +31706,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -31763,7 +31763,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -31782,7 +31782,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -31801,7 +31801,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -31820,7 +31820,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -31858,7 +31858,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -31934,7 +31934,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -31953,7 +31953,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -32010,7 +32010,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -32029,7 +32029,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -32048,7 +32048,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -32067,7 +32067,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -32086,7 +32086,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -32105,7 +32105,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -32181,7 +32181,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -32219,7 +32219,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -32238,7 +32238,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -32329,7 +32329,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -32375,7 +32375,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -32584,7 +32584,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -32630,7 +32630,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -32653,7 +32653,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -32699,7 +32699,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -32768,7 +32768,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -32837,7 +32837,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -32860,7 +32860,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -32883,7 +32883,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -32908,7 +32908,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -32954,7 +32954,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -33023,7 +33023,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -33046,7 +33046,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -33115,7 +33115,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -33138,7 +33138,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -33161,7 +33161,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -33184,7 +33184,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -33207,7 +33207,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -33230,7 +33230,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -33322,7 +33322,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -33368,7 +33368,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -33391,7 +33391,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -33485,7 +33485,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -33533,7 +33533,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -33749,7 +33749,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -33797,7 +33797,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -33821,7 +33821,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -33869,7 +33869,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -33893,7 +33893,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -33965,7 +33965,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -34037,7 +34037,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -34061,7 +34061,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -34085,7 +34085,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -34109,7 +34109,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -34157,7 +34157,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -34253,7 +34253,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -34277,7 +34277,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -34349,7 +34349,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -34373,7 +34373,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -34397,7 +34397,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -34421,7 +34421,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -34445,7 +34445,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -34469,7 +34469,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -34565,7 +34565,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -34613,7 +34613,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -34637,7 +34637,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -34731,7 +34731,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -34777,7 +34777,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -34986,7 +34986,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -35032,7 +35032,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -35055,7 +35055,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -35101,7 +35101,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -35124,7 +35124,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -35193,7 +35193,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -35262,7 +35262,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -35285,7 +35285,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -35308,7 +35308,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -35333,7 +35333,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -35379,7 +35379,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -35471,7 +35471,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -35494,7 +35494,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -35563,7 +35563,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -35586,7 +35586,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -35609,7 +35609,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -35632,7 +35632,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -35655,7 +35655,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -35678,7 +35678,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -35770,7 +35770,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -35816,7 +35816,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -35839,7 +35839,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -35909,7 +35909,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -35957,7 +35957,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -36125,7 +36125,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -36173,7 +36173,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -36197,7 +36197,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -36245,7 +36245,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -36365,7 +36365,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -36389,7 +36389,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -36437,7 +36437,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -36533,7 +36533,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -36581,7 +36581,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -36605,7 +36605,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -36629,7 +36629,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -36653,7 +36653,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -36677,7 +36677,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -36773,7 +36773,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -36821,7 +36821,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -36845,7 +36845,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -36917,7 +36917,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -36965,7 +36965,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -37109,7 +37109,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -37157,7 +37157,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -37181,7 +37181,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -37229,7 +37229,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -37253,7 +37253,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -37325,7 +37325,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -37397,7 +37397,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -37421,7 +37421,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -37445,7 +37445,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -37493,7 +37493,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -37589,7 +37589,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -37661,7 +37661,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -37685,7 +37685,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -37709,7 +37709,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -37733,7 +37733,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -37757,7 +37757,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -37781,7 +37781,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -37853,7 +37853,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -37901,7 +37901,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -37925,7 +37925,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -37997,7 +37997,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -38045,7 +38045,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -38189,7 +38189,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -38237,7 +38237,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -38261,7 +38261,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -38309,7 +38309,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -38381,7 +38381,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -38453,7 +38453,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -38477,7 +38477,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -38501,7 +38501,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -38549,7 +38549,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -38621,7 +38621,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -38693,7 +38693,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -38717,7 +38717,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -38741,7 +38741,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -38765,7 +38765,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -38789,7 +38789,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -38861,7 +38861,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -38909,7 +38909,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -38933,7 +38933,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -39009,7 +39009,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -39061,7 +39061,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -39217,7 +39217,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -39269,7 +39269,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -39295,7 +39295,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -39347,7 +39347,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -39373,7 +39373,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -39451,7 +39451,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -39529,7 +39529,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -39555,7 +39555,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -39581,7 +39581,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -39633,7 +39633,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -39737,7 +39737,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -39815,7 +39815,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -39841,7 +39841,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -39867,7 +39867,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -39893,7 +39893,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -39919,7 +39919,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -39997,7 +39997,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -40049,7 +40049,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -40075,7 +40075,7 @@ "linux", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [ "msan" ], @@ -40170,7 +40170,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -40216,7 +40216,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -40400,7 +40400,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -40446,7 +40446,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -40469,7 +40469,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -40515,7 +40515,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -40538,7 +40538,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -40607,7 +40607,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -40676,7 +40676,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -40699,7 +40699,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -40722,7 +40722,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -40745,7 +40745,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -40791,7 +40791,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -40883,7 +40883,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -40906,7 +40906,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -40975,7 +40975,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -40998,7 +40998,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -41021,7 +41021,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -41044,7 +41044,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -41067,7 +41067,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -41090,7 +41090,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -41182,7 +41182,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -41228,7 +41228,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -41251,7 +41251,7 @@ "mac", "posix" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "exclude_iomgrs": [ "uv" From 2f269ec781ab0c50bb917381df60a1c37da8d071 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 20 Apr 2017 08:03:08 -0700 Subject: [PATCH 459/461] Rollback rqs change: may have been too aggressive --- test/core/end2end/gen_build_yaml.py | 3 +- tools/run_tests/generated/tests.json | 48 ++++++++++++++-------------- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py index ecc174373a7..e31a46d0329 100755 --- a/test/core/end2end/gen_build_yaml.py +++ b/test/core/end2end/gen_build_yaml.py @@ -96,8 +96,7 @@ END2END_TESTS = { 'bad_ping': connectivity_test_options._replace(proxyable=False), 'binary_metadata': default_test_options._replace(cpu_cost=LOWCPU), 'resource_quota_server': default_test_options._replace(large_writes=True, - proxyable=False, - cpu_cost=LOWCPU), + proxyable=False), 'call_creds': default_test_options._replace(secure=True), 'cancel_after_accept': default_test_options._replace(cpu_cost=LOWCPU), 'cancel_after_client_done': default_test_options._replace(cpu_cost=LOWCPU), diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 35dfcace7c7..043b4cf66e5 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -6724,7 +6724,7 @@ "mac", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -7947,7 +7947,7 @@ "mac", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -9128,7 +9128,7 @@ "linux", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -10197,7 +10197,7 @@ "mac", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -11398,7 +11398,7 @@ "mac", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -12450,7 +12450,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -13582,7 +13582,7 @@ "mac", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -14841,7 +14841,7 @@ "linux", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -16077,7 +16077,7 @@ "mac", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -17336,7 +17336,7 @@ "linux", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -19496,7 +19496,7 @@ "linux", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -22910,7 +22910,7 @@ "mac", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -24133,7 +24133,7 @@ "mac", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -26360,7 +26360,7 @@ "mac", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -27561,7 +27561,7 @@ "mac", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -28761,7 +28761,7 @@ "mac", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -29818,7 +29818,7 @@ "mac", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -30996,7 +30996,7 @@ "mac", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -32029,7 +32029,7 @@ "ci_platforms": [ "linux" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -33138,7 +33138,7 @@ "mac", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -34373,7 +34373,7 @@ "linux", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -35586,7 +35586,7 @@ "mac", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [], "flaky": false, @@ -37685,7 +37685,7 @@ "linux", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [ "uv" @@ -40998,7 +40998,7 @@ "mac", "posix" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "exclude_iomgrs": [ "uv" From f2ea1d19f5d9abd358ae5c5fe33d5491c0b20556 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 20 Apr 2017 10:48:57 -0700 Subject: [PATCH 460/461] Increase threshold probability for reporting differences --- tools/profiling/microbenchmarks/speedup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/profiling/microbenchmarks/speedup.py b/tools/profiling/microbenchmarks/speedup.py index 5a1ed3f2cf5..8af0066c9df 100644 --- a/tools/profiling/microbenchmarks/speedup.py +++ b/tools/profiling/microbenchmarks/speedup.py @@ -30,7 +30,7 @@ from scipy import stats import math -_THRESHOLD = 0.00001 +_THRESHOLD = 1e-10 def scale(a, mul): return [x*mul for x in a] From 143cfa779255ca550767e467e89acf9e65ebd43a Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 20 Apr 2017 11:32:40 -0700 Subject: [PATCH 461/461] Disable compression+resource_quota_server tests --- test/core/end2end/gen_build_yaml.py | 17 +++++----- tools/run_tests/generated/tests.json | 46 ---------------------------- 2 files changed, 10 insertions(+), 53 deletions(-) diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py index e31a46d0329..48e57205395 100755 --- a/test/core/end2end/gen_build_yaml.py +++ b/test/core/end2end/gen_build_yaml.py @@ -39,9 +39,9 @@ import hashlib FixtureOptions = collections.namedtuple( 'FixtureOptions', - 'fullstack includes_proxy dns_resolver secure platforms ci_mac tracing exclude_configs exclude_iomgrs large_writes') + 'fullstack includes_proxy dns_resolver secure platforms ci_mac tracing exclude_configs exclude_iomgrs large_writes enables_compression') default_unsecure_fixture_options = FixtureOptions( - True, False, True, False, ['windows', 'linux', 'mac', 'posix'], True, False, [], [], True) + True, False, True, False, ['windows', 'linux', 'mac', 'posix'], True, False, [], [], True, False) socketpair_unsecure_fixture_options = default_unsecure_fixture_options._replace(fullstack=False, dns_resolver=False) default_secure_fixture_options = default_unsecure_fixture_options._replace(secure=True) uds_fixture_options = default_unsecure_fixture_options._replace(dns_resolver=False, platforms=['linux', 'mac', 'posix'], exclude_iomgrs=['uv']) @@ -51,8 +51,7 @@ fd_unsecure_fixture_options = default_unsecure_fixture_options._replace( # maps fixture name to whether it requires the security library END2END_FIXTURES = { - 'h2_compress': default_unsecure_fixture_options, - + 'h2_compress': default_unsecure_fixture_options._replace(enables_compression=True), 'h2_census': default_unsecure_fixture_options, 'h2_load_reporting': default_unsecure_fixture_options, 'h2_fakesec': default_secure_fixture_options._replace(ci_mac=False), @@ -83,8 +82,8 @@ END2END_FIXTURES = { TestOptions = collections.namedtuple( 'TestOptions', - 'needs_fullstack needs_dns proxyable secure traceable cpu_cost exclude_iomgrs large_writes flaky') -default_test_options = TestOptions(False, False, True, False, True, 1.0, [], False, False) + 'needs_fullstack needs_dns proxyable secure traceable cpu_cost exclude_iomgrs large_writes flaky allow_compression') +default_test_options = TestOptions(False, False, True, False, True, 1.0, [], False, False, True) connectivity_test_options = default_test_options._replace(needs_fullstack=True) LOWCPU = 0.1 @@ -96,7 +95,8 @@ END2END_TESTS = { 'bad_ping': connectivity_test_options._replace(proxyable=False), 'binary_metadata': default_test_options._replace(cpu_cost=LOWCPU), 'resource_quota_server': default_test_options._replace(large_writes=True, - proxyable=False), + proxyable=False, + allow_compression=False), 'call_creds': default_test_options._replace(secure=True), 'cancel_after_accept': default_test_options._replace(cpu_cost=LOWCPU), 'cancel_after_client_done': default_test_options._replace(cpu_cost=LOWCPU), @@ -172,6 +172,9 @@ def compatible(f, t): if END2END_TESTS[t].large_writes: if not END2END_FIXTURES[f].large_writes: return False + if not END2END_TESTS[t].allow_compression: + if END2END_FIXTURES[f].enables_compression: + return False return True diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index 043b4cf66e5..7629ca3d661 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -7937,29 +7937,6 @@ "posix" ] }, - { - "args": [ - "resource_quota_server" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "language": "c", - "name": "h2_compress_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "server_finishes_request" @@ -28751,29 +28728,6 @@ "posix" ] }, - { - "args": [ - "resource_quota_server" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "language": "c", - "name": "h2_compress_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "server_finishes_request"