A few src/core fixes due to missing exec_ctx_finish

pull/13058/head
Yash Tibrewal 7 years ago
parent 7486144de0
commit a13a8c0f3e
  1. 7
      include/grpc/support/tls_gcc.h
  2. 3
      include/grpc/support/tls_msvc.h
  3. 1
      include/grpc/support/tls_pthread.h
  4. 2
      src/core/lib/iomgr/ev_posix.cc
  5. 1
      src/core/lib/iomgr/resolve_address_posix.cc
  6. 19
      src/core/lib/iomgr/tcp_uv.cc
  7. 3
      src/core/lib/surface/init.cc
  8. 6
      test/core/bad_client/bad_client.cc
  9. 2
      test/core/end2end/bad_server_response_test.cc
  10. 60
      test/core/iomgr/resource_quota_test.cc
  11. 1
      test/core/iomgr/tcp_posix_test.cc
  12. 1
      test/core/iomgr/tcp_server_posix_test.cc
  13. 12
      test/core/iomgr/timer_list_test.cc
  14. 2
      test/core/iomgr/udp_server_test.cc
  15. 14
      test/core/security/jwt_verifier_test.cc
  16. 1
      test/core/security/secure_endpoint_test.cc
  17. 3
      test/core/transport/connectivity_state_test.cc
  18. 1
      test/core/util/port_server_client.cc
  19. 11
      test/cpp/client/client_channel_stress_test.cc

@ -37,6 +37,10 @@ struct gpr_gcc_thread_local {
static bool name##_inited = false; \ static bool name##_inited = false; \
static __thread struct gpr_gcc_thread_local name = {0, &(name##_inited)} static __thread struct gpr_gcc_thread_local name = {0, &(name##_inited)}
#define GPR_TLS_NON_STATIC_DECL(name) \
bool name##_inited = false; \
__thread struct gpr_gcc_thread_local name = {0, &(name##_inited)}
#define gpr_tls_init(tls) \ #define gpr_tls_init(tls) \
do { \ do { \
GPR_ASSERT(*((tls)->inited) == false); \ GPR_ASSERT(*((tls)->inited) == false); \
@ -71,6 +75,9 @@ struct gpr_gcc_thread_local {
#define GPR_TLS_DECL(name) \ #define GPR_TLS_DECL(name) \
static __thread struct gpr_gcc_thread_local name = {0} static __thread struct gpr_gcc_thread_local name = {0}
#define GPR_TLS_NON_STATIC_DECL(name) \
__thread struct gpr_gcc_thread_local name = {0}
#define gpr_tls_init(tls) \ #define gpr_tls_init(tls) \
do { \ do { \
} while (0) } while (0)

@ -29,6 +29,9 @@ struct gpr_msvc_thread_local {
#define GPR_TLS_DECL(name) \ #define GPR_TLS_DECL(name) \
static __declspec(thread) struct gpr_msvc_thread_local name = {0} static __declspec(thread) struct gpr_msvc_thread_local name = {0}
#define GPR_TLS_NON_STATIC_DECL(name) \
__declspec(thread) struct gpr_msvc_thread_local name = {0}
#define gpr_tls_init(tls) \ #define gpr_tls_init(tls) \
do { \ do { \
} while (0) } while (0)

@ -30,6 +30,7 @@ struct gpr_pthread_thread_local {
}; };
#define GPR_TLS_DECL(name) static struct gpr_pthread_thread_local name = {0} #define GPR_TLS_DECL(name) static struct gpr_pthread_thread_local name = {0}
#define GPR_TLS_NON_STATIC_DECL(name) struct gpr_pthread_thread_local name = {0}
#define gpr_tls_init(tls) GPR_ASSERT(0 == pthread_key_create(&(tls)->key, NULL)) #define gpr_tls_init(tls) GPR_ASSERT(0 == pthread_key_create(&(tls)->key, NULL))
#define gpr_tls_destroy(tls) pthread_key_delete((tls)->key) #define gpr_tls_destroy(tls) pthread_key_delete((tls)->key)

@ -46,7 +46,7 @@ grpc_poll_function_type grpc_poll_function = poll;
grpc_wakeup_fd grpc_global_wakeup_fd; grpc_wakeup_fd grpc_global_wakeup_fd;
static const grpc_event_engine_vtable* g_event_engine; static const grpc_event_engine_vtable* g_event_engine = nullptr;
static const char* g_poll_strategy_name = nullptr; static const char* g_poll_strategy_name = nullptr;
typedef const grpc_event_engine_vtable* (*event_engine_factory_fn)( typedef const grpc_event_engine_vtable* (*event_engine_factory_fn)(

@ -42,6 +42,7 @@
static grpc_error* blocking_resolve_address_impl( static grpc_error* blocking_resolve_address_impl(
const char* name, const char* default_port, const char* name, const char* default_port,
grpc_resolved_addresses** addresses) { grpc_resolved_addresses** addresses) {
grpc_core::ExecCtx exec_ctx;
struct addrinfo hints; struct addrinfo hints;
struct addrinfo *result = nullptr, *resp; struct addrinfo *result = nullptr, *resp;
char* host; char* host;

@ -65,7 +65,7 @@ typedef struct {
grpc_pollset* pollset; grpc_pollset* pollset;
} grpc_tcp; } grpc_tcp;
static void tcp_free(grpc_exec_ctx* exec_ctx, grpc_tcp* tcp) { static void tcp_free(grpc_tcp* tcp) {
grpc_resource_user_unref(tcp->resource_user); grpc_resource_user_unref(tcp->resource_user);
gpr_free(tcp->handle); gpr_free(tcp->handle);
gpr_free(tcp->peer_string); gpr_free(tcp->peer_string);
@ -126,11 +126,9 @@ static void alloc_uv_buf(uv_handle_t* handle, size_t suggested_size,
* allocation was successful. So slices[0] should always exist here */ * allocation was successful. So slices[0] should always exist here */
buf->base = (char*)GRPC_SLICE_START_PTR(tcp->read_slices->slices[0]); buf->base = (char*)GRPC_SLICE_START_PTR(tcp->read_slices->slices[0]);
buf->len = GRPC_SLICE_LENGTH(tcp->read_slices->slices[0]); buf->len = GRPC_SLICE_LENGTH(tcp->read_slices->slices[0]);
grpc_exec_ctx_finish();
} }
static void call_read_cb(grpc_exec_ctx* exec_ctx, grpc_tcp* tcp, static void call_read_cb(grpc_tcp* tcp, grpc_error* error) {
grpc_error* error) {
grpc_closure* cb = tcp->read_cb; grpc_closure* cb = tcp->read_cb;
if (grpc_tcp_trace.enabled()) { if (grpc_tcp_trace.enabled()) {
gpr_log(GPR_DEBUG, "TCP:%p call_cb %p %p:%p", tcp, cb, cb->cb, cb->cb_arg); gpr_log(GPR_DEBUG, "TCP:%p call_cb %p %p:%p", tcp, cb, cb->cb, cb->cb_arg);
@ -147,7 +145,7 @@ static void call_read_cb(grpc_exec_ctx* exec_ctx, grpc_tcp* tcp,
} }
tcp->read_slices = NULL; tcp->read_slices = NULL;
tcp->read_cb = NULL; tcp->read_cb = NULL;
GRPC_CLOSURE_RUN(exec_ctx, cb, error); GRPC_CLOSURE_RUN(, cb, error);
} }
static void read_callback(uv_stream_t* stream, ssize_t nread, static void read_callback(uv_stream_t* stream, ssize_t nread,
@ -165,7 +163,7 @@ static void read_callback(uv_stream_t* stream, ssize_t nread,
uv_read_stop(stream); uv_read_stop(stream);
if (nread == UV_EOF) { if (nread == UV_EOF) {
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("EOF"); error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("EOF");
grpc_slice_buffer_reset_and_unref_internal(&exec_ctx, tcp->read_slices); grpc_slice_buffer_reset_and_unref_internal(tcp->read_slices);
} else if (nread > 0) { } else if (nread > 0) {
// Successful read // Successful read
error = GRPC_ERROR_NONE; error = GRPC_ERROR_NONE;
@ -175,15 +173,14 @@ static void read_callback(uv_stream_t* stream, ssize_t nread,
grpc_slice_buffer_init(&garbage); grpc_slice_buffer_init(&garbage);
grpc_slice_buffer_trim_end( grpc_slice_buffer_trim_end(
tcp->read_slices, tcp->read_slices->length - (size_t)nread, &garbage); tcp->read_slices, tcp->read_slices->length - (size_t)nread, &garbage);
grpc_slice_buffer_reset_and_unref_internal(&exec_ctx, &garbage); grpc_slice_buffer_reset_and_unref_internal(&garbage);
} }
} else { } else {
// nread < 0: Error // nread < 0: Error
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("TCP Read failed"); error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("TCP Read failed");
grpc_slice_buffer_reset_and_unref_internal(&exec_ctx, tcp->read_slices); grpc_slice_buffer_reset_and_unref_internal(tcp->read_slices);
} }
call_read_cb(tcp, error); call_read_cb(tcp, error);
grpc_exec_ctx_finish();
} }
static void tcp_read_allocation_done(void* tcpp, grpc_error* error) { static void tcp_read_allocation_done(void* tcpp, grpc_error* error) {
@ -246,7 +243,6 @@ static void write_callback(uv_write_t* req, int status) {
} }
gpr_free(tcp->write_buffers); gpr_free(tcp->write_buffers);
GRPC_CLOSURE_SCHED(cb, error); GRPC_CLOSURE_SCHED(cb, error);
grpc_exec_ctx_finish();
} }
static void uv_endpoint_write(grpc_endpoint* ep, static void uv_endpoint_write(grpc_endpoint* ep,
@ -306,7 +302,6 @@ static void uv_endpoint_write(grpc_endpoint* ep,
static void uv_add_to_pollset(grpc_endpoint* ep, grpc_pollset* pollset) { static void uv_add_to_pollset(grpc_endpoint* ep, grpc_pollset* pollset) {
// No-op. We're ignoring pollsets currently // No-op. We're ignoring pollsets currently
(void)exec_ctx;
(void)ep; (void)ep;
(void)pollset; (void)pollset;
grpc_tcp* tcp = (grpc_tcp*)ep; grpc_tcp* tcp = (grpc_tcp*)ep;
@ -316,7 +311,6 @@ static void uv_add_to_pollset(grpc_endpoint* ep, grpc_pollset* pollset) {
static void uv_add_to_pollset_set(grpc_endpoint* ep, static void uv_add_to_pollset_set(grpc_endpoint* ep,
grpc_pollset_set* pollset) { grpc_pollset_set* pollset) {
// No-op. We're ignoring pollsets currently // No-op. We're ignoring pollsets currently
(void)exec_ctx;
(void)ep; (void)ep;
(void)pollset; (void)pollset;
} }
@ -324,7 +318,6 @@ static void uv_add_to_pollset_set(grpc_endpoint* ep,
static void uv_delete_from_pollset_set(grpc_endpoint* ep, static void uv_delete_from_pollset_set(grpc_endpoint* ep,
grpc_pollset_set* pollset) { grpc_pollset_set* pollset) {
// No-op. We're ignoring pollsets currently // No-op. We're ignoring pollsets currently
(void)exec_ctx;
(void)ep; (void)ep;
(void)pollset; (void)pollset;
} }

@ -151,6 +151,9 @@ void grpc_init(void) {
void grpc_shutdown(void) { void grpc_shutdown(void) {
int i; int i;
GRPC_API_TRACE("grpc_shutdown(void)", 0, ()); GRPC_API_TRACE("grpc_shutdown(void)", 0, ());
if (grpc_core::ExecCtx::Get()) {
grpc_core::ExecCtx::Get()->Flush();
}
grpc_core::ExecCtx _local_exec_ctx(0); grpc_core::ExecCtx _local_exec_ctx(0);
gpr_mu_lock(&g_init_mu); gpr_mu_lock(&g_init_mu);
if (--g_initializations == 0) { if (--g_initializations == 0) {

@ -135,6 +135,7 @@ void grpc_run_bad_client_test(
/* Write data */ /* Write data */
grpc_endpoint_write(sfd.client, &outgoing, &done_write_closure); grpc_endpoint_write(sfd.client, &outgoing, &done_write_closure);
grpc_core::ExecCtx::Get()->Flush();
/* Await completion, unless the request is large and write may not finish /* Await completion, unless the request is large and write may not finish
* before the peer shuts down. */ * before the peer shuts down. */
@ -147,7 +148,7 @@ void grpc_run_bad_client_test(
grpc_endpoint_shutdown( grpc_endpoint_shutdown(
sfd.client, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Forced Disconnect")); sfd.client, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Forced Disconnect"));
grpc_endpoint_destroy(sfd.client); grpc_endpoint_destroy(sfd.client);
grpc_core::ExecCtx::Get()->Flush();
sfd.client = nullptr; sfd.client = nullptr;
} }
@ -167,7 +168,7 @@ void grpc_run_bad_client_test(
GRPC_CLOSURE_INIT(&read_done_closure, read_done, &read_done_event, GRPC_CLOSURE_INIT(&read_done_closure, read_done, &read_done_event,
grpc_schedule_on_exec_ctx); grpc_schedule_on_exec_ctx);
grpc_endpoint_read(sfd.client, &incoming, &read_done_closure); grpc_endpoint_read(sfd.client, &incoming, &read_done_closure);
grpc_core::ExecCtx::Get()->Flush();
do { do {
GPR_ASSERT(gpr_time_cmp(deadline, gpr_now(deadline.clock_type)) > 0); GPR_ASSERT(gpr_time_cmp(deadline, gpr_now(deadline.clock_type)) > 0);
GPR_ASSERT( GPR_ASSERT(
@ -186,6 +187,7 @@ void grpc_run_bad_client_test(
grpc_endpoint_shutdown( grpc_endpoint_shutdown(
sfd.client, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Test Shutdown")); sfd.client, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Test Shutdown"));
grpc_endpoint_destroy(sfd.client); grpc_endpoint_destroy(sfd.client);
grpc_core::ExecCtx::Get()->Flush();
} }
GPR_ASSERT( GPR_ASSERT(

@ -290,7 +290,7 @@ static void run_test(const char* response_payload,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Test Shutdown")); GRPC_ERROR_CREATE_FROM_STATIC_STRING("Test Shutdown"));
grpc_endpoint_destroy(state.tcp); grpc_endpoint_destroy(state.tcp);
cleanup_rpc(); cleanup_rpc();
grpc_core::ExecCtx::Get()->Flush();
test_tcp_server_destroy(&test_server); test_tcp_server_destroy(&test_server);
grpc_shutdown(); grpc_shutdown();

@ -154,7 +154,7 @@ static void test_simple_async_alloc(void) {
gpr_event_init(&ev); gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev)); grpc_resource_user_alloc(usr, 1024, set_event(&ev));
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
nullptr); nullptr);
} }
@ -177,7 +177,7 @@ static void test_async_alloc_blocked_by_size(void) {
{ {
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev)); grpc_resource_user_alloc(usr, 1024, set_event(&ev));
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait( GPR_ASSERT(gpr_event_wait(
&ev, grpc_timeout_milliseconds_to_deadline(100)) == nullptr); &ev, grpc_timeout_milliseconds_to_deadline(100)) == nullptr);
} }
@ -204,7 +204,7 @@ static void test_scavenge(void) {
gpr_event_init(&ev); gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr1, 1024, set_event(&ev)); grpc_resource_user_alloc(usr1, 1024, set_event(&ev));
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
nullptr); nullptr);
; ;
@ -218,7 +218,7 @@ static void test_scavenge(void) {
gpr_event_init(&ev); gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr2, 1024, set_event(&ev)); grpc_resource_user_alloc(usr2, 1024, set_event(&ev));
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
nullptr); nullptr);
; ;
@ -243,7 +243,7 @@ static void test_scavenge_blocked(void) {
gpr_event_init(&ev); gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr1, 1024, set_event(&ev)); grpc_resource_user_alloc(usr1, 1024, set_event(&ev));
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
nullptr); nullptr);
; ;
@ -252,14 +252,14 @@ static void test_scavenge_blocked(void) {
gpr_event_init(&ev); gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr2, 1024, set_event(&ev)); grpc_resource_user_alloc(usr2, 1024, set_event(&ev));
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait( GPR_ASSERT(gpr_event_wait(
&ev, grpc_timeout_milliseconds_to_deadline(100)) == nullptr); &ev, grpc_timeout_milliseconds_to_deadline(100)) == nullptr);
} }
{ {
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_free(usr1, 1024); grpc_resource_user_free(usr1, 1024);
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
nullptr); nullptr);
; ;
@ -284,7 +284,7 @@ static void test_blocked_until_scheduled_reclaim(void) {
gpr_event_init(&ev); gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev)); grpc_resource_user_alloc(usr, 1024, set_event(&ev));
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
nullptr); nullptr);
; ;
@ -301,7 +301,7 @@ static void test_blocked_until_scheduled_reclaim(void) {
gpr_event_init(&ev); gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev)); grpc_resource_user_alloc(usr, 1024, set_event(&ev));
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&reclaim_done, GPR_ASSERT(gpr_event_wait(&reclaim_done,
grpc_timeout_seconds_to_deadline(5)) != nullptr); grpc_timeout_seconds_to_deadline(5)) != nullptr);
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
@ -328,7 +328,7 @@ static void test_blocked_until_scheduled_reclaim_and_scavenge(void) {
gpr_event_init(&ev); gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr1, 1024, set_event(&ev)); grpc_resource_user_alloc(usr1, 1024, set_event(&ev));
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
nullptr); nullptr);
; ;
@ -345,7 +345,7 @@ static void test_blocked_until_scheduled_reclaim_and_scavenge(void) {
gpr_event_init(&ev); gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr2, 1024, set_event(&ev)); grpc_resource_user_alloc(usr2, 1024, set_event(&ev));
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&reclaim_done, GPR_ASSERT(gpr_event_wait(&reclaim_done,
grpc_timeout_seconds_to_deadline(5)) != nullptr); grpc_timeout_seconds_to_deadline(5)) != nullptr);
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
@ -372,7 +372,7 @@ static void test_blocked_until_scheduled_destructive_reclaim(void) {
gpr_event_init(&ev); gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev)); grpc_resource_user_alloc(usr, 1024, set_event(&ev));
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
nullptr); nullptr);
; ;
@ -389,7 +389,7 @@ static void test_blocked_until_scheduled_destructive_reclaim(void) {
gpr_event_init(&ev); gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev)); grpc_resource_user_alloc(usr, 1024, set_event(&ev));
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&reclaim_done, GPR_ASSERT(gpr_event_wait(&reclaim_done,
grpc_timeout_seconds_to_deadline(5)) != nullptr); grpc_timeout_seconds_to_deadline(5)) != nullptr);
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
@ -420,7 +420,7 @@ static void test_unused_reclaim_is_cancelled(void) {
usr, false, make_unused_reclaimer(set_event(&benign_done))); usr, false, make_unused_reclaimer(set_event(&benign_done)));
grpc_resource_user_post_reclaimer( grpc_resource_user_post_reclaimer(
usr, true, make_unused_reclaimer(set_event(&destructive_done))); usr, true, make_unused_reclaimer(set_event(&destructive_done)));
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&benign_done, GPR_ASSERT(gpr_event_wait(&benign_done,
grpc_timeout_milliseconds_to_deadline(100)) == grpc_timeout_milliseconds_to_deadline(100)) ==
nullptr); nullptr);
@ -451,7 +451,7 @@ static void test_benign_reclaim_is_preferred(void) {
gpr_event_init(&ev); gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev)); grpc_resource_user_alloc(usr, 1024, set_event(&ev));
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
nullptr); nullptr);
; ;
@ -462,7 +462,7 @@ static void test_benign_reclaim_is_preferred(void) {
usr, false, make_reclaimer(usr, 1024, set_event(&benign_done))); usr, false, make_reclaimer(usr, 1024, set_event(&benign_done)));
grpc_resource_user_post_reclaimer( grpc_resource_user_post_reclaimer(
usr, true, make_unused_reclaimer(set_event(&destructive_done))); usr, true, make_unused_reclaimer(set_event(&destructive_done)));
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&benign_done, GPR_ASSERT(gpr_event_wait(&benign_done,
grpc_timeout_milliseconds_to_deadline(100)) == grpc_timeout_milliseconds_to_deadline(100)) ==
nullptr); nullptr);
@ -475,7 +475,7 @@ static void test_benign_reclaim_is_preferred(void) {
gpr_event_init(&ev); gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev)); grpc_resource_user_alloc(usr, 1024, set_event(&ev));
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&benign_done, GPR_ASSERT(gpr_event_wait(&benign_done,
grpc_timeout_seconds_to_deadline(5)) != nullptr); grpc_timeout_seconds_to_deadline(5)) != nullptr);
GPR_ASSERT(gpr_event_wait(&destructive_done, GPR_ASSERT(gpr_event_wait(&destructive_done,
@ -511,7 +511,7 @@ static void test_multiple_reclaims_can_be_triggered(void) {
gpr_event_init(&ev); gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev)); grpc_resource_user_alloc(usr, 1024, set_event(&ev));
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) !=
nullptr); nullptr);
; ;
@ -522,7 +522,7 @@ static void test_multiple_reclaims_can_be_triggered(void) {
usr, false, make_reclaimer(usr, 512, set_event(&benign_done))); usr, false, make_reclaimer(usr, 512, set_event(&benign_done)));
grpc_resource_user_post_reclaimer( grpc_resource_user_post_reclaimer(
usr, true, make_reclaimer(usr, 512, set_event(&destructive_done))); usr, true, make_reclaimer(usr, 512, set_event(&destructive_done)));
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&benign_done, GPR_ASSERT(gpr_event_wait(&benign_done,
grpc_timeout_milliseconds_to_deadline(100)) == grpc_timeout_milliseconds_to_deadline(100)) ==
nullptr); nullptr);
@ -535,7 +535,7 @@ static void test_multiple_reclaims_can_be_triggered(void) {
gpr_event_init(&ev); gpr_event_init(&ev);
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&ev)); grpc_resource_user_alloc(usr, 1024, set_event(&ev));
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&benign_done, GPR_ASSERT(gpr_event_wait(&benign_done,
grpc_timeout_seconds_to_deadline(5)) != nullptr); grpc_timeout_seconds_to_deadline(5)) != nullptr);
GPR_ASSERT(gpr_event_wait(&destructive_done, GPR_ASSERT(gpr_event_wait(&destructive_done,
@ -597,7 +597,7 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released(
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_post_reclaimer( grpc_resource_user_post_reclaimer(
usr, false, make_unused_reclaimer(set_event(&reclaimer_cancelled))); usr, false, make_unused_reclaimer(set_event(&reclaimer_cancelled)));
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&reclaimer_cancelled, GPR_ASSERT(gpr_event_wait(&reclaimer_cancelled,
grpc_timeout_milliseconds_to_deadline(100)) == grpc_timeout_milliseconds_to_deadline(100)) ==
nullptr); nullptr);
@ -607,7 +607,7 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released(
gpr_event_init(&allocated); gpr_event_init(&allocated);
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&allocated)); grpc_resource_user_alloc(usr, 1024, set_event(&allocated));
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&allocated, GPR_ASSERT(gpr_event_wait(&allocated,
grpc_timeout_seconds_to_deadline(5)) != NULL); grpc_timeout_seconds_to_deadline(5)) != NULL);
GPR_ASSERT(gpr_event_wait(&reclaimer_cancelled, GPR_ASSERT(gpr_event_wait(&reclaimer_cancelled,
@ -617,7 +617,7 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released(
{ {
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_unref(usr); grpc_resource_user_unref(usr);
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&reclaimer_cancelled, GPR_ASSERT(gpr_event_wait(&reclaimer_cancelled,
grpc_timeout_milliseconds_to_deadline(100)) == grpc_timeout_milliseconds_to_deadline(100)) ==
nullptr); nullptr);
@ -625,7 +625,7 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released(
{ {
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_free(usr, 1024); grpc_resource_user_free(usr, 1024);
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&reclaimer_cancelled, GPR_ASSERT(gpr_event_wait(&reclaimer_cancelled,
grpc_timeout_seconds_to_deadline(5)) != grpc_timeout_seconds_to_deadline(5)) !=
nullptr); nullptr);
@ -645,7 +645,7 @@ static void test_reclaimers_can_be_posted_repeatedly(void) {
gpr_event_init(&allocated); gpr_event_init(&allocated);
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&allocated)); grpc_resource_user_alloc(usr, 1024, set_event(&allocated));
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&allocated, GPR_ASSERT(gpr_event_wait(&allocated,
grpc_timeout_seconds_to_deadline(5)) != nullptr); grpc_timeout_seconds_to_deadline(5)) != nullptr);
} }
@ -656,7 +656,7 @@ static void test_reclaimers_can_be_posted_repeatedly(void) {
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_post_reclaimer( grpc_resource_user_post_reclaimer(
usr, false, make_reclaimer(usr, 1024, set_event(&reclaimer_done))); usr, false, make_reclaimer(usr, 1024, set_event(&reclaimer_done)));
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&reclaimer_done, GPR_ASSERT(gpr_event_wait(&reclaimer_done,
grpc_timeout_milliseconds_to_deadline(100)) == grpc_timeout_milliseconds_to_deadline(100)) ==
nullptr); nullptr);
@ -666,7 +666,7 @@ static void test_reclaimers_can_be_posted_repeatedly(void) {
gpr_event_init(&allocated); gpr_event_init(&allocated);
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc(usr, 1024, set_event(&allocated)); grpc_resource_user_alloc(usr, 1024, set_event(&allocated));
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(gpr_event_wait(&allocated, GPR_ASSERT(gpr_event_wait(&allocated,
grpc_timeout_seconds_to_deadline(5)) != NULL); grpc_timeout_seconds_to_deadline(5)) != NULL);
GPR_ASSERT(gpr_event_wait(&reclaimer_done, GPR_ASSERT(gpr_event_wait(&reclaimer_done,
@ -701,7 +701,7 @@ static void test_one_slice(void) {
const int start_allocs = num_allocs; const int start_allocs = num_allocs;
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc_slices(&alloc, 1024, 1, &buffer); grpc_resource_user_alloc_slices(&alloc, 1024, 1, &buffer);
grpc_core::ExecCtx::Get()->Flush();
assert_counter_becomes(&num_allocs, start_allocs + 1); assert_counter_becomes(&num_allocs, start_allocs + 1);
} }
@ -733,7 +733,7 @@ static void test_one_slice_deleted_late(void) {
const int start_allocs = num_allocs; const int start_allocs = num_allocs;
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc_slices(&alloc, 1024, 1, &buffer); grpc_resource_user_alloc_slices(&alloc, 1024, 1, &buffer);
grpc_core::ExecCtx::Get()->Flush();
assert_counter_becomes(&num_allocs, start_allocs + 1); assert_counter_becomes(&num_allocs, start_allocs + 1);
} }
@ -775,7 +775,7 @@ static void test_negative_rq_free_pool(void) {
const int start_allocs = num_allocs; const int start_allocs = num_allocs;
grpc_core::ExecCtx _local_exec_ctx; grpc_core::ExecCtx _local_exec_ctx;
grpc_resource_user_alloc_slices(&alloc, 1024, 1, &buffer); grpc_resource_user_alloc_slices(&alloc, 1024, 1, &buffer);
grpc_core::ExecCtx::Get()->Flush();
assert_counter_becomes(&num_allocs, start_allocs + 1); assert_counter_becomes(&num_allocs, start_allocs + 1);
} }

@ -549,6 +549,7 @@ int main(int argc, char** argv) {
grpc_schedule_on_exec_ctx); grpc_schedule_on_exec_ctx);
grpc_pollset_shutdown(g_pollset, &destroyed); grpc_pollset_shutdown(g_pollset, &destroyed);
grpc_core::ExecCtx::Get()->Flush();
grpc_shutdown(); grpc_shutdown();
gpr_free(g_pollset); gpr_free(g_pollset);

@ -411,6 +411,7 @@ static void test_connect(size_t num_connects,
GPR_ASSERT(grpc_tcp_server_port_fd(s, 0, 0) >= 0); GPR_ASSERT(grpc_tcp_server_port_fd(s, 0, 0) >= 0);
grpc_tcp_server_unref(s); grpc_tcp_server_unref(s);
grpc_core::ExecCtx::Get()->Flush();
/* Weak ref lost. */ /* Weak ref lost. */
GPR_ASSERT(weak_ref.server == nullptr); GPR_ASSERT(weak_ref.server == nullptr);

@ -72,7 +72,7 @@ static void add_test(void) {
/* collect timers. Only the first batch should be ready. */ /* collect timers. Only the first batch should be ready. */
grpc_core::ExecCtx::Get()->TestOnlySetNow(start + 500); grpc_core::ExecCtx::Get()->TestOnlySetNow(start + 500);
GPR_ASSERT(grpc_timer_check(nullptr) == GRPC_TIMERS_FIRED); GPR_ASSERT(grpc_timer_check(nullptr) == GRPC_TIMERS_FIRED);
grpc_core::ExecCtx::Get()->Flush();
for (i = 0; i < 20; i++) { for (i = 0; i < 20; i++) {
GPR_ASSERT(cb_called[i][1] == (i < 10)); GPR_ASSERT(cb_called[i][1] == (i < 10));
GPR_ASSERT(cb_called[i][0] == 0); GPR_ASSERT(cb_called[i][0] == 0);
@ -80,7 +80,7 @@ static void add_test(void) {
grpc_core::ExecCtx::Get()->TestOnlySetNow(start + 600); grpc_core::ExecCtx::Get()->TestOnlySetNow(start + 600);
GPR_ASSERT(grpc_timer_check(nullptr) == GRPC_TIMERS_CHECKED_AND_EMPTY); GPR_ASSERT(grpc_timer_check(nullptr) == GRPC_TIMERS_CHECKED_AND_EMPTY);
grpc_core::ExecCtx::Get()->Flush();
for (i = 0; i < 30; i++) { for (i = 0; i < 30; i++) {
GPR_ASSERT(cb_called[i][1] == (i < 10)); GPR_ASSERT(cb_called[i][1] == (i < 10));
GPR_ASSERT(cb_called[i][0] == 0); GPR_ASSERT(cb_called[i][0] == 0);
@ -89,7 +89,7 @@ static void add_test(void) {
/* collect the rest of the timers */ /* collect the rest of the timers */
grpc_core::ExecCtx::Get()->TestOnlySetNow(start + 1500); grpc_core::ExecCtx::Get()->TestOnlySetNow(start + 1500);
GPR_ASSERT(grpc_timer_check(nullptr) == GRPC_TIMERS_FIRED); GPR_ASSERT(grpc_timer_check(nullptr) == GRPC_TIMERS_FIRED);
grpc_core::ExecCtx::Get()->Flush();
for (i = 0; i < 30; i++) { for (i = 0; i < 30; i++) {
GPR_ASSERT(cb_called[i][1] == (i < 20)); GPR_ASSERT(cb_called[i][1] == (i < 20));
GPR_ASSERT(cb_called[i][0] == 0); GPR_ASSERT(cb_called[i][0] == 0);
@ -135,16 +135,16 @@ void destruction_test(void) {
GRPC_CLOSURE_CREATE(cb, (void*)(intptr_t)4, grpc_schedule_on_exec_ctx)); GRPC_CLOSURE_CREATE(cb, (void*)(intptr_t)4, grpc_schedule_on_exec_ctx));
grpc_core::ExecCtx::Get()->TestOnlySetNow(2); grpc_core::ExecCtx::Get()->TestOnlySetNow(2);
GPR_ASSERT(grpc_timer_check(nullptr) == GRPC_TIMERS_FIRED); GPR_ASSERT(grpc_timer_check(nullptr) == GRPC_TIMERS_FIRED);
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(1 == cb_called[4][1]); GPR_ASSERT(1 == cb_called[4][1]);
grpc_timer_cancel(&timers[0]); grpc_timer_cancel(&timers[0]);
grpc_timer_cancel(&timers[3]); grpc_timer_cancel(&timers[3]);
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(1 == cb_called[0][0]); GPR_ASSERT(1 == cb_called[0][0]);
GPR_ASSERT(1 == cb_called[3][0]); GPR_ASSERT(1 == cb_called[3][0]);
grpc_timer_list_shutdown(); grpc_timer_list_shutdown();
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(1 == cb_called[1][0]); GPR_ASSERT(1 == cb_called[1][0]);
GPR_ASSERT(1 == cb_called[2][0]); GPR_ASSERT(1 == cb_called[2][0]);
} }

@ -308,7 +308,7 @@ int main(int argc, char** argv) {
GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset, GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset,
grpc_schedule_on_exec_ctx); grpc_schedule_on_exec_ctx);
grpc_pollset_shutdown(g_pollset, &destroyed); grpc_pollset_shutdown(g_pollset, &destroyed);
grpc_core::ExecCtx::Get()->Flush();
gpr_free(g_pollset); gpr_free(g_pollset);
grpc_shutdown(); grpc_shutdown();
return 0; return 0;

@ -366,7 +366,7 @@ static void test_jwt_verifier_google_email_issuer_success(void) {
grpc_jwt_verifier_verify(verifier, nullptr, jwt, expected_audience, grpc_jwt_verifier_verify(verifier, nullptr, jwt, expected_audience,
on_verification_success, (void*)expected_user_data); on_verification_success, (void*)expected_user_data);
grpc_jwt_verifier_destroy(verifier); grpc_jwt_verifier_destroy(verifier);
grpc_core::ExecCtx::Get()->Flush();
gpr_free(jwt); gpr_free(jwt);
grpc_httpcli_set_override(nullptr, nullptr); grpc_httpcli_set_override(nullptr, nullptr);
} }
@ -399,7 +399,7 @@ static void test_jwt_verifier_custom_email_issuer_success(void) {
grpc_jwt_verifier_verify(verifier, nullptr, jwt, expected_audience, grpc_jwt_verifier_verify(verifier, nullptr, jwt, expected_audience,
on_verification_success, (void*)expected_user_data); on_verification_success, (void*)expected_user_data);
grpc_jwt_verifier_destroy(verifier); grpc_jwt_verifier_destroy(verifier);
grpc_core::ExecCtx::Get()->Flush();
gpr_free(jwt); gpr_free(jwt);
grpc_httpcli_set_override(nullptr, nullptr); grpc_httpcli_set_override(nullptr, nullptr);
} }
@ -446,7 +446,7 @@ static void test_jwt_verifier_url_issuer_success(void) {
grpc_jwt_verifier_verify(verifier, nullptr, jwt, expected_audience, grpc_jwt_verifier_verify(verifier, nullptr, jwt, expected_audience,
on_verification_success, (void*)expected_user_data); on_verification_success, (void*)expected_user_data);
grpc_jwt_verifier_destroy(verifier); grpc_jwt_verifier_destroy(verifier);
grpc_core::ExecCtx::Get()->Flush();
gpr_free(jwt); gpr_free(jwt);
grpc_httpcli_set_override(nullptr, nullptr); grpc_httpcli_set_override(nullptr, nullptr);
} }
@ -486,7 +486,7 @@ static void test_jwt_verifier_url_issuer_bad_config(void) {
on_verification_key_retrieval_error, on_verification_key_retrieval_error,
(void*)expected_user_data); (void*)expected_user_data);
grpc_jwt_verifier_destroy(verifier); grpc_jwt_verifier_destroy(verifier);
grpc_core::ExecCtx::Get()->Flush();
gpr_free(jwt); gpr_free(jwt);
grpc_httpcli_set_override(nullptr, nullptr); grpc_httpcli_set_override(nullptr, nullptr);
} }
@ -509,7 +509,7 @@ static void test_jwt_verifier_bad_json_key(void) {
on_verification_key_retrieval_error, on_verification_key_retrieval_error,
(void*)expected_user_data); (void*)expected_user_data);
grpc_jwt_verifier_destroy(verifier); grpc_jwt_verifier_destroy(verifier);
grpc_core::ExecCtx::Get()->Flush();
gpr_free(jwt); gpr_free(jwt);
grpc_httpcli_set_override(nullptr, nullptr); grpc_httpcli_set_override(nullptr, nullptr);
} }
@ -562,7 +562,7 @@ static void test_jwt_verifier_bad_signature(void) {
(void*)expected_user_data); (void*)expected_user_data);
gpr_free(jwt); gpr_free(jwt);
grpc_jwt_verifier_destroy(verifier); grpc_jwt_verifier_destroy(verifier);
grpc_core::ExecCtx::Get()->Flush();
grpc_httpcli_set_override(nullptr, nullptr); grpc_httpcli_set_override(nullptr, nullptr);
} }
@ -591,7 +591,7 @@ static void test_jwt_verifier_bad_format(void) {
on_verification_bad_format, on_verification_bad_format,
(void*)expected_user_data); (void*)expected_user_data);
grpc_jwt_verifier_destroy(verifier); grpc_jwt_verifier_destroy(verifier);
grpc_core::ExecCtx::Get()->Flush();
grpc_httpcli_set_override(nullptr, nullptr); grpc_httpcli_set_override(nullptr, nullptr);
} }

@ -181,6 +181,7 @@ static void test_leftover(grpc_endpoint_test_config config, size_t slice_size) {
GRPC_CLOSURE_INIT(&done_closure, inc_call_ctr, &n, grpc_schedule_on_exec_ctx); GRPC_CLOSURE_INIT(&done_closure, inc_call_ctr, &n, grpc_schedule_on_exec_ctx);
grpc_endpoint_read(f.client_ep, &incoming, &done_closure); grpc_endpoint_read(f.client_ep, &incoming, &done_closure);
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(n == 1); GPR_ASSERT(n == 1);
GPR_ASSERT(incoming.count == 1); GPR_ASSERT(incoming.count == 1);
GPR_ASSERT(grpc_slice_eq(s, incoming.slices[0])); GPR_ASSERT(grpc_slice_eq(s, incoming.slices[0]));

@ -107,6 +107,7 @@ static void test_subscribe_then_destroy(void) {
GPR_ASSERT(g_counter == 0); GPR_ASSERT(g_counter == 0);
grpc_connectivity_state_destroy(&tracker); grpc_connectivity_state_destroy(&tracker);
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(state == GRPC_CHANNEL_SHUTDOWN); GPR_ASSERT(state == GRPC_CHANNEL_SHUTDOWN);
GPR_ASSERT(g_counter == 1); GPR_ASSERT(g_counter == 1);
} }
@ -126,7 +127,7 @@ static void test_subscribe_with_failure_then_destroy(void) {
GPR_ASSERT(state == GRPC_CHANNEL_SHUTDOWN); GPR_ASSERT(state == GRPC_CHANNEL_SHUTDOWN);
GPR_ASSERT(g_counter == 0); GPR_ASSERT(g_counter == 0);
grpc_connectivity_state_destroy(&tracker); grpc_connectivity_state_destroy(&tracker);
grpc_core::ExecCtx::Get()->Flush();
GPR_ASSERT(state == GRPC_CHANNEL_SHUTDOWN); GPR_ASSERT(state == GRPC_CHANNEL_SHUTDOWN);
GPR_ASSERT(g_counter == 1); GPR_ASSERT(g_counter == 1);
} }

@ -241,6 +241,7 @@ int grpc_pick_port_using_server(void) {
grpc_pollset_shutdown(grpc_polling_entity_pollset(&pr.pops), grpc_pollset_shutdown(grpc_polling_entity_pollset(&pr.pops),
shutdown_closure); shutdown_closure);
grpc_core::ExecCtx::Get()->Flush();
grpc_shutdown(); grpc_shutdown();
return pr.port; return pr.port;

@ -214,13 +214,13 @@ class ClientChannelStressTest {
}; };
void SetNextResolution(const std::vector<AddressData>& address_data) { void SetNextResolution(const std::vector<AddressData>& address_data) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_core::ExecCtx exec_ctx;
grpc_lb_addresses* addresses = grpc_lb_addresses* addresses =
grpc_lb_addresses_create(address_data.size(), nullptr); grpc_lb_addresses_create(address_data.size(), nullptr);
for (size_t i = 0; i < address_data.size(); ++i) { for (size_t i = 0; i < address_data.size(); ++i) {
char* lb_uri_str; char* lb_uri_str;
gpr_asprintf(&lb_uri_str, "ipv4:127.0.0.1:%d", address_data[i].port); gpr_asprintf(&lb_uri_str, "ipv4:127.0.0.1:%d", address_data[i].port);
grpc_uri* lb_uri = grpc_uri_parse(&exec_ctx, lb_uri_str, true); grpc_uri* lb_uri = grpc_uri_parse(lb_uri_str, true);
GPR_ASSERT(lb_uri != nullptr); GPR_ASSERT(lb_uri != nullptr);
grpc_lb_addresses_set_address_from_uri( grpc_lb_addresses_set_address_from_uri(
addresses, i, lb_uri, address_data[i].is_balancer, addresses, i, lb_uri, address_data[i].is_balancer,
@ -230,10 +230,9 @@ class ClientChannelStressTest {
} }
grpc_arg fake_addresses = grpc_lb_addresses_create_channel_arg(addresses); grpc_arg fake_addresses = grpc_lb_addresses_create_channel_arg(addresses);
grpc_channel_args fake_result = {1, &fake_addresses}; grpc_channel_args fake_result = {1, &fake_addresses};
grpc_fake_resolver_response_generator_set_response( grpc_fake_resolver_response_generator_set_response(response_generator_,
&exec_ctx, response_generator_, &fake_result); &fake_result);
grpc_lb_addresses_destroy(&exec_ctx, addresses); grpc_lb_addresses_destroy(addresses);
grpc_exec_ctx_finish(&exec_ctx);
} }
void KeepSendingRequests() { void KeepSendingRequests() {

Loading…
Cancel
Save