Re: [exim] Bug#360696: Failed to get write lock for/var/spoo…

Top Page
Delete this message
Reply to this message
Author: Michel Meyers
Date:  
To: Matthew Byng-Maddick, 360696-quiet
CC: exim-users, 360696-submitter
Old-Topics: Re: [exim] Failed to get write lock for/var/spool/exim4/db/retry.lockfile: timed out
Subject: Re: [exim] Bug#360696: Failed to get write lock for/var/spool/exim4/db/retry.lockfile:timed out
Matthew Byng-Maddick wrote:
> On Wed, Apr 26, 2006 at 09:39:15AM +0100, Philip Hazel wrote:
>> Ah! I don't know much about mailscanner. Am I right in thinking it looks
>> at Exim's spool files itself? If so, then indeed it may have something
>> to do with this.
>
> Yes, it does.
>
> Which is why it needs to know (and care) about the spool file format. It
> ends up moving the queue files from one directory to another, and prodding
> exim to deliver from the second (using -Mc).


I might be wrong but as far as I know it doesn't. Amavis basically works
as an SMTP loop here:

1. Exim receives the message through port 25
2. Exim checks the 'received protocol' and 'interface_port' to see
whether the message comes from the scanner or Spamassassin or not.

  amavis:
         no_verify
   # added for TMDA
   local_part_suffix= -*
   local_part_suffix_optional
   check_local_user
         driver = manualroute
        condition = "${if or {{eq {$interface_port}{10025}} \
                          {eq {$received_protocol}{spam-scanned}} \
                          {eq {$sender_address}{}} \
                         }{0}{1}}"
         # if scanning incoming mails, uncomment the following line and
         # change local_domains accordingly
         domains = +local_domains
         transport = amavis
         route_list = "* localhost byname"
         self = send



If neither is true, it forwards it to the scanner using an SMTP transport:

  amavis:
         driver = smtp
         port = 10024
         allow_localhost


The scanner listens to port 10024 and later returns the message to port
10025 (exim is listening to that one as well).

So far, there's no reason to care or touch the lockfile (except for
whatever Exim does with it of course).

3. if one of the two is true it goes to the next step: check whether the
message was spam-scanned already:

spamcheck_router:
no_verify
# added for TMDA
local_part_suffix= -*
local_part_suffix_optional
check_local_user
# When to scan a message :
# - it isn't already flagged as spam
# - it isn't already scanned
condition = "${if and { {!def:h_X-Spam-Flag:} {!eq
{$received_protocol}{spam-scanned}}} {1}{0}}"
driver = accept
transport = spamcheck

If not spam-scanned already, give it to Spamassassin using a pipe:

spamcheck:
     driver = pipe
     command = /usr/sbin/exim4 -oMr spam-scanned -bS
     use_bsmtp = true
     transport_filter = /usr/bin/spamc
     home_directory = "/tmp"
     current_directory = "/tmp"
     # must use a privileged user to set $received_protocol on the way
back in!
     user = Debian-exim
     group = Debian-exim
     log_output = true
     return_fail_output = true
     return_path_add = false
     message_prefix =
     message_suffix =


This could be where the second 'cannot get lock' message gets generated.
(the above command seems to infer that exim gets called here)

4. After returning from Spamassassin, the mail goes through the rest of
the routers.

A complete delivery cycle thus looks like this:

2006-04-26 12:35:15 1FYhMZ-0004mu-Rf <= service@indomain H=indomain
(mail.indomain) [82.149.xx.xx] P=esmtp S=1992
2006-04-26 12:35:29 1FYhMn-0004vQ-Hs <= service@indomain H=localhost
[127.0.0.1] P=esmtp S=2522
2006-04-26 12:35:29 1FYhMZ-0004mu-Rf => user@mydomain R=amavis T=amavis
H=localhost [127.0.0.1]
2006-04-26 12:35:29 1FYhMZ-0004mu-Rf Completed
2006-04-26 12:35:53 1FYhMn-0004vj-OH <= service@indomain U=Debian-exim
P=spam-scanned S=2930 id=E1FYhMn-0004vQ-Hs@mydomain
2006-04-26 12:35:53 1FYhMn-0004vj-OH => user <user@mydomain>
R=local_user T=mail_spool
2006-04-26 12:35:53 1FYhMn-0004vj-OH Completed
2006-04-26 12:35:53 1FYhMn-0004vQ-Hs => user <user@mydomain>
R=spamcheck_router T=spamcheck
2006-04-26 12:35:53 1FYhMn-0004vQ-Hs Completed

The received lines (in reverse order) then look as follows:

Received: from localhost ([127.0.0.1])
    by mydomain with esmtp (Exim 4.61)
    (envelope-from <service@indomain>)
    id 1FYhMn-0004vQ-Hs
    for user@mydomain; Wed, 26 Apr 2006 12:35:29 +0200
Received: from mydomain ([127.0.0.1])
    by localhost (mydomain [127.0.0.1]) (amavisd-new, port 10024)
    with ESMTP id 30697-10 for <user@mydomain>;
    Wed, 26 Apr 2006 12:35:16 +0200 (CEST)
Received: from indomain ([82.149.xx.xx] helo=mail.indomain)
    by mydomain with esmtp (Exim 4.61)
    (envelope-from <service@indomain>)
    id 1FYhMZ-0004mu-Rf
    for user@mydomain; Wed, 26 Apr 2006 12:35:15 +0200


Greetings,
        Michel