Skip to content

python grpc server with multiprocessing fails #16001

Closed
@p1c2u

Description

@p1c2u

What version of gRPC and what language are you using?

grpc 1.13.0 with python 3.6.5

What operating system (Linux, Windows, …) and version?

CentOS 7 (Linux 3.10.0-862.3.2.el7.x86_64)

What runtime / compiler are you using (e.g. python version or version of gcc)

CPython 3.6.5

What did you do?

server = grpc.server(futures.ProcessPoolExecutor(max_workers=4))
service_pb2_grpc.add_FindPortServicer_to_server(FindPort(), server)
server.add_insecure_port('[::]:' + port)
server.start()

What did you expect to see?

Based on doc https://github.com/grpc/grpc/blob/master/doc/fork_support.md
gRPC server should run on 4 processes

What did you see instead?

Server crash

8156 tcp_server_posix.cc:210]    Failed accept4: Invalid argument
Traceback (most recent call last):
  File "/usr/lib64/python3.6/multiprocessing/queues.py", line 234, in _feed
    obj = _ForkingPickler.dumps(obj)
  File "/usr/lib64/python3.6/multiprocessing/reduction.py", line 52, in dumps
    cls(buf, protocol).dump(obj)
  File "stringsource", line 2, in grpc._cython.cygrpc.RequestCallEvent.__reduce_cython__
TypeError: no default __reduce__ due to non-trivial __cinit__

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

Anything else we should know about your project / environment?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions