Hi!
I'm using dovecot-2.3.21.1 from pkgsrc on NetBSD 11.99.8/x86_64.
I use certbot to handle dovecot's TLS certificate, and since I haven't implemented a nicer method yet, I restart dovecot weekly from cron to make sure it has the newest certificate.
The symptom I see is that the restart doesn't finish until the next restart a week later - only then the previous restart's cron job "finishes" and I get an email.
In a discussion on the NetBSD mailing list[1], RVP diagnosed it as follows:
--- begin quote ---
cron is still waiting for output from dovecot:
dovecot doesn't dup2() its STDERR_FILENO[2]--prolly to spew out error msgs.
when cron runs a crontab command, it dup2(STDOUT, STDERR)s the cmds stdout and stderr.
then it reads from this combined output and write()s this to sendmail's stdin.
all this works if either a) the program dies (ie. is not a daemon) so that cron can close sendmail's stdin.; or b) the daemon itself closes its stderr so an EOF can be generated when stdout is exhausted.
neither a) nor b) are satisfied in this case, so cron is still waiting for output which'll never arrive.
a week later, `service dovecot restart' kills the still running dovecot so cron can now "complete" the job and generate the email.
--- end quote ---
Can you please change dovecot to also dup(2) stderr to fix this?
Thank you, Thomas
[1] https://mail-index.netbsd.org/current-users/2026/09/13/msg047887.html [2]: https://github.com/dovecot/core/blob/main/src/master/main.c#L931