Mailing List Archive

spamd fails to remove bayes.lock file
Hello,

I have a problem with the /.spamassassin/bayes.lock

I see this error:

Oct 23 15:12:14 server spamd[18073]: bayes: cannot open bayes databases /.spamassassin/bayes_* R/W: lock failed: File exists
Oct 23 15:12:14 server spamd[18157]: bayes: cannot open bayes databases /.spamassassin/bayes_* R/W: lock failed: File exists
Oct 23 15:12:14 server spamd[18107]: bayes: cannot open bayes databases /.spamassassin/bayes_* R/W: lock failed: File exists


spamassassin -V
SpamAssassin version 3.4.1
running on Perl version 5.10.1

bayes_expiry_max_db_size 150000
bayes_learn_to_journal 1
bayes_auto_learn 0

# spamassassin

SPAMDOPTIONS="-u nobody -H --round-robin --min-children=30 --max-children=190 --min-spare=5 --max-spare=80 --timeout-child=120 --max-conn-per-child=100 -i -A IP"

# directory perms

ll -d /.spamassassin
drwxrwxrwx 3 nobody nobody 4096 oct 23 15:16 /.spamassassin

####################################################

Any idea how to solve it?

Regards,
Re: spamd fails to remove bayes.lock file [ In reply to ]
On Tue, 23 Oct 2018 18:16:51 +0000
Emanuel Gonzalez wrote:

> Hello,
>
> I have a problem with the /.spamassassin/bayes.lock
>
> I see this error:
>
> Oct 23 15:12:14 server spamd[18073]: bayes: cannot open bayes
> databases /.spamassassin/bayes_* R/W: lock failed: File exists Oct 23
> 15:12:14 server spamd[18157]: bayes: cannot open bayes
> databases /.spamassassin/bayes_* R/W: lock failed: File exists Oct 23
> 15:12:14 server spamd[18107]: bayes: cannot open bayes
> databases /.spamassassin/bayes_* R/W: lock failed: File exists

> bayes_expiry_max_db_size 150000
> bayes_learn_to_journal 1
> bayes_auto_learn 0

you may need to set

bayes_auto_expire 0

and do your expiry from cron using sa-learn


I've not seen it myself, but there is a known problem with auto-expiry.
It runs as part of an ordinary scan which can lead to it being
interrupted by a timeout.

I think the lock files will just time out eventually if the underlying
problem is fixed.
Re: spamd fails to remove bayes.lock file [ In reply to ]
On Tue, 23 Oct 2018, RW wrote:

> On Tue, 23 Oct 2018 18:16:51 +0000
> Emanuel Gonzalez wrote:
>
>> Hello,
>>
>> I have a problem with the /.spamassassin/bayes.lock
>>
>> I see this error:
>>
>> Oct 23 15:12:14 server spamd[18073]: bayes: cannot open bayes
>> databases /.spamassassin/bayes_* R/W: lock failed: File exists Oct 23
>> 15:12:14 server spamd[18157]: bayes: cannot open bayes
>> databases /.spamassassin/bayes_* R/W: lock failed: File exists Oct 23
>> 15:12:14 server spamd[18107]: bayes: cannot open bayes
>> databases /.spamassassin/bayes_* R/W: lock failed: File exists
>
>> bayes_expiry_max_db_size 150000
>> bayes_learn_to_journal 1
>> bayes_auto_learn 0
>
> you may need to set
>
> bayes_auto_expire 0
>
> and do your expiry from cron using sa-learn

This is best practice, yes.


What are the permissions on the files themselves?

--
John Hardin KA7OHZ http://www.impsec.org/~jhardin/
jhardin@impsec.org FALaholic #11174 pgpk -a jhardin@impsec.org
key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
No representation without taxation!
-----------------------------------------------------------------------
572 days since the first commercial re-flight of an orbital booster (SpaceX)
spamd fails to remove bayes.lock file [ In reply to ]
Hello.!!

I have a problem with the `/.spamassassin/bayes.lock`

This is the error I'm seeing :

Oct 23 15:12:14 server spamd[18073]: bayes: cannot open bayes databases
/.spamassassin/bayes_* R/W: lock failed: File exists
Oct 23 15:12:14 server spamd[18157]: bayes: cannot open bayes databases
/.spamassassin/bayes_* R/W: lock failed: File exists
Oct 23 15:12:14 server spamd[18107]: bayes: cannot open bayes databases
/.spamassassin/bayes_* R/W: lock failed: File exists


The command `spamassassin -V` is showing :

SpamAssassin version 3.4.1
running on Perl version 5.10.1

bayes_expiry_max_db_size 150000
bayes_learn_to_journal 1
bayes_auto_learn 0


128K bayes_journal
547M bayes_seen
4,0M bayes_toks


# spamassassin

SPAMDOPTIONS="-u nobody -H --round-robin --min-children=30
--max-children=190 --min-spare=5 --max-spare=80 --timeout-child=120
--max-conn-per-child=100 -i -A IP"

# directory perms

Also the command `ll -d /.spamassassin` is showing :

drwxrwxrwx 3 nobody nobody 4096 oct 23 15:16 /.spamassassin

I restart the service and it works, but the problem reappears again

Do you have any idea how to solve it?

Regards,
Re: spamd fails to remove bayes.lock file [ In reply to ]
On Wed, 24 Oct 2018, Emanuel Gonzalez wrote:

> Hello.!!
>
> I have a problem with the `/.spamassassin/bayes.lock`
>
> This is the error I'm seeing :
>
> Oct 23 15:12:14 server spamd[18073]: bayes: cannot open bayes databases
> /.spamassassin/bayes_* R/W: lock failed: File exists
> Oct 23 15:12:14 server spamd[18157]: bayes: cannot open bayes databases
> /.spamassassin/bayes_* R/W: lock failed: File exists
> Oct 23 15:12:14 server spamd[18107]: bayes: cannot open bayes databases
> /.spamassassin/bayes_* R/W: lock failed: File exists
>
>
> The command `spamassassin -V` is showing :
>
> SpamAssassin version 3.4.1
> running on Perl version 5.10.1
>
> bayes_expiry_max_db_size 150000
> bayes_learn_to_journal 1
> bayes_auto_learn 0
>
>
> 128K bayes_journal
> 547M bayes_seen
> 4,0M bayes_toks
>
>
> # spamassassin
>
> SPAMDOPTIONS="-u nobody -H --round-robin --min-children=30
> --max-children=190 --min-spare=5 --max-spare=80 --timeout-child=120
> --max-conn-per-child=100 -i -A IP"
>
> # directory perms
>
> Also the command `ll -d /.spamassassin` is showing :
>
> drwxrwxrwx 3 nobody nobody 4096 oct 23 15:16 /.spamassassin
>
> I restart the service and it works, but the problem reappears again
>
> Do you have any idea how to solve it?


As was suggested earlier, disable auto-expiry and run a cron job to expire
Bayes tokens.




--
John Hardin KA7OHZ http://www.impsec.org/~jhardin/
jhardin@impsec.org FALaholic #11174 pgpk -a jhardin@impsec.org
key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
Britain used to be the most powerful empire in the world.
Now they're terrified of pocketknives.
How the mighty have fallen. -- Matt Walsh
-----------------------------------------------------------------------
573 days since the first commercial re-flight of an orbital booster (SpaceX)
Re: spamd fails to remove bayes.lock file [ In reply to ]
Have you check permissions on './spamassassin'?

I had semiliar issue in the past!

Thanks,
Motty


On 10/24/18 8:10 AM, John Hardin wrote:
> On Wed, 24 Oct 2018, Emanuel Gonzalez wrote:
>
>> Hello.!!
>>
>> I have a problem with the `/.spamassassin/bayes.lock`
>>
>> This is the error I'm seeing :
>>
>>    Oct 23 15:12:14 server spamd[18073]: bayes: cannot open bayes
>> databases
>> /.spamassassin/bayes_* R/W: lock failed: File exists
>>    Oct 23 15:12:14 server spamd[18157]: bayes: cannot open bayes
>> databases
>> /.spamassassin/bayes_* R/W: lock failed: File exists
>>    Oct 23 15:12:14 server spamd[18107]: bayes: cannot open bayes
>> databases
>> /.spamassassin/bayes_* R/W: lock failed: File exists
>>
>>
>> The command `spamassassin -V` is showing :
>>
>>    SpamAssassin version 3.4.1
>>    running on Perl version 5.10.1
>>
>>    bayes_expiry_max_db_size 150000
>>    bayes_learn_to_journal 1
>>    bayes_auto_learn 0
>>
>>
>> 128K    bayes_journal
>> 547M    bayes_seen
>> 4,0M    bayes_toks
>>
>>
>>    # spamassassin
>>
>>    SPAMDOPTIONS="-u nobody -H --round-robin --min-children=30
>> --max-children=190 --min-spare=5 --max-spare=80 --timeout-child=120
>> --max-conn-per-child=100 -i -A IP"
>>
>>    # directory perms
>>
>> Also the command `ll -d /.spamassassin` is showing :
>>
>>    drwxrwxrwx 3 nobody nobody 4096 oct 23 15:16 /.spamassassin
>>
>> I restart the service and it works, but the problem reappears again
>>
>> Do you have any idea how to solve it?
>
>
> As was suggested earlier, disable auto-expiry and run a cron job to
> expire Bayes tokens.
>
>
>
>
Re: spamd fails to remove bayes.lock file [ In reply to ]
Hi.!!

the permits of the directory are correct:

ll -d /.spamassassin/
drwxrwxr-x 2 nobody nobody 63 oct 29 08:54 /.spamassassin/

The parameter bayes_auto_learn is set to "0".

any ideas?

Regards,

Emanuel.
Re: spamd fails to remove bayes.lock file [ In reply to ]
On Mon, 29 Oct 2018, Emanuel Gonzalez wrote:

> Hi.!!
>
> the permits of the directory are correct:
>
> ll -d /.spamassassin/
> drwxrwxr-x 2 nobody nobody 63 oct 29 08:54 /.spamassassin/
>
> The parameter bayes_auto_learn is set to "0".

The advice was for auto *expire*.


--
John Hardin KA7OHZ http://www.impsec.org/~jhardin/
jhardin@impsec.org FALaholic #11174 pgpk -a jhardin@impsec.org
key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
...the Fates notice those who buy chainsaws...
-- www.darwinawards.com
-----------------------------------------------------------------------
2 days until Halloween
Re: spamd fails to remove bayes.lock file [ In reply to ]
> John Hardin <jhardin@impsec.org> kirjoitti 24.10.2018 kello 18.10:
>
> On Wed, 24 Oct 2018, Emanuel Gonzalez wrote:
>
>> Hello.!!
>>
>> I have a problem with the `/.spamassassin/bayes.lock`
>>
>> This is the error I'm seeing :
>>
>> Oct 23 15:12:14 server spamd[18073]: bayes: cannot open bayes databases
>> /.spamassassin/bayes_* R/W: lock failed: File exists
>> Oct 23 15:12:14 server spamd[18157]: bayes: cannot open bayes databases
>> /.spamassassin/bayes_* R/W: lock failed: File exists
>> Oct 23 15:12:14 server spamd[18107]: bayes: cannot open bayes databases
>> /.spamassassin/bayes_* R/W: lock failed: File exists
>>
>>
>> The command `spamassassin -V` is showing :
>>
>> SpamAssassin version 3.4.1
>> running on Perl version 5.10.1
>>
>> bayes_expiry_max_db_size 150000
>> bayes_learn_to_journal 1
>> bayes_auto_learn 0
>>
>>
>> 128K bayes_journal
>> 547M bayes_seen
>> 4,0M bayes_toks
>>
>>
>> # spamassassin
>>
>> SPAMDOPTIONS="-u nobody -H --round-robin --min-children=30
>> --max-children=190 --min-spare=5 --max-spare=80 --timeout-child=120
>> --max-conn-per-child=100 -i -A IP"
>>
>> # directory perms
>>
>> Also the command `ll -d /.spamassassin` is showing :
>>
>> drwxrwxrwx 3 nobody nobody 4096 oct 23 15:16 /.spamassassin
>>
>> I restart the service and it works, but the problem reappears again
>>
>> Do you have any idea how to solve it?
>
>
> As was suggested earlier, disable auto-expiry and run a cron job to expire Bayes tokens.
>


I seem to have auto expiry on, but have not seen any problems with it.

jarif@gamecock ~ $ sudo egrep "bayes|expir" /etc/spamassassin/local.cf
use_bayes 1
#bayes_store_module Mail::SpamAssassin::BayesStore::SQL
#bayes_sql_dsn DBI:mysql:spamassassin:dbsrv.fredriksson.dy.fi
#bayes_sql_username spamassassin
#bayes_sql_password *munged*
#bayes_sql_override_username spam
#bayes_expiry_max_db_size 1500000
#bayes_auto_expire 0
bayes_store_module Mail::SpamAssassin::BayesStore::Redis
bayes_sql_dsn server=192.168.1.124:6379;password=*munged*;database=2
bayes_token_ttl 21d
bayes_seen_ttl 8d
bayes_auto_expire 1
bayes_auto_learn 1
bayes_learn_to_journal 0
bayes_ignore_from *@spamassassin.apache.org
bayes_ignore_to *@spamassassin.apache.org

br. jarif
Re: spamd fails to remove bayes.lock file [ In reply to ]
On Tue, 30 Oct 2018 17:27:18 +0200
Jari Fredriksson wrote:

> > John Hardin <jhardin@impsec.org> kirjoitti 24.10.2018 kello 18.10:

> > As was suggested earlier, disable auto-expiry and run a cron job to
> > expire Bayes tokens.
>
>
> I seem to have auto expiry on, but have not seen any problems with it.

Expiry with Redis is very different, and only auto-expiry is supported.
Re: spamd fails to remove bayes.lock file [ In reply to ]
On Tue, 30 Oct 2018, RW wrote:

> On Tue, 30 Oct 2018 17:27:18 +0200
> Jari Fredriksson wrote:
>
>>> John Hardin <jhardin@impsec.org> kirjoitti 24.10.2018 kello 18.10:
>
>>> As was suggested earlier, disable auto-expiry and run a cron job to
>>> expire Bayes tokens.
>>
>>
>> I seem to have auto expiry on, but have not seen any problems with it.
>
> Expiry with Redis is very different, and only auto-expiry is supported.

Ah, okay, then take that "best practice" suggestion as "modulo redis". :)


--
John Hardin KA7OHZ http://www.impsec.org/~jhardin/
jhardin@impsec.org FALaholic #11174 pgpk -a jhardin@impsec.org
key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
...the Fates notice those who buy chainsaws...
-- www.darwinawards.com
-----------------------------------------------------------------------
Tomorrow: Halloween