Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate Protobuf Version Templating #24911

Merged
merged 3 commits into from
Dec 8, 2020
Merged

Conversation

gnossen
Copy link
Contributor

@gnossen gnossen commented Dec 5, 2020

Fixes #24897

Since both the protobuf and grpcio-tools packages include libprotobuf as a shared library, an application loading both of them has symbol conflicts that need to be resolved by the operating system's runtime linker. In most cases, the runtime linker uses the first loaded symbol, ignoring the second. In corner cases, such as in MacOS in #24897, some startup functions were run by the version from grpcio-tools while the version packaged with protobuf was called at runtime. This resulted in corruption from the perspective of the version of libprotobuf packaged by the protobuf wheel because internal data structures had changed between the two versions.

By requiring an exact version, this is no longer an issue. This also brings Python into line with other wrapped languages, including Ruby, C#, and Objective-C. Since updating the Protobuf version has been a tedious manual process in the past, I went ahead and pulled all languages into the templating system so in the future, only one instance of the protobuf version string will have to be changed -- in build_handwritten.yaml.

CC @jtattermusch since some of these changes will have to be reconciled with #24855. Once this is merged, I'll update the "Updating third_party/protobuf submodule in grpc" document accordingly.

CC @yulin-liang since this also touches Obj C files.

Update: @lidizheng made the good point that the protobuf Python package has much narrower platform support than we do, so pinning the version would be too restrictive. I've removed that portion of the PR so that this is now just an automation change for updaing the protobuf version. I'll address #24897 in a series of follow-up PRs.

Copy link
Contributor

@jtattermusch jtattermusch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for the general idea, but some tests seem to be failing.

@jtattermusch
Copy link
Contributor

Btw the protobuf and grpcio-tools conflict only happens in python because of the weird way the protoc binaries are distributed in python (as a python native extension as opposed to just binaries). FWIW it might be useful to simplify the grpcio-tools package by not duplicating the entire protobuf build (for which we extract the build metadata from protobuf's bazel - which has always been a hack).

tools/distrib/python/grpcio_tools/setup.py Outdated Show resolved Hide resolved
templates/grpc.gemspec.template Outdated Show resolved Hide resolved
Copy link
Contributor

@lidizheng lidizheng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if we don't change "install_requires" for now.

@gnossen gnossen changed the title Pin protobuf version dependency for grpcio-tools Automate Protobuf Version Templating Dec 7, 2020
tools/buildgen/plugins/expand_version.py Outdated Show resolved Hide resolved
@gnossen
Copy link
Contributor Author

gnossen commented Dec 8, 2020

Unrelated failure: #24937

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

grpcio-tools==1.34.0 seg faults on macOS Big Sur, depending on import order
4 participants