aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi
diff options
context:
space:
mode:
authorGravatar Ken Payson <kpayson@google.com>2016-07-11 10:38:39 -0700
committerGravatar Ken Payson <kpayson@google.com>2016-07-11 10:38:39 -0700
commit136ea365e37b611f6b3f7ab94f221737ad3e1cc6 (patch)
tree5a62352facb5a6523f6d03e8aa1080bb038e2107 /src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi
parentc1bfe124ab0d151f7619f4fefc08244bd1dd4750 (diff)
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.
Diffstat (limited to 'src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi')
-rw-r--r--src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi
index b24e69243e..035ac49a8b 100644
--- a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi
+++ b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi
@@ -46,8 +46,7 @@ cdef class ChannelCredentials:
def __dealloc__(self):
if self.c_credentials != NULL:
- with nogil:
- grpc_channel_credentials_release(self.c_credentials)
+ grpc_channel_credentials_release(self.c_credentials)
cdef class CallCredentials:
@@ -64,8 +63,7 @@ cdef class CallCredentials:
def __dealloc__(self):
if self.c_credentials != NULL:
- with nogil:
- grpc_call_credentials_release(self.c_credentials)
+ grpc_call_credentials_release(self.c_credentials)
cdef class ServerCredentials:
@@ -76,8 +74,7 @@ cdef class ServerCredentials:
def __dealloc__(self):
if self.c_credentials != NULL:
- with nogil:
- grpc_server_credentials_release(self.c_credentials)
+ grpc_server_credentials_release(self.c_credentials)
cdef class CredentialsMetadataPlugin: