TCP server spins at 100% CPU when accept() fails with EMFILE
@itsGiaan ya está trabajando en esto.
Desde el 17/11/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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.
- Lenguaje dominante
- C
- Estrellas
- 14.8k
- Forks
- 3.4k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de OpenVPN/openvpn
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 71/100
-
CVE-2026-11604 vs OpenVPN 2.7.x DocumentationQuizá libre de nuevo @lstipakov la tomó hace 35 días y no hay ningún pull request abierto. AbiertoDCO website Windows
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Document Real Address format change in management/status output (OpenVPN 2.7)Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertodocumentation enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Since 2.7.9 "route-method exe" can't set routePosiblemente ocupada @d12fk la tomó hace 1 día. Abiertooutdated code Windows
-
enhancement feature
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Todos los issues de OpenVPN/openvpn
Issues similares
-
issue: bug report
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 2 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
documentation
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Stellarium/stellarium#5197 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
ChupathingyCE/chupathingyce#1550 ·
Los mantenedores suelen responder en 1 día
-
[BUG] SWAPDB sends no invalidation to CLIENT TRACKING clientsPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
redis/redis#16302 · 1 comentario ·
Los mantenedores suelen responder en 1 día