cyrus 2.4 deadlock identified: SIGALRM race

Thomas Jarosch thomas.jarosch at intra2net.com
Tue Sep 1 12:35:10 EDT 2015


On Tuesday, 1. September 2015 14:31:23 Thomas Jarosch wrote:
> ------------------------------
> commit 17eb391b918c394319e4d1fe5985de10128f34d7
> Author: Greg Banks <gnb at fastmail.fm>
> Date:   Fri Mar 23 17:27:32 2012 +1100
> 
>     idle: don't use signals, use AF_UNIX dgrams
> 
>     Communications back from idled to imapds are via a message sent on the
> AF_UNIX socket.  The IDLE command is implemented as a select() loop, and
> there's absolutely nothing that needs to be done in signal handler
> context.  Best of all, no more unexpected delivery of SIGUSR1 or
> SIGUSER2, assassinating innocent bystander processes.
> ------------------------------

it looks like the changes to idle.c / idled.c / idlemsg.c can easily be 
backported (=cherry-picked) to 2.4. Many of them apply without
any manual changes needed.

For a quick test I've already cherry-picked these commits to 2.4:
-------------------------------
6c66fea idle: shut down on SIGQUIT
490245b idle: don't do FD_ISSET(-1,) it's unhelpful
d3b4d40 idle: unlink local AF_UNIX socket when done
215ded8 idle: rename notify_sock -> idle_sock
e0a2ae7 idle: don't use signals, use AF_UNIX dgrams
b03bacf idle: centralise AF_UNIX socket creation
060892e idle: move message send/recv into a common file
a072b0b idle: rename idle_data_t -> idle_message_t
47bf369 idle: better function names in idled
5beb409 idle: some const correctness
7bfe482 idle: remove "freelist" ientry memory management
8ebce36 idle: rename messages IDLE_FOO -> IDLE_MSG_FOO
c302829 idle: whitespace cleanup
-------------------------------

This was just a rough try, I'll compile a more complete
list of needed changes. If I get this up and running, I'll send
a git pull request for 2.4 to fix this nasty issue.

Thomas



More information about the Cyrus-devel mailing list