Menu

The wake-up that was already spent: a lost-wakeup bug with an edge-triggered eventfd
📰

The wake-up that was already spent: a lost-wakeup bug with an edge-triggered eventfd

DEV Community: cpp·Dimath Jayasinghe·about 8 hours ago
#dZJhnV9z
#devtocpp#devto#dev#socket#events
Long article (1041 words) — no AI summary yet.
Reading 0:00
15s threshold

A server I work on went quiet after a burst of connections. It had not crashed, it logged nothing, and its connection gauge said 0, yet the process on the other end of its socket still held thousands of connections it believed were open. This is the story of finding why, and the one rule about edge-triggered notifications that I had only half applied.

The symptom

The server (C++, one event loop per thread, epoll) hands events to a second process over a Unix socket: a connection opened, a message arrived, a connection closed. After a load test of 5,000 browsers connecting at once and joining channels, about two runs in three ended with the server showing 0 connections while the other process still held thousands. The Close events had been created and queued. They never arrived.

No error, no log line, no crash.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.