]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Reverse comment about io_loop_stop() being safe to call in signal handlers
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 9 Apr 2020 12:55:59 +0000 (15:55 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 22 May 2020 08:38:37 +0000 (08:38 +0000)
It is not safe. First there's the issue that ioloop.running is a bitmask,
but secondly there's a race condition between io_loop_stop() and the arrival
of the last timeout and/or IO event. It can end up running epoll_wait() with
only a stale IO and no timeouts, which hangs indefinitely.

src/lib/ioloop.h

index c51296512f9af08c39ad1db370cc46c76f4651b8..c48a5b5e1366fd8f044adf87a4c604068ba327f5 100644 (file)
@@ -182,7 +182,7 @@ void io_loop_time_refresh(void);
 
 void io_loop_run(struct ioloop *ioloop);
 /* Stop the ioloop immediately. No further IO or timeout callbacks are called.
-   This is safe to run in a signal handler. */
+   Warning: This is not safe to be called in non-delayed signal handlers. */
 void io_loop_stop(struct ioloop *ioloop);
 /* Stop ioloop after finishing all the pending IOs and timeouts. */
 void io_loop_stop_delayed(struct ioloop *ioloop);