Engineering

How Google Traced GKE API Timeouts to a Three-Layer Linux Kernel TCP Bug

An investigation into how packet reordering in Google Cloud Private Service Connect, Envoy's SHUT_WR half-close behavior, and a Linux kernel 6.1 tcp_ack() bug combined to strand Kubernetes control plane sockets in FIN_WAIT_2—blocking ~800 developers until an upstream Linux 6.9.7 patch landed in GKE 1.33.5.

By 0xScorPionSon

11 min read

How Google Traced GKE API Timeouts to a Three-Layer Linux Kernel TCP Bug

GKE Three-Layer TCP Bug Architecture

Executive Summary

In early 2026, a multi-cluster Google Kubernetes Engine (GKE) environment in Google Cloud's europe-west region began suffering intermittent i/o timeout failures on port 443 when pods, system DaemonSets, and external CI runners dialed the Kubernetes API server. Over several weeks, the incident escalated to a P0 freeze that blocked roughly 800 developers from deploying to production.

As detailed by Google Cloud on October 30, 2026, and analyzed by InfoQ on November 21, 2026, the root cause was not a single misconfiguration or overloaded control plane. Instead, three independent, individually reasonable behaviors across three distinct layers of the stack collided:

  1. Network Fabric Reordering: Google Cloud's Private Service Connect (PSC) user-space packet switch (USPS) reordered FIN,ACK and ACK packets between its miss-thread slow path and fast path.
  2. Proxy Half-Close Semantics: Envoy on the Kubernetes Control Plane (KCP) VM called shutdown(SHUT_WR), keeping sockets non-orphaned so Linux's tcp_fin_timeout (60 seconds) never started.
  3. Linux Kernel 6.1 State-Machine Bug: In tcp_ack(), an old-but-acceptable ACK under RFC 5961 returned 0, causing the kernel's FIN handler to silently discard the reordered client FIN and strand sockets in FIN_WAIT_2 for over two minutes.

When PSC's NAT layer reused those source ports and a February 2026 USPS security update began dropping RFC 5961 challenge ACKs as "invalid ACK packets," new API handshakes timed out. Resolution required a USPS rollback (restoring clusters by early March 2026), a proxy-protocol fix with PacketDrill regression tests, and an upstream Linux kernel patch (commit 795a7dfbc3d9 by Eric Dumazet) merged into Linux 6.9.7, backported to 6.6.y and 6.1.y, and shipped in GKE 1.33.5 and later.


The Bottleneck & Scale Constraints

The affected customer operated multiple large GKE clusters in europe-west using Private Service Connect (PSC) for private control-plane connectivity, alongside Cilium for network policy, External Secrets Operator, Twistlock security scanners, and internal operators built with kopf.

On Day 1 (January 2026), application logs across multiple namespaces in a UAT cluster began recording intermittent connection timeouts to the cluster's internal API virtual IP (1.2.3.4:443 in Google's anonymized trace):

TimeoutError: Connect call failed ('1.2.3.4', 443)
dial tcp 1.2.3.4:443: i/o timeout
# 1.2.3.4 is the cluster's internal VIP for kube-apiserver,
# routed through Private Service Connect

By Day 10, the errors shifted from occasional spikes to persistent failures across five clusters in the same region. By Day 15, the case was escalated to P0: roughly 800 developers were blocked from shipping to production.

Eliminating the Usual Suspects

Before touching kernel internals, Google Cloud and the customer systematically ruled out every common Kubernetes control-plane bottleneck:

Suspect Component Verification Check Result
Custom kopf operator Timeline audit + complete shutdown Cleared — timeouts began 8 days before deployment and persisted after shutdown
External Secrets Operator Scaled down to zero Cleared — system-level pods still failed to reach the API server
Security agents (Twistlock) Uninstalled from nodes Cleared — timeouts continued across DaemonSets and external GitHub Actions runners
conntrack table exhaustion Checked KCP OS connection tracking Cleared — utilization sat at ~50% of the default 1.3 million entry limit
Control plane overload Resized KCP VMs + checked kube-apiserver latency Cleared — API server internal latencies remained healthy

Because failures hit both cluster-internal pods and external developer laptops/CI runners simultaneously, the bottleneck clearly lived in the network and transport path between clients and kube-apiserver. On Day 22, engineers collected simultaneous packet captures (pcap) at the control-plane host NIC, the programmable virtual NIC (PIGv), and inside the kube-apiserver container.


Inside the Solution: Architecture & Internals

In a PSC-enabled GKE cluster, a pod dialing the control plane's internal IP traverses a multi-hop virtualized pipeline:

  1. The pod sends a SYN to the cluster's internal PSC endpoint IP.
  2. Google's Andromeda networking fabric and USPS (User Space Packet Switch) intercept the flow, apply NAT, and inject a PROXY protocol header so kube-apiserver can observe the true client IP.
  3. Traffic passes through an internal passthrough Network Load Balancer to the KCP VM's PIGv virtual NIC.
  4. Envoy terminates the connection locally on the KCP VM and proxies requests to kube-apiserver.
sequenceDiagram
    participant Pod as GKE Pod (Client)
    participant PSC as PSC / USPS (NAT + Proxy Protocol)
    participant PIGv as KCP VM (PIGv + Linux 6.1)
    participant Envoy as Envoy Proxy

    Note over Pod,Envoy: Phase 1: Reordered Close Leaves Socket Stuck
    Pod->>PSC: FIN, ACK (then final ACK)
    PSC-->>PIGv: Reordered: ACK arrives before FIN, ACK
    Envoy->>PIGv: shutdown(SHUT_WR) -> socket NOT orphaned
    PIGv->>PIGv: tcp_ack() returns 0 on old-but-valid ACK<br/>FIN silently dropped -> stuck in FIN_WAIT_2 (>120s)

    Note over Pod,Envoy: Phase 2: Port Reuse + Dropped Challenge ACK
    Pod->>PSC: New SYN (reused NAT source port 53426)
    PSC->>PIGv: Forward SYN on same 5-tuple
    PIGv-->>PSC: RFC 5961 Challenge ACK (old seq)
    PSC--xPod: USPS drops Challenge ACK as "invalid ACK"
    Pod->>Pod: SYN retransmits -> i/o timeout

What the Packet Captures Exposed

Simultaneous captures showed client SYN packets reaching the KCP VM's PIGv interface, yet clients never received a SYN-ACK. Instead, the KCP VM replied with an out-of-place ACK carrying sequence numbers from a previous connection that had used the same source port (e.g., 53426) more than two minutes earlier.

Under RFC 5961 (Section 4), when a TCP endpoint receives a SYN matching an existing or lingering 5-tuple, it must not blindly accept the handshake. Instead, it replies with a challenge ACK containing the old connection's sequence numbers. A legitimate client sees the unexpected ACK, responds with an RST to clear the stale state, and retries its SYN, which then succeeds.

However, Andromeda metrics revealed a sudden spike in a counter named "Proxy protocol drop: invalid ACK packet" starting in February 2026—reaching several drops per second across europe-west. A recent USPS rollout, intended to fix an unrelated proxy-protocol security issue, had begun dropping ACK packets that appeared before a SYN-ACK during handshake setup. Challenge ACKs fit that exact profile. Because PSC NAT multiplexes many pods across nodes onto shared source ports, 5-tuple reuse happened frequently—turning silent challenge-ACK drops into widespread API timeouts.

Rolling back the USPS change restored connectivity by early March 2026, but engineers still had to answer the deeper architectural question: why were KCP VM sockets stuck in FIN_WAIT_2 for over two minutes in the first place?

Bug #1: Packet Reordering at PIGv / USPS

Comparing host-NIC captures against PIGv captures inside the VM proved that packets arrived in order at the physical host, but were reordered before reaching the guest kernel. When USPS encounters a new flow ("miss"), a slower miss-thread injects the proxy-protocol header and initializes NAT state, while subsequent packets take a fast path. During connection teardown, the client's final ACK occasionally overtook its FIN,ACK, arriving at the KCP VM after the server had already transitioned through FIN_WAIT_1 into FIN_WAIT_2.

Bug #2: Envoy's Half-Close and the Frozen tcp_fin_timeout

Normally, Linux protects against lingering FIN_WAIT_2 sockets via net.ipv4.tcp_fin_timeout (configured to 60 seconds on the KCP VM). Crucially, however, tcp_fin_timeout only applies to orphaned sockets—sockets closed by the owning user-space process.

Envoy calls shutdown(SHUT_WR) to perform a graceful TCP half-close: it closes its write half while keeping the socket open to drain any remaining client data. Because Envoy still held the file descriptor, the kernel did not treat the socket as orphaned, so the 60-second timer never started. netstat confirmed sockets lingering in FIN_WAIT_2 for > 120 seconds—plenty of time for PSC NAT to recycle the port.

Bug #3: Linux Kernel 6.1 Silently Discarding Reordered FINs

Even with reordering and SHUT_WR, a compliant TCP stack should still process a valid incoming FIN in FIN_WAIT_2 and transition to TIME_WAIT. Tracing the guest kernel's TCP state machine—Container-Optimized OS (COS) running Linux 6.1—revealed why it didn't.

When the reordered FIN,ACK arrived, the kernel invoked tcp_ack() to validate its acknowledgment number. Under RFC 5961's stricter window rules, an ACK that is slightly old—yet still within the acceptable window due to network reordering—is valid. In Linux 6.1, a specific code path caused tcp_ack() to return 0 ("not fully processed") for such old-but-acceptable ACKs. The caller in the closing path checked that return value, saw 0, and aborted before calling tcp_fin(). The FIN was silently dropped, leaving the socket stranded in FIN_WAIT_2 indefinitely.

The upstream fix—authored by Google's Eric Dumazet—resolved this in commit 795a7dfbc3d9 (net: tcp: accept old ack during closing), ensuring old-but-acceptable ACKs no longer prevent tcp_fin() execution during teardown.


Verified Results, Benchmarks & Post-Mortem Lessons

Google Cloud coordinated a three-part resolution across networking, proxy, and OS teams:

  • Immediate Mitigation (February–March 2026): Rolled back the USPS change, stopping "Proxy protocol drop: invalid ACK packet" events and restoring all affected customer clusters by early March 2026.
  • Proxy-Protocol Correctness Fix: Shipped a revised USPS update that properly forwards RFC 5961 challenge ACKs during connection setup, backed by an automated PacketDrill regression test.
  • Linux Kernel & GKE Rollout: Backported commit 795a7dfbc3d9 from Linux 6.9.7 into the 6.6.y and 6.1.y LTS branches, shipping to GKE customer clusters in GKE 1.33.5 and later.

Industry Reaction & Architectural Commentary

The post-mortem sparked sharp discussion across the systems engineering community, as captured by InfoQ:

  • Kernel Lifecycle Debt: Justin Garrison, Field CTO at Sidero, noted that while kernel-patch post-mortems are compelling, the underlying bug had already been fixed upstream in 6.9.7—GKE hit it because its COS images were still running a roughly three-year-old 6.1 LTS kernel and required a backport.
  • Diagnostic Methodology for Distributed Systems: Guangba Yu, postdoctoral researcher at the Chinese University of Hong Kong, highlighted the case as a blueprint for AIOps and chaos engineering: correlating simultaneous multi-point path observations, protocol state-machine dumps, and infrastructure rollout timelines, while separating temporary symptom mitigation (the USPS rollback) from true state-machine correction (the kernel patch).
  • Multi-Layer Failure Amplification: As Google Cloud Sr. Technical Solutions Engineer Akash Thakur summarized, none of the three issues alone would have caused a multi-week developer freeze. Each layer's behavior looked locally defensible until NAT port-reuse pressure linked them together.

Practical Takeaways for Your Stack

  1. Audit Your GKE and LTS Kernel Versions: If you run GKE clusters with Private Service Connect and experienced unexplained dial tcp ...:443: i/o timeout errors, verify that both your control plane and node pools are running GKE 1.33.5 or later (or an equivalent patched COS/Linux kernel 6.1.y / 6.6.y / 6.9.7+ build).
  2. Do Not Rely on tcp_fin_timeout for Proxy-Held Sockets: Tuning net.ipv4.tcp_fin_timeout will not rescue sockets stuck in FIN_WAIT_2 if a proxy like Envoy holds the descriptor open via shutdown(SHUT_WR). Inspect ss -tonp state fin-wait-2 to verify whether stuck sockets are actually orphaned or still owned by a process.
  3. Capture Packets Simultaneously Across Boundaries: When application and control-plane metrics look healthy (conntrack at 50%, low API latency), capture pcap traces at the host NIC, virtual NIC, and inside the container at the exact same timestamp. Single-point captures miss subtle packet reordering introduced by virtual switches or NAT layers.
  4. Test Half-Close Flows Under Reordering: If you operate Envoy, HAProxy, or custom L4 proxies behind NAT or load balancers that inject PROXY protocol headers, include PacketDrill or tc netem packet-reordering tests in CI—especially around connection teardown and rapid 5-tuple reuse.
  5. When NOT to Over-Engineer: Avoid disabling RFC 5961 challenge ACKs (tcp_challenge_ack_limit hacks) or ripping out Envoy half-close semantics in production as a knee-jerk reaction. RFC 5961 protects against blind in-window TCP reset and injection attacks; keep standard protocol protections intact and fix the underlying kernel/middlebox state handling.

Frequently Asked Questions (FAQ)

1. What caused the GKE API server i/o timeout errors?

Three bugs interacted simultaneously: Private Service Connect's USPS layer reordered FIN,ACK and ACK packets, Envoy's shutdown(SHUT_WR) half-close kept sockets non-orphaned (bypassing tcp_fin_timeout), and a Linux kernel 6.1 tcp_ack() bug silently dropped the reordered FIN, leaving sockets stuck in FIN_WAIT_2. When PSC NAT reused those ports and a February 2026 USPS patch dropped RFC 5961 challenge ACKs, new handshakes timed out.

2. Why didn't net.ipv4.tcp_fin_timeout = 60 close the stuck FIN_WAIT_2 sockets?

In Linux, tcp_fin_timeout only applies to orphaned sockets that no user-space process holds open. Because Envoy called shutdown(SHUT_WR) to close only the write side while waiting to drain reads, the kernel still considered the socket owned by Envoy and never started the 60-second timer.

3. What is an RFC 5961 challenge ACK, and why did PSC drop it?

Defined in RFC 5961, a challenge ACK is sent when an endpoint receives a SYN on a 5-tuple that still has lingering state, prompting a legitimate client to send an RST and clear the stale socket. A February 2026 USPS proxy-protocol security update treated any ACK arriving before SYN-ACK as invalid and dropped it silently.

4. Which Linux kernel and GKE versions contain the permanent fix?

Eric Dumazet's upstream fix (commit 795a7dfbc3d9, net: tcp: accept old ack during closing) landed in Linux 6.9.7 and was backported to the 6.6.y and 6.1.y LTS branches. Google shipped the patched Container-Optimized OS images starting in GKE 1.33.5.

5. How can engineers detect similar multi-layer TCP state issues?

Monitor FIN_WAIT_2 socket counts (ss -s or netstat) alongside middlebox drop counters, and run simultaneous packet captures at the host NIC, virtual NIC, and application container. Reproducing teardown sequences with PacketDrill helps isolate whether packet reordering or proxy half-close triggers kernel state-machine stalls.


Sources

  1. Google Cloud Blog — Akash Thakur, "The three-layer GKE network mystery" (October 30, 2026): https://cloud.google.com/blog/products/networking/the-three-layer-gke-network-mystery
  2. InfoQ — Renato Losio, "How Google Traced GKE API Timeouts to a Linux Kernel TCP Bug" (November 21, 2026): https://www.infoq.com/news/2026/11/gke-kernel-network-bug/
  3. Google Cloud Documentation — "About Private Service Connect | GKE networking" (Updated November 10, 2026): https://docs.cloud.google.com/kubernetes-engine/docs/concepts/private-service-connect
  4. IETF RFC 5961 — "Improving TCP's Robustness to Blind In-Window Attacks" (August 2010): https://datatracker.ietf.org/doc/html/rfc5961

More on Engineering

Engineering

Microsoft agent-framework PyPI Hijack: .pth Startup Execution & Cloud Credential Theft

On November 17, 2026, attackers published two hijacked releases (1.26.1 and 1.26.2) of Microsoft's official agent-framework PyPI package during a ~45-minute window. Both releases dropped .pth startup hooks that execute on any Python invocation—even pip—to harvest environment variables, credential files, Azure IMDS tokens, and CI OIDC credentials before exfiltrating them to webhook.site.

11 min read

Engineering

Kubernetes 1.38 Enters Code Freeze Ahead of December 16: Breaking Removals, DRA Graduations, and Gang Scheduling Status

Kubernetes 1.38 has entered code and test freeze ahead of its planned December 16, 2026 release, locking down scope around v1.38.0-beta.0. While AI workload primitives like CompositePodGroup (v1beta1) and DRA Device Binding Conditions (GA) advance, several removed feature gates and stricter JWK/kubelet validations will break unverified upgrades. Here is what actually shipped in the 1.38 changelog, how the scheduling architecture works, and how to test your clusters before December 16.

9 min read

Engineering

Cloudflare Workers VPC Adds Custom CA and mTLS Support, Ending verify_ca Workarounds for Private Origins

Previously, connecting Cloudflare Workers VPC to internal APIs or private databases signed by an enterprise CA meant downgrading TLS verification to verify_ca or disabled—and origins requiring client certificates were unreachable. On November 18, 2026, Cloudflare added custom CA and mutual TLS (mTLS) client certificate support across both HTTP and TCP VPC Services, including Hyperdrive PostgreSQL connections to Amazon RDS. Here is how the certificate architecture works, how to configure it with Wrangler 4.164.0+ or Terraform 5.29.0+, and how to audit existing services.

11 min read

Tell us what is not working

A thirty-minute call, no deck and no obligation. You will leave with a straight answer about whether this is worth building - including if that answer is no.

Start a project

Direct line

hello@codebumble.net
Dhaka, Bangladesh  :   local timeCalls in English or Bangla