Hi all,

On a regular basis at around 3am most mornings the following message is logged 
to syslog.

2013-02-09 03:30:31
(78636-03) (!!)TROUBLE in check_mail: gen_mail_id FAILED: find_or_save_addr: 
failed to insert addr [email protected]: sql exec: err=1205, HY000, DBD::mysql::st 
execute failed: Lock wait timeout exceeded; try restarting transaction at (eval 
114) line 172. at (eval 115) line 115.

During this time I have a script which runs to tidy up the databases...

[Sat, 09 Feb 2013 03:27:36 +0000] Preforming "DELETE FROM amavisd_msgs WHERE 
time_num < UNIX_TIMESTAMP() - 28*24*60*60;" 
[Sat, 09 Feb 2013 03:28:11 +0000] Preforming "DELETE FROM amavisd_msgs WHERE 
time_num < UNIX_TIMESTAMP() - 60*60 AND content IS NULL;" 
[Sat, 09 Feb 2013 03:28:34 +0000] Preforming "DELETE FROM amavisd_maddr WHERE 
NOT EXISTS (SELECT 1 FROM amavisd_msgs    WHERE sid=maddr_id) AND NOT EXISTS 
(SELECT 1 FROM amavisd_msgrcpt WHERE rid=maddr_id);" 
[Sat, 09 Feb 2013 03:28:39 +0000] Preforming "DELETE amavisd_quarantine FROM 
amavisd_quarantine LEFT JOIN amavisd_msgs USING(mail_id) WHERE 
amavisd_msgs.mail_id IS NULL;" 
[Sat, 09 Feb 2013 03:30:13 +0000] Preforming "DELETE amavisd_msgrcpt FROM 
amavisd_msgrcpt LEFT JOIN amavisd_msgs USING(mail_id) WHERE 
amavisd_msgs.mail_id IS NULL;" 
[Sat, 09 Feb 2013 03:30:31 +0000] Preforming "DELETE FROM amavisd_maddr WHERE 
NOT EXISTS (SELECT 1 FROM amavisd_msgs    WHERE sid=maddr_id) AND NOT EXISTS 
(SELECT 1 FROM amavisd_msgrcpt WHERE rid=maddr_id);" 
[Sat, 09 Feb 2013 03:30:35 +0000] Preforming "OPTIMIZE TABLE amavisd_msgs, 
amavisd_msgrcpt, amavisd_quarantine, amavisd_maddr;" 
[Sat, 09 Feb 2013 03:36:25 +0000] Preforming "DELETE FROM bayes_seen WHERE 
bayes_seen.lastupdate <= DATE_SUB(NOW(),INTERVAL 28 DAY);" 
[Sat, 09 Feb 2013 03:36:27 +0000] Preforming "DELETE FROM bayes_token WHERE 
bayes_token.atime <= UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL 28 DAY));" 
[Sat, 09 Feb 2013 03:37:13 +0000] Preforming "OPTIMIZE TABLE bayes_seen, 
bayes_token" 
[Sat, 09 Feb 2013 03:39:38 +0000] Preforming "FLUSH TABLES;"

I just wondering how long amavis waits for a lock on a MySQL database table and 
is there is any way to override it?

The message is simply deferred and it's retried (and sent without problems) 
about 5 mins later.

Thanks

Steve


DISCLAIMER
This email is for the use of the intended recipient(s) only. If you have 
received this email in error, please notify the sender immediately and then 
delete it. 
If you are not the intended recipient, you must not keep, use, disclose, copy 
or distribute this email without the author’s prior permission. 
We have taken precautions to minimise the risk of transmitting software 
viruses, but we advise you to carry out your own virus checks on any attachment 
to this message.
We cannot accept liability for any loss or damage caused by software viruses.
The information contained in this communication may be confidential and may be 
subject to the attorney-client privilege. 
If you are the intended recipient and you do not wish to receive similar 
electronic messages from us in future then please respond to the sender to this 
effect.


Reply via email to