From 8b371e23c0091b838807b0bc0e9a3026c6f02fc9 Mon Sep 17 00:00:00 2001 From: Ken Payson Date: Wed, 15 Mar 2017 16:15:13 -0700 Subject: [PATCH 1/2] Change GIL aquire functions to make it c-core thread safe --- .../grpc/_cython/_cygrpc/security.pxd.pxi | 2 +- .../grpc/_cython/_cygrpc/security.pyx.pxi | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/security.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/security.pxd.pxi index 3a952ca309a..9915b0ed1ab 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/security.pxd.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/security.pxd.pxi @@ -29,4 +29,4 @@ cdef grpc_ssl_roots_override_result ssl_roots_override_callback( - char **pem_root_certs) with gil + char **pem_root_certs) nogil diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi index 20fc1c5fce7..357b0330d5c 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/security.pyx.pxi @@ -33,12 +33,14 @@ import pkg_resources cdef grpc_ssl_roots_override_result ssl_roots_override_callback( - char **pem_root_certs) with gil: - temporary_pem_root_certs = pkg_resources.resource_string( - __name__.rstrip('.cygrpc'), '_credentials/roots.pem') - pem_root_certs[0] = gpr_malloc(len(temporary_pem_root_certs) + 1) - memcpy( - pem_root_certs[0], temporary_pem_root_certs, - len(temporary_pem_root_certs)) - pem_root_certs[0][len(temporary_pem_root_certs)] = '\0' + char **pem_root_certs) nogil: + with gil: + temporary_pem_root_certs = pkg_resources.resource_string( + __name__.rstrip('.cygrpc'), '_credentials/roots.pem') + pem_root_certs[0] = gpr_malloc(len(temporary_pem_root_certs) + 1) + memcpy( + pem_root_certs[0], temporary_pem_root_certs, + len(temporary_pem_root_certs)) + pem_root_certs[0][len(temporary_pem_root_certs)] = '\0' + return GRPC_SSL_ROOTS_OVERRIDE_OK From 42053039ff6515cdbb6192134266411e35a73823 Mon Sep 17 00:00:00 2001 From: Ken Payson Date: Wed, 15 Mar 2017 17:08:32 -0700 Subject: [PATCH 2/2] Changes --- tools/dockerfile/grpc_artifact_python_manylinux_x64/Dockerfile | 2 +- tools/dockerfile/grpc_artifact_python_manylinux_x86/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/dockerfile/grpc_artifact_python_manylinux_x64/Dockerfile b/tools/dockerfile/grpc_artifact_python_manylinux_x64/Dockerfile index 71098629112..06be7bec184 100644 --- a/tools/dockerfile/grpc_artifact_python_manylinux_x64/Dockerfile +++ b/tools/dockerfile/grpc_artifact_python_manylinux_x64/Dockerfile @@ -39,7 +39,7 @@ RUN yum update -y RUN yum remove -y git RUN yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc RUN cd /usr/src && \ - wget https://kernel.org/pub/software/scm/git/git-2.0.5.tar.gz && \ + curl -O -L https://kernel.org/pub/software/scm/git/git-2.0.5.tar.gz && \ tar xzf git-2.0.5.tar.gz RUN cd /usr/src/git-2.0.5 && \ make prefix=/usr/local/git all && \ diff --git a/tools/dockerfile/grpc_artifact_python_manylinux_x86/Dockerfile b/tools/dockerfile/grpc_artifact_python_manylinux_x86/Dockerfile index 36286bca53d..8693e30cb4a 100644 --- a/tools/dockerfile/grpc_artifact_python_manylinux_x86/Dockerfile +++ b/tools/dockerfile/grpc_artifact_python_manylinux_x86/Dockerfile @@ -39,7 +39,7 @@ RUN yum update -y RUN yum remove -y git RUN yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc RUN cd /usr/src && \ - wget https://kernel.org/pub/software/scm/git/git-2.0.5.tar.gz && \ + curl -O -L https://kernel.org/pub/software/scm/git/git-2.0.5.tar.gz && \ tar xzf git-2.0.5.tar.gz RUN cd /usr/src/git-2.0.5 && \ make prefix=/usr/local/git all && \