Skip to content

libnetwork: avoid restarting rootless helper during teardown - #1067

Open
shrevid03 wants to merge 1 commit into
podman-container-tools:mainfrom
shrevid03:fix-rootless-teardown-restart-pr
Open

libnetwork: avoid restarting rootless helper during teardown#1067
shrevid03 wants to merge 1 commit into
podman-container-tools:mainfrom
shrevid03:fix-rootless-teardown-restart-pr

Conversation

@shrevid03

@shrevid03 shrevid03 commented Aug 11, 2026

Copy link
Copy Markdown

Summary

Avoid restarting or recreating the rootless network helper during teardown.

Teardown() currently uses the same getOrCreateNetns() path as Setup() and
Run(). If the rootless network namespace still exists but the helper process
has already exited, that path checks the stale helper PID and can fall through
to starting the helper again.

During an orderly systemd user-manager shutdown, starting a new helper scope can
fail because the shutdown transaction is already queued.

This change adds an explicit create/non-create mode:

  • Setup() and Run() retain the existing create/recovery behavior.
  • Teardown() only uses an existing network namespace and does not recreate or
    restart the rootless helper.

Related to podman-container-tools/podman#29419.

Testing

Added Test_getOrCreateNetnsNoCreateDoesNotRestartHelper.

The test creates an existing network namespace reference with a stale helper PID
and verifies that getOrCreateNetns(false) returns the existing namespace
without attempting to restart the helper.

Verified with:

  • go test ./libnetwork/internal/rootlessnetns -count=1
  • git diff --check

I reproduced the shutdown failure on a Fedora CoreOS 44 aarch64 Podman Machine
VM using Podman 6.0.2, Netavark 2.0.0, and Aardvark DNS 2.0.0 with a rootless
Quadlet container on a custom bridge network.

With this change, the rootless-netns teardown path no longer attempts to
restart the dead rootless network helper.

Scope

While validating the full shutdown path, I also identified a separate
Netavark/Aardvark teardown path that can attempt to restart a dead
aardvark-dns process.

That behavior is outside the scope of this PR; this change is intentionally
limited to the rootless-netns teardown behavior in common/libnetwork.

@github-actions github-actions Bot added the common Related to "common" package label Aug 11, 2026
Signed-off-by: Shreya Vidyadhar Keshatti <shrevidh03@gmail.com>
@shrevid03
shrevid03 force-pushed the fix-rootless-teardown-restart-pr branch from 1a58db1 to 3fd162d Compare August 11, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Related to "common" package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant