Skip to content

Using luasql-sqlite3 in multithreaded applications #88

Description

@Aditya23456

Hi,

I am using Lua lanes to run 3 threads. I am using luasqlite-3 database to store the data collected by these threads. I can have my 3 threads independently reading data simultaneously from the db but when I try to write on db from more than 1 thread I get "LuaSQL: database is locked thread: 0xb6f35c10 tcp{client}: 0xb6e8f1a0" error. Is Luasqlite-3 threadsafe? The only way I see is to write a separate thread dedicated for db connections and make other threads send data to it. This is not scalable and requires many implementation details. Also, I have written an independent script which accesses the database for readings and runs as a separate process. Even this independent script can't access the sqllite database when my multithreaded application is running and gives error LuaSQL: database is locked. I read online that compiling SQLite with the threadsafe tag or configuring it during runtime will help. Can anyone put some light on how to make Luasqlite-3 multi-threaded? I see all 3 threads have different environment object.
Thanks,
Aditya

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions