grpc 1.20.0 → 1.21.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +500 -29
- data/etc/roots.pem +146 -0
- data/include/grpc/grpc_security.h +1 -1
- data/include/grpc/impl/codegen/grpc_types.h +10 -7
- data/include/grpc/impl/codegen/port_platform.h +11 -1
- data/include/grpc/impl/codegen/slice.h +1 -21
- data/include/grpc/impl/codegen/status.h +2 -1
- data/include/grpc/slice.h +1 -1
- data/src/core/ext/filters/client_channel/backup_poller.cc +19 -13
- data/src/core/ext/filters/client_channel/backup_poller.h +3 -0
- data/src/core/ext/filters/client_channel/channel_connectivity.cc +1 -1
- data/src/core/ext/filters/client_channel/client_channel.cc +2084 -1673
- data/src/core/ext/filters/client_channel/client_channel_channelz.cc +2 -3
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +4 -0
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +54 -49
- data/src/core/ext/filters/client_channel/health/health_check_client.h +20 -9
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +1 -2
- data/src/core/ext/filters/client_channel/http_connect_handshaker.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy.cc +3 -30
- data/src/core/ext/filters/client_channel/lb_policy.h +16 -25
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +106 -81
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +6 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +8 -12
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +2 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +57 -49
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +47 -41
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +24 -20
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +989 -284
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +4 -1
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +105 -2
- data/src/core/ext/filters/client_channel/lb_policy_registry.h +9 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +79 -36
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +84 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +3 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +179 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +15 -3
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +80 -4
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +7 -13
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv.cc +39 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc +0 -6
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +2 -64
- data/src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc +28 -0
- data/src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h +29 -0
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +4 -4
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +367 -232
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +55 -76
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +50 -39
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +18 -12
- data/src/core/ext/filters/client_channel/service_config.cc +247 -27
- data/src/core/ext/filters/client_channel/service_config.h +119 -166
- data/src/core/ext/filters/client_channel/subchannel.cc +46 -84
- data/src/core/ext/filters/client_channel/subchannel.h +7 -7
- data/src/core/ext/filters/deadline/deadline_filter.cc +3 -4
- data/src/core/ext/filters/deadline/deadline_filter.h +3 -2
- data/src/core/ext/filters/http/client/http_client_filter.cc +7 -5
- data/src/core/ext/filters/http/client/http_client_filter.h +1 -1
- data/src/core/ext/filters/http/client_authority_filter.cc +1 -1
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +4 -3
- data/src/core/ext/filters/http/server/http_server_filter.cc +18 -12
- data/src/core/ext/filters/message_size/message_size_filter.cc +118 -76
- data/src/core/ext/filters/message_size/message_size_filter.h +33 -0
- data/src/core/ext/transport/chttp2/alpn/alpn.h +1 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc +9 -7
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +93 -60
- data/src/core/ext/transport/chttp2/transport/flow_control.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +4 -3
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +8 -2
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +3 -2
- data/src/core/ext/transport/chttp2/transport/internal.h +35 -23
- data/src/core/ext/transport/chttp2/transport/parsing.cc +4 -4
- data/src/core/ext/transport/chttp2/transport/stream_lists.cc +3 -3
- data/src/core/ext/transport/chttp2/transport/writing.cc +61 -27
- data/src/core/ext/transport/inproc/inproc_transport.cc +18 -18
- data/src/core/lib/channel/channel_args.cc +0 -101
- data/src/core/lib/channel/channel_args.h +0 -37
- data/src/core/lib/channel/channel_stack.h +9 -5
- data/src/core/lib/channel/channelz_registry.cc +1 -1
- data/src/core/lib/channel/connected_channel.cc +2 -2
- data/src/core/lib/channel/context.h +3 -0
- data/src/core/lib/channel/handshaker.cc +4 -4
- data/src/core/lib/channel/handshaker.h +1 -1
- data/src/core/lib/compression/compression_args.cc +127 -0
- data/src/core/lib/compression/compression_args.h +55 -0
- data/src/core/lib/debug/trace.cc +13 -7
- data/src/core/lib/debug/trace.h +12 -0
- data/src/core/lib/gpr/arena.h +13 -9
- data/src/core/lib/gpr/env.h +2 -5
- data/src/core/lib/gpr/env_linux.cc +6 -1
- data/src/core/lib/gpr/env_posix.cc +5 -0
- data/src/core/lib/gpr/env_windows.cc +7 -5
- data/src/core/lib/gpr/log.cc +9 -13
- data/src/core/lib/gpr/string.cc +12 -6
- data/src/core/lib/gpr/string.h +4 -2
- data/src/core/lib/gpr/time_posix.cc +13 -0
- data/src/core/lib/gprpp/arena.cc +103 -0
- data/src/core/lib/gprpp/arena.h +121 -0
- data/src/core/lib/gprpp/fork.cc +12 -29
- data/src/core/lib/gprpp/global_config.h +87 -0
- data/src/core/lib/gprpp/global_config_custom.h +29 -0
- data/src/core/lib/gprpp/global_config_env.cc +135 -0
- data/src/core/lib/gprpp/global_config_env.h +131 -0
- data/src/core/lib/gprpp/global_config_generic.h +44 -0
- data/src/core/lib/gprpp/map.h +419 -0
- data/src/core/lib/gprpp/optional.h +1 -0
- data/src/core/lib/gprpp/orphanable.h +2 -2
- data/src/core/lib/gprpp/{mutex_lock.h → pair.h} +15 -19
- data/src/core/lib/gprpp/ref_counted.h +18 -2
- data/src/core/lib/gprpp/sync.h +126 -0
- data/src/core/lib/http/parser.cc +1 -1
- data/src/core/lib/iomgr/call_combiner.cc +84 -90
- data/src/core/lib/iomgr/call_combiner.h +75 -82
- data/src/core/lib/iomgr/cfstream_handle.cc +202 -0
- data/src/core/lib/iomgr/cfstream_handle.h +82 -0
- data/src/core/lib/iomgr/combiner.h +1 -1
- data/src/core/lib/iomgr/endpoint_cfstream.cc +375 -0
- data/src/core/lib/iomgr/endpoint_cfstream.h +49 -0
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +2 -2
- data/src/core/lib/iomgr/error.h +23 -0
- data/src/core/lib/iomgr/error_cfstream.cc +52 -0
- data/src/core/lib/iomgr/error_cfstream.h +31 -0
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +34 -27
- data/src/core/lib/iomgr/ev_epollex_linux.cc +33 -33
- data/src/core/lib/iomgr/ev_poll_posix.cc +7 -7
- data/src/core/lib/iomgr/ev_posix.cc +15 -13
- data/src/core/lib/iomgr/ev_posix.h +4 -1
- data/src/core/lib/iomgr/executor.cc +13 -9
- data/src/core/lib/iomgr/fork_posix.cc +0 -1
- data/src/core/lib/iomgr/internal_errqueue.cc +1 -1
- data/src/core/lib/iomgr/iomgr.cc +6 -5
- data/src/core/lib/iomgr/iomgr_custom.cc +3 -0
- data/src/core/lib/iomgr/iomgr_custom.h +2 -0
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +93 -0
- data/src/core/lib/iomgr/iomgr_windows.cc +1 -0
- data/src/core/lib/iomgr/lockfree_event.cc +3 -3
- data/src/core/lib/iomgr/port.h +11 -0
- data/src/core/lib/iomgr/resource_quota.cc +40 -37
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +6 -2
- data/src/core/lib/iomgr/socket_windows.cc +19 -0
- data/src/core/lib/iomgr/socket_windows.h +8 -0
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +216 -0
- data/src/core/lib/iomgr/tcp_client_custom.cc +2 -2
- data/src/core/lib/iomgr/tcp_client_posix.cc +3 -3
- data/src/core/lib/iomgr/tcp_client_windows.cc +1 -1
- data/src/core/lib/iomgr/tcp_custom.cc +9 -9
- data/src/core/lib/iomgr/tcp_posix.cc +41 -41
- data/src/core/lib/iomgr/tcp_server_custom.cc +3 -3
- data/src/core/lib/iomgr/tcp_server_posix.cc +14 -1
- data/src/core/lib/iomgr/tcp_server_windows.cc +2 -2
- data/src/core/lib/iomgr/tcp_windows.cc +7 -9
- data/src/core/lib/iomgr/timer_generic.cc +16 -16
- data/src/core/lib/iomgr/timer_manager.cc +12 -11
- data/src/core/lib/profiling/basic_timers.cc +10 -4
- data/src/core/lib/security/context/security_context.cc +6 -7
- data/src/core/lib/security/context/security_context.h +3 -4
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +1 -1
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +2 -3
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +1 -1
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +7 -7
- data/src/core/lib/security/security_connector/load_system_roots_linux.cc +7 -5
- data/src/core/lib/security/security_connector/security_connector.cc +0 -1
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +3 -2
- data/src/core/lib/security/security_connector/ssl_utils.cc +30 -26
- data/src/core/lib/security/security_connector/ssl_utils.h +5 -1
- data/src/core/lib/security/transport/client_auth_filter.cc +7 -11
- data/src/core/lib/security/transport/secure_endpoint.cc +4 -4
- data/src/core/lib/security/transport/server_auth_filter.cc +2 -3
- data/src/core/lib/slice/slice.cc +99 -116
- data/src/core/lib/slice/slice_buffer.cc +5 -0
- data/src/core/lib/slice/slice_intern.cc +38 -95
- data/src/core/lib/slice/slice_internal.h +200 -2
- data/src/core/lib/surface/api_trace.h +1 -1
- data/src/core/lib/surface/call.cc +41 -35
- data/src/core/lib/surface/call.h +7 -2
- data/src/core/lib/surface/call_details.cc +0 -1
- data/src/core/lib/surface/completion_queue.cc +36 -27
- data/src/core/lib/surface/init.cc +3 -4
- data/src/core/lib/surface/lame_client.cc +1 -1
- data/src/core/lib/surface/server.cc +18 -25
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/bdp_estimator.cc +3 -3
- data/src/core/lib/transport/bdp_estimator.h +2 -2
- data/src/core/lib/transport/connectivity_state.cc +10 -40
- data/src/core/lib/transport/connectivity_state.h +0 -8
- data/src/core/lib/transport/error_utils.cc +12 -0
- data/src/core/lib/transport/metadata.cc +206 -278
- data/src/core/lib/transport/metadata.h +205 -10
- data/src/core/lib/transport/static_metadata.cc +108 -116
- data/src/core/lib/transport/static_metadata.h +1 -2
- data/src/core/lib/transport/status_metadata.cc +3 -3
- data/src/core/lib/transport/transport.cc +29 -66
- data/src/core/lib/transport/transport.h +36 -8
- data/src/core/lib/transport/transport_impl.h +1 -1
- data/src/core/tsi/fake_transport_security.cc +4 -4
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +1 -1
- data/src/core/tsi/ssl_transport_security.cc +1 -1
- data/src/ruby/ext/grpc/rb_grpc.c +1 -1
- data/src/ruby/lib/grpc/errors.rb +22 -3
- data/src/ruby/lib/grpc/generic/bidi_call.rb +1 -1
- data/src/ruby/lib/grpc/generic/rpc_server.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/errors_spec.rb +141 -0
- metadata +57 -33
- data/src/core/lib/gpr/arena.cc +0 -192
@@ -316,7 +316,7 @@ static void fork_fd_list_add_wakeup_fd(grpc_cached_wakeup_fd* fd) {
|
|
316
316
|
#define UNREF_BY(fd, n, reason) unref_by(fd, n, reason, __FILE__, __LINE__)
|
317
317
|
static void ref_by(grpc_fd* fd, int n, const char* reason, const char* file,
|
318
318
|
int line) {
|
319
|
-
if (grpc_trace_fd_refcount
|
319
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_fd_refcount)) {
|
320
320
|
gpr_log(GPR_DEBUG,
|
321
321
|
"FD %d %p ref %d %" PRIdPTR " -> %" PRIdPTR " [%s; %s:%d]",
|
322
322
|
fd->fd, fd, n, gpr_atm_no_barrier_load(&fd->refst),
|
@@ -333,7 +333,7 @@ static void ref_by(grpc_fd* fd, int n) {
|
|
333
333
|
#ifndef NDEBUG
|
334
334
|
static void unref_by(grpc_fd* fd, int n, const char* reason, const char* file,
|
335
335
|
int line) {
|
336
|
-
if (grpc_trace_fd_refcount
|
336
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_trace_fd_refcount)) {
|
337
337
|
gpr_log(GPR_DEBUG,
|
338
338
|
"FD %d %p unref %d %" PRIdPTR " -> %" PRIdPTR " [%s; %s:%d]",
|
339
339
|
fd->fd, fd, n, gpr_atm_no_barrier_load(&fd->refst),
|
@@ -561,7 +561,7 @@ static void fd_notify_on_write(grpc_fd* fd, grpc_closure* closure) {
|
|
561
561
|
}
|
562
562
|
|
563
563
|
static void fd_notify_on_error(grpc_fd* fd, grpc_closure* closure) {
|
564
|
-
if (grpc_polling_trace
|
564
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
|
565
565
|
gpr_log(GPR_ERROR, "Polling engine does not support tracking errors.");
|
566
566
|
}
|
567
567
|
GRPC_CLOSURE_SCHED(closure, GRPC_ERROR_CANCELLED);
|
@@ -580,7 +580,7 @@ static void fd_set_writable(grpc_fd* fd) {
|
|
580
580
|
}
|
581
581
|
|
582
582
|
static void fd_set_error(grpc_fd* fd) {
|
583
|
-
if (grpc_polling_trace
|
583
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
|
584
584
|
gpr_log(GPR_ERROR, "Polling engine does not support tracking errors.");
|
585
585
|
}
|
586
586
|
}
|
@@ -1012,7 +1012,7 @@ static grpc_error* pollset_work(grpc_pollset* pollset,
|
|
1012
1012
|
r = grpc_poll_function(pfds, pfd_count, timeout);
|
1013
1013
|
GRPC_SCHEDULING_END_BLOCKING_REGION;
|
1014
1014
|
|
1015
|
-
if (grpc_polling_trace
|
1015
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
|
1016
1016
|
gpr_log(GPR_INFO, "%p poll=%d", pollset, r);
|
1017
1017
|
}
|
1018
1018
|
|
@@ -1036,7 +1036,7 @@ static grpc_error* pollset_work(grpc_pollset* pollset,
|
|
1036
1036
|
}
|
1037
1037
|
} else {
|
1038
1038
|
if (pfds[0].revents & POLLIN_CHECK) {
|
1039
|
-
if (grpc_polling_trace
|
1039
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
|
1040
1040
|
gpr_log(GPR_INFO, "%p: got_wakeup", pollset);
|
1041
1041
|
}
|
1042
1042
|
work_combine_error(
|
@@ -1046,7 +1046,7 @@ static grpc_error* pollset_work(grpc_pollset* pollset,
|
|
1046
1046
|
if (watchers[i].fd == nullptr) {
|
1047
1047
|
fd_end_poll(&watchers[i], 0, 0);
|
1048
1048
|
} else {
|
1049
|
-
if (grpc_polling_trace
|
1049
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
|
1050
1050
|
gpr_log(GPR_INFO, "%p got_event: %d r:%d w:%d [%d]", pollset,
|
1051
1051
|
pfds[i].fd, (pfds[i].revents & POLLIN_CHECK) != 0,
|
1052
1052
|
(pfds[i].revents & POLLOUT_CHECK) != 0, pfds[i].revents);
|
@@ -31,13 +31,19 @@
|
|
31
31
|
#include <grpc/support/string_util.h>
|
32
32
|
|
33
33
|
#include "src/core/lib/debug/trace.h"
|
34
|
-
#include "src/core/lib/gpr/env.h"
|
35
34
|
#include "src/core/lib/gpr/useful.h"
|
35
|
+
#include "src/core/lib/gprpp/global_config.h"
|
36
36
|
#include "src/core/lib/iomgr/ev_epoll1_linux.h"
|
37
37
|
#include "src/core/lib/iomgr/ev_epollex_linux.h"
|
38
38
|
#include "src/core/lib/iomgr/ev_poll_posix.h"
|
39
39
|
#include "src/core/lib/iomgr/internal_errqueue.h"
|
40
40
|
|
41
|
+
GPR_GLOBAL_CONFIG_DEFINE_STRING(
|
42
|
+
grpc_poll_strategy, "all",
|
43
|
+
"Declares which polling engines to try when starting gRPC. "
|
44
|
+
"This is a comma-separated list of engines, which are tried in priority "
|
45
|
+
"order first -> last.")
|
46
|
+
|
41
47
|
grpc_core::TraceFlag grpc_polling_trace(false,
|
42
48
|
"polling"); /* Disabled by default */
|
43
49
|
|
@@ -46,16 +52,15 @@ grpc_core::TraceFlag grpc_fd_trace(false, "fd_trace");
|
|
46
52
|
grpc_core::DebugOnlyTraceFlag grpc_trace_fd_refcount(false, "fd_refcount");
|
47
53
|
grpc_core::DebugOnlyTraceFlag grpc_polling_api_trace(false, "polling_api");
|
48
54
|
|
49
|
-
#ifndef NDEBUG
|
50
|
-
|
51
55
|
// Polling API trace only enabled in debug builds
|
56
|
+
#ifndef NDEBUG
|
52
57
|
#define GRPC_POLLING_API_TRACE(format, ...) \
|
53
|
-
if (grpc_polling_api_trace
|
58
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_api_trace)) { \
|
54
59
|
gpr_log(GPR_INFO, "(polling-api) " format, __VA_ARGS__); \
|
55
60
|
}
|
56
61
|
#else
|
57
62
|
#define GRPC_POLLING_API_TRACE(...)
|
58
|
-
#endif
|
63
|
+
#endif // NDEBUG
|
59
64
|
|
60
65
|
/** Default poll() function - a pointer so that it can be overridden by some
|
61
66
|
* tests */
|
@@ -66,7 +71,7 @@ int aix_poll(struct pollfd fds[], nfds_t nfds, int timeout) {
|
|
66
71
|
return poll(fds, nfds, timeout);
|
67
72
|
}
|
68
73
|
grpc_poll_function_type grpc_poll_function = aix_poll;
|
69
|
-
#endif
|
74
|
+
#endif // GPR_AIX
|
70
75
|
|
71
76
|
grpc_wakeup_fd grpc_global_wakeup_fd;
|
72
77
|
|
@@ -205,14 +210,11 @@ void grpc_register_event_engine_factory(const char* name,
|
|
205
210
|
const char* grpc_get_poll_strategy_name() { return g_poll_strategy_name; }
|
206
211
|
|
207
212
|
void grpc_event_engine_init(void) {
|
208
|
-
char
|
209
|
-
if (s == nullptr) {
|
210
|
-
s = gpr_strdup("all");
|
211
|
-
}
|
213
|
+
grpc_core::UniquePtr<char> value = GPR_GLOBAL_CONFIG_GET(grpc_poll_strategy);
|
212
214
|
|
213
215
|
char** strings = nullptr;
|
214
216
|
size_t nstrings = 0;
|
215
|
-
split(
|
217
|
+
split(value.get(), &strings, &nstrings);
|
216
218
|
|
217
219
|
for (size_t i = 0; g_event_engine == nullptr && i < nstrings; i++) {
|
218
220
|
try_engine(strings[i]);
|
@@ -224,10 +226,10 @@ void grpc_event_engine_init(void) {
|
|
224
226
|
gpr_free(strings);
|
225
227
|
|
226
228
|
if (g_event_engine == nullptr) {
|
227
|
-
gpr_log(GPR_ERROR, "No event engine could be initialized from %s",
|
229
|
+
gpr_log(GPR_ERROR, "No event engine could be initialized from %s",
|
230
|
+
value.get());
|
228
231
|
abort();
|
229
232
|
}
|
230
|
-
gpr_free(s);
|
231
233
|
}
|
232
234
|
|
233
235
|
void grpc_event_engine_shutdown(void) {
|
@@ -24,16 +24,19 @@
|
|
24
24
|
#include <poll.h>
|
25
25
|
|
26
26
|
#include "src/core/lib/debug/trace.h"
|
27
|
+
#include "src/core/lib/gprpp/global_config.h"
|
27
28
|
#include "src/core/lib/iomgr/exec_ctx.h"
|
28
29
|
#include "src/core/lib/iomgr/pollset.h"
|
29
30
|
#include "src/core/lib/iomgr/pollset_set.h"
|
30
31
|
#include "src/core/lib/iomgr/wakeup_fd_posix.h"
|
31
32
|
|
33
|
+
GPR_GLOBAL_CONFIG_DECLARE_STRING(grpc_poll_strategy);
|
34
|
+
|
32
35
|
extern grpc_core::TraceFlag grpc_fd_trace; /* Disabled by default */
|
33
36
|
extern grpc_core::TraceFlag grpc_polling_trace; /* Disabled by default */
|
34
37
|
|
35
38
|
#define GRPC_FD_TRACE(format, ...) \
|
36
|
-
if (grpc_fd_trace
|
39
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_fd_trace)) { \
|
37
40
|
gpr_log(GPR_INFO, "(fd-trace) " format, __VA_ARGS__); \
|
38
41
|
}
|
39
42
|
|
@@ -36,15 +36,19 @@
|
|
36
36
|
|
37
37
|
#define MAX_DEPTH 2
|
38
38
|
|
39
|
-
#define EXECUTOR_TRACE(format, ...)
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
39
|
+
#define EXECUTOR_TRACE(format, ...) \
|
40
|
+
do { \
|
41
|
+
if (GRPC_TRACE_FLAG_ENABLED(executor_trace)) { \
|
42
|
+
gpr_log(GPR_INFO, "EXECUTOR " format, __VA_ARGS__); \
|
43
|
+
} \
|
44
|
+
} while (0)
|
45
|
+
|
46
|
+
#define EXECUTOR_TRACE0(str) \
|
47
|
+
do { \
|
48
|
+
if (GRPC_TRACE_FLAG_ENABLED(executor_trace)) { \
|
49
|
+
gpr_log(GPR_INFO, "EXECUTOR " str); \
|
50
|
+
} \
|
51
|
+
} while (0)
|
48
52
|
|
49
53
|
namespace grpc_core {
|
50
54
|
namespace {
|
@@ -36,7 +36,7 @@ static bool errqueue_supported = false;
|
|
36
36
|
bool kernel_supports_errqueue() { return errqueue_supported; }
|
37
37
|
|
38
38
|
void grpc_errqueue_init() {
|
39
|
-
/* Both-compile time and run-time linux kernel versions should be
|
39
|
+
/* Both-compile time and run-time linux kernel versions should be at least 4.0.0
|
40
40
|
*/
|
41
41
|
#ifdef GRPC_LINUX_ERRQUEUE
|
42
42
|
struct utsname buffer;
|
data/src/core/lib/iomgr/iomgr.cc
CHANGED
@@ -29,9 +29,9 @@
|
|
29
29
|
#include <grpc/support/string_util.h>
|
30
30
|
#include <grpc/support/sync.h>
|
31
31
|
|
32
|
-
#include "src/core/lib/gpr/env.h"
|
33
32
|
#include "src/core/lib/gpr/string.h"
|
34
33
|
#include "src/core/lib/gpr/useful.h"
|
34
|
+
#include "src/core/lib/gprpp/global_config.h"
|
35
35
|
#include "src/core/lib/gprpp/thd.h"
|
36
36
|
#include "src/core/lib/iomgr/buffer_list.h"
|
37
37
|
#include "src/core/lib/iomgr/exec_ctx.h"
|
@@ -41,6 +41,10 @@
|
|
41
41
|
#include "src/core/lib/iomgr/timer.h"
|
42
42
|
#include "src/core/lib/iomgr/timer_manager.h"
|
43
43
|
|
44
|
+
GPR_GLOBAL_CONFIG_DEFINE_BOOL(grpc_abort_on_leaks, false,
|
45
|
+
"A debugging aid to cause a call to abort() when "
|
46
|
+
"gRPC objects are leaked past grpc_shutdown()");
|
47
|
+
|
44
48
|
static gpr_mu g_mu;
|
45
49
|
static gpr_cv g_rcv;
|
46
50
|
static int g_shutdown;
|
@@ -186,8 +190,5 @@ void grpc_iomgr_unregister_object(grpc_iomgr_object* obj) {
|
|
186
190
|
}
|
187
191
|
|
188
192
|
bool grpc_iomgr_abort_on_leaks(void) {
|
189
|
-
|
190
|
-
bool should_we = gpr_is_true(env);
|
191
|
-
gpr_free(env);
|
192
|
-
return should_we;
|
193
|
+
return GPR_GLOBAL_CONFIG_GET(grpc_abort_on_leaks);
|
193
194
|
}
|
@@ -49,6 +49,8 @@ static bool iomgr_platform_add_closure_to_background_poller(
|
|
49
49
|
return false;
|
50
50
|
}
|
51
51
|
|
52
|
+
bool g_custom_iomgr_enabled = false;
|
53
|
+
|
52
54
|
static grpc_iomgr_platform_vtable vtable = {
|
53
55
|
iomgr_platform_init,
|
54
56
|
iomgr_platform_flush,
|
@@ -61,6 +63,7 @@ void grpc_custom_iomgr_init(grpc_socket_vtable* socket,
|
|
61
63
|
grpc_custom_resolver_vtable* resolver,
|
62
64
|
grpc_custom_timer_vtable* timer,
|
63
65
|
grpc_custom_poller_vtable* poller) {
|
66
|
+
g_custom_iomgr_enabled = true;
|
64
67
|
grpc_custom_endpoint_init(socket);
|
65
68
|
grpc_custom_timer_init(timer);
|
66
69
|
grpc_custom_pollset_init(poller);
|
@@ -39,6 +39,8 @@ extern gpr_thd_id g_init_thread;
|
|
39
39
|
#define GRPC_CUSTOM_IOMGR_ASSERT_SAME_THREAD()
|
40
40
|
#endif /* GRPC_CUSTOM_IOMGR_THREAD_CHECK */
|
41
41
|
|
42
|
+
extern bool g_custom_iomgr_enabled;
|
43
|
+
|
42
44
|
void grpc_custom_iomgr_init(grpc_socket_vtable* socket,
|
43
45
|
grpc_custom_resolver_vtable* resolver,
|
44
46
|
grpc_custom_timer_vtable* timer,
|
@@ -0,0 +1,93 @@
|
|
1
|
+
/*
|
2
|
+
*
|
3
|
+
* Copyright 2015 gRPC authors.
|
4
|
+
*
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
* you may not use this file except in compliance with the License.
|
7
|
+
* You may obtain a copy of the License at
|
8
|
+
*
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
*
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
* See the License for the specific language governing permissions and
|
15
|
+
* limitations under the License.
|
16
|
+
*
|
17
|
+
*/
|
18
|
+
|
19
|
+
#include <grpc/support/port_platform.h>
|
20
|
+
|
21
|
+
#include "src/core/lib/iomgr/port.h"
|
22
|
+
|
23
|
+
#ifdef GRPC_CFSTREAM_IOMGR
|
24
|
+
|
25
|
+
#include "src/core/lib/debug/trace.h"
|
26
|
+
#include "src/core/lib/iomgr/ev_posix.h"
|
27
|
+
#include "src/core/lib/iomgr/iomgr_internal.h"
|
28
|
+
#include "src/core/lib/iomgr/iomgr_posix.h"
|
29
|
+
#include "src/core/lib/iomgr/resolve_address.h"
|
30
|
+
#include "src/core/lib/iomgr/tcp_client.h"
|
31
|
+
#include "src/core/lib/iomgr/tcp_posix.h"
|
32
|
+
#include "src/core/lib/iomgr/tcp_server.h"
|
33
|
+
#include "src/core/lib/iomgr/timer.h"
|
34
|
+
|
35
|
+
static const char* grpc_cfstream_env_var = "grpc_cfstream";
|
36
|
+
|
37
|
+
extern grpc_tcp_server_vtable grpc_posix_tcp_server_vtable;
|
38
|
+
extern grpc_tcp_client_vtable grpc_posix_tcp_client_vtable;
|
39
|
+
extern grpc_tcp_client_vtable grpc_cfstream_client_vtable;
|
40
|
+
extern grpc_timer_vtable grpc_generic_timer_vtable;
|
41
|
+
extern grpc_pollset_vtable grpc_posix_pollset_vtable;
|
42
|
+
extern grpc_pollset_set_vtable grpc_posix_pollset_set_vtable;
|
43
|
+
extern grpc_address_resolver_vtable grpc_posix_resolver_vtable;
|
44
|
+
|
45
|
+
static void iomgr_platform_init(void) {
|
46
|
+
grpc_wakeup_fd_global_init();
|
47
|
+
grpc_event_engine_init();
|
48
|
+
}
|
49
|
+
|
50
|
+
static void iomgr_platform_flush(void) {}
|
51
|
+
|
52
|
+
static void iomgr_platform_shutdown(void) {
|
53
|
+
grpc_event_engine_shutdown();
|
54
|
+
grpc_wakeup_fd_global_destroy();
|
55
|
+
}
|
56
|
+
|
57
|
+
static void iomgr_platform_shutdown_background_closure(void) {
|
58
|
+
grpc_shutdown_background_closure();
|
59
|
+
}
|
60
|
+
|
61
|
+
static bool iomgr_platform_is_any_background_poller_thread(void) {
|
62
|
+
return grpc_is_any_background_poller_thread();
|
63
|
+
}
|
64
|
+
|
65
|
+
static bool iomgr_platform_add_closure_to_background_poller(
|
66
|
+
grpc_closure* closure, grpc_error* error) {
|
67
|
+
return grpc_add_closure_to_background_poller(closure, error);
|
68
|
+
}
|
69
|
+
|
70
|
+
static grpc_iomgr_platform_vtable vtable = {
|
71
|
+
iomgr_platform_init,
|
72
|
+
iomgr_platform_flush,
|
73
|
+
iomgr_platform_shutdown,
|
74
|
+
iomgr_platform_shutdown_background_closure,
|
75
|
+
iomgr_platform_is_any_background_poller_thread,
|
76
|
+
iomgr_platform_add_closure_to_background_poller};
|
77
|
+
|
78
|
+
void grpc_set_default_iomgr_platform() {
|
79
|
+
char* enable_cfstream = getenv(grpc_cfstream_env_var);
|
80
|
+
grpc_tcp_client_vtable* client_vtable = &grpc_posix_tcp_client_vtable;
|
81
|
+
if (enable_cfstream != nullptr && enable_cfstream[0] == '1') {
|
82
|
+
client_vtable = &grpc_cfstream_client_vtable;
|
83
|
+
}
|
84
|
+
grpc_set_tcp_client_impl(client_vtable);
|
85
|
+
grpc_set_tcp_server_impl(&grpc_posix_tcp_server_vtable);
|
86
|
+
grpc_set_timer_impl(&grpc_generic_timer_vtable);
|
87
|
+
grpc_set_pollset_vtable(&grpc_posix_pollset_vtable);
|
88
|
+
grpc_set_pollset_set_vtable(&grpc_posix_pollset_set_vtable);
|
89
|
+
grpc_set_resolver_impl(&grpc_posix_resolver_vtable);
|
90
|
+
grpc_set_iomgr_platform_vtable(&vtable);
|
91
|
+
}
|
92
|
+
|
93
|
+
#endif /* GRPC_CFSTREAM_IOMGR */
|
@@ -94,7 +94,7 @@ void LockfreeEvent::NotifyOn(grpc_closure* closure) {
|
|
94
94
|
* sure that the shutdown error has been initialized properly before us
|
95
95
|
* referencing it. */
|
96
96
|
gpr_atm curr = gpr_atm_acq_load(&state_);
|
97
|
-
if (grpc_polling_trace
|
97
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
|
98
98
|
gpr_log(GPR_ERROR, "LockfreeEvent::NotifyOn: %p curr=%p closure=%p", this,
|
99
99
|
(void*)curr, closure);
|
100
100
|
}
|
@@ -160,7 +160,7 @@ bool LockfreeEvent::SetShutdown(grpc_error* shutdown_err) {
|
|
160
160
|
|
161
161
|
while (true) {
|
162
162
|
gpr_atm curr = gpr_atm_no_barrier_load(&state_);
|
163
|
-
if (grpc_polling_trace
|
163
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
|
164
164
|
gpr_log(GPR_ERROR, "LockfreeEvent::SetShutdown: %p curr=%p err=%s",
|
165
165
|
&state_, (void*)curr, grpc_error_string(shutdown_err));
|
166
166
|
}
|
@@ -209,7 +209,7 @@ void LockfreeEvent::SetReady() {
|
|
209
209
|
while (true) {
|
210
210
|
gpr_atm curr = gpr_atm_no_barrier_load(&state_);
|
211
211
|
|
212
|
-
if (grpc_polling_trace
|
212
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
|
213
213
|
gpr_log(GPR_ERROR, "LockfreeEvent::SetReady: %p curr=%p", &state_,
|
214
214
|
(void*)curr);
|
215
215
|
}
|
data/src/core/lib/iomgr/port.h
CHANGED
@@ -44,6 +44,8 @@
|
|
44
44
|
#elif defined(GPR_WINDOWS)
|
45
45
|
#define GRPC_WINSOCK_SOCKET 1
|
46
46
|
#define GRPC_WINDOWS_SOCKETUTILS 1
|
47
|
+
#define GRPC_WINDOWS_SOCKET_ARES_EV_DRIVER 1
|
48
|
+
#define GRPC_ARES_RESOLVE_LOCALHOST_MANUALLY 1
|
47
49
|
#elif defined(GPR_ANDROID)
|
48
50
|
#define GRPC_HAVE_IPV6_RECVPKTINFO 1
|
49
51
|
#define GRPC_HAVE_IP_PKTINFO 1
|
@@ -88,6 +90,15 @@
|
|
88
90
|
#ifdef LINUX_VERSION_CODE
|
89
91
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
|
90
92
|
#define GRPC_HAVE_TCP_USER_TIMEOUT
|
93
|
+
#ifdef __GLIBC_PREREQ
|
94
|
+
#if !(__GLIBC_PREREQ(2, 17))
|
95
|
+
/*
|
96
|
+
* TCP_USER_TIMEOUT wasn't imported to glibc until 2.17. Use Linux system
|
97
|
+
* header instead.
|
98
|
+
*/
|
99
|
+
#define GRPC_LINUX_TCP_H 1
|
100
|
+
#endif /* __GLIBC_PREREQ(2, 17) */
|
101
|
+
#endif /* ifdef __GLIBC_PREREQ */
|
91
102
|
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37) */
|
92
103
|
#endif /* LINUX_VERSION_CODE */
|
93
104
|
#ifndef __GLIBC__
|
@@ -32,6 +32,7 @@
|
|
32
32
|
|
33
33
|
#include "src/core/lib/gpr/useful.h"
|
34
34
|
#include "src/core/lib/iomgr/combiner.h"
|
35
|
+
#include "src/core/lib/slice/slice_internal.h"
|
35
36
|
|
36
37
|
grpc_core::TraceFlag grpc_resource_quota_trace(false, "resource_quota");
|
37
38
|
|
@@ -316,7 +317,7 @@ static bool rq_alloc(grpc_resource_quota* resource_quota) {
|
|
316
317
|
while ((resource_user = rulist_pop_head(resource_quota,
|
317
318
|
GRPC_RULIST_AWAITING_ALLOCATION))) {
|
318
319
|
gpr_mu_lock(&resource_user->mu);
|
319
|
-
if (grpc_resource_quota_trace
|
320
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
|
320
321
|
gpr_log(GPR_INFO,
|
321
322
|
"RQ: check allocation for user %p shutdown=%" PRIdPTR
|
322
323
|
" free_pool=%" PRId64,
|
@@ -342,14 +343,14 @@ static bool rq_alloc(grpc_resource_quota* resource_quota) {
|
|
342
343
|
resource_user->free_pool = 0;
|
343
344
|
resource_quota->free_pool -= amt;
|
344
345
|
rq_update_estimate(resource_quota);
|
345
|
-
if (grpc_resource_quota_trace
|
346
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
|
346
347
|
gpr_log(GPR_INFO,
|
347
348
|
"RQ %s %s: grant alloc %" PRId64
|
348
349
|
" bytes; rq_free_pool -> %" PRId64,
|
349
350
|
resource_quota->name, resource_user->name, amt,
|
350
351
|
resource_quota->free_pool);
|
351
352
|
}
|
352
|
-
} else if (grpc_resource_quota_trace
|
353
|
+
} else if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace) &&
|
353
354
|
resource_user->free_pool >= 0) {
|
354
355
|
gpr_log(GPR_INFO, "RQ %s %s: discard already satisfied alloc request",
|
355
356
|
resource_quota->name, resource_user->name);
|
@@ -381,7 +382,7 @@ static bool rq_reclaim_from_per_user_free_pool(
|
|
381
382
|
resource_user->free_pool = 0;
|
382
383
|
resource_quota->free_pool += amt;
|
383
384
|
rq_update_estimate(resource_quota);
|
384
|
-
if (grpc_resource_quota_trace
|
385
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
|
385
386
|
gpr_log(GPR_INFO,
|
386
387
|
"RQ %s %s: reclaim_from_per_user_free_pool %" PRId64
|
387
388
|
" bytes; rq_free_pool -> %" PRId64,
|
@@ -391,7 +392,7 @@ static bool rq_reclaim_from_per_user_free_pool(
|
|
391
392
|
gpr_mu_unlock(&resource_user->mu);
|
392
393
|
return true;
|
393
394
|
} else {
|
394
|
-
if (grpc_resource_quota_trace
|
395
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
|
395
396
|
gpr_log(GPR_INFO,
|
396
397
|
"RQ %s %s: failed to reclaim_from_per_user_free_pool; "
|
397
398
|
"free_pool = %" PRId64 "; rq_free_pool = %" PRId64,
|
@@ -411,7 +412,7 @@ static bool rq_reclaim(grpc_resource_quota* resource_quota, bool destructive) {
|
|
411
412
|
: GRPC_RULIST_RECLAIMER_BENIGN;
|
412
413
|
grpc_resource_user* resource_user = rulist_pop_head(resource_quota, list);
|
413
414
|
if (resource_user == nullptr) return false;
|
414
|
-
if (grpc_resource_quota_trace
|
415
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
|
415
416
|
gpr_log(GPR_INFO, "RQ %s %s: initiate %s reclamation", resource_quota->name,
|
416
417
|
resource_user->name, destructive ? "destructive" : "benign");
|
417
418
|
}
|
@@ -430,41 +431,43 @@ static bool rq_reclaim(grpc_resource_quota* resource_quota, bool destructive) {
|
|
430
431
|
* ru_slice: a slice implementation that is backed by a grpc_resource_user
|
431
432
|
*/
|
432
433
|
|
433
|
-
|
434
|
-
grpc_slice_refcount base;
|
435
|
-
gpr_refcount refs;
|
436
|
-
grpc_resource_user* resource_user;
|
437
|
-
size_t size;
|
438
|
-
} ru_slice_refcount;
|
434
|
+
namespace grpc_core {
|
439
435
|
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
static void ru_slice_unref(void* p) {
|
446
|
-
ru_slice_refcount* rc = static_cast<ru_slice_refcount*>(p);
|
447
|
-
if (gpr_unref(&rc->refs)) {
|
448
|
-
grpc_resource_user_free(rc->resource_user, rc->size);
|
436
|
+
class RuSliceRefcount {
|
437
|
+
public:
|
438
|
+
static void Destroy(void* p) {
|
439
|
+
auto* rc = static_cast<RuSliceRefcount*>(p);
|
440
|
+
rc->~RuSliceRefcount();
|
449
441
|
gpr_free(rc);
|
450
442
|
}
|
451
|
-
|
443
|
+
RuSliceRefcount(grpc_resource_user* resource_user, size_t size)
|
444
|
+
: base_(grpc_slice_refcount::Type::REGULAR, &refs_, Destroy, this,
|
445
|
+
&base_),
|
446
|
+
resource_user_(resource_user),
|
447
|
+
size_(size) {
|
448
|
+
// Nothing to do here.
|
449
|
+
}
|
450
|
+
~RuSliceRefcount() { grpc_resource_user_free(resource_user_, size_); }
|
451
|
+
|
452
|
+
grpc_slice_refcount* base_refcount() { return &base_; }
|
452
453
|
|
453
|
-
|
454
|
-
|
455
|
-
|
454
|
+
private:
|
455
|
+
grpc_slice_refcount base_;
|
456
|
+
RefCount refs_;
|
457
|
+
grpc_resource_user* resource_user_;
|
458
|
+
size_t size_;
|
459
|
+
};
|
460
|
+
|
461
|
+
} // namespace grpc_core
|
456
462
|
|
457
463
|
static grpc_slice ru_slice_create(grpc_resource_user* resource_user,
|
458
464
|
size_t size) {
|
459
|
-
|
460
|
-
gpr_malloc(sizeof(
|
461
|
-
rc
|
462
|
-
rc->base.sub_refcount = &rc->base;
|
463
|
-
gpr_ref_init(&rc->refs, 1);
|
464
|
-
rc->resource_user = resource_user;
|
465
|
-
rc->size = size;
|
465
|
+
auto* rc = static_cast<grpc_core::RuSliceRefcount*>(
|
466
|
+
gpr_malloc(sizeof(grpc_core::RuSliceRefcount) + size));
|
467
|
+
new (rc) grpc_core::RuSliceRefcount(resource_user, size);
|
466
468
|
grpc_slice slice;
|
467
|
-
|
469
|
+
|
470
|
+
slice.refcount = rc->base_refcount();
|
468
471
|
slice.data.refcounted.bytes = reinterpret_cast<uint8_t*>(rc + 1);
|
469
472
|
slice.data.refcounted.length = size;
|
470
473
|
return slice;
|
@@ -540,7 +543,7 @@ static void ru_post_destructive_reclaimer(void* ru, grpc_error* error) {
|
|
540
543
|
}
|
541
544
|
|
542
545
|
static void ru_shutdown(void* ru, grpc_error* error) {
|
543
|
-
if (grpc_resource_quota_trace
|
546
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
|
544
547
|
gpr_log(GPR_INFO, "RU shutdown %p", ru);
|
545
548
|
}
|
546
549
|
grpc_resource_user* resource_user = static_cast<grpc_resource_user*>(ru);
|
@@ -882,7 +885,7 @@ static void resource_user_alloc_locked(grpc_resource_user* resource_user,
|
|
882
885
|
grpc_closure* optional_on_done) {
|
883
886
|
ru_ref_by(resource_user, static_cast<gpr_atm>(size));
|
884
887
|
resource_user->free_pool -= static_cast<int64_t>(size);
|
885
|
-
if (grpc_resource_quota_trace
|
888
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
|
886
889
|
gpr_log(GPR_INFO, "RQ %s %s: alloc %" PRIdPTR "; free_pool -> %" PRId64,
|
887
890
|
resource_user->resource_quota->name, resource_user->name, size,
|
888
891
|
resource_user->free_pool);
|
@@ -941,7 +944,7 @@ void grpc_resource_user_free(grpc_resource_user* resource_user, size_t size) {
|
|
941
944
|
GPR_ASSERT(prior >= static_cast<long>(size));
|
942
945
|
bool was_zero_or_negative = resource_user->free_pool <= 0;
|
943
946
|
resource_user->free_pool += static_cast<int64_t>(size);
|
944
|
-
if (grpc_resource_quota_trace
|
947
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
|
945
948
|
gpr_log(GPR_INFO, "RQ %s %s: free %" PRIdPTR "; free_pool -> %" PRId64,
|
946
949
|
resource_user->resource_quota->name, resource_user->name, size,
|
947
950
|
resource_user->free_pool);
|
@@ -967,7 +970,7 @@ void grpc_resource_user_post_reclaimer(grpc_resource_user* resource_user,
|
|
967
970
|
}
|
968
971
|
|
969
972
|
void grpc_resource_user_finish_reclamation(grpc_resource_user* resource_user) {
|
970
|
-
if (grpc_resource_quota_trace
|
973
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_resource_quota_trace)) {
|
971
974
|
gpr_log(GPR_INFO, "RQ %s %s: reclamation complete",
|
972
975
|
resource_user->resource_quota->name, resource_user->name);
|
973
976
|
}
|