aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-06-28 13:53:16 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-06-28 13:53:16 -0700
commita439859c73f34bec8f38e28fe818e2d3305d7873 (patch)
treea0e7550346ebc6a4112ced216ac16025e30a75a9 /src
parent3203c372477785a7114df3caed255f028a1766e6 (diff)
parentfe466b0e170120263811ab12a4406c7438201481 (diff)
Merge github.com:grpc/grpc into %s
Diffstat (limited to 'src')
-rw-r--r--src/core/ext/census/grpc_filter.c3
-rw-r--r--src/core/ext/client_config/client_channel.c6
-rw-r--r--src/core/ext/client_config/subchannel.c2
-rw-r--r--src/core/ext/transport/chttp2/transport/chttp2_transport.c12
-rw-r--r--src/core/lib/debug/trace.c8
-rw-r--r--src/core/lib/iomgr/error.c61
-rw-r--r--src/core/lib/iomgr/ev_epoll_linux.c32
-rw-r--r--src/core/lib/surface/call.h1
-rw-r--r--src/core/lib/surface/completion_queue.c30
-rw-r--r--src/core/lib/surface/completion_queue.h4
-rw-r--r--src/core/lib/surface/init.c7
-rw-r--r--src/core/lib/surface/surface_trace.h48
-rw-r--r--src/csharp/Grpc.Auth/project.json6
-rw-r--r--src/csharp/Grpc.Core.Tests/project.json8
-rw-r--r--src/csharp/Grpc.Core/project.json7
-rw-r--r--src/csharp/Grpc.Examples.MathClient/project.json8
-rw-r--r--src/csharp/Grpc.Examples.MathServer/project.json8
-rw-r--r--src/csharp/Grpc.Examples.Tests/project.json8
-rw-r--r--src/csharp/Grpc.HealthCheck.Tests/project.json8
-rw-r--r--src/csharp/Grpc.HealthCheck/project.json6
-rw-r--r--src/csharp/Grpc.IntegrationTesting.Client/project.json8
-rw-r--r--src/csharp/Grpc.IntegrationTesting.QpsWorker/project.json8
-rw-r--r--src/csharp/Grpc.IntegrationTesting.Server/project.json8
-rw-r--r--src/csharp/Grpc.IntegrationTesting.StressClient/project.json8
-rw-r--r--src/csharp/Grpc.IntegrationTesting/project.json8
-rw-r--r--src/objective-c/ProtoRPC/ProtoService.m18
-rw-r--r--src/ruby/spec/client_server_spec.rb46
27 files changed, 273 insertions, 104 deletions
diff --git a/src/core/ext/census/grpc_filter.c b/src/core/ext/census/grpc_filter.c
index 72e4e5427e..f51d850e01 100644
--- a/src/core/ext/census/grpc_filter.c
+++ b/src/core/ext/census/grpc_filter.c
@@ -45,6 +45,7 @@
#include "src/core/ext/census/census_interface.h"
#include "src/core/ext/census/census_rpc_stats.h"
#include "src/core/lib/channel/channel_stack.h"
+#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/transport/static_metadata.h"
typedef struct call_data {
@@ -92,6 +93,7 @@ static void client_start_transport_op(grpc_exec_ctx *exec_ctx,
static void server_on_done_recv(grpc_exec_ctx *exec_ctx, void *ptr,
grpc_error *error) {
+ GPR_TIMER_BEGIN("census-server:server_on_done_recv", 0);
grpc_call_element *elem = ptr;
call_data *calld = elem->call_data;
channel_data *chand = elem->channel_data;
@@ -99,6 +101,7 @@ static void server_on_done_recv(grpc_exec_ctx *exec_ctx, void *ptr,
extract_and_annotate_method_tag(calld->recv_initial_metadata, calld, chand);
}
calld->on_done_recv->cb(exec_ctx, calld->on_done_recv->cb_arg, error);
+ GPR_TIMER_END("census-server:server_on_done_recv", 0);
}
static void server_mutate_op(grpc_call_element *elem,
diff --git a/src/core/ext/client_config/client_channel.c b/src/core/ext/client_config/client_channel.c
index 1d5a7d5224..a096435c98 100644
--- a/src/core/ext/client_config/client_channel.c
+++ b/src/core/ext/client_config/client_channel.c
@@ -367,6 +367,8 @@ static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *elemp,
uint32_t initial_metadata_flags,
grpc_connected_subchannel **connected_subchannel,
grpc_closure *on_ready) {
+ GPR_TIMER_BEGIN("cc_pick_subchannel", 0);
+
grpc_call_element *elem = elemp;
channel_data *chand = elem->channel_data;
call_data *calld = elem->call_data;
@@ -391,6 +393,7 @@ static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *elemp,
}
}
gpr_mu_unlock(&chand->mu_config);
+ GPR_TIMER_END("cc_pick_subchannel", 0);
return 1;
}
if (chand->lb_policy != NULL) {
@@ -402,6 +405,7 @@ static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *elemp,
initial_metadata, initial_metadata_flags,
connected_subchannel, on_ready);
GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "cc_pick_subchannel");
+ GPR_TIMER_END("cc_pick_subchannel", 0);
return r;
}
if (chand->resolver != NULL && !chand->started_resolving) {
@@ -426,6 +430,8 @@ static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *elemp,
NULL);
}
gpr_mu_unlock(&chand->mu_config);
+
+ GPR_TIMER_END("cc_pick_subchannel", 0);
return 0;
}
diff --git a/src/core/ext/client_config/subchannel.c b/src/core/ext/client_config/subchannel.c
index 468067ea57..d089cd4399 100644
--- a/src/core/ext/client_config/subchannel.c
+++ b/src/core/ext/client_config/subchannel.c
@@ -690,9 +690,11 @@ char *grpc_subchannel_call_get_peer(grpc_exec_ctx *exec_ctx,
void grpc_subchannel_call_process_op(grpc_exec_ctx *exec_ctx,
grpc_subchannel_call *call,
grpc_transport_stream_op *op) {
+ GPR_TIMER_BEGIN("grpc_subchannel_call_process_op", 0);
grpc_call_stack *call_stack = SUBCHANNEL_CALL_TO_CALL_STACK(call);
grpc_call_element *top_elem = grpc_call_stack_element(call_stack, 0);
top_elem->filter->start_transport_stream_op(exec_ctx, top_elem, op);
+ GPR_TIMER_END("grpc_subchannel_call_process_op", 0);
}
grpc_connected_subchannel *grpc_subchannel_get_connected_subchannel(
diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c
index c311f54409..c0ec88ba8e 100644
--- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c
+++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c
@@ -637,6 +637,8 @@ static void finish_global_actions(grpc_exec_ctx *exec_ctx,
grpc_chttp2_executor_action_header *hdr;
grpc_chttp2_executor_action_header *next;
+ GPR_TIMER_BEGIN("finish_global_actions", 0);
+
for (;;) {
if (!t->executor.writing_active && !t->closed &&
grpc_chttp2_unlocking_check_writes(exec_ctx, &t->global, &t->writing)) {
@@ -654,7 +656,9 @@ static void finish_global_actions(grpc_exec_ctx *exec_ctx,
NULL;
gpr_mu_unlock(&t->executor.mu);
while (hdr != NULL) {
+ GPR_TIMER_BEGIN("chttp2:locked_action", 0);
hdr->action(exec_ctx, t, hdr->stream, hdr->arg);
+ GPR_TIMER_END("chttp2:locked_action", 0);
next = hdr->next;
gpr_free(hdr);
UNREF_TRANSPORT(exec_ctx, t, "pending_action");
@@ -667,6 +671,8 @@ static void finish_global_actions(grpc_exec_ctx *exec_ctx,
gpr_mu_unlock(&t->executor.mu);
break;
}
+
+ GPR_TIMER_END("finish_global_actions", 0);
}
void grpc_chttp2_run_with_global_lock(grpc_exec_ctx *exec_ctx,
@@ -676,6 +682,8 @@ void grpc_chttp2_run_with_global_lock(grpc_exec_ctx *exec_ctx,
void *arg, size_t sizeof_arg) {
grpc_chttp2_executor_action_header *hdr;
+ GPR_TIMER_BEGIN("grpc_chttp2_run_with_global_lock", 0);
+
REF_TRANSPORT(t, "run_global");
gpr_mu_lock(&t->executor.mu);
@@ -684,7 +692,9 @@ void grpc_chttp2_run_with_global_lock(grpc_exec_ctx *exec_ctx,
t->executor.global_active = 1;
gpr_mu_unlock(&t->executor.mu);
+ GPR_TIMER_BEGIN("chttp2:locked_action", 0);
action(exec_ctx, t, optional_stream, arg);
+ GPR_TIMER_END("chttp2:locked_action", 0);
finish_global_actions(exec_ctx, t);
} else {
@@ -721,6 +731,8 @@ void grpc_chttp2_run_with_global_lock(grpc_exec_ctx *exec_ctx,
}
UNREF_TRANSPORT(exec_ctx, t, "run_global");
+
+ GPR_TIMER_END("grpc_chttp2_run_with_global_lock", 0);
}
/*******************************************************************************
diff --git a/src/core/lib/debug/trace.c b/src/core/lib/debug/trace.c
index 555f497b78..c56046785b 100644
--- a/src/core/lib/debug/trace.c
+++ b/src/core/lib/debug/trace.c
@@ -88,7 +88,11 @@ static void parse(const char *s) {
split(s, &strings, &nstrings);
for (i = 0; i < nstrings; i++) {
- grpc_tracer_set_enabled(strings[i], 1);
+ if (strings[i][0] == '-') {
+ grpc_tracer_set_enabled(strings[i] + 1, 0);
+ } else {
+ grpc_tracer_set_enabled(strings[i], 1);
+ }
}
for (i = 0; i < nstrings; i++) {
@@ -117,7 +121,7 @@ int grpc_tracer_set_enabled(const char *name, int enabled) {
tracer *t;
if (0 == strcmp(name, "all")) {
for (t = tracers; t; t = t->next) {
- *t->flag = 1;
+ *t->flag = enabled;
}
} else {
int found = 0;
diff --git a/src/core/lib/iomgr/error.c b/src/core/lib/iomgr/error.c
index aa94bb7fdf..e20a0169c5 100644
--- a/src/core/lib/iomgr/error.c
+++ b/src/core/lib/iomgr/error.c
@@ -48,6 +48,8 @@
#include <grpc/support/log_windows.h>
#endif
+#include "src/core/lib/profiling/timers.h"
+
static void destroy_integer(void *key) {}
static void *copy_integer(void *key) { return key; }
@@ -216,6 +218,7 @@ void grpc_error_unref(grpc_error *err) {
grpc_error *grpc_error_create(const char *file, int line, const char *desc,
grpc_error **referencing,
size_t num_referencing) {
+ GPR_TIMER_BEGIN("grpc_error_create", 0);
grpc_error *err = gpr_malloc(sizeof(*err));
if (err == NULL) { // TODO(ctiller): make gpr_malloc return NULL
return GRPC_ERROR_OOM;
@@ -241,61 +244,78 @@ grpc_error *grpc_error_create(const char *file, int line, const char *desc,
(void *)(uintptr_t)GRPC_ERROR_TIME_CREATED,
box_time(gpr_now(GPR_CLOCK_REALTIME)));
gpr_ref_init(&err->refs, 1);
+ GPR_TIMER_END("grpc_error_create", 0);
return err;
}
static grpc_error *copy_error_and_unref(grpc_error *in) {
+ GPR_TIMER_BEGIN("copy_error_and_unref", 0);
+ grpc_error *out;
if (is_special(in)) {
- if (in == GRPC_ERROR_NONE) return GRPC_ERROR_CREATE("no error");
- if (in == GRPC_ERROR_OOM) return GRPC_ERROR_CREATE("oom");
- if (in == GRPC_ERROR_CANCELLED)
- return grpc_error_set_int(GRPC_ERROR_CREATE("cancelled"),
- GRPC_ERROR_INT_GRPC_STATUS,
- GRPC_STATUS_CANCELLED);
- return GRPC_ERROR_CREATE("unknown");
- }
- grpc_error *out = gpr_malloc(sizeof(*out));
+ if (in == GRPC_ERROR_NONE)
+ out = GRPC_ERROR_CREATE("no error");
+ else if (in == GRPC_ERROR_OOM)
+ out = GRPC_ERROR_CREATE("oom");
+ else if (in == GRPC_ERROR_CANCELLED)
+ out =
+ grpc_error_set_int(GRPC_ERROR_CREATE("cancelled"),
+ GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_CANCELLED);
+ else
+ out = GRPC_ERROR_CREATE("unknown");
+ } else {
+ out = gpr_malloc(sizeof(*out));
#ifdef GRPC_ERROR_REFCOUNT_DEBUG
- gpr_log(GPR_DEBUG, "%p create copying", out);
+ gpr_log(GPR_DEBUG, "%p create copying", out);
#endif
- out->ints = gpr_avl_ref(in->ints);
- out->strs = gpr_avl_ref(in->strs);
- out->errs = gpr_avl_ref(in->errs);
- out->times = gpr_avl_ref(in->times);
- out->next_err = in->next_err;
- gpr_ref_init(&out->refs, 1);
- GRPC_ERROR_UNREF(in);
+ out->ints = gpr_avl_ref(in->ints);
+ out->strs = gpr_avl_ref(in->strs);
+ out->errs = gpr_avl_ref(in->errs);
+ out->times = gpr_avl_ref(in->times);
+ out->next_err = in->next_err;
+ gpr_ref_init(&out->refs, 1);
+ GRPC_ERROR_UNREF(in);
+ }
+ GPR_TIMER_END("copy_error_and_unref", 0);
return out;
}
grpc_error *grpc_error_set_int(grpc_error *src, grpc_error_ints which,
intptr_t value) {
+ GPR_TIMER_BEGIN("grpc_error_set_int", 0);
grpc_error *new = copy_error_and_unref(src);
new->ints = gpr_avl_add(new->ints, (void *)(uintptr_t)which, (void *)value);
+ GPR_TIMER_END("grpc_error_set_int", 0);
return new;
}
bool grpc_error_get_int(grpc_error *err, grpc_error_ints which, intptr_t *p) {
+ GPR_TIMER_BEGIN("grpc_error_get_int", 0);
void *pp;
if (is_special(err)) {
if (err == GRPC_ERROR_CANCELLED && which == GRPC_ERROR_INT_GRPC_STATUS) {
*p = GRPC_STATUS_CANCELLED;
+ GPR_TIMER_END("grpc_error_get_int", 0);
return true;
}
+ GPR_TIMER_END("grpc_error_get_int", 0);
return false;
}
if (gpr_avl_maybe_get(err->ints, (void *)(uintptr_t)which, &pp)) {
if (p != NULL) *p = (intptr_t)pp;
+ GPR_TIMER_END("grpc_error_get_int", 0);
return true;
}
+ GPR_TIMER_END("grpc_error_get_int", 0);
return false;
}
grpc_error *grpc_error_set_str(grpc_error *src, grpc_error_strs which,
const char *value) {
+ GPR_TIMER_BEGIN("grpc_error_set_str", 0);
grpc_error *new = copy_error_and_unref(src);
new->strs =
gpr_avl_add(new->strs, (void *)(uintptr_t)which, gpr_strdup(value));
+ GPR_TIMER_END("grpc_error_set_str", 0);
return new;
}
@@ -305,8 +325,10 @@ const char *grpc_error_get_str(grpc_error *err, grpc_error_strs which) {
}
grpc_error *grpc_error_add_child(grpc_error *src, grpc_error *child) {
+ GPR_TIMER_BEGIN("grpc_error_add_child", 0);
grpc_error *new = copy_error_and_unref(src);
new->errs = gpr_avl_add(new->errs, (void *)(new->next_err++), child);
+ GPR_TIMER_END("grpc_error_add_child", 0);
return new;
}
@@ -498,6 +520,7 @@ void grpc_error_free_string(const char *str) {
}
const char *grpc_error_string(grpc_error *err) {
+ GPR_TIMER_BEGIN("grpc_error_string", 0);
if (err == GRPC_ERROR_NONE) return no_error_string;
if (err == GRPC_ERROR_OOM) return oom_error_string;
if (err == GRPC_ERROR_CANCELLED) return cancelled_error_string;
@@ -514,7 +537,9 @@ const char *grpc_error_string(grpc_error *err) {
qsort(kvs.kvs, kvs.num_kvs, sizeof(kv_pair), cmp_kvs);
- return finish_kvs(&kvs);
+ const char *out = finish_kvs(&kvs);
+ GPR_TIMER_END("grpc_error_string", 0);
+ return out;
}
grpc_error *grpc_os_error(const char *file, int line, int err,
diff --git a/src/core/lib/iomgr/ev_epoll_linux.c b/src/core/lib/iomgr/ev_epoll_linux.c
index 5460d72734..475bd3c1df 100644
--- a/src/core/lib/iomgr/ev_epoll_linux.c
+++ b/src/core/lib/iomgr/ev_epoll_linux.c
@@ -1031,6 +1031,8 @@ static void fd_notify_on_write(grpc_exec_ctx *exec_ctx, grpc_fd *fd,
*/
GPR_TLS_DECL(g_current_thread_pollset);
GPR_TLS_DECL(g_current_thread_worker);
+static __thread bool g_initialized_sigmask;
+static __thread sigset_t g_orig_sigmask;
static void sig_handler(int sig_num) {
#ifdef GRPC_EPOLL_DEBUG
@@ -1388,7 +1390,6 @@ static grpc_error *pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
int timeout_ms = poll_deadline_to_millis_timeout(deadline, now);
sigset_t new_mask;
- sigset_t orig_mask;
grpc_pollset_worker worker;
worker.next = worker.prev = NULL;
@@ -1423,21 +1424,26 @@ static grpc_error *pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
times *except* when it is in epoll_pwait(). This way, the worker never
misses acting on a kick */
- sigemptyset(&new_mask);
- sigaddset(&new_mask, grpc_wakeup_signal);
- pthread_sigmask(SIG_BLOCK, &new_mask, &orig_mask);
- sigdelset(&orig_mask, grpc_wakeup_signal);
- /* new_mask: The new thread mask which blocks 'grpc_wakeup_signal'. This is
- the mask used at all times *except during epoll_wait()*"
- orig_mask: The thread mask which allows 'grpc_wakeup_signal' and this is
- the mask to use *during epoll_wait()*
-
- The new_mask is set on the worker before it is added to the pollset (i.e
- before it can be kicked) */
+ if (!g_initialized_sigmask) {
+ sigemptyset(&new_mask);
+ sigaddset(&new_mask, grpc_wakeup_signal);
+ pthread_sigmask(SIG_BLOCK, &new_mask, &g_orig_sigmask);
+ sigdelset(&g_orig_sigmask, grpc_wakeup_signal);
+ g_initialized_sigmask = true;
+ /* new_mask: The new thread mask which blocks 'grpc_wakeup_signal'.
+ This is the mask used at all times *except during
+ epoll_wait()*"
+ g_orig_sigmask: The thread mask which allows 'grpc_wakeup_signal' and
+ this is the mask to use *during epoll_wait()*
+
+ The new_mask is set on the worker before it is added to the pollset
+ (i.e before it can be kicked) */
+ }
push_front_worker(pollset, &worker); /* Add worker to pollset */
- pollset_work_and_unlock(exec_ctx, pollset, timeout_ms, &orig_mask, &error);
+ pollset_work_and_unlock(exec_ctx, pollset, timeout_ms, &g_orig_sigmask,
+ &error);
grpc_exec_ctx_flush(exec_ctx);
gpr_mu_lock(&pollset->mu);
diff --git a/src/core/lib/surface/call.h b/src/core/lib/surface/call.h
index b640345c21..3a78fe3aa3 100644
--- a/src/core/lib/surface/call.h
+++ b/src/core/lib/surface/call.h
@@ -37,7 +37,6 @@
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/channel/context.h"
#include "src/core/lib/surface/api_trace.h"
-#include "src/core/lib/surface/surface_trace.h"
#include <grpc/grpc.h>
#include <grpc/impl/codegen/compression_types.h>
diff --git a/src/core/lib/surface/completion_queue.c b/src/core/lib/surface/completion_queue.c
index 72b7db1ba9..5978884db8 100644
--- a/src/core/lib/surface/completion_queue.c
+++ b/src/core/lib/surface/completion_queue.c
@@ -48,7 +48,6 @@
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/call.h"
#include "src/core/lib/surface/event_string.h"
-#include "src/core/lib/surface/surface_trace.h"
int grpc_trace_operation_failures;
@@ -93,6 +92,17 @@ struct grpc_completion_queue {
static gpr_mu g_freelist_mu;
static grpc_completion_queue *g_freelist;
+int grpc_cq_pluck_trace;
+int grpc_cq_event_timeout_trace;
+
+#define GRPC_SURFACE_TRACE_RETURNED_EVENT(cq, event) \
+ if (grpc_api_trace && \
+ (grpc_cq_pluck_trace || (event)->type != GRPC_QUEUE_TIMEOUT)) { \
+ char *_ev = grpc_event_string(event); \
+ gpr_log(GPR_INFO, "RETURN_EVENT[%p]: %s", cq, _ev); \
+ gpr_free(_ev); \
+ }
+
static void on_pollset_shutdown_done(grpc_exec_ctx *exec_ctx, void *cc,
grpc_error *error);
@@ -426,14 +436,16 @@ grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cc, void *tag,
GPR_TIMER_BEGIN("grpc_completion_queue_pluck", 0);
- GRPC_API_TRACE(
- "grpc_completion_queue_pluck("
- "cc=%p, tag=%p, "
- "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));
+ if (grpc_cq_pluck_trace) {
+ GRPC_API_TRACE(
+ "grpc_completion_queue_pluck("
+ "cc=%p, tag=%p, "
+ "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));
+ }
GPR_ASSERT(!reserved);
deadline = gpr_convert_clock_type(deadline, GPR_CLOCK_MONOTONIC);
diff --git a/src/core/lib/surface/completion_queue.h b/src/core/lib/surface/completion_queue.h
index b9dd1092b6..3049284f68 100644
--- a/src/core/lib/surface/completion_queue.h
+++ b/src/core/lib/surface/completion_queue.h
@@ -39,6 +39,10 @@
#include <grpc/grpc.h>
#include "src/core/lib/iomgr/pollset.h"
+/* These trace flags default to 1. The corresponding lines are only traced
+ if grpc_api_trace is also truthy */
+extern int grpc_cq_pluck_trace;
+extern int grpc_cq_event_timeout_trace;
extern int grpc_trace_operation_failures;
typedef struct grpc_cq_completion {
diff --git a/src/core/lib/surface/init.c b/src/core/lib/surface/init.c
index f07039cb94..5397913a21 100644
--- a/src/core/lib/surface/init.c
+++ b/src/core/lib/surface/init.c
@@ -57,7 +57,6 @@
#include "src/core/lib/surface/init.h"
#include "src/core/lib/surface/lame_client.h"
#include "src/core/lib/surface/server.h"
-#include "src/core/lib/surface/surface_trace.h"
#include "src/core/lib/transport/connectivity_state.h"
#include "src/core/lib/transport/transport_impl.h"
@@ -165,6 +164,12 @@ void grpc_init(void) {
&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);
+ // Default pluck trace to 1
+ grpc_cq_pluck_trace = 1;
+ grpc_register_tracer("queue_timeout", &grpc_cq_event_timeout_trace);
+ // Default timeout trace to 1
+ grpc_cq_event_timeout_trace = 1;
grpc_register_tracer("op_failure", &grpc_trace_operation_failures);
grpc_security_pre_init();
grpc_iomgr_init();
diff --git a/src/core/lib/surface/surface_trace.h b/src/core/lib/surface/surface_trace.h
deleted file mode 100644
index a69a0fff57..0000000000
--- a/src/core/lib/surface/surface_trace.h
+++ /dev/null
@@ -1,48 +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.
- *
- */
-
-#ifndef GRPC_CORE_LIB_SURFACE_SURFACE_TRACE_H
-#define GRPC_CORE_LIB_SURFACE_SURFACE_TRACE_H
-
-#include <grpc/support/log.h>
-#include "src/core/lib/debug/trace.h"
-#include "src/core/lib/surface/api_trace.h"
-
-#define GRPC_SURFACE_TRACE_RETURNED_EVENT(cq, event) \
- if (grpc_api_trace) { \
- char *_ev = grpc_event_string(event); \
- gpr_log(GPR_INFO, "RETURN_EVENT[%p]: %s", cq, _ev); \
- gpr_free(_ev); \
- }
-
-#endif /* GRPC_CORE_LIB_SURFACE_SURFACE_TRACE_H */
diff --git a/src/csharp/Grpc.Auth/project.json b/src/csharp/Grpc.Auth/project.json
index 4c5c960204..2241413359 100644
--- a/src/csharp/Grpc.Auth/project.json
+++ b/src/csharp/Grpc.Auth/project.json
@@ -12,6 +12,12 @@
"requireLicenseAcceptance": false,
"tags": [ "gRPC RPC Protocol HTTP/2 Auth OAuth2" ],
},
+ "buildOptions": {
+ "define": [ "SIGNED" ],
+ "keyFile": "../keys/Grpc.snk",
+ "publicSign": true,
+ "xmlDoc": true
+ },
"dependencies": {
"Grpc.Core": "0.16.0-dev",
"Google.Apis.Auth": "1.11.1"
diff --git a/src/csharp/Grpc.Core.Tests/project.json b/src/csharp/Grpc.Core.Tests/project.json
index 3ad081df39..6402912d05 100644
--- a/src/csharp/Grpc.Core.Tests/project.json
+++ b/src/csharp/Grpc.Core.Tests/project.json
@@ -5,6 +5,10 @@
"configurations": {
"Debug": {
"buildOptions": {
+ "define": [ "SIGNED" ],
+ "keyFile": "../keys/Grpc.snk",
+ "publicSign": true,
+ "xmlDoc": true,
"copyToOutput": {
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Debug/grpc_csharp_ext.dll",
@@ -17,6 +21,10 @@
},
"Release": {
"buildOptions": {
+ "define": [ "SIGNED" ],
+ "keyFile": "../keys/Grpc.snk",
+ "publicSign": true,
+ "xmlDoc": true,
"copyToOutput": {
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Release/grpc_csharp_ext.dll",
diff --git a/src/csharp/Grpc.Core/project.json b/src/csharp/Grpc.Core/project.json
index 4729a9346c..775764e1d7 100644
--- a/src/csharp/Grpc.Core/project.json
+++ b/src/csharp/Grpc.Core/project.json
@@ -21,8 +21,13 @@
"build/native/bin/macosx_x64/": "../nativelibs/macosx_x64/libgrpc_csharp_ext.dylib"
}
},
+ "shared": "Version.cs",
"buildOptions": {
- "embed": [ "../../../etc/roots.pem" ]
+ "embed": [ "../../../etc/roots.pem" ],
+ "define": [ "SIGNED" ],
+ "keyFile": "../keys/Grpc.snk",
+ "publicSign": true,
+ "xmlDoc": true
},
"dependencies": {
"Ix-Async": "1.2.5"
diff --git a/src/csharp/Grpc.Examples.MathClient/project.json b/src/csharp/Grpc.Examples.MathClient/project.json
index b254f15af8..378fc8cf8b 100644
--- a/src/csharp/Grpc.Examples.MathClient/project.json
+++ b/src/csharp/Grpc.Examples.MathClient/project.json
@@ -5,6 +5,10 @@
"configurations": {
"Debug": {
"buildOptions": {
+ "define": [ "SIGNED" ],
+ "keyFile": "../keys/Grpc.snk",
+ "publicSign": true,
+ "xmlDoc": true,
"copyToOutput": {
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Debug/grpc_csharp_ext.dll",
@@ -17,6 +21,10 @@
},
"Release": {
"buildOptions": {
+ "define": [ "SIGNED" ],
+ "keyFile": "../keys/Grpc.snk",
+ "publicSign": true,
+ "xmlDoc": true,
"copyToOutput": {
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Release/grpc_csharp_ext.dll",
diff --git a/src/csharp/Grpc.Examples.MathServer/project.json b/src/csharp/Grpc.Examples.MathServer/project.json
index b254f15af8..378fc8cf8b 100644
--- a/src/csharp/Grpc.Examples.MathServer/project.json
+++ b/src/csharp/Grpc.Examples.MathServer/project.json
@@ -5,6 +5,10 @@
"configurations": {
"Debug": {
"buildOptions": {
+ "define": [ "SIGNED" ],
+ "keyFile": "../keys/Grpc.snk",
+ "publicSign": true,
+ "xmlDoc": true,
"copyToOutput": {
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Debug/grpc_csharp_ext.dll",
@@ -17,6 +21,10 @@
},
"Release": {
"buildOptions": {
+ "define": [ "SIGNED" ],
+ "keyFile": "../keys/Grpc.snk",
+ "publicSign": true,
+ "xmlDoc": true,
"copyToOutput": {
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Release/grpc_csharp_ext.dll",
diff --git a/src/csharp/Grpc.Examples.Tests/project.json b/src/csharp/Grpc.Examples.Tests/project.json
index d2779e814f..6af0645441 100644
--- a/src/csharp/Grpc.Examples.Tests/project.json
+++ b/src/csharp/Grpc.Examples.Tests/project.json
@@ -5,6 +5,10 @@
"configurations": {
"Debug": {
"buildOptions": {
+ "define": [ "SIGNED" ],
+ "keyFile": "../keys/Grpc.snk",
+ "publicSign": true,
+ "xmlDoc": true,
"copyToOutput": {
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Debug/grpc_csharp_ext.dll",
@@ -17,6 +21,10 @@
},
"Release": {
"buildOptions": {
+ "define": [ "SIGNED" ],
+ "keyFile": "../keys/Grpc.snk",
+ "publicSign": true,
+ "xmlDoc": true,
"copyToOutput": {
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Release/grpc_csharp_ext.dll",
diff --git a/src/csharp/Grpc.HealthCheck.Tests/project.json b/src/csharp/Grpc.HealthCheck.Tests/project.json
index 74599bd4b9..0e42fe2da6 100644
--- a/src/csharp/Grpc.HealthCheck.Tests/project.json
+++ b/src/csharp/Grpc.HealthCheck.Tests/project.json
@@ -5,6 +5,10 @@
"configurations": {
"Debug": {
"buildOptions": {
+ "define": [ "SIGNED" ],
+ "keyFile": "../keys/Grpc.snk",
+ "publicSign": true,
+ "xmlDoc": true,
"copyToOutput": {
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Debug/grpc_csharp_ext.dll",
@@ -17,6 +21,10 @@
},
"Release": {
"buildOptions": {
+ "define": [ "SIGNED" ],
+ "keyFile": "../keys/Grpc.snk",
+ "publicSign": true,
+ "xmlDoc": true,
"copyToOutput": {
"mappings": {
"nativelibs/windows_x64/grpc_csharp_ext.dll": "../../../vsprojects/x64/Release/grpc_csharp_ext.dll",
diff --git a/src/csharp/Grpc.HealthCheck/project.json b/src/csharp/Grpc.HealthCheck/project.json
index c4895c2ad3..f2e1ce5a65 100644
--- a/src/csharp/Grpc.HealthCheck/project.json
+++ b/src/csharp/Grpc.HealthCheck/project.json
@@ -12,6 +12,12 @@
"requireLicenseAcceptance": false,
"tags": [ "gRPC health check" ]
},
+ "buildOptions": {
+ "define": [ "SIGNED" ],
+ "keyFile": "../keys/Grpc.snk",
+ "publicSign": true,
+ "xmlDoc": true
+ },
"dependencies": {
"Grpc.Core": "0.16.0-dev",
"Google.Protobuf": "3.0.0-beta3"
diff --git a/src/csharp/Grpc.IntegrationTesting.Client/project.json b/src/csharp/Grpc.IntegrationTesting.Client/project.json
index e5ba04d717..827e5a8e0f 100644
--- a/src/csharp/Grpc.IntegrationTesting.Client/project.json
+++ b/src/csharp/Grpc.IntegrationTesting.Client/project.json
@@ -5,6 +5,10 @@
"configurations": {
"Debug": {
"buildOptions": {
+ "define": [ "SIGNED" ],
+ "keyFile": "../keys/Grpc.snk",
+ "publicSign": true,
+ "xmlDoc": true,
"copyToOutput": {
"include": "data/*",
"mappings": {
@@ -18,6 +22,10 @@
},
"Release": {
"buildOptions": {
+ "define": [ "SIGNED" ],
+ "keyFile": "../keys/Grpc.snk",
+ "publicSign": true,
+ "xmlDoc": true,
"copyToOutput": {
"include": "data/*",
"mappings": {
diff --git a/src/csharp/Grpc.IntegrationTesting.QpsWorker/project.json b/src/csharp/Grpc.IntegrationTesting.QpsWorker/project.json
index e5ba04d717..827e5a8e0f 100644
--- a/src/csharp/Grpc.IntegrationTesting.QpsWorker/project.json
+++ b/src/csharp/Grpc.IntegrationTesting.QpsWorker/project.json
@@ -5,6 +5,10 @@
"configurations": {
"Debug": {
"buildOptions": {
+ "define": [ "SIGNED" ],
+ "keyFile": "../keys/Grpc.snk",
+ "publicSign": true,
+ "xmlDoc": true,
"copyToOutput": {
"include": "data/*",
"mappings": {
@@ -18,6 +22,10 @@
},
"Release": {
"buildOptions": {
+ "define": [ "SIGNED" ],
+ "keyFile": "../keys/Grpc.snk",
+ "publicSign": true,
+ "xmlDoc": true,
"copyToOutput": {
"include": "data/*",
"mappings": {
diff --git a/src/csharp/Grpc.IntegrationTesting.Server/project.json b/src/csharp/Grpc.IntegrationTesting.Server/project.json
index e5ba04d717..827e5a8e0f 100644
--- a/src/csharp/Grpc.IntegrationTesting.Server/project.json
+++ b/src/csharp/Grpc.IntegrationTesting.Server/project.json
@@ -5,6 +5,10 @@
"configurations": {
"Debug": {
"buildOptions": {
+ "define": [ "SIGNED" ],
+ "keyFile": "../keys/Grpc.snk",
+ "publicSign": true,
+ "xmlDoc": true,
"copyToOutput": {
"include": "data/*",
"mappings": {
@@ -18,6 +22,10 @@
},
"Release": {
"buildOptions": {
+ "define": [ "SIGNED" ],
+ "keyFile": "../keys/Grpc.snk",
+ "publicSign": true,
+ "xmlDoc": true,
"copyToOutput": {
"include": "data/*",
"mappings": {
diff --git a/src/csharp/Grpc.IntegrationTesting.StressClient/project.json b/src/csharp/Grpc.IntegrationTesting.StressClient/project.json
index e5ba04d717..827e5a8e0f 100644
--- a/src/csharp/Grpc.IntegrationTesting.StressClient/project.json
+++ b/src/csharp/Grpc.IntegrationTesting.StressClient/project.json
@@ -5,6 +5,10 @@
"configurations": {
"Debug": {
"buildOptions": {
+ "define": [ "SIGNED" ],
+ "keyFile": "../keys/Grpc.snk",
+ "publicSign": true,
+ "xmlDoc": true,
"copyToOutput": {
"include": "data/*",
"mappings": {
@@ -18,6 +22,10 @@
},
"Release": {
"buildOptions": {
+ "define": [ "SIGNED" ],
+ "keyFile": "../keys/Grpc.snk",
+ "publicSign": true,
+ "xmlDoc": true,
"copyToOutput": {
"include": "data/*",
"mappings": {
diff --git a/src/csharp/Grpc.IntegrationTesting/project.json b/src/csharp/Grpc.IntegrationTesting/project.json
index 3493ab0c22..9a364f2ff7 100644
--- a/src/csharp/Grpc.IntegrationTesting/project.json
+++ b/src/csharp/Grpc.IntegrationTesting/project.json
@@ -5,6 +5,10 @@
"configurations": {
"Debug": {
"buildOptions": {
+ "define": [ "SIGNED" ],
+ "keyFile": "../keys/Grpc.snk",
+ "publicSign": true,
+ "xmlDoc": true,
"copyToOutput": {
"include": "data/*",
"mappings": {
@@ -18,6 +22,10 @@
},
"Release": {
"buildOptions": {
+ "define": [ "SIGNED" ],
+ "keyFile": "../keys/Grpc.snk",
+ "publicSign": true,
+ "xmlDoc": true,
"copyToOutput": {
"include": "data/*",
"mappings": {
diff --git a/src/objective-c/ProtoRPC/ProtoService.m b/src/objective-c/ProtoRPC/ProtoService.m
index 9740190851..3487fac59d 100644
--- a/src/objective-c/ProtoRPC/ProtoService.m
+++ b/src/objective-c/ProtoRPC/ProtoService.m
@@ -65,18 +65,18 @@
return self;
}
-- (ProtoRPC *)RPCToMethod:(NSString *)method
- requestsWriter:(GRXWriter *)requestsWriter
- responseClass:(Class)responseClass
- responsesWriteable:(id<GRXWriteable>)responsesWriteable {
+- (GRPCProtoCall *)RPCToMethod:(NSString *)method
+ requestsWriter:(GRXWriter *)requestsWriter
+ responseClass:(Class)responseClass
+ responsesWriteable:(id<GRXWriteable>)responsesWriteable {
GRPCProtoMethod *methodName = [[GRPCProtoMethod alloc] initWithPackage:_packageName
service:_serviceName
method:method];
- return [[ProtoRPC alloc] initWithHost:_host
- method:methodName
- requestsWriter:requestsWriter
- responseClass:responseClass
- responsesWriteable:responsesWriteable];
+ return [[GRPCProtoCall alloc] initWithHost:_host
+ method:methodName
+ requestsWriter:requestsWriter
+ responseClass:responseClass
+ responsesWriteable:responsesWriteable];
}
@end
diff --git a/src/ruby/spec/client_server_spec.rb b/src/ruby/spec/client_server_spec.rb
index aedeca272d..d60d84996f 100644
--- a/src/ruby/spec/client_server_spec.rb
+++ b/src/ruby/spec/client_server_spec.rb
@@ -43,11 +43,11 @@ shared_context 'setup: tags' do
Time.now + 5
end
- def server_allows_client_to_proceed
+ def server_allows_client_to_proceed(metadata = {})
recvd_rpc = @server.request_call(@server_queue, @server_tag, deadline)
expect(recvd_rpc).to_not eq nil
server_call = recvd_rpc.call
- ops = { CallOps::SEND_INITIAL_METADATA => {} }
+ ops = { CallOps::SEND_INITIAL_METADATA => metadata }
svr_batch = server_call.run_batch(@server_queue, @server_tag, deadline, ops)
expect(svr_batch.send_metadata).to be true
server_call
@@ -135,6 +135,48 @@ shared_examples 'basic GRPC message delivery is OK' do
expect(svr_batch.send_message).to be true
end
+ it 'compressed messages can be sent and received' do
+ call = new_client_call
+ server_call = nil
+ long_request_str = '0' * 2000
+ long_response_str = '1' * 2000
+ md = { 'grpc-internal-encoding-request' => 'gzip' }
+
+ server_thread = Thread.new do
+ server_call = server_allows_client_to_proceed(md)
+ end
+
+ client_ops = {
+ CallOps::SEND_INITIAL_METADATA => md,
+ CallOps::SEND_MESSAGE => long_request_str
+ }
+ batch_result = call.run_batch(@client_queue, @client_tag, deadline,
+ client_ops)
+ expect(batch_result.send_metadata).to be true
+ expect(batch_result.send_message).to be true
+
+ # confirm the server can read the inbound message
+ server_thread.join
+ server_ops = {
+ CallOps::RECV_MESSAGE => nil,
+ CallOps::SEND_MESSAGE => long_response_str
+ }
+ svr_batch = server_call.run_batch(@server_queue, @server_tag, deadline,
+ server_ops)
+ expect(svr_batch.message).to eq(long_request_str)
+ expect(svr_batch.send_message).to be true
+
+ client_ops = {
+ CallOps::SEND_CLOSE_FROM_CLIENT => nil,
+ CallOps::RECV_INITIAL_METADATA => nil,
+ CallOps::RECV_MESSAGE => nil
+ }
+ batch_result = call.run_batch(@client_queue, @client_tag, deadline,
+ client_ops)
+ expect(batch_result.send_close).to be true
+ expect(batch_result.message).to eq long_response_str
+ end
+
it 'servers can ignore a client write and send a status' do
call = new_client_call
server_call = nil