Skip to content

[Bug]: apiserver never finishes startup when com.apple.pfd is unresponsive — every container command hangs forever (macOS 27.0) #2275

Description

@afischer-zedas

Summary

On macOS 27.0, every container command hangs forever — system start, system status, all of them. There is no error, no timeout, and no way to diagnose it
with the CLI itself, because the CLI is the thing that blocks.

The underlying fault is outside container: /usr/libexec/pfd never answers an
XPC request from /usr/libexec/InternetSharing. But container turns an
unresponsive OS daemon into an indefinite hang rather than an error, which is
the part I think is actionable here.

Environment

  • container 1.4.1 (Homebrew, brew install container)
  • macOS 27.0 (26A428), Apple silicon
  • Reproduced across reboots; persists indefinitely once triggered

What happens

$ container system start
Launching container-apiserver...
Testing access to container-apiserver...
<hangs forever>

$ container system status
<hangs forever, no output at all>

Both had to be killed manually. This also hangs any automation that shells out
to container — in my case an unattended update run sat blocked for hours
overnight, which is how I found it.

Where it blocks

container-apiserver starts, registers plugins, and stops during startup while
bringing up the network plugin. Its last log line, and then silence:

container-apiserver [com.apple.container:APIServer] initializing networks service
container-apiserver [com.apple.container:APIServer] Registering plugin [id=com.apple.container.container-network-vmnet.default]
container-apiserver [com.apple.xpc:connection] activating connection: mach=true listener=false peer=false name=com.apple.container.network.container-network-vmnet.default

Because the apiserver never finishes startup, it never activates its own
listener, so every client connecting to com.apple.container.apiserver blocks
forever. That is why system status hangs exactly like system start.

sample of container-network-vmnet, parked in the same place for 3+ hours:

NetworkVmnetHelper.Start.run()
 └─ protocol witness for Network.start() in conformance ReservedVmnetNetwork
     └─ ReservedVmnetNetwork.startNetwork(configuration:log:)
         └─ vmnet_network_create  (in vmnet)
             └─ _NETRBCreateNetwork  (in Netrb)
                 └─ _NETRBClientCreateInternal
                     └─ NETRBXPCSetupAndSend
                         └─ xpc_connection_send_message_with_reply_sync
                             └─ mach_msg2_trap

xpc_connection_send_message_with_reply_sync has no timeout, so this never
returns. The chain below it:

container-network-vmnet
 └─ com.apple.NetworkSharing → /usr/libexec/InternetSharing
     last log: "[com.apple.pf] user xpc send -> delete", then connects to com.apple.pfd, then silence
     └─ /usr/libexec/pfd  ✗ exits 3 immediately: "no pf starter references held"
        launchd re-spawns it every 10s forever (runs counter climbs by 1 per 10s)

Why this is not a misconfigured host

pf's own state is clean, which rules out a stale anchor from a VPN or security
product (this machine has third-party network and endpoint-security system
extensions installed; the output below is what exonerates them):

$ sudo pfctl -s info
Status: Disabled

$ sudo pfctl -s References
No pf starter references held

$ sudo pfctl -s Anchors
  com.apple

So pfd is reporting the true state, not a corrupted one — it just exits on
that condition without replying to the in-flight request. That is an Apple bug
and I am filing it with Apple separately.

Things that do not help, for the record:

  • Uninstalling or fully stopping container. Kill every container process and
    pfd still re-spawns every 10s while InternetSharing stays wedged.
  • Rebooting. With container completely stopped and no container process
    present, com.apple.Virtualization.VirtualMachine (a Virtualization.framework
    VM starting at login — Colima, in my case) connects to
    com.apple.NetworkSharing about a minute after boot, InternetSharing reaches
    the same dead end, and the pfd loop resumes. Any VM asking for a shared/NAT
    network re-arms it.
  • sudo launchctl kickstart -k system/com.apple.NetworkSharing — refused:
    150: Operation not permitted while System Integrity Protection is engaged.

What I'd like container to do

I don't expect container to fix pf. But right now an unresponsive system
daemon is indistinguishable from slow work, for an unbounded time:

  1. Bound the vmnet network bring-up. vmnet_network_create is reached
    through a synchronous XPC send with no reply timeout. A bounded wait that
    fails with something like "timed out creating vmnet network; the
    com.apple.NetworkSharing / pfd services are not responding"
    would turn hours
    of silence into an actionable message.
  2. Bound plugin registration during apiserver startup, so one unhealthy
    plugin cannot prevent the apiserver from ever activating its listener. Even
    starting degraded, with the network plugin reported as failed, would leave
    container system status usable — which matters because right now the
    diagnostic command is broken by the same fault it would diagnose.
  3. Give the CLI a client-side timeout on the apiserver connection, so
    container <anything> cannot hang indefinitely against a half-started
    apiserver.

Happy to supply full sample output or unified-log extracts if useful.

Reproduction

I can't give a clean recipe for wedging pfd on demand — it appeared with the
macOS 27.0 upgrade on this machine. But the container-side behaviour is
reproducible from any state where com.apple.pfd doesn't answer: the apiserver
hangs at network-plugin registration and every CLI call blocks forever. The
diagnostics above (launchctl print system/com.apple.pfd showing a climbing
runs count with last exit code = 3, plus sample of
container-network-vmnet) identify it in a few seconds once you know to look.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions