Skip to content

client: do not fork a child process unless a tunnel is configured - #1604

Open
bpalermo wants to merge 1 commit into
envoyproxy:mainfrom
bpalermo:up/no-fork-without-tunnel
Open

client: do not fork a child process unless a tunnel is configured#1604
bpalermo wants to merge 1 commit into
envoyproxy:mainfrom
bpalermo:up/no-fork-without-tunnel

Conversation

@bpalermo

@bpalermo bpalermo commented Sep 7, 2026

Copy link
Copy Markdown

Description

This PR is related to #1609

ProcessImpl::run() always goes through EncapsulationSubProcessRunner, which fork()s a child even when no --tunnel-uri is configured. In that case the child does nothing but sem_post() a process-shared semaphore and _exit(), while the parent blocks in sem_wait() until it does. The parent is already multithreaded at that point (at least the SignalHandler thread; in -c opt builds also the allocator's state), so the child can deadlock on a lock owned by a thread that does not exist in it before it ever reaches sem_post(), and the client hangs at startup without sending a request. This runs the load in-process unless a tunnel is actually requested; the fork is still used for the tunneling path, where the child runs the encapsulating Envoy.

Notes for Reviewers

  • The runner's terminate/cancel paths already null-check encap_runner_, so no other change is needed.
  • Testing: //test:process_test and //test:python_test (which includes the tunneling integration tests) pass. Version history updated.

ProcessImpl::run() always went through EncapsulationSubProcessRunner,
forking a child even without --tunnel-uri; in that case the child only
posts a process-shared semaphore and exits while the parent blocks in
sem_wait(). The parent is already multithreaded at that point (the
signal handler thread, allocator state), so the child could deadlock on
a lock owned by a thread that does not exist in it before ever reaching
sem_post(), leaving nighthawk_client hung at startup with no request
sent. Run the load in-process unless a tunnel is actually requested.

Signed-off-by: Bruno Palermo <[email protected]>
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.

1 participant