> On Jan 10, 2018, at 7:45 PM, Wietse Venema <wie...@porcupine.org> wrote:
> 
>> 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.
> 
> It certainly looks like a problem specific to your setup. The Postfix
> sqlite client has been around since Postfix 2.8 and it has hardly
> changed.
> 
>> 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?
> 
> The only lock that can prevent sqlite from reading is a write lock,
> and there is nothing in Postfix that generate an sqlite write request.
> 
> Look at the file modification time. Did the file change recently?
> 
> Let's find out more about the error first. See John Fawcett's suggestion.

SQLite is designed primarily for embedded access and writers acquire
exclusive locks when making updates, or merging the write-ahead-log
into the database ...  Read-only users need to be willing to retry
database operations when it is locked by a writer.  The easiest way
to do that is by making the first raw SQL command at the start of a
connection a pragma to set a busy timeout:

    https://www.sqlite.org/pragma.html#pragma_busy_timeout

    PRAGMA busy_timeout = milliseconds

For a database with email-related info large transactions
and long write-locks should be rare, so 1000ms or so should
be enough.

-- 
        Viktor.

Reply via email to