Handling of concurrent events in the server
@bobot has been trying to run the regression suite on the CI slaves and the jobs sometimes get stuck. So, I have been looking at
src/server/server-unix.c to try to understand why. I don't think it is related, but the code looks a bit strange.
What happens when several events happen at once in the main loop? For example, a client connects and a child exits. It seems to me that the code will first handle
cur->fd == server_sock and then breaks out of the inner loop. As a consequence, the child death will not be handled until another child dies (or never if it was the last child). Am I missing something?
Another potential issue is that
close_client (and thus
poll_list. So, the code should be modified to break out of the inner loop, so as to avoid use-after-free. But then, we are back to the previous issue. If several events happen at once, some of them might be lost in the process.