From 0dfbedcd38f6911bf7bb248e9e58a3a061f58015 Mon Sep 17 00:00:00 2001 From: Adam Shiervani Date: Wed, 2 Dec 2026 14:14:57 +0100 Subject: [PATCH 1/2] Raise the socket limit so that the HTTP server can accept a connection while Tailscale starts With 16 sockets, the HTTP server's connections, Tailscale's start and a session takeover used them all. accept() then failed with ENFILE, and lwIP closed the connection that it had already accepted, so a browser got ERR_CONNECTION_CLOSED on the Tailscale address. The limit is now 32, and the TCP control block limit rises with it. --- .../include/jetkvm_memory_policy.h | 2 +- .../tests/test_coexistence_budget.py | 2 +- sdkconfig.defaults | 12 +++++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/components/jetkvm_memory_policy/include/jetkvm_memory_policy.h b/components/jetkvm_memory_policy/include/jetkvm_memory_policy.h index 440a6396..06548190 100644 --- a/components/jetkvm_memory_policy/include/jetkvm_memory_policy.h +++ b/components/jetkvm_memory_policy/include/jetkvm_memory_policy.h @@ -129,7 +129,7 @@ extern "C" { #define JETKVM_MEMORY_LWIP_TCPIP_MBOX_BASELINE_ENTRIES 64U #define JETKVM_MEMORY_LWIP_MBOX_AB_ENTRIES 256U #define JETKVM_MEMORY_LWIP_TCP_MBOX_ENTRIES 256U -#define JETKVM_MEMORY_LWIP_MAX_TCP_SOCKETS 16U +#define JETKVM_MEMORY_LWIP_MAX_TCP_SOCKETS 32U #define JETKVM_MEMORY_ETHERNET_MAX_FRAME_BYTES 1522U #define JETKVM_MEMORY_LWIP_TCPIP_MBOX_AB_GROWTH_BYTES \ ((JETKVM_MEMORY_LWIP_MBOX_AB_ENTRIES - \ diff --git a/components/jetkvm_memory_policy/tests/test_coexistence_budget.py b/components/jetkvm_memory_policy/tests/test_coexistence_budget.py index 4f8769e3..c041b260 100644 --- a/components/jetkvm_memory_policy/tests/test_coexistence_budget.py +++ b/components/jetkvm_memory_policy/tests/test_coexistence_budget.py @@ -191,7 +191,7 @@ def require_compact(source: str, expression: str) -> None: ) == 1024 assert evaluate( "JETKVM_MEMORY_LWIP_TCP_MBOX_ALL_SOCKETS_BYTES", policy -) == 16384 +) == 32768 assert evaluate( "JETKVM_MEMORY_LWIP_TCPIP_MBOX_AB_PAYLOAD_MAX_BYTES", policy ) == 389_632 diff --git a/sdkconfig.defaults b/sdkconfig.defaults index d85ec9b4..4690e2e1 100644 --- a/sdkconfig.defaults +++ b/sdkconfig.defaults @@ -95,9 +95,15 @@ CONFIG_MQTT_TASK_STACK_ON_EXTERNAL_MEMORY=y CONFIG_WEBRTC_TRANSPORT_MAX_AU_BYTES=524288 CONFIG_WEBRTC_TRANSPORT_RTP_POOL_BYTES=1048576 -# Browsers open up to six HTTP/1.1 connections, beside the HTTP server's own -# descriptors and the WebRTC UDP socket. -CONFIG_LWIP_MAX_SOCKETS=16 +# The sockets that can be open at once: 11 of the HTTP server (two listeners, +# its control socket, eight connections), 6 of Tailscale while it starts, 4 of +# two WebRTC peers during a takeover, and one each for MQTT, the cloud, an +# update, an image mount and an OS Services download. With no socket free, +# accept() fails and lwIP closes the connection that it has already accepted. +CONFIG_LWIP_MAX_SOCKETS=32 +# lwIP ends the oldest connection when it has no TCP control block left, so +# the sockets must not be able to use them up. +CONFIG_LWIP_MAX_ACTIVE_TCP=32 # User-provided NTP servers ahead of the public fallback. CONFIG_LWIP_SNTP_MAX_SERVERS=4 # IPv6 addresses from router advertisements (SLAAC) for the ipv6_mode setting. From 59b9a3ce3055de221822a832f8f3e8818e1507a1 Mon Sep 17 00:00:00 2001 From: Adam Shiervani Date: Wed, 2 Dec 2026 14:15:05 +0100 Subject: [PATCH 2/2] Remove the kf-503 section: the socket limit was the cause --- tools/combined_load/KNOWN_FAILURES.md | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/tools/combined_load/KNOWN_FAILURES.md b/tools/combined_load/KNOWN_FAILURES.md index ff230898..e702bfd9 100644 --- a/tools/combined_load/KNOWN_FAILURES.md +++ b/tools/combined_load/KNOWN_FAILURES.md @@ -3,7 +3,7 @@ Faults of the Mini that the combined-load walk meets. A section is of one of three kinds: - **Tolerated breakage:** entries in `ethernet/known-failures.jsonc` or `wifi/known-failures.jsonc` link to the section, and the walk passes with the fault. -- **Breakage that fails the walk:** no entry tolerates the fault ([kf-503](#kf-503), [kf-504](#kf-504)). +- **Breakage that fails the walk:** no entry tolerates the fault ([kf-504](#kf-504)). - **Slow spot:** the Mini is slow and nothing breaks ([kf-287](#kf-287), [kf-296](#kf-296), [kf-306](#kf-306), [kf-349](#kf-349), [kf-386](#kf-386), [kf-500](#kf-500)). The walk's report counts it under `USABILITY`. It has no entry. @@ -428,25 +428,6 @@ To reproduce, run `tools/combined_load/run.sh --list=full` and look at ` - Check whether the mount's USB re-enumeration ([kf-268](#kf-268)) or the host reading the new drive ([kf-269](#kf-269)) delays the clipboard round. - - -## kf-503: The Mini closes HTTPS connections on its Tailscale address for about 3 s after it joins - -### Problem - -After Tailscale turns on and the Mini reports that it runs, a browser that opens `https:///` gets `ERR_CONNECTION_CLOSED`. The Mini accepts the TCP connection and ends it during the TLS handshake. About 3 s later the same address serves the page. - -The walk loads the page once when `tailscale on` is done, and that change failed in 3 of 10 full walks in a row on the Ethernet Mini. A probe that connected every 2 s after `tailscale on` got an unexpected end of file in the handshake for about 3 s. - -No entry tolerates this fault: a walk that meets it fails. - -To reproduce, run `tools/combined_load/run.sh --list=full` with HTTPS on and look at the change `tailscale on`. - -### Next steps - -- Find what ends the handshake in that window: the HTTPS listener on the Tailscale interface, the certificate for the Tailscale address, or the memory reservation for a TLS connection. -- Report Tailscale as running only when the Mini serves a connection on its Tailscale address. - ## kf-504: After a mount, the OS Services session sometimes does not come back