From 40f265651491e371ebb77d6ef9007b16dbf369ff Mon Sep 17 00:00:00 2001 From: Jason Wu Date: Mon, 25 Nov 2024 16:21:06 -0800 Subject: [PATCH] disable thread check for postpfork --- src/ruby/ext/grpc/rb_grpc.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/ruby/ext/grpc/rb_grpc.c b/src/ruby/ext/grpc/rb_grpc.c index b26ddf357c065..903c9bf22332e 100644 --- a/src/ruby/ext/grpc/rb_grpc.c +++ b/src/ruby/ext/grpc/rb_grpc.c @@ -378,12 +378,12 @@ static VALUE grpc_rb_prefork(VALUE self) { "GRPC.prefork already called without a matching " "GRPC.postfork_{parent,child}"); } - if (!grpc_ruby_initial_thread()) { - rb_raise(rb_eRuntimeError, - "GRPC.prefork and fork need to be called from the same thread " - "that GRPC was initialized on (GRPC lazy-initializes when when " - "the first GRPC object is created"); - } + // if (!grpc_ruby_initial_thread()) { + // rb_raise(rb_eRuntimeError, + // "GRPC.prefork and fork need to be called from the same thread " + // "that GRPC was initialized on (GRPC lazy-initializes when when " + // "the first GRPC object is created"); + // } if (g_grpc_rb_num_fork_unsafe_threads > 0) { rb_raise( rb_eRuntimeError, @@ -434,11 +434,11 @@ static VALUE grpc_rb_postfork_parent(VALUE self) { "GRPC.postfork_parent must be called only from the parent process " "after a fork"); } - if (!grpc_ruby_initial_thread()) { - rb_raise(rb_eRuntimeError, - "GRPC.postfork_parent needs to be called from the same thread " - "that GRPC.prefork (and fork) was called from"); - } + // if (!grpc_ruby_initial_thread()) { + // rb_raise(rb_eRuntimeError, + // "GRPC.postfork_parent needs to be called from the same thread " + // "that GRPC.prefork (and fork) was called from"); + // } grpc_ruby_init_threads(); g_grpc_rb_prefork_pending = false; return Qnil;