diff options
author | Ken Payson <kpayson@google.com> | 2016-07-11 10:38:39 -0700 |
---|---|---|
committer | Ken Payson <kpayson@google.com> | 2016-07-11 10:38:39 -0700 |
commit | 136ea365e37b611f6b3f7ab94f221737ad3e1cc6 (patch) | |
tree | 5a62352facb5a6523f6d03e8aa1080bb038e2107 /src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi | |
parent | c1bfe124ab0d151f7619f4fefc08244bd1dd4750 (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.pxi | 9 |
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: |