Skip to content

Disable gRPC fork support in the server - #4365

Merged
r4victor merged 1 commit into
masterfrom
issue_4362_grpc_fork_support
Oct 12, 2026
Merged

r4victor merged 1 commit into
masterfrom
issue_4362_grpc_fork_support

Conversation

@r4victor

Copy link
Copy Markdown
Collaborator

Fixes #4362. On uvloop, every subprocess the server starts (e.g. ssh) is a plain fork(), which runs gRPC's fork handlers in the child. They restart gRPC's threads, and the child can crash before it execs, stalling the server while it waits (for minutes with systemd-coredump). In a standalone repro on EC2 (grpcio 1.84.0, uvloop 0.23.0), about 4 in 10,000 spawns crashed; with GRPC_ENABLE_FORK_SUPPORT=false there were 0 in about 290,000.

  • Add bootstrap.set_up_process(), which server entry points call before other imports. It defaults GRPC_ENABLE_FORK_SUPPORT=false and GRPC_VERBOSITY=ERROR (moved from the CLI), and warns if grpc was already imported, since gRPC reads the setting on import.
  • Warn at startup if set_up_process() wasn't called, so applications that extend the server notice the missing call.

gRPC's fork handlers restart its threads in every forked child, which can crash subprocesses the server starts before they exec and stall the server (#4362).
@r4victor
r4victor merged commit 521bbf8 into master Oct 12, 2026
26 checks passed
@r4victor
r4victor deleted the issue_4362_grpc_fork_support branch October 12, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Server freezes for 5 minutes when a forked ssh crashes in gRPC, killing the server and leaking Nebius instances

1 participant