mirror of https://github.com/grpc/grpc.git
[ruby] simplify shutdown; remove unnecessary attempts at grpc_shutdown (#33674)
So far, we've structured global C-core init/shutdown as follows: 1) every grpc-ruby object calls `grpc_init` when allocated, and `grpc_shutdown` when finalized 2) grpc-ruby background threads are each wrapped in a `grpc_init/shutdown` pair - for example seepull/33683/headb32d94de05/src/ruby/ext/grpc/rb_event_thread.c (L122)
andb32d94de05/src/ruby/ext/grpc/rb_event_thread.c (L136)
But because ruby doesn't join ruby threads when the process is terminating, the `init/shutdown` pairs in 2) are always left open. I.e., thus far we have never been invoking the final call to `grpc_shutdown` which actually does C-core global shutdown. Thus our calls to `grpc_shutdown` are useless. So we might as well keep things simple and not even attempt to call `grpc_shutdown`. Now we just call `grpc_init` before using C-core, and then never even attempt global shutdown (in non-forking situations). As a bonus, this fixes the issue with the event thread's `grpc_ruby_init` racing with `prefork` that is mentioned in https://github.com/grpc/grpc/pull/33666
parent
a1ce253826
commit
b21152269d
11 changed files with 2 additions and 37 deletions
Loading…
Reference in new issue