Comments (4)
strace isn’t much more helpful:
$ sudo strace -fyy -p13835 -p13829
strace: Process 13835 attached
strace: Process 13829 attached
[pid 13829] wait4(13835, <unfinished ...>
[pid 13835] futex(0xffff9eaaaca8, FUTEX_WAIT_PRIVATE, 2, NULL^Cstrace: Process 13835 detached
<detached ...>
strace: Process 13829 detached
from grpc-perl.
Looks like the call to Grpc::XS::init()
hangs.
from grpc-perl.
See https://rt.cpan.org/Public/Bug/Display.html?id=129720.
from grpc-perl.
The hang is due to a race between grpc_shutdown()
(via Grpc::XS::destroy()
) and fork()
. Prior to gRPC version 1.20 (https://github.com/grpc/grpc/releases/tag/v1.20.0), grpc_shutdown()
was synchronous, i.e. it blocked until shutdown was complete. From 1.20 onwards, the shutdown happens on a freshly spawned thread, while grpc_shutdown()
returns (see https://github.com/yang-g/grpc/blob/cedc76bf3833db276732e6ef0a0c5074d655f9ac/src/core/lib/surface/init.cc#L208). Thus, shutdown might still be in progress when fork occurs. If fork occurs without or before shutdown is complete, the library will be in a bad internal state in the child process. This can lead to a deadlock when the child calls Grpc::XS::destroy()
(which usually happens automatically at exit).
A fix is to use grpc_shutdown_blocking()
when available, which preserves the old behavior. I'll submit a PR that fixes this shortly.
Also, on the subject of fork-safety (mentioned in the README), as long as Grpc::XS::destroy()
is called and all client objects deleted/freed before fork()
, usage of the library is safe in both parent and child, both before and after fork. Naturally, both processes must (re)initialize the library after the fork. I have stress tested this extensively, but unfortunately not in code I'm able to share.
from grpc-perl.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grpc-perl.