blog.rust.gay

Three bugs kept the Kubernetes API in FIN_WAIT_2

In January 2026, a customer running several GKE clusters in europe-west started seeing intermittent i/o timeout errors when pods called the Kubernetes API server. The clusters used Private Service Connect for private control-plane access. Around 800 developers were blocked from deploying to production for weeks.

The obvious suspects were ruled out one by one: a custom kopf operator, the External Secrets Operator, security agents, conntrack exhaustion, an overloaded control plane. Conntrack was at about half of its 1.3 million default maximum. The control plane was not saturated. The failures were intermittent, which made them hard to reproduce and easy to blame on the application.

The eventual answer involved three bugs in three layers: packet reordering in Google's user-space packet switch, an Envoy half-close that kept sockets in FIN_WAIT_2, and a Linux 6.1 TCP bug that silently discarded the final FIN. Each layer had a plausible explanation that was incomplete. The case is a good study in why simultaneous observation beats sequential debugging.

The path a "local" API call takes

A pod calling the Kubernetes API looks like a local call. It is not. The packet leaves the pod, enters the cluster network, and reaches Private Service Connect. PSC forwards it through an internal passthrough network load balancer to a control-plane VM. On that VM, Envoy accepts the connection and proxies it to kube-apiserver.

That path is deliberate. PSC keeps the control plane private without exposing it to the public internet. The cost is that a single connection traverses several components, each with its own state: the pod's network namespace, the PSC packet switch, the load balancer, the VM's kernel, Envoy, and the API server. When the failure is intermittent, each component can produce a capture that looks normal on its own.

The customer's captures showed the symptom clearly. New SYN packets were receiving stale ACKs from connections that had already closed. Wireshark labeled the streams "TCP Port numbers reused." That label is a hint, not a diagnosis: PSC reuses source ports across many pods, so 5-tuple collisions are common. When a SYN matches recently closed state, RFC 5961 says the server should send a challenge ACK carrying the old sequence number. A legitimate client answers with RST, and the stale state clears.

That mechanism works only if the challenge ACK reaches the client. In this case, it did not.

The packet capture that changed the case

The turning point was capturing at two points at once: the control-plane VM's NIC and the kube-apiserver container. Sequential captures had been inconclusive because the symptom moved. Simultaneous captures showed that the SYN reached the VM and that a stale ACK left it, but the challenge ACK was being dropped before it could clear the client's state.

The drop came from a change in PSC's user-space packet switch. A February 2026 fix for a different proxy-protocol bug began treating challenge ACKs as invalid ACKs and discarding them. The metric Proxy protocol drop: invalid ACK packet spiked on February 18. That timestamp was the thread that connected the packet captures to a rollout.

Rolling back the PSC change in February restored the clusters by early March. That was a band-aid, not a root fix. The rollback removed the drop, but the sockets were still staying in FIN_WAIT_2 for far longer than they should, and the underlying kernel bug was still there.

Three bugs, one at a time

The first bug was packet reordering in PSC. A new flow takes a slower "miss" path that adds the proxy-protocol header and NAT state. Packets can arrive out of order, and the receiver's handling of that reordering interacted with the rest of the path. On its own, reordering is common and usually harmless. Here it changed the timing that exposed the other two bugs.

The second was Envoy's half-close. When Envoy finishes sending, it calls shutdown(SHUT_WR) and keeps the socket open for reads. That is a normal way to close one direction of a connection. The side effect is that the kernel does not consider the socket orphaned, so tcp_fin_timeout — 60 seconds on these systems — never starts. The socket stayed in FIN_WAIT_2 for more than two minutes.

The third was the kernel bug. In Linux 6.1, tcp_ack() returned 0 for an old-but-acceptable ACK under RFC 5961. The FIN path treated that return value as "not processed," so tcp_fin() was never called and the FIN was silently discarded. The socket had no way to complete the close. The bug had already been fixed upstream; the control-plane VMs were running Container-Optimized OS based on 6.1 and 6.6, so the fix had to be backported.

The interaction is the point. Reordering made the stale-ACK path more likely. Envoy's half-close kept the socket alive long enough for the kernel bug to matter. The kernel bug turned a slow close into a permanent one. Remove any one of the three and the outage does not happen in the same way.

The fixes

The immediate fix was the PSC rollback. The correctness fix replaced the change with proper challenge-ACK handling and added a PacketDrill regression test, so the behavior is now covered by a test rather than by a rollout metric.

The root fix was Linux commit 795a7dfbc3d9, "net: tcp: accept old ack during closing," by Eric Dumazet. It was merged in 6.9.7 and backported to the 6.6.y and 6.1.y branches. GKE customers received it in version 1.33.5 and later.

The backport is the part that deserves attention. The fix existed upstream. The control-plane images were on older long-term-support kernels, which is normal for a managed service. The gap between "fixed upstream" and "running in the fleet" is a scheduling problem, and it is where most of the outage lived.

Engineers from GKE, PSC, networking, host networking, the kernel team, Andromeda, Container-Optimized OS, and the upstream Linux community worked on the case — roughly seven or eight specialties. That is not a sign of poor engineering. It is what a cross-layer bug looks like when no single team owns the whole path.

The cost of a managed control plane

The GKE case is also a story about the managed-service contract. A customer buys a control plane that is supposed to be available, and the provider chooses the kernel, the proxy and the network path. That is the value of a managed service: the customer does not have to debug the stack. It is also the risk: when the bug is in the provider's LTS kernel, the customer cannot fix it by upgrading a package.

The backport is the mechanism that makes the contract work. Google had the fix in 6.9.7 and backported it to 6.6.y and 6.1.y, then shipped it in GKE 1.33.5. That is a reasonable process. The critique is about latency: the bug was already fixed upstream, and the managed fleet still ran an affected kernel for months.

There is no way to eliminate that gap entirely. A managed service cannot chase every upstream release without breaking its own support model. What it can do is shorten the path for bugs that matter, and publish enough detail that customers can understand the exposure. The GKE post does the second part well. The first part is an operational choice that every provider makes.

What to copy in your own incident response

The first lesson is to capture at more than one point at the same time. Sequential captures invite a theory that fits the first capture and is contradicted by the second. Simultaneous captures let you compare what left one component with what arrived at the next.

The second is to correlate packet captures with rollout metrics. The Proxy protocol drop: invalid ACK packet spike on February 18 was the evidence that turned a plausible theory into a timeline. Without it, the team would have kept looking at the application.

The third is to distinguish making the symptom go away from fixing the state machine. The rollback restored service. It did not fix the socket lifetime or the kernel's handling of the final ACK. If the team had stopped at the rollback, the next reordering event could have produced the same outage.

The fourth is to test the protocol state machine, not just the happy path. The PacketDrill test is the durable artifact from this incident. It encodes the challenge-ACK behavior so a future change cannot silently drop it again.

Justin Garrison's public comment on the case is a fair critique: GKE was running a three-year-old kernel and had to backport a bug that was already fixed. That is the trade-off of a managed service on an LTS base. The fix is not to chase every upstream release; it is to have a backport process that can move when a bug matters. The case shows that process working, but it also shows how long the window can be.

Conclusion

Three bugs in three layers produced one symptom: a Kubernetes API call that timed out. The packet reordering, the Envoy half-close and the Linux 6.1 tcp_ack() return value were each defensible in isolation. Together they kept sockets in FIN_WAIT_2 until the client gave up.

The fix is in the kernel and in GKE 1.33.5, and the regression test is in place. The operational lesson is broader: when a symptom appears at every layer, the answer is usually an interaction, not a single broken component. Capture at multiple points, correlate with rollouts, and fix the state machine after you have stopped the bleeding.

Sources


← back to posts