[horde] IMP IMAP DB Cache backend lifetime
Jan Schneider
jan at horde.org
Mon Aug 28 08:10:27 UTC 2017
Zitat von Joao S Veiga <jsveiga at rf.com.br>:
> Hello,
>
> I noticed my mysql cpu usage was high, and tracked it down to a
> deadlock on an IMP IMAP cache delete:
>
> 2017-08-24 16:41:42 ERR: HORDE [imp] SQL QUERY FAILED: Deadlock
> found when trying to get lock; try restarting transaction
> DELETE FROM horde_imap_client_message WHERE messageid IN (SELECT
> messageid FROM horde_imap_client_data d WHERE d.hostspec = 'localhost'
> AND d.port = '143' AND d.username = 'james.sousa' AND d.mailbox = '01
> ESTRUTURA ARQ') AND (msguid = '6461' OR msguid = '6494' OR msguid =
> '6495' OR msguid = '6496' OR msguid = '6497' OR msguid = '6498' OR
> msguid = '6499' OR msguid = '6500' OR msguid = '6501' OR msguid =
> [...]
>
> I deleted the imap cache tables on mysql manually and all is ok (but
> there were 137k entries in the message cache, and I have less than
> 50 users) but while trying to solve this I noticed two things:
>
> 1 - horde-clear-cache does not clear the IMP IMAP DB cache tables
> (horde_imap_client_data, horde_imap_client_metadata,
> horde_imap_client_message). Is there a script for clearing these
> tables, or doing it via sql is the only way?
imp-query-imap-cache
> 2 - the Db.php backend
> (framework/Imap_Client/lib/Horde/Imap/Client/Cache/Backend/Db.php)
> does have a clear($lifetime) function, but I couldn't find where is
> it called. Who is supposed to call that?
See above.
> 3 - it seems there's a missing ")" in that function at the DELETE
> statement (line 320 at
> https://github.com/horde/horde/blob/master/framework/Imap_Client/lib/Horde/Imap/Client/Cache/Backend/Db.php):
>
> $purge = time() - $lifetime;
> $sql = 'DELETE FROM %s WHERE messageid IN (SELECT messageid FROM %s
> WHERE modified < ?';
> foreach (array(self::MD_TABLE, self::MSG_TABLE) as $val) {
>
> I've searched for an sql error in the logs and couldn't find one for
> this statement, so maybe it's never called?
Indeed, fixed for the next release.
It's only called when using the --lifetime parameter with
imp-query-imap-cache.
--
Jan Schneider
The Horde Project
https://www.horde.org/
More information about the horde
mailing list