Hard
SO_REUSEPORT listeners with one stalled worker
On a Linux host, eight worker processes each open their own listening socket on port 9000 with SO_REUSEPORT and run their own accept() loop. One worker blocks for two seconds on a synchronous disk flush while the other seven sit idle. No BPF steering program is attached. What happens to new connections arriving during those two seconds?
main.cpp
// In each of 8 worker processes:
int lfd = socket(AF_INET, SOCK_STREAM, 0);
int one = 1;
setsockopt(lfd, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one));
bind(lfd, (struct sockaddr*)&addr, sizeof(addr)); // port 9000
listen(lfd, 1024);
for (;;) handle(accept(lfd, NULL, NULL));35 of 45 in Networking