epoll loops on disconnection of a client

view story

http://stackoverflow.com – I am trying to implement a socket server by using epoll. I have 2 threads doing 2 tasks: listening to incoming connection writing on screen the data the client is sending. For my test I have the client and the server on the same machine with 3 or 4 clients running. The server works fine until I don't kill one of the client by issuing a CTRL-C: as soon I do that the server starts looping and printing at a very fast rate data from other client. The strange thing is that the client sends data each 2 seconds but the rate of the server is higher epoll_wait is also supposed to print something (HowTos)