SUMMARY Sometimes, an agent is in a weird state. If you go to KMail, right-click and select Restart Account, or in Akonadiconsole select Restart Agent, the agent doesn't exit. STEPS TO REPRODUCE 1. Get into this condition (unknown how; probably related to network interfaces going up and down) 2. Open Akonadiconsole, select affected agent, get its Identifier and find it in the ps process list 3. Right-click the agent, Restart Account OBSERVED RESULT The same process is still running. EXPECTED RESULT A new process shows up in the process list SOFTWARE/OS VERSIONS Qt: 5.15.0 KDE Frameworks: 5.71.0 kf5-config: 1.0 ADDITIONAL INFORMATION strace shows the process received a D-Bus message asking it to exit: [pid 2894] recvmsg(9<socket:[43406]>, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="l\1\0\1\0\0\0\0q\210\2\0\236\0\0\0\1\1o\0\1\0\0\0/\0\0\0\0\0\0\0\6\1s\0005\0\0\0org.freedesktop.Akonadi.Agent.akonadi_imap_resource_5\0\0\0\2\1s\0%\0\0\0org.freedesktop.Akonadi.Agent.Control\0\0\0\3\1s\0\4\0\0\0quit\0\0\0\0\7\1s\0\5\0\0\0:1.31\0\0\0", iov_len=2048}], msg_iovlen=1, msg_controllen=0, msg_flags=MSG_CMSG_CLOEXEC}, MSG_CMSG_CLOEXEC) = 176 It replied confirming it received this message: [pid 2894] sendmsg(9<socket:[43406]>, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="l\2\1\1\0\0\0\0\5#\1\0\30\0\0\0\6\1s\0\5\0\0\0:1.31\0\0\0\5\1u\0q\210\2\0", iov_len=40}, {iov_base="", iov_len=0}], msg_iovlen=2, msg_controllen=0, msg_flags=0}, MSG_NOSIGNAL <unfinished ...> But didn't exit. Hypothesis: there's a job inside the process that is holding the event loop counter above 0. So the event loop doesn't exit.