Skip to content

[BUG] Sentinel spins at 100% CPU when an ICMP error is left in the socket error queue (redis/hiredis#1375 not yet in deps/hiredis) #15908

Closed

Description

@igr-zimmer

Describe the bug

Sentinel can keep a CPU busy forever when one of its TCP connections has an ICMP error sitting in the socket error queue. SO_ERROR is 0, recv() returns EAGAIN and epoll reports EPOLLERR on every iteration, so the event loop never sleeps.

redis/hiredis#1375 (by @swills) fixes this in hiredis by draining MSG_ERRQUEUE after a nonblocking connect. It was merged on 2026-09-21, but the copy in deps/hiredis does not have it yet: deps/hiredis/net.c has no MSG_ERRQUEUE handling on unstable, 8.12, 8.10 or 8.2. In redis/hiredis#1375, @sundb asked about picking it into Redis for older versions, and in #15107 @oranagra noted that both fixes are needed. I couldn't find an issue or PR in this repo tracking that, so I'm opening this one.

I found this in our production environment. 18 of our 78 Sentinels were spinning at their 450m CPU limit, about 8 cores in total. We see it on 7.0.5, 8.2.1 and 8.8.0 (official alpine images), and some instances had been spinning for months. For now we are working around it on our side.

To reproduce

  1. Kubernetes with kube-proxy in iptables mode, using the DandyDeveloper redis-ha chart (3 Redis + 3 Sentinel). Each instance announces the ClusterIP of a per-pod Service.
  2. Restart or replace one of the Redis pods. For a few seconds the node has no kube-proxy rule for that pod's Service, and kube-proxy answers SYNs to it with ICMP port unreachable (type 3, code 3).
  3. A Sentinel connecting to that address at the same time gets the connection established after the SYN is retransmitted, but the ICMP report stays in the socket error queue.
  4. Repeat the rollout a few times. In our clusters roughly one in four of these ICMP events leaves a Sentinel spinning.

Environment: EKS 1.35, Amazon Linux 2023 nodes, kernel 6.12.80-106.156.amzn2023.x86_64, chart versions 4.22.3 and 4.39.0.

Expected behavior

Sentinel keeps sleeping in epoll_wait between events, and a stale entry in the error queue doesn't keep EPOLLERR asserted.

Additional information

To make sure we were looking at the same problem, I checked the stuck sockets on one of the spinning Sentinels. They had IP_RECVERR off and SO_ERROR at 0, and each one held a single ICMP port unreachable in its error queue. Once I drained that queue, the Sentinel went back to normal right away, without a restart. So this looks like exactly the case redis/hiredis#1375 handles, and the SO_ERROR check from #15107 wouldn't catch it on its own. I have the traces and counters if they're useful.

Is there a plan or a target version for bringing redis/hiredis#1375 into deps/hiredis? Knowing which releases will include it would help us decide between keeping the workaround and planning an upgrade. I'm also glad to test a build with the change in our setup.

Related: redis/hiredis#1375, redis/hiredis#1376, #15107, #9956, DandyDeveloper/charts#422.

Activity

  1. sundb commented on Oct 10, 2026

    @sundb
    Collaborator

    Closed via #15917

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