TCP server spins at 100% CPU when accept() fails with EMFILE
@itsGiaan がすでに取り組んでいます。
2026年11月17日 から。
評価
この issue はまだ評価されていません。
説明
Description
When a TCP server runs out of file descriptors, accept() fails with EMFILE. The pending connection stays in the listen queue, so the listening socket remains readable. Every event wait then returns immediately, accept() fails again, and the server busy-loops at 100% CPU.
Because the server loop only runs scheduled timers when the event wait returns no events, timers (ping-restart, hand-window, etc.) stall for as long as the condition lasts. The same applies to the management listener.
The default --max-clients is 1024, the same as the usual default soft RLIMIT_NOFILE on Linux. Since each TCP client uses one descriptor, plus the tun device, listeners, log and management, a TCP server with default settings hits EMFILE before reaching --max-clients.
On Linux the issue is not specific to the userspace data channel: it reproduces with DCO as well, since accepting connections and the event loop stay in userspace.
Affected platforms
Linux: reproduced, with both epoll and poll. The default limits are enough.
FreeBSD 14.5: reproduced (poll backend). The kernel also leaves the pending connection in the queue after a failed accept(), on a stock system the default descriptor limit is much higher (kern.maxfilesperproc), so it needs a lowered limit or a --max-clients close to it.
macOS: not affected, because XNU drops the pending connection when accept() fails.
Windows: not affected.
How to reproduce
Start a server with tcp-server listener, on Linux the default limits are enough (about 1000 connections are needed); a low limit such as ulimit -n 64 makes it quicker to reproduce.
Open TCP connections to the server port, without completing the handshake, until accept() fails with Too many open files.
Watch the CPU usage of the server process: it stays at 100% and the log fills with TCP: accept(...) failed: Too many open files (errno=24).
Patches are ready and will be sent to Gerrit.
- 主要言語
- C
- スター
- 14.8k
- フォーク
- 3.4k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
OpenVPN/openvpn のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 71/100
-
CVE-2026-11604 vs OpenVPN 2.7.x Documentation再び着手できるかも @lstipakov が 35 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンDCO website Windows
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
Document Real Address format change in management/status output (OpenVPN 2.7)対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンdocumentation enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
Since 2.7.9 "route-method exe" can't set route対応中かも @d12fk が 1 日前に担当しました。 オープンoutdated code Windows
-
enhancement feature
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
OpenVPN/openvpn の issue をすべて見る
似ている issue
-
issue: bug report
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 2 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
Stellarium/stellarium#5197 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ChupathingyCE/chupathingyce#1550 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] SWAPDB sends no invalidation to CLIENT TRACKING clients対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
redis/redis#16302 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信