On 01/10/2018 09:28 PM, Sebastian Wolfgarten wrote:
> Hi,
>
> I am uncertain as to what’s causing the DB to get locked - I am also running 
> Roundcube (webmail) on the server, maybe that’s the reason. I will check the 
> permission roundcube uses to access the db, I think it can be read-only which 
> will hopefully fix the locking issue.
>
> As a feature request, would it maybe make sense to add a waiting period to be 
> able to wait for the lock for 1-2 seconds and then retry with the database 
> query?
>
> Thanks.
>
> Kind regards
> Sebastian
>
>> Am 10.01.2018 um 21:15 schrieb Wietse Venema <wie...@porcupine.org>:
>>
>> Sebastian Wolfgarten:
>>> Dear all,
>>>
>>> I am running postfix 3.3 and recently migrated all my virtual
>>> domains from MySQL to Sqlite for performance reasons. So far,
>>> everything works fine however up to 5-8 times a day, I am seeing
>>> an error message in my mail.log saying that the Sqlite 3 database
>>> may be locked. Here is an example:
>> So what is locking the database? The query as shown does not attempt
>> to modify the database. Note that the query fails immediately, there
>> is no attempt to wait for a lock to be released.
>>
>>      Wietse
>>
>>> Jan 10 18:00:45 waldfest postfix/smtpd[88198]: 3D13F5076C7: 
>>> client=spring-chicken-bi.twitter.com[199.16.156.174]
>> ...
>>> Jan 10 18:00:45 waldfest postfix/cleanup[88252]: fatal: dict_sqlite_lookup: 
>>> /etc/postfix/sqlite_virtual_alias_maps.cf: SQL finalize failed for query 
>>> 'SELECT goto FROM alias WHERE address='pre...@freizeitpark-erlebnis.de' AND 
>>> active = '1'': database is locked?

Could be useful to see the return code from sqlite3_step. If this is
different to SQLITE_DONE or SQLITE_ROW then the warning message is
triggered. When using sqlite3_step() after the sqlite3_prepare_v2()
function the return code can contain extended error information.

https://www.sqlite.org/rescode.html

If you're able to compile from source:

--- dict_sqlite.c    2015-01-11 17:52:40.000000000 +0100
+++ dict_sqlite_new.c    2018-01-10 21:55:12.149559110 +0100
@@ -244,8 +244,8 @@
     }
     /* Fix 20100616 */
     else {
-        msg_warn("%s: %s: SQL step failed for query '%s': %s\n",
-             myname, dict_sqlite->parser->name,
+        msg_warn("%s: %s: SQL step failed with result %d for query
'%s': %s\n",
+             myname, dict_sqlite->parser->name,status,
              vstring_str(query), sqlite3_errmsg(dict_sqlite->db));
         dict->error = DICT_ERR_RETRY;
         break;

John

Reply via email to