]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: fd: make sure to mark the thread as not stuck in fd_update_events()
authorWilly Tarreau <w@1wt.eu>
Fri, 16 Aug 2019 14:06:14 +0000 (16:06 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 16 Aug 2019 14:06:14 +0000 (16:06 +0200)
When I/O events are being processed, we want to make sure to mark the
thread as not stuck. The reason is that some pollers (like poll()) which
do not limit the number of FDs they report could possibly report a huge
amount of FD all having to perform moderately expensive operations in
the I/O callback (e.g. via mux-pt which forwards to the upper layers),
making the watchdog think the thread is stuck since it does not schedule.
Of course this must never happen but if it ever does we must be liberal
about it.

This should be backported to 2.0, where the situation may happen more
easily due to the FD cache which can start to collect a large amount of
events. It may be related to the report in issue #201 though nothing is
certain about it.

include/proto/fd.h

index 4fbb9dc1af3d9285690b8bf8b2aa8db2fce04b9d..e146976b2a2ef990580c500b793be6ae3acaaff9 100644 (file)
@@ -415,6 +415,8 @@ static inline void fd_update_events(int fd, int evts)
 
        if (fdtab[fd].iocb)
                fdtab[fd].iocb(fd);
+
+       ti->flags &= ~TI_FL_STUCK; // this thread is still running
 }
 
 /* Prepares <fd> for being polled */