commit | 3de283c665387a569b139d589c2409d51ceafee8 | [log] [tgz] |
---|---|---|
author | Jared Hance <jhance@dropbox.com> | Wed Mar 20 10:23:22 2019 -0700 |
committer | Jared Hance <jhance@dropbox.com> | Wed Mar 20 12:01:11 2019 -0700 |
tree | 53519f8870c377470749b5518569025938a159f1 | |
parent | ba7da20f1d51a49b8d8063bdb163a8c33bf924e5 [diff] |
Make gil handling in completion queue more robust It turns out that the code generation for "with gil" is a bit more complicated than the logic for re-obtaining the gil at the end of "with nogil." This is because PyGILState_Ensure seems to, during interpreter finalization, think it needs to call a new thread (resulting in a call to cpython new_threadstate) which then segfaults. Because "with nogil" knows that, prior to executing, it already had the gil, it doesn't need to set up as much state, and thus the segfault does not occur. To avoid this, we just only use "with nogil" within the infinite loop, and then end the "nogil" block before we check signals. This avoids needing any "with gil" call at all. I was able to reliably reproduce the segfault within a few minutes before the patch by running a binary in a loop (with py3) while maxing out my machines cpu usage. After the patch, I have not been able to reproduce the segfault after two hours. Note that this race can only occur when the user does not properly clean up all their channels, and is relying on garbage collection to do so (which isn't guaranteed). However, we want to avoid a segfault on failure to close because this isn't a good user error and makes it hard to debug.
gRPC is a modern, open source, high-performance remote procedure call (RPC) framework that can run anywhere. gRPC enables client and server applications to communicate transparently, and simplifies the building of connected systems.
To maximize usability, gRPC supports the standard method for adding dependencies to a user‘s chosen language (if there is one). In most languages, the gRPC runtime comes as a package available in a user’s language package manager.
For instructions on how to use the language-specific gRPC runtime for a project, please refer to these documents
src/cpp
directoryGrpc
grpc
go get google.golang.org/grpc
npm install grpc
gRPC-ProtoRPC
dependency to podspecpecl install grpc
pip install grpcio
gem install grpc
Per-language quickstart guides and tutorials can be found in the documentation section on the grpc.io website. Code examples are available in the examples directory.
Precompiled bleeding-edge package builds of gRPC master
branch's HEAD
are uploaded daily to packages.grpc.io.
Contributions are welcome!
Please read How to contribute which will guide you through the entire workflow of how to build the source code, how to run the tests, and how to contribute changes to the gRPC codebase. The “How to contribute” document also contains info on how the contribution process works and contains best practices for creating contributions.
Sometimes things go wrong. Please check out the Troubleshooting guide if you are experiencing issues with gRPC.
See the Performance dashboard for performance numbers of the latest released version.
See gRPC Concepts
This repository contains source code for gRPC libraries implemented in multiple languages written on top of a shared C core library src/core.
Libraries in different languages may be in various states of development. We are seeking contributions for all of these libraries:
Language | Source |
---|---|
Shared C [core library] | src/core |
C++ | src/cpp |
Ruby | src/ruby |
Python | src/python |
PHP | src/php |
C# | src/csharp |
Objective-C | src/objective-c |
Language | Source repo |
---|---|
Java | grpc-java |
Go | grpc-go |
NodeJS | grpc-node |
WebJS | grpc-web |
Dart | grpc-dart |