From 136ea365e37b611f6b3f7ab94f221737ad3e1cc6 Mon Sep 17 00:00:00 2001 From: Ken Payson Date: Mon, 11 Jul 2016 10:38:39 -0700 Subject: Hold onto the GIL in __dealloc__ functions When a child thread triggers __dealloc__ as part of a thread being joined, the thread is already considered to be "joined", and so releasing the GIL can allow the main thread to proceed to exit, which introduces shutdown race conditions/memory leaks. --- src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi') diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi index 3e03b6efe1..4f2d51b03f 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/server.pyx.pxi @@ -171,5 +171,4 @@ cdef class Server: # much but repeatedly release the GIL and wait while not self.is_shutdown: time.sleep(0) - with nogil: - grpc_server_destroy(self.c_server) + grpc_server_destroy(self.c_server) -- cgit v1.2.3