Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 360115 - net-mail/cyrus hangs with bad sendmail path
Summary: net-mail/cyrus hangs with bad sendmail path
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: x86 Linux
: Normal normal (vote)
Assignee: Net-Mail Packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-23 10:58 UTC by Grzegorz Mucha
Modified: 2011-06-21 06:36 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
/etc/postfix/master.cf (master.cf.txt,2.13 KB, text/plain)
2011-03-23 11:02 UTC, Grzegorz Mucha
Details
emerge --info (emerge--info.txt,3.06 KB, text/plain)
2011-03-23 11:03 UTC, Grzegorz Mucha
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Grzegorz Mucha 2011-03-23 10:58:30 UTC
I'm using postfix-2.7.3 + cyrus-imapd-2.3.14-r3 (and cyrus-imap-dev-2.3.14, cyrus-sasl-2.1.23-r1, cyrus-imap-admin-2.3.14). Users can define their sieve scripts in order to process incoming mails, including forwarding emails to external address (they do this via Horde).

I have one user that forwards his mail to gmail account, his sieve script ends with:

# Forward
if true {
    redirect "username_hidden@gmail.com";
    keep;
} 

It was working fine over years until my recent postfix upgrade from 2.7.2 to 2.7.3. The issue with postfix upgrade to 2.7.3 is that it removes /usr/lib/sendmail (see bug 360097), and since I didn't have "sendmail: path_to_sendmail" line included in /etc/imapd.conf, cyrus assumed the default path to sendmail as /usr/lib/sendmail (as stated in 'man imapd.conf').

When the email came to the above mentioned user, lmtpunix tried to usr /usr/lib/sendmail to forward email to external address, but couldn't find sendmail executable, so it reported an error:

Mar 15 08:34:02 myhost lmtpunix[10927]: FATAL: couldn't exec() sendmail 

till now everything is correct - but it should end here, leaving this email in the queue. But it's not the case, and there is a series of fatal events:
- lmtp goes up to 99% of CPU
- more messages appear in the logs (see attachments)
- postfix receives mails, but cannot deliver them to local mailboxes, they stuck in the queue 
- finally things start to timeout ("postfix/pipe[14616]: warning: pipe_command_read: read time limit exceeded", "pyza deliver[16202]: connect(/var/imap/socket/lmtp) failed: Connection timed out"), and...
- imap authentication stops working (for instance I couldn't log to Horde, which was configured to use imap auth)
- the result is that the whole mail system hangs turning to be unusable

Reproducible: Always

Steps to Reproduce:
1. You need to have user, who forwards mails to external email address by sieve rule
2. You should not have /usr/lib/sendmail or your 'sendmail' value defined in /etc/imapd.conf should point to some non-existent location
3. Now you send email to this user, it may be internal mail or mail coming from outside, it doesn't matter.
Actual Results:  
You should see logs like these:

Mar 15 01:47:40 myhost postfix/qmgr[16757]: 4C14593701: from=<plaxo@mx.plaxo.com>, size=36238, nrcpt=1 (queue active)
Mar 15 01:47:40 myhost lmtpunix[14342]: FATAL: couldn't exec() sendmail
Mar 15 01:47:40 myhost lmtpunix[14341]: sieve runtime error for kowal id <3ec84bbc7fac13cb27ee60c45d6f7534@xpertmailer.com>: Redirect: Sendmail process terminated normally, exit status 75
Mar 15 01:47:40 myhost lmtpunix[14341]: IOERROR: opening /var/spool/imap/stage./14341-1300150060-0: No such file or directory
Mar 15 01:47:40 myhost postfix/pipe[14339]: 4C14593701: to=<kowal@mydomain.com>, relay=cyrus, delay=0.57, delays=0.1/0.01/0/0.47, dsn=4.3.0, status=deferred (temporary failure)
Mar 15 01:47:40 myhost lmtpunix[14341]: IOERROR: error unlinking file /var/spool/imap/stage./14341-1300150060-0: No such file or directory

then you should notice that lmtp process consumes 99% of CPU (if there are no CPU consuming processes in the background)

After few minutes you should notice timeouts:

Mar 15 01:49:01 myhost master[3221]: process 14341 exited, signaled to death by 11
Mar 15 01:49:01 myhost master[3221]: service lmtpunix pid 14341 in READY state: terminated abnormally
Mar 15 01:55:37 myhost postfix/qmgr[16757]: 4C14593701: from=<plaxo@mx.plaxo.com>, size=36238, nrcpt=1 (queue active)
Mar 15 02:12:17 myhost postfix/pipe[14374]: warning: pipe_command_read: read time limit exceeded
Mar 15 02:12:17 myhost postfix/pipe[14374]: 4C14593701: to=<kowal@mydomain.com>, relay=cyrus, delay=1477, delays=477/0.01/0/1000, dsn=5.3.0, status=bounced (Command time limit exceeded: "/usr/lib/cyrus/deliver")
Mar 15 02:12:17 myhost postfix/cleanup[14409]: 60701936F2: message-id=<20110315011217.60701936F2@myhost.mydomain.com>

and - if you use imap authentication - it should stop working, like in this case:

Mar 15 08:37:40 myhost HORDE[14698]: [imp] FAILED LOGIN for grzes [89.76.61.2] to {localhost:143 [imap/notls]} [pid 14698 on line 139 of "/var/www/localhost/htdocs/horde/imp/lib/Auth/imp.php"]  

Expected Results:  
In my case it was postfix upgrade that removed sendmail binary from default path used by cyrus (/usr/lib/sendmail) and I could easily fix it by defining:

sendmail: /usr/sbin/sendmail

in /etc/imapd.conf. But the same behaviour would happen if someone would change sendmail location in /etc/imapd.conf and by mistake misspeled the path to sendmail, so it points to bad location. In all cases there shoudl be an error logged and mail going outside should be deffered or left in the queue.

By no change a simple misconfiguration should not lead to hanging cyrus processes, so I hope you can find why it was happening and either fix the bug or put additional checks that will protect cyrus deamons against crash resulting from bad sendmail binary path defined.

Installed software:

a) mail-mta/postfix-2.7.3 (pam sasl ssl -cdb -doc -dovecot-sasl -examples -hardened -ipv6 -ldap -mbox -mysql -nis -postgres -selinux -vda)

b) net-mail/cyrus-imapd-2.3.14-r3 (pam sieve ssl tcpd -idled -kerberos -kolab -nntp -replication -snmp)


I posted the initial problem description and workaround here: http://forums.gentoo.org/viewtopic-t-869079.html. One user confirmed he had the same problem.
Comment 1 Grzegorz Mucha 2011-03-23 11:00:57 UTC
/etc/imapd.conf:
----------------

configdirectory:        /var/imap
partition-default:      /var/spool/imap
sievedir:               /var/imap/sieve
tls_ca_path:            /etc/ssl/myhost/
tls_cert_file:          /etc/ssl/myhost/server.crt
tls_key_file:           /etc/ssl/myhost/server.key
admins:                 cyradm
hashimapspool:          yes
allowanonymouslogin:    no
allowplaintext:         yes
sasl_mech_list: PLAIN LOGIN
sasl_pwcheck_method:   saslauthd
duplicatesuppression: 0
lmtp_downcase_rcpt: 1
Comment 2 Grzegorz Mucha 2011-03-23 11:02:05 UTC
Created attachment 266969 [details]
/etc/postfix/master.cf
Comment 3 Grzegorz Mucha 2011-03-23 11:03:03 UTC
Created attachment 266971 [details]
emerge --info
Comment 4 Grzegorz Mucha 2011-03-23 11:05:09 UTC
Of course the "admins" line in /etc/imapd.conf is:

admins:                 cyrus
Comment 5 Tim Harder gentoo-dev 2011-03-24 07:16:28 UTC

*** This bug has been marked as a duplicate of bug 359289 ***
Comment 6 Eray Aslan gentoo-dev 2011-03-24 07:20:29 UTC
Reopening.  Problem here is not the missing symlink.  Problem is even with a missing/bad symlink, cyrus should not hang.
Comment 7 Tim Harder gentoo-dev 2011-03-24 20:44:08 UTC
(In reply to comment #6)
> Reopening.  Problem here is not the missing symlink.  Problem is even with a
> missing/bad symlink, cyrus should not hang.

Gotcha. Someone wanting to fix the problem should also make cyrus default to /usr/sbin/sendmail as well. :)
Comment 8 Eray Aslan gentoo-dev 2011-06-21 06:36:54 UTC
Please reopen if it is still a problem with 2.4.8.  Thank you.