Merge pull request #10183 from muxi/backport-10042

Backport 10042: Use the right encoding overhead number in remote interop test with Cronet
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 89a983c..28bff0d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,7 +42,7 @@
 cmake_minimum_required(VERSION 2.8)
 
 set(PACKAGE_NAME      "grpc")
-set(PACKAGE_VERSION   "1.2.0-pre1")
+set(PACKAGE_VERSION   "1.2.0-pre2")
 set(PACKAGE_STRING    "${PACKAGE_NAME} ${PACKAGE_VERSION}")
 set(PACKAGE_TARNAME   "${PACKAGE_NAME}-${PACKAGE_VERSION}")
 set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/")
diff --git a/Makefile b/Makefile
index c35fe90..331523e 100644
--- a/Makefile
+++ b/Makefile
@@ -412,8 +412,8 @@
 endif
 
 CORE_VERSION = 3.0.0-dev
-CPP_VERSION = 1.2.0-pre1
-CSHARP_VERSION = 1.2.0-pre1
+CPP_VERSION = 1.2.0-pre2
+CSHARP_VERSION = 1.2.0-pre2
 
 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES))
 CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS)
diff --git a/build.yaml b/build.yaml
index c71e98c..ce88586 100644
--- a/build.yaml
+++ b/build.yaml
@@ -14,7 +14,7 @@
   '#10': See the expand_version.py for all the quirks here
   core_version: 3.0.0-dev
   g_stands_for: green
-  version: 1.2.0-pre1
+  version: 1.2.0-pre2
 filegroups:
 - name: census
   public_headers:
diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec
index 8b67a5d..6e65f68 100644
--- a/gRPC-Core.podspec
+++ b/gRPC-Core.podspec
@@ -37,7 +37,7 @@
 
 Pod::Spec.new do |s|
   s.name     = 'gRPC-Core'
-  version = '1.2.0-pre1'
+  version = '1.2.0-pre2'
   s.version  = version
   s.summary  = 'Core cross-platform gRPC library, written in C'
   s.homepage = 'http://www.grpc.io'
diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec
index 8fbdf7a..2b6908b 100644
--- a/gRPC-ProtoRPC.podspec
+++ b/gRPC-ProtoRPC.podspec
@@ -36,7 +36,7 @@
 
 Pod::Spec.new do |s|
   s.name     = 'gRPC-ProtoRPC'
-  version = '1.2.0-pre1'
+  version = '1.2.0-pre2'
   s.version  = version
   s.summary  = 'RPC library for Protocol Buffers, based on gRPC'
   s.homepage = 'http://www.grpc.io'
diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec
index e302e64..7293a18 100644
--- a/gRPC-RxLibrary.podspec
+++ b/gRPC-RxLibrary.podspec
@@ -36,7 +36,7 @@
 
 Pod::Spec.new do |s|
   s.name     = 'gRPC-RxLibrary'
-  version = '1.2.0-pre1'
+  version = '1.2.0-pre2'
   s.version  = version
   s.summary  = 'Reactive Extensions library for iOS/OSX.'
   s.homepage = 'http://www.grpc.io'
diff --git a/gRPC.podspec b/gRPC.podspec
index 64a6f0a..149847e 100644
--- a/gRPC.podspec
+++ b/gRPC.podspec
@@ -35,7 +35,7 @@
 
 Pod::Spec.new do |s|
   s.name     = 'gRPC'
-  version = '1.2.0-pre1'
+  version = '1.2.0-pre2'
   s.version  = version
   s.summary  = 'gRPC client library for iOS/OSX'
   s.homepage = 'http://www.grpc.io'
diff --git a/package.json b/package.json
index 588425d..36f7d35 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "grpc",
-  "version": "1.2.0-pre1",
+  "version": "1.2.0-pre2",
   "author": "Google Inc.",
   "description": "gRPC Library for Node",
   "homepage": "http://www.grpc.io/",
diff --git a/package.xml b/package.xml
index 9430502..7b3e6b1 100644
--- a/package.xml
+++ b/package.xml
@@ -13,8 +13,8 @@
  <date>2017-03-01</date>
  <time>16:06:07</time>
  <version>
-  <release>1.2.0RC1</release>
-  <api>1.2.0RC1</api>
+  <release>1.2.0RC2</release>
+  <api>1.2.0RC2</api>
  </version>
  <stability>
   <release>beta</release>
diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc
index 30395fb..9b30223 100644
--- a/src/cpp/common/version_cc.cc
+++ b/src/cpp/common/version_cc.cc
@@ -37,5 +37,5 @@
 #include <grpc++/grpc++.h>
 
 namespace grpc {
-grpc::string Version() { return "1.2.0-pre1"; }
+grpc::string Version() { return "1.2.0-pre2"; }
 }
diff --git a/src/csharp/Grpc.Auth/project.json b/src/csharp/Grpc.Auth/project.json
index d4fbdc1..fc0a8ba 100644
--- a/src/csharp/Grpc.Auth/project.json
+++ b/src/csharp/Grpc.Auth/project.json
@@ -1,5 +1,5 @@
 {
-  "version": "1.2.0-pre1",
+  "version": "1.2.0-pre2",
   "title": "gRPC C# Auth",
   "authors": [ "Google Inc." ],
   "copyright": "Copyright 2015, Google Inc.",
@@ -21,7 +21,7 @@
     }
   },
   "dependencies": {
-    "Grpc.Core": "1.2.0-pre1",
+    "Grpc.Core": "1.2.0-pre2",
     "Google.Apis.Auth": "1.21.0"
   },
   "frameworks": {
diff --git a/src/csharp/Grpc.Core.Testing/project.json b/src/csharp/Grpc.Core.Testing/project.json
index 9d1180d..0070b74 100644
--- a/src/csharp/Grpc.Core.Testing/project.json
+++ b/src/csharp/Grpc.Core.Testing/project.json
@@ -1,5 +1,5 @@
 {
-  "version": "1.2.0-pre1",
+  "version": "1.2.0-pre2",
   "title": "gRPC C# Core Testing",
   "authors": [ "Google Inc." ],
   "copyright": "Copyright 2017, Google Inc.",
@@ -21,7 +21,7 @@
     }
   },
   "dependencies": {
-    "Grpc.Core": "1.2.0-pre1"
+    "Grpc.Core": "1.2.0-pre2"
   },
   "frameworks": {
     "net45": {
diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs
index b6e3bc5..8773183 100644
--- a/src/csharp/Grpc.Core/VersionInfo.cs
+++ b/src/csharp/Grpc.Core/VersionInfo.cs
@@ -53,6 +53,6 @@
         /// <summary>
         /// Current version of gRPC C#
         /// </summary>
-        public const string CurrentVersion = "1.2.0-pre1";
+        public const string CurrentVersion = "1.2.0-pre2";
     }
 }
diff --git a/src/csharp/Grpc.Core/project.json b/src/csharp/Grpc.Core/project.json
index 5131101..0f9f1e8 100644
--- a/src/csharp/Grpc.Core/project.json
+++ b/src/csharp/Grpc.Core/project.json
@@ -1,5 +1,5 @@
 {
-  "version": "1.2.0-pre1",
+  "version": "1.2.0-pre2",
   "title": "gRPC C# Core",
   "authors": [ "Google Inc." ],
   "copyright": "Copyright 2015, Google Inc.",
diff --git a/src/csharp/Grpc.HealthCheck/project.json b/src/csharp/Grpc.HealthCheck/project.json
index 330002f..ae3094b 100644
--- a/src/csharp/Grpc.HealthCheck/project.json
+++ b/src/csharp/Grpc.HealthCheck/project.json
@@ -1,5 +1,5 @@
 {
-  "version": "1.2.0-pre1",
+  "version": "1.2.0-pre2",
   "title": "gRPC C# Healthchecking",
   "authors": [ "Google Inc." ],
   "copyright": "Copyright 2015, Google Inc.",
@@ -21,7 +21,7 @@
     }
   },
   "dependencies": {
-    "Grpc.Core": "1.2.0-pre1",
+    "Grpc.Core": "1.2.0-pre2",
     "Google.Protobuf": "3.2.0"
   },
   "frameworks": {
diff --git a/src/csharp/Grpc.Reflection/project.json b/src/csharp/Grpc.Reflection/project.json
index 1a77a85..8daa9e4 100644
--- a/src/csharp/Grpc.Reflection/project.json
+++ b/src/csharp/Grpc.Reflection/project.json
@@ -1,5 +1,5 @@
 {
-  "version": "1.2.0-pre1",
+  "version": "1.2.0-pre2",
   "title": "gRPC C# Reflection",
   "authors": [ "Google Inc." ],
   "copyright": "Copyright 2016, Google Inc.",
@@ -21,7 +21,7 @@
     }
   },
   "dependencies": {
-    "Grpc.Core": "1.2.0-pre1",
+    "Grpc.Core": "1.2.0-pre2",
     "Google.Protobuf": "3.2.0"
   },
   "frameworks": {
diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat
index fee896d..9e10748 100755
--- a/src/csharp/build_packages_dotnetcli.bat
+++ b/src/csharp/build_packages_dotnetcli.bat
@@ -28,7 +28,7 @@
 @rem OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 @rem Current package versions
-set VERSION=1.2.0-pre1
+set VERSION=1.2.0-pre2
 set PROTOBUF_VERSION=3.0.0
 
 @rem Adjust the location of nuget.exe
diff --git a/src/csharp/build_packages_dotnetcli.sh b/src/csharp/build_packages_dotnetcli.sh
index bc7350f..a283dc7 100755
--- a/src/csharp/build_packages_dotnetcli.sh
+++ b/src/csharp/build_packages_dotnetcli.sh
@@ -66,7 +66,7 @@
 dotnet pack --configuration Release Grpc.HealthCheck/project.json --output ../../artifacts
 dotnet pack --configuration Release Grpc.Reflection/project.json --output ../../artifacts
 
-nuget pack Grpc.nuspec -Version "1.2.0-pre1" -OutputDirectory ../../artifacts
-nuget pack Grpc.Tools.nuspec -Version "1.2.0-pre1" -OutputDirectory ../../artifacts
+nuget pack Grpc.nuspec -Version "1.2.0-pre2" -OutputDirectory ../../artifacts
+nuget pack Grpc.Tools.nuspec -Version "1.2.0-pre2" -OutputDirectory ../../artifacts
 
 (cd ../../artifacts && zip csharp_nugets_dotnetcli.zip *.nupkg)
diff --git a/src/node/health_check/package.json b/src/node/health_check/package.json
index 302f260..d03d5a4 100644
--- a/src/node/health_check/package.json
+++ b/src/node/health_check/package.json
@@ -1,6 +1,6 @@
 {
   "name": "grpc-health-check",
-  "version": "1.2.0-pre1",
+  "version": "1.2.0-pre2",
   "author": "Google Inc.",
   "description": "Health check service for use with gRPC",
   "repository": {
@@ -15,7 +15,7 @@
     }
   ],
   "dependencies": {
-    "grpc": "^1.2.0-pre1",
+    "grpc": "^1.2.0-pre2",
     "lodash": "^3.9.3",
     "google-protobuf": "^3.0.0"
   },
diff --git a/src/node/tools/package.json b/src/node/tools/package.json
index 78071ad..e3b53bc 100644
--- a/src/node/tools/package.json
+++ b/src/node/tools/package.json
@@ -1,6 +1,6 @@
 {
   "name": "grpc-tools",
-  "version": "1.2.0-pre1",
+  "version": "1.2.0-pre2",
   "author": "Google Inc.",
   "description": "Tools for developing with gRPC on Node.js",
   "homepage": "http://www.grpc.io/",
diff --git "a/src/objective-c/\041ProtoCompiler-gRPCPlugin.podspec" "b/src/objective-c/\041ProtoCompiler-gRPCPlugin.podspec"
index ccad095..2a2f4de 100644
--- "a/src/objective-c/\041ProtoCompiler-gRPCPlugin.podspec"
+++ "b/src/objective-c/\041ProtoCompiler-gRPCPlugin.podspec"
@@ -42,7 +42,7 @@
   # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed
   # before them.
   s.name     = '!ProtoCompiler-gRPCPlugin'
-  v = '1.2.0-pre1'
+  v = '1.2.0-pre2'
   s.version  = v
   s.summary  = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.'
   s.description = <<-DESC
diff --git a/src/objective-c/GRPCClient/private/version.h b/src/objective-c/GRPCClient/private/version.h
index 2d9ecc6..289a55d 100644
--- a/src/objective-c/GRPCClient/private/version.h
+++ b/src/objective-c/GRPCClient/private/version.h
@@ -38,4 +38,4 @@
 // `tools/buildgen/generate_projects.sh`.
 
 
-#define GRPC_OBJC_VERSION_STRING @"1.2.0-pre1"
+#define GRPC_OBJC_VERSION_STRING @"1.2.0-pre2"
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/security.pxd.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/security.pxd.pxi
index 3a952ca..9915b0e 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 20fc1c5..357b033 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 @@
 
 
 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] = <char *>gpr_malloc(len(temporary_pem_root_certs) + 1)
-  memcpy(
-      pem_root_certs[0], <char *>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] = <char *>gpr_malloc(len(temporary_pem_root_certs) + 1)
+    memcpy(
+        pem_root_certs[0], <char *>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
diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py
index 12c80fd..ff72fde 100644
--- a/src/python/grpcio/grpc_version.py
+++ b/src/python/grpcio/grpc_version.py
@@ -29,4 +29,4 @@
 
 # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!!
 
-VERSION='1.2.0rc1'
+VERSION='1.2.0rc2'
diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py
index 6d7907d..6e09845 100644
--- a/src/python/grpcio_health_checking/grpc_version.py
+++ b/src/python/grpcio_health_checking/grpc_version.py
@@ -29,4 +29,4 @@
 
 # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!!
 
-VERSION='1.2.0rc1'
+VERSION='1.2.0rc2'
diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py
index 0372478..3fe4779 100644
--- a/src/python/grpcio_reflection/grpc_version.py
+++ b/src/python/grpcio_reflection/grpc_version.py
@@ -29,4 +29,4 @@
 
 # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!!
 
-VERSION='1.2.0rc1'
+VERSION='1.2.0rc2'
diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py
index 5be5ecf..ca78d14 100644
--- a/src/python/grpcio_tests/grpc_version.py
+++ b/src/python/grpcio_tests/grpc_version.py
@@ -29,4 +29,4 @@
 
 # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!!
 
-VERSION='1.2.0rc1'
+VERSION='1.2.0rc2'
diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb
index c5169e6..2cc0a95 100644
--- a/src/ruby/lib/grpc/version.rb
+++ b/src/ruby/lib/grpc/version.rb
@@ -29,5 +29,5 @@
 
 # GRPC contains the General RPC module.
 module GRPC
-  VERSION = '1.2.0.pre1'
+  VERSION = '1.2.0.pre2'
 end
diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb
index 2970518..22a2a72 100644
--- a/src/ruby/tools/version.rb
+++ b/src/ruby/tools/version.rb
@@ -29,6 +29,6 @@
 
 module GRPC
   module Tools
-    VERSION = '1.2.0.pre1'
+    VERSION = '1.2.0.pre2'
   end
 end
diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py
index 72c9298..b784a80 100644
--- a/tools/distrib/python/grpcio_tools/grpc_version.py
+++ b/tools/distrib/python/grpcio_tools/grpc_version.py
@@ -29,4 +29,4 @@
 
 # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!!
 
-VERSION='1.2.0rc1'
+VERSION='1.2.0rc2'
diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++
index 1588755..7af9246 100644
--- a/tools/doxygen/Doxyfile.c++
+++ b/tools/doxygen/Doxyfile.c++
@@ -40,7 +40,7 @@
 # could be handy for archiving the generated documentation or if some version
 # control system is used.
 
-PROJECT_NUMBER         = 1.2.0-pre1
+PROJECT_NUMBER         = 1.2.0-pre2
 
 # Using the PROJECT_BRIEF tag one can provide an optional one line description
 # for a project that appears at the top of each page and should give viewer a
diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal
index 62d8010..5ca6512 100644
--- a/tools/doxygen/Doxyfile.c++.internal
+++ b/tools/doxygen/Doxyfile.c++.internal
@@ -40,7 +40,7 @@
 # could be handy for archiving the generated documentation or if some version
 # control system is used.
 
-PROJECT_NUMBER         = 1.2.0-pre1
+PROJECT_NUMBER         = 1.2.0-pre2
 
 # Using the PROJECT_BRIEF tag one can provide an optional one line description
 # for a project that appears at the top of each page and should give viewer a