Environment
- CP version: v0.9.4 (
f925e5f6)
Description
The cpworker control socket listens with a backlog of 1. ss -xl on a running worker shows LISTEN 0 1 .../cpworker.sock.
Go dials unix sockets non-blocking, and a full backlog makes connect fail immediately with EAGAIN instead of waiting. Both cpctl and cpdaemon connect through cpgolib/cpworker/unix_client.go. So whenever two clients connect at nearly the same time, the second one fails. For example, cpdaemon's periodic stats collection can overlap with an operator's cpctl stats or a reload.
With 32 clients connecting at once, 29 fail with connect: resource temporarily unavailable.
Steps to reproduce
TestControlProtocol/concurrent_clients in cpworker/tests/integration/control_protocol_test.go (branch feat/verification-coverage).
Expected
Concurrent clients are queued and served. For example, use listen(fd, SOMAXCONN).
Actual
Every connection beyond the first pending one fails with EAGAIN.
中文原文
测试环境
问题描述
cpworker 控制 socket 的 listen backlog 为 1(运行中 ss -xl 显示 LISTEN 0 1 .../cpworker.sock)。Go 以非阻塞方式 dial unix socket,backlog 满时 connect 立即返回 EAGAIN 而不是等待。cpctl 与 cpdaemon 都通过 cpgolib/cpworker/unix_client.go 连接,因此两个客户端几乎同时连接时(例如 cpdaemon 定期采集统计与运维的 cpctl stats 或 reload 重叠)后者失败。
32 个客户端同时连接,29 个报 connect: resource temporarily unavailable。
复现
feat/verification-coverage 分支 cpworker/tests/integration/control_protocol_test.go 的 TestControlProtocol/concurrent_clients。
期望
并发客户端排队并得到服务(例如 listen(fd, SOMAXCONN))。
实际
第一个等待中的连接之外全部 EAGAIN。
Environment
f925e5f6)Description
The cpworker control socket listens with a backlog of 1.
ss -xlon a running worker showsLISTEN 0 1 .../cpworker.sock.Go dials unix sockets non-blocking, and a full backlog makes
connectfail immediately withEAGAINinstead of waiting. Both cpctl and cpdaemon connect throughcpgolib/cpworker/unix_client.go. So whenever two clients connect at nearly the same time, the second one fails. For example, cpdaemon's periodic stats collection can overlap with an operator'scpctl statsor a reload.With 32 clients connecting at once, 29 fail with
connect: resource temporarily unavailable.Steps to reproduce
TestControlProtocol/concurrent_clientsincpworker/tests/integration/control_protocol_test.go(branchfeat/verification-coverage).Expected
Concurrent clients are queued and served. For example, use
listen(fd, SOMAXCONN).Actual
Every connection beyond the first pending one fails with
EAGAIN.中文原文
测试环境
f925e5f6)问题描述
cpworker 控制 socket 的 listen backlog 为 1(运行中
ss -xl显示LISTEN 0 1 .../cpworker.sock)。Go 以非阻塞方式 dial unix socket,backlog 满时connect立即返回EAGAIN而不是等待。cpctl 与 cpdaemon 都通过cpgolib/cpworker/unix_client.go连接,因此两个客户端几乎同时连接时(例如 cpdaemon 定期采集统计与运维的cpctl stats或 reload 重叠)后者失败。32 个客户端同时连接,29 个报
connect: resource temporarily unavailable。复现
feat/verification-coverage分支cpworker/tests/integration/control_protocol_test.go的TestControlProtocol/concurrent_clients。期望
并发客户端排队并得到服务(例如
listen(fd, SOMAXCONN))。实际
第一个等待中的连接之外全部
EAGAIN。