From ffe1a99bb1653d63f6f6e140a90b87f02588de8e Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 9 Mar 2017 10:04:11 -0800 Subject: [PATCH 1/2] Switch Node back to using libuv iomgr by default --- binding.gyp | 8 +++----- templates/binding.gyp.template | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/binding.gyp b/binding.gyp index c521a27c300..178d9e952d1 100644 --- a/binding.gyp +++ b/binding.gyp @@ -39,11 +39,9 @@ { 'variables': { 'runtime%': 'node', - # UV integration in C core is disabled by default while bugs are ironed - # out. It can be re-enabled for one build by setting the npm config - # variable grpc_uv to true, and it can be re-enabled permanently by - # setting it to true here. - 'grpc_uv%': 'false', + # UV integration in C core is enabled by default. It can be disabled + # by setting this argument to anything else. + 'grpc_uv%': 'true', # Some Node installations use the system installation of OpenSSL, and on # some systems, the system OpenSSL still does not have ALPN support. This # will let users recompile gRPC to work without ALPN. diff --git a/templates/binding.gyp.template b/templates/binding.gyp.template index 5e401e89773..5f30d645fa9 100644 --- a/templates/binding.gyp.template +++ b/templates/binding.gyp.template @@ -41,11 +41,9 @@ { 'variables': { 'runtime%': 'node', - # UV integration in C core is disabled by default while bugs are ironed - # out. It can be re-enabled for one build by setting the npm config - # variable grpc_uv to true, and it can be re-enabled permanently by - # setting it to true here. - 'grpc_uv%': 'false', + # UV integration in C core is enabled by default. It can be disabled + # by setting this argument to anything else. + 'grpc_uv%': 'true', # Some Node installations use the system installation of OpenSSL, and on # some systems, the system OpenSSL still does not have ALPN support. This # will let users recompile gRPC to work without ALPN. From 6bd07c656b8d0170eb499e9ee61cf9ca827d59c9 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 10 Mar 2017 10:48:57 -0800 Subject: [PATCH 2/2] Stop gRPC timers from keeping the UV loop open --- src/core/lib/iomgr/timer_uv.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/lib/iomgr/timer_uv.c b/src/core/lib/iomgr/timer_uv.c index f28a14405db..8e8a07578c6 100644 --- a/src/core/lib/iomgr/timer_uv.c +++ b/src/core/lib/iomgr/timer_uv.c @@ -78,6 +78,10 @@ void grpc_timer_init(grpc_exec_ctx *exec_ctx, grpc_timer *timer, uv_timer->data = timer; timer->uv_timer = uv_timer; uv_timer_start(uv_timer, run_expired_timer, timeout, 0); + /* We assume that gRPC timers are only used alongside other active gRPC + objects, and that there will therefore always be something else keeping + the uv loop alive whenever there is a timer */ + uv_unref((uv_handle_t *)uv_timer); } void grpc_timer_cancel(grpc_exec_ctx *exec_ctx, grpc_timer *timer) {