Brad Arant cfc0b19418 Fix stuck-write give-up path spinning forever instead of actually closing
shutdown() only sets shutDown=true and expects the fifo to drain
normally before eventReceived()'s keepAlive check
(!shutDown || (fifo.size() > 0 && !readHangup)) lets the connection
close - correct for a graceful QUIT/LOGOUT reply that just needs a few
more successful writes to flush, but exactly backwards for the give-up
path: the whole reason that path was reached is that the front of the
fifo can never be sent. Leaving it queued meant keepAlive stayed true
forever, resetSocket() kept re-arming EPOLLWRNORM because fifo wasn't
empty, the very next write attempt hit the identical stall
immediately, and shutdown() got called again - forever, at whatever
rate the kernel could fire EPOLLWRNORM.

Confirmed live on a real internet-facing server (Zephora's game
server, an ordinary port-scanner connection was enough to trigger it):
one socket logged "consecutive writes made zero progress - giving up
and shutting down" 2.4 million+ times in under 4 milliseconds,
pegging a worker thread at 100% CPU indefinitely. The give-up path now
clears the undeliverable fifo entry before calling shutdown(), so
keepAlive correctly evaluates to just !shutDown (now false) on the
next cycle and the connection actually tears down.
2026-09-06 19:41:07 +00:00
2022-10-13 17:50:13 +00:00
2024-07-11 15:45:33 -07:00
2023-06-19 23:22:46 +00:00
2024-07-10 13:30:18 -07:00
2024-07-10 13:30:18 -07:00
2024-07-11 15:45:33 -07:00
2024-07-10 13:30:18 -07:00
2024-07-10 13:30:18 -07:00
2024-07-10 13:30:18 -07:00
2020-04-13 09:40:58 -07:00
2024-07-10 13:30:18 -07:00
2024-07-10 13:30:18 -07:00
2024-07-10 13:30:18 -07:00
2023-06-19 23:22:46 +00:00
2025-01-28 16:26:40 -08:00
2024-07-10 13:30:18 -07:00
2019-05-21 16:41:07 -07:00
2019-02-07 13:28:21 -08:00
2019-09-18 18:32:15 -07:00
S
Description
This repository provides core functionality for TCP and UDP servers using the epoll linux function.
184 MiB
0 Stars 1 Watchers 0 Forks
Languages
C++ 99.6%
Shell 0.4%