[Dovecot] Dovecot-deliver sometimes fails when message set to discard via sieve
Hi, sometimes mails that i discard via sieve gets delivered to my inbox and i can not figure out why. So i hope you can give me a hint.
My setup is:
I use a self compiled dovecot 1.2.4 with installed sieve and managesieve plugin.
Incoming mails a processed by Postfix and the delivered to Procmail. Procmail invokes Spamassassin and discard all mails marked as spam. The other mails are passed to Dovecot deliver this way:
:0 w | /opt/dovecot/libexec/dovecot/deliver
For moving mails to subdirectorys this works always, but not for mails that are discard via Sieve. Examples are:
if header :contains "List-Id" "git.vger.kernel.org" { if header :contains "Subject" "[ANNOUNCE]" { fileinto "Announce"; stop; } if header :contains "Subject" "[ANN]" { fileinto "Announce"; stop; } if header :contains "Subject" "[PATCH" { discard; stop; } fileinto "Lists.Git"; stop; }
or
if header :contains "Organization" "web.de" { discard; stop; }
This often works, but sometimes it fails. Procmail reports then that deliver reported an error (but not which) and delivers them to my inbox. There are also no message in dovecots or dovecot delivers log file.
Dose anybody have an idea?
Steve
Am 28.12.2009 um 11:55 schrieb Steve Wagner:
if header :contains "Organization" "web.de" { discard; stop; }
This often works, but sometimes it fails. Procmail reports then that deliver reported an error (but not which) and delivers them to my inbox. There are also no message in dovecots or dovecot delivers log file.
This rule will fail, when there is no HeaderEntry called "Organization". You should try "From" instead, this HeaderEntry should always be there to test against.
Tobi
Am 28.12.2009 um 11:55 schrieb Steve Wagner:
if header :contains "Organization" "web.de" { discard; stop; }
This often works, but sometimes it fails. Procmail reports then that deliver reported an error (but not which) and delivers them to my inbox. There are also no message in dovecots or dovecot delivers log file.
This rule will fail, when there is no HeaderEntry called "Organization". You should try "From" instead, this HeaderEntry should always be there to test against.
Tobi
Hi Tobi, yes but it is correct. It should only discard messages that have this header. The sieve filter is larger, this are only the parts witch use discard.
Steve
Am 28.12.2009 12:25, schrieb Tobias Lang:
Am 28.12.2009 um 11:55 schrieb Steve Wagner:
if header :contains "Organization" "web.de" { discard; stop; }
This often works, but sometimes it fails. Procmail reports then that deliver reported an error (but not which) and delivers them to my inbox. There are also no message in dovecots or dovecot delivers log file.
This rule will fail, when there is no HeaderEntry called "Organization". You should try "From" instead, this HeaderEntry should always be there to test against.
Tobi
Am 28.12.2009 um 13:02 schrieb Steve Wagner:
Hi Tobi, yes but it is correct. It should only discard messages that have this header. The sieve filter is larger, this are only the parts witch use discard.
Steve
Am 28.12.2009 12:25, schrieb Tobias Lang:
Am 28.12.2009 um 11:55 schrieb Steve Wagner:
if header :contains "Organization" "web.de" { discard; stop; }
This often works, but sometimes it fails. Procmail reports then that deliver reported an error (but not which) and delivers them to my inbox. There are also no message in dovecots or dovecot delivers log file.
This rule will fail, when there is no HeaderEntry called "Organization". You should try "From" instead, this HeaderEntry should always be there to test against.
Tobi
Hey Steve,
as you can not provide some error messages, it is quite hard to help you with your problem. However, I would guess that there is something wrong with your sieve rules - based on the information, that most mails get filtered correctly. Try analyzing the mails causing errors separately with e.g.:
http://www.fastmail.fm/docs/sieve/sievetest.php
Maybe you can isolate the error there.
Tobi
Ok ive tested it. The sieve script works as expected.
The only error message i have, come from procmail.log:
24918-Folder: /opt/dovecot/libexec/dovecot/deliver 3720 24919-procmail: Error while writing to "/opt/dovecot/libexec/dovecot/deliver" 24920:From KeineAntwortAdresse@web.de Tue Dec 8 07:19:55 2009
The procmail-deliver error logfile is empty and the normal log file dose not contains that error.
Do you have an idea how else i can get the error message?
Steve
Am 28.12.2009 13:15, schrieb Tobias Lang:
Am 28.12.2009 um 13:02 schrieb Steve Wagner:
Hi Tobi, yes but it is correct. It should only discard messages that have this header. The sieve filter is larger, this are only the parts witch use discard.
Steve
Am 28.12.2009 12:25, schrieb Tobias Lang:
Am 28.12.2009 um 11:55 schrieb Steve Wagner:
if header :contains "Organization" "web.de" { discard; stop; }
This often works, but sometimes it fails. Procmail reports then that deliver reported an error (but not which) and delivers them to my inbox. There are also no message in dovecots or dovecot delivers log file.
This rule will fail, when there is no HeaderEntry called "Organization". You should try "From" instead, this HeaderEntry should always be there to test against.
Tobi
Hey Steve,
as you can not provide some error messages, it is quite hard to help you with your problem. However, I would guess that there is something wrong with your sieve rules - based on the information, that most mails get filtered correctly. Try analyzing the mails causing errors separately with e.g.:
http://www.fastmail.fm/docs/sieve/sievetest.php
Maybe you can isolate the error there.
Tobi
Am 28.12.2009 um 14:34 schrieb Steve Wagner:
Ok ive tested it. The sieve script works as expected.
The only error message i have, come from procmail.log:
24918-Folder: /opt/dovecot/libexec/dovecot/deliver 3720 24919-procmail: Error while writing to "/opt/dovecot/libexec/dovecot/deliver" 24920:From KeineAntwortAdresse@web.de Tue Dec 8 07:19:55 2009
The procmail-deliver error logfile is empty and the normal log file dose not contains that error.
Do you have an idea how else i can get the error message?
Steve
Try using 'VERBOSE=on' in .procmailrc . Moreover I find it curious that, procmail tries to write to dovecot/deliver. This should be a binary file and no writing should occur to it. What does your .procmailrc look like?
Tobi
My procmailrc looks like this. I have a lot of my old mail filerings ruls commented out and this is the rest which is active:
- < 256000 | /usr/bin/spamc -U /var/run/spamd.sock
:0
- ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\* /dev/null
:0w
- ^X-Spam-Status: YES |~/.deliver-to-maildir seen .Junk/
:0
^List-Id: .*debian-arm.lists.debian.org { :0 fhw |sed -e 's/^Subject:[ ]*/Subject: [Debian-Arm] /'
:0 .Lists-Low.Debian/ }
:0 e { EXITCODE=75 HOST }
# Work around procmail bug: any output on stderr will cause the "F" in "From" # to be dropped. This will re-add it. :0
^^rom[ ] { LOG="*** Dropped F off From_ header! Fixing up. "
:0 fhw | sed -e '1s/^/F/' }
:0 w | /opt/dovecot/libexec/dovecot/deliver
Am 28.12.2009 14:57, schrieb Tobias Lang:
Am 28.12.2009 um 14:34 schrieb Steve Wagner:
Ok ive tested it. The sieve script works as expected.
The only error message i have, come from procmail.log:
24918-Folder: /opt/dovecot/libexec/dovecot/deliver 3720 24919-procmail: Error while writing to "/opt/dovecot/libexec/dovecot/deliver" 24920:From KeineAntwortAdresse@web.de Tue Dec 8 07:19:55 2009
The procmail-deliver error logfile is empty and the normal log file dose not contains that error.
Do you have an idea how else i can get the error message?
Steve
Try using 'VERBOSE=on' in .procmailrc . Moreover I find it curious that, procmail tries to write to dovecot/deliver. This should be a binary file and no writing should occur to it. What does your .procmailrc look like?
Tobi
Am 28.12.2009 um 15:09 schrieb Steve Wagner:
[snip]
:0 w | /opt/dovecot/libexec/dovecot/deliver
Looks uncritical to me. Although there is no default rule at the end of .procmailrc, Dovecot deliver and Sieve should reroute everything not catched by a rule to INBOX.
Did Procmails "VERBOSE=on" reveal something?
Tobi
On Mon, 2009-12-28 at 14:34 +0100, Steve Wagner wrote:
The only error message i have, come from procmail.log:
24918-Folder: /opt/dovecot/libexec/dovecot/deliver 3720 24919-procmail: Error while writing to "/opt/dovecot/libexec/dovecot/deliver" 24920:From KeineAntwortAdresse@web.de Tue Dec 8 07:19:55 2009
This probably means that deliver crashed. Maybe instead of executing deliver directly, you could execute deliver.sh that works something like:
#!/bin/sh
cd /tmp ulimit -c unlimited /opt/dovecot/libexec/dovecot/deliver $* code=$? if [ $code != 0 ]; then echo 'deliver failed' >> /tmp/deliver.err fi exit $code
Then see if deliver wrote a core file to /tmp or to user's home dir (if user has one). If you do get a core file, get gdb backtrace:
gdb /opt/dovecot/libexec/dovecot/deliver core bt full
Sorry for the late answer, i was quiet busy the time.
I now execute the script. I report back when the error occures next time.
Steve
Am 29.12.2009 22:19, schrieb Timo Sirainen:
On Mon, 2009-12-28 at 14:34 +0100, Steve Wagner wrote:
The only error message i have, come from procmail.log:
24918-Folder: /opt/dovecot/libexec/dovecot/deliver 3720 24919-procmail: Error while writing to "/opt/dovecot/libexec/dovecot/deliver" 24920:From KeineAntwortAdresse@web.de Tue Dec 8 07:19:55 2009
This probably means that deliver crashed. Maybe instead of executing deliver directly, you could execute deliver.sh that works something like:
#!/bin/sh
cd /tmp ulimit -c unlimited /opt/dovecot/libexec/dovecot/deliver $* code=$? if [ $code != 0 ]; then echo 'deliver failed' >> /tmp/deliver.err fi exit $code
Then see if deliver wrote a core file to /tmp or to user's home dir (if user has one). If you do get a core file, get gdb backtrace:
gdb /opt/dovecot/libexec/dovecot/deliver core bt full
Hi Timo, deliver works with the script and ive got some fails while using it, but the script dose not wrote anything.
Any further ideas?
Steve
On 29.12.2009 22:19, Timo Sirainen wrote:
On Mon, 2009-12-28 at 14:34 +0100, Steve Wagner wrote:
The only error message i have, come from procmail.log:
24918-Folder: /opt/dovecot/libexec/dovecot/deliver 3720 24919-procmail: Error while writing to "/opt/dovecot/libexec/dovecot/deliver" 24920:From KeineAntwortAdresse@web.de Tue Dec 8 07:19:55 2009
This probably means that deliver crashed. Maybe instead of executing deliver directly, you could execute deliver.sh that works something like:
#!/bin/sh
cd /tmp ulimit -c unlimited /opt/dovecot/libexec/dovecot/deliver $* code=$? if [ $code != 0 ]; then echo 'deliver failed'>> /tmp/deliver.err fi exit $code
Then see if deliver wrote a core file to /tmp or to user's home dir (if user has one). If you do get a core file, get gdb backtrace:
gdb /opt/dovecot/libexec/dovecot/deliver core bt full
Does procmail still log the same thing about "error writing to.."? Maybe a slightly different script:
#!/bin/sh
file=/tmp/deliver.date +%s
.$$
cd /tmp
cat > $file
ulimit -c unlimited
/opt/dovecot/libexec/dovecot/deliver $* < $file
code=$?
rm $file
if [ $code != 0 ]; then
echo 'deliver failed' >> /tmp/deliver.err
fi
exit $code
On Wed, 2010-01-13 at 10:40 +0100, Steve Wagner wrote:
Hi Timo, deliver works with the script and ive got some fails while using it, but the script dose not wrote anything.
Any further ideas?
Steve
On 29.12.2009 22:19, Timo Sirainen wrote:
On Mon, 2009-12-28 at 14:34 +0100, Steve Wagner wrote:
The only error message i have, come from procmail.log:
24918-Folder: /opt/dovecot/libexec/dovecot/deliver 3720 24919-procmail: Error while writing to "/opt/dovecot/libexec/dovecot/deliver" 24920:From KeineAntwortAdresse@web.de Tue Dec 8 07:19:55 2009
This probably means that deliver crashed. Maybe instead of executing deliver directly, you could execute deliver.sh that works something like:
#!/bin/sh
cd /tmp ulimit -c unlimited /opt/dovecot/libexec/dovecot/deliver $* code=$? if [ $code != 0 ]; then echo 'deliver failed'>> /tmp/deliver.err fi exit $code
Then see if deliver wrote a core file to /tmp or to user's home dir (if user has one). If you do get a core file, get gdb backtrace:
gdb /opt/dovecot/libexec/dovecot/deliver core bt full
participants (3)
-
Steve Wagner
-
Timo Sirainen
-
Tobias Lang