mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[GH-ISSUE #312] bug(network): Debian ifupdown hotplug triggers ifquery process storm during large-scale sandbox churn, inflating pause/resume latency #83
Labels
No labels
bug
documentation
enhancement
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/AgentENV#83
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @helloC-A on GitHub (Sep 22, 2026).
Original GitHub issue: https://github.com/kvcache-ai/AgentENV/issues/312
Affected component
Network
AgentENV version
2f48c9c(kvcache-ai/AgentENV main)Host environment
uname -a): Linux 6.6.95+ #5 SMP Tue Aug 4 14:23:38 CST 2026 aarch64 GNU/LinuxOperation and configuration
Steps to reproduce
ifupdownpackage installed, confirm the hotplug rule is active:cat /lib/udev/rules.d/85-ifupdown.rules(SUBSYSTEM=="net", ACTION=="add|remove" -> RUN ifupdown-hotplug)
or run a load test with repeated pause/resume cycles across many sandboxes).
watch -n 1 'ps -eo comm | grep -c "^ifquery$"'Expected behavior
Creating or deleting an AENV NIC on the host should not spawn per-event helper
processes from unrelated subsystems: AENV NICs are not listed in
/etc/network/interfaces, so ifupdown has nothing to do for them.
Under large-scale sandbox churn, host CPU should remain available for sandbox
lifecycle operations, and pause/resume latency should stay at its intrinsic
level (tens of milliseconds).
Actual behavior
Every NIC add/remove udev event invokes /lib/udev/ifupdown-hotplug, which forks
ifquery once per event to reach the conclusion "not managed" — a check whose
outcome is always "no", yet costs a full process spawn (~3 forks per event:
udevd worker + hotplug shell + ifquery).
During churn, concurrent ifquery counts grow monotonically (arrival rate >
service rate) instead of staying flat:
The storm saturates host CPUs and inflates sandbox lifecycle operations that
are short and host-CPU-mediated. Load test results, same workload before and
after suppressing the storm (n = 22434 pause/resume cycles):
No error is logged; the symptom is process-count growth and latency inflation.
Logs and diagnostics
Reproduction frequency
Always
Regression information
N/A — not a regression. The storm is inherent to how AENV NIC events interact
with Debian's ifupdown hotplug integration and is observable on stock main.
No known-good release exists where Debian hosts were unaffected.
Additional context
Root cause
Debian's ifupdown package ships a udev rule that runs /lib/udev/ifupdown-hotplug
for every net device add/remove. Its net_ifup() runs
ifquery --allow hotplug -l "$INTERFACE"to decide whether the interface ishotplug-managed — the check happens before the judgment. AENV NICs are never in
/etc/network/interfaces, so the answer is always "no", but ifquery is fully
spawned each time. At sandbox scale this becomes a process storm: pause/resume
are short host-CPU-mediated operations (API socket round trips, process_vm_readv
snapshot copies, fork/exec on resume), and per-step scheduling queueing under
hundreds of runnable processes adds hundreds of ms per cycle.
Other distributions are unaffected: NetworkManager / systemd-networkd handle net
events in-process without forking external check processes. This is why the issue
is Debian-specific.
Proposed fix (design check before PR, per contributing guidelines)
veth-->aenv-so AENV NICs are uniquelyidentifiable (no false match with Docker/K8s NICs).
aenv-*to the existing early-exit whitelists in ifupdown-hotplug (bothadd and remove paths). This whitelist already exists for NICs managed by other
software (ppp*, lo, ipsec*), so this is its intended use — ifupdown's effective
behavior for these NICs is unchanged (it did nothing before, it does nothing
now; only the wasteful fork is skipped).
upgrades cannot overwrite it; keep a backup beside the script. Everything is
applied by --setup-host, idempotent, no manual steps.
depends on ifupdown for these interfaces.
Alternatives evaluated and rejected:
OPTIONS+="ignore_device"(removed in udev148, silently ignored), GOTO-skip udev rules (system rule override / upgrade
conflicts), disabling ifupdown hotplug globally (breaks other services),
whitelisting
veth-*(collides with Docker/K8s).With the fix applied, ifquery counts stay in single digits during the same churn,
and pause+resume per cycle improves from 3088.7 ms to 1602.4 ms (-48%, n=22434).
Pre-submission checklist