Swift-Kuery-SQLite icon indicating copy to clipboard operation
Swift-Kuery-SQLite copied to clipboard

[Issue] libsqlite3.dylib: illegal multi-threaded access to database connection?

Open diuming opened this issue 5 years ago • 0 comments

macOS 10.15.6 Xcode 11.6

How do i resolve this problem?

[logging] BUG IN CLIENT OF libsqlite3.dylib: illegal multi-threaded access to database connection

self.pool = SQLiteConnection.createPool(filename: self.fileName,
                                        poolOptions: ConnectionPoolOptions(initialCapacity: 10,
                                                                           maxCapacity: 30))
Database.default = Database(pool)

Could update SQLiteConnection.swift ?

public static func createPool(_ location: Location = .inMemoryShared, poolOptions: ConnectionPoolOptions) -> ConnectionPool {
    let connectionGenerator: () -> Connection? = {
        let connection = SQLiteConnection(location)
        //if sqlite3_open(location.description, &connection.connection) != SQLITE_OK {
        if sqlite3_open_v2(location.description, &connection.connection, SQLITE_OPEN_FULLMUTEX | SQLITE_OPEN_READWRITE |  SQLITE_OPEN_CREATE, nil) != SQLITE_OK {
            return nil
        }
.
.
.

diuming avatar Oct 26 '20 08:10 diuming