[Bro-Dev] [JIRA] (BIT-1325) multiple sqlite writers to same db file yields "database is locked" error

Tony Cebzanov (JIRA) jira at bro-tracker.atlassian.net
Wed Mar 4 15:28:02 PST 2015

    [ https://bro-tracker.atlassian.net/browse/BIT-1325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=19915#comment-19915 ] 

Tony Cebzanov commented on BIT-1325:

What in particular is giving you the impression that the prepared statement that's locking the entire database for as long as the prepared statement is active?

Obviously not using prepared statements would be a non-starter performance-wise, but I feel like when the current code isn't even trying to catch the SQLITE_BUSY and SQLITE_LOCKED return codes, it's hard for me to accept the notion that it's a case of prepared statements being the problem.  Maybe catching SQLITE_BUSY and then retrying after some time would take care of things once the other writer is finished?

> multiple sqlite writers to same db file yields "database is locked" error
> -------------------------------------------------------------------------
>                 Key: BIT-1325
>                 URL: https://bro-tracker.atlassian.net/browse/BIT-1325
>             Project: Bro Issue Tracker
>          Issue Type: Problem
>          Components: Bro
>    Affects Versions: 2.3
>            Reporter: Tony Cebzanov
>              Labels: logging, sqlite
> I want to have multiple log streams logged to the same sqlite database, but when trying to log to sqlite using the following configuration:
> {code}
>     local filter: Log::Filter =
>         [
>         $name="sqlite_conn",
>         $path="analysis",
>         $config=table(["tablename"] = "conn"),
>         $writer=Log::WRITER_SQLITE
>         ];
>     Log::add_filter(Conn::LOG, filter);
>     local http_filter: Log::Filter =
>         [
>         $name="sqlite_http",
>         $path="analysis",
>         $config=table(["tablename"] = "http"),
>         $writer=Log::WRITER_SQLITE
>         ];
>     Log::add_filter(HTTP::LOG, http_filter);
> {code}
> I get the following error:
> {code}
> error: analysis/Log::WRITER_SQLITE: Error executing table creation statement: database is locked
> {code}

This message was sent by Atlassian JIRA

More information about the bro-dev mailing list