From 84f75d448e2eb9c76301598cfaf8630603ef4a98 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 3 May 2017 13:06:35 -0700 Subject: Fix ASAN/TSAN failures - trace system is now thread safe when run with TSAN - fix a race in client_auth_filter.c - allow timer manager to run in single threaded mode for fuzzers --- src/core/lib/surface/api_trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/lib/surface/api_trace.c') diff --git a/src/core/lib/surface/api_trace.c b/src/core/lib/surface/api_trace.c index 79e3e5ca9b..3b20e042b4 100644 --- a/src/core/lib/surface/api_trace.c +++ b/src/core/lib/surface/api_trace.c @@ -33,4 +33,4 @@ #include "src/core/lib/surface/api_trace.h" -int grpc_api_trace = 0; +grpc_tracer_flag grpc_api_trace; -- cgit v1.2.3 From 9f276e19a8ea1cbf5d445ed44635ebb6142c62ec Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 3 May 2017 14:07:10 -0700 Subject: Fix mac build --- src/core/lib/surface/api_trace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/core/lib/surface/api_trace.c') diff --git a/src/core/lib/surface/api_trace.c b/src/core/lib/surface/api_trace.c index 3b20e042b4..55c69cd5b0 100644 --- a/src/core/lib/surface/api_trace.c +++ b/src/core/lib/surface/api_trace.c @@ -31,6 +31,7 @@ * */ +#include "src/core/lib/debug/trace.h" #include "src/core/lib/surface/api_trace.h" -grpc_tracer_flag grpc_api_trace; +grpc_tracer_flag grpc_api_trace = GRPC_TRACER_INITIALIZER(false); -- cgit v1.2.3 From bc0ab08652fb93bb030aa97955bd8c109a3d3215 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 5 May 2017 10:42:44 -0700 Subject: clang-format --- src/core/ext/transport/chttp2/transport/internal.h | 2 +- src/core/lib/iomgr/ev_epoll_thread_pool_linux.c | 20 ++++++++++++-------- src/core/lib/iomgr/ev_epoll_thread_pool_linux.h | 3 ++- src/core/lib/iomgr/ev_epollex_linux.h | 3 ++- src/core/lib/iomgr/ev_epollsig_linux.c | 9 +++++---- src/core/lib/iomgr/ev_posix.c | 7 ++++--- src/core/lib/iomgr/ev_posix.h | 2 +- src/core/lib/iomgr/iomgr.c | 4 +--- src/core/lib/surface/api_trace.c | 2 +- 9 files changed, 29 insertions(+), 23 deletions(-) (limited to 'src/core/lib/surface/api_trace.c') diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h index bb5ce60872..b9d06a84d3 100644 --- a/src/core/ext/transport/chttp2/transport/internal.h +++ b/src/core/ext/transport/chttp2/transport/internal.h @@ -671,7 +671,7 @@ typedef enum { #define GRPC_CHTTP2_FLOW_CREDIT_COMMON(phase, transport, id, dst_context, \ dst_var, amount) \ do { \ - if (GRPC_TRACER_ON(grpc_flowctl_trace)) { \ + if (GRPC_TRACER_ON(grpc_flowctl_trace)) { \ grpc_chttp2_flowctl_trace(__FILE__, __LINE__, phase, \ GRPC_CHTTP2_FLOWCTL_CREDIT, #dst_context, \ #dst_var, NULL, #amount, transport->is_client, \ diff --git a/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c b/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c index cf20fc3346..a3a9e76ed4 100644 --- a/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c +++ b/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c @@ -66,9 +66,9 @@ #include "src/core/lib/support/block_annotate.h" /* TODO: sreek - Move this to init.c and initialize this like other tracers. */ -#define GRPC_POLLING_TRACE(fmt, ...) \ - if (GRPC_TRACER_ON(grpc_polling_trace)) { \ - gpr_log(GPR_INFO, (fmt), __VA_ARGS__); \ +#define GRPC_POLLING_TRACE(fmt, ...) \ + if (GRPC_TRACER_ON(grpc_polling_trace)) { \ + gpr_log(GPR_INFO, (fmt), __VA_ARGS__); \ } /* The alarm system needs to be able to wakeup 'some poller' sometimes @@ -78,7 +78,7 @@ struct epoll_set; -#define GRPC_POLLSET_KICK_BROADCAST ((grpc_pollset_worker*)1) +#define GRPC_POLLSET_KICK_BROADCAST ((grpc_pollset_worker *)1) /******************************************************************************* * Fd Declarations @@ -358,8 +358,8 @@ static void epoll_set_add_wakeup_fd_locked(epoll_set *eps, gpr_asprintf(&err_msg, "epoll_ctl (epoll_fd: %d) add wakeup fd: %d failed with " "error: %d (%s)", - eps->epoll_fd, GRPC_WAKEUP_FD_GET_READ_FD(wakeup_fd), - errno, strerror(errno)); + eps->epoll_fd, GRPC_WAKEUP_FD_GET_READ_FD(wakeup_fd), errno, + strerror(errno)); append_error(error, GRPC_OS_ERROR(errno, err_msg), err_desc); gpr_free(err_msg); } @@ -1291,7 +1291,8 @@ static bool is_epoll_available() { return true; } -const grpc_event_engine_vtable *grpc_init_epoll_thread_pool_linux(bool requested_explicitly) { +const grpc_event_engine_vtable *grpc_init_epoll_thread_pool_linux( + bool requested_explicitly) { if (!requested_explicitly) return NULL; if (!grpc_has_wakeup_fd()) { @@ -1328,6 +1329,9 @@ const grpc_event_engine_vtable *grpc_init_epoll_thread_pool_linux(bool requested #include "src/core/lib/iomgr/ev_posix.h" /* If GRPC_LINUX_EPOLL is not defined, it means epoll is not available. Return * NULL */ -const grpc_event_engine_vtable *grpc_init_epoll_linux(bool requested_explicitly) { return NULL; } +const grpc_event_engine_vtable *grpc_init_epoll_linux( + bool requested_explicitly) { + return NULL; +} #endif /* defined(GRPC_POSIX_SOCKET) */ #endif /* !defined(GRPC_LINUX_EPOLL) */ diff --git a/src/core/lib/iomgr/ev_epoll_thread_pool_linux.h b/src/core/lib/iomgr/ev_epoll_thread_pool_linux.h index b94dbe7d5d..9af776a52e 100644 --- a/src/core/lib/iomgr/ev_epoll_thread_pool_linux.h +++ b/src/core/lib/iomgr/ev_epoll_thread_pool_linux.h @@ -37,6 +37,7 @@ #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/port.h" -const grpc_event_engine_vtable *grpc_init_epoll_thread_pool_linux(bool requested_explicitly); +const grpc_event_engine_vtable *grpc_init_epoll_thread_pool_linux( + bool requested_explicitly); #endif /* GRPC_CORE_LIB_IOMGR_EV_EPOLL_THREAD_POOL_LINUX_H */ diff --git a/src/core/lib/iomgr/ev_epollex_linux.h b/src/core/lib/iomgr/ev_epollex_linux.h index a865c49116..a078a7f19a 100644 --- a/src/core/lib/iomgr/ev_epollex_linux.h +++ b/src/core/lib/iomgr/ev_epollex_linux.h @@ -37,6 +37,7 @@ #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/port.h" -const grpc_event_engine_vtable *grpc_init_epollex_linux(bool explicitly_requested); +const grpc_event_engine_vtable *grpc_init_epollex_linux( + bool explicitly_requested); #endif /* GRPC_CORE_LIB_IOMGR_EV_EPOLLEX_LINUX_H */ diff --git a/src/core/lib/iomgr/ev_epollsig_linux.c b/src/core/lib/iomgr/ev_epollsig_linux.c index 32096ed55f..52362a62f4 100644 --- a/src/core/lib/iomgr/ev_epollsig_linux.c +++ b/src/core/lib/iomgr/ev_epollsig_linux.c @@ -65,9 +65,9 @@ #define GRPC_POLLSET_KICK_BROADCAST ((grpc_pollset_worker *)1) -#define GRPC_POLLING_TRACE(fmt, ...) \ - if (GRPC_TRACER_ON(grpc_polling_trace)) { \ - gpr_log(GPR_INFO, (fmt), __VA_ARGS__); \ +#define GRPC_POLLING_TRACE(fmt, ...) \ + if (GRPC_TRACER_ON(grpc_polling_trace)) { \ + gpr_log(GPR_INFO, (fmt), __VA_ARGS__); \ } /* Uncomment the following to enable extra checks on poll_object operations */ @@ -1920,7 +1920,8 @@ const grpc_event_engine_vtable *grpc_init_epollsig_linux( } if (!is_grpc_wakeup_signal_initialized) { - /* TODO(ctiller): when other epoll engines are ready, remove the true || to force this to be explitly chosen if needed */ + /* TODO(ctiller): when other epoll engines are ready, remove the true || to + * force this to be explitly chosen if needed */ if (true || explicit_request) { grpc_use_signal(SIGRTMIN + 6); } else { diff --git a/src/core/lib/iomgr/ev_posix.c b/src/core/lib/iomgr/ev_posix.c index 0b0535c852..02c6c746ac 100644 --- a/src/core/lib/iomgr/ev_posix.c +++ b/src/core/lib/iomgr/ev_posix.c @@ -45,14 +45,15 @@ #include #include "src/core/lib/debug/trace.h" -#include "src/core/lib/iomgr/ev_epollex_linux.h" #include "src/core/lib/iomgr/ev_epoll1_linux.h" -#include "src/core/lib/iomgr/ev_epollsig_linux.h" #include "src/core/lib/iomgr/ev_epoll_thread_pool_linux.h" +#include "src/core/lib/iomgr/ev_epollex_linux.h" +#include "src/core/lib/iomgr/ev_epollsig_linux.h" #include "src/core/lib/iomgr/ev_poll_posix.h" #include "src/core/lib/support/env.h" -grpc_tracer_flag grpc_polling_trace = GRPC_TRACER_INITIALIZER(false); /* Disabled by default */ +grpc_tracer_flag grpc_polling_trace = + GRPC_TRACER_INITIALIZER(false); /* Disabled by default */ /** Default poll() function - a pointer so that it can be overridden by some * tests */ diff --git a/src/core/lib/iomgr/ev_posix.h b/src/core/lib/iomgr/ev_posix.h index e013a6c953..80619aab5f 100644 --- a/src/core/lib/iomgr/ev_posix.h +++ b/src/core/lib/iomgr/ev_posix.h @@ -36,12 +36,12 @@ #include +#include "src/core/lib/debug/trace.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/pollset.h" #include "src/core/lib/iomgr/pollset_set.h" #include "src/core/lib/iomgr/wakeup_fd_posix.h" #include "src/core/lib/iomgr/workqueue.h" -#include "src/core/lib/debug/trace.h" extern grpc_tracer_flag grpc_polling_trace; /* Disabled by default */ diff --git a/src/core/lib/iomgr/iomgr.c b/src/core/lib/iomgr/iomgr.c index 37804d8600..1fd41c2f88 100644 --- a/src/core/lib/iomgr/iomgr.c +++ b/src/core/lib/iomgr/iomgr.c @@ -68,9 +68,7 @@ void grpc_iomgr_init(void) { grpc_iomgr_platform_init(); } -void grpc_iomgr_start(void) { - grpc_timer_manager_init(); -} +void grpc_iomgr_start(void) { grpc_timer_manager_init(); } static size_t count_objects(void) { grpc_iomgr_object *obj; diff --git a/src/core/lib/surface/api_trace.c b/src/core/lib/surface/api_trace.c index 55c69cd5b0..d8941cdf42 100644 --- a/src/core/lib/surface/api_trace.c +++ b/src/core/lib/surface/api_trace.c @@ -31,7 +31,7 @@ * */ -#include "src/core/lib/debug/trace.h" #include "src/core/lib/surface/api_trace.h" +#include "src/core/lib/debug/trace.h" grpc_tracer_flag grpc_api_trace = GRPC_TRACER_INITIALIZER(false); -- cgit v1.2.3