Skip to content

Crash when accessing in multi-threaded environment #813

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sree127 opened this issue Jun 4, 2018 · 12 comments
Open

Crash when accessing in multi-threaded environment #813

sree127 opened this issue Jun 4, 2018 · 12 comments
Labels

Comments

@sree127
Copy link

sree127 commented Jun 4, 2018

Build Information

Application is written in Swift 4
Using SQLite.swift 0.11.4 via CocoaPods
Xcode 9.3.1

Crash Information

I'm experiencing a crash in sqlite3_prepare_v2 which gets called from Connection.prepare or Connection.pluck on devices running iOS 9 & iOS 10. The connections are accessed in a multi-threaded environment and works fine on iOS 11 and above.

Below is a screenshot of the exact place where the crash happens:

What might be the possible reason for this. TIA

screen shot 2018-06-04 at 18 32 32

@deepti82
Copy link

In my app also same issue occur. any fix on it?

@pigmasha
Copy link

pigmasha commented Jun 19, 2018

ios9: the following code crashes in connection.scalar method with
Thread 7: EXC_BREAKPOINT (code=EXC_ARM_BREAKPOINT, subcode=0xdefe)

let connection = try! Connection(fullPath)
try! connection.run("CREATE TABLE Records (id INTEGER, name TEXT NOT NULL)")

for _ in 0 ..< 100 {
    DispatchQueue.global().async {
        _ = try? connection.scalar("SELECT COUNT(*) FROM Records")
    }
}
DispatchQueue.global().async {
    try! connection.transaction(.exclusive) {
        try connection.run(Table("Records").drop(ifExists: true))
    }
}

@wasitu
Copy link

wasitu commented Jul 12, 2018

This does not happen on Xcode9.2.
I checked it by switching Xcode.
But I'm not sure.

@lpioneer
Copy link

I got the same problem as "sree127". However, it was fixed with xcode9.2. Please note.

@wukongzhikong
Copy link

XCode 10, iOS 9.3, Simulator, still crash in sqlite3_prepare_v2.

@wukongzhikong
Copy link

It's ok on iOS 10.3.1 simulator.

@YanPengImp
Copy link

I had the same problem on iOS9 simulator, multi-thread use one Connection call sqlite3_prepare_v2.

@makleso6
Copy link

makleso6 commented Sep 6, 2019

Connection.txt
This patch helps me

@lorenzomalferrari
Copy link

Where did you apply the patch? I have the same problem and I can't solve it

@khsalman
Copy link

khsalman commented Feb 4, 2021

Still having the crash in XCode 12.4. I was using multiple thread. On single thread it works fine but crash on using multiple threads

@bridger
Copy link

bridger commented Apr 1, 2021

I'm also seeing this issue with Xcode 12 and multiple threads. I'm not sure if this is due to an Xcode change or a SQLite.swift change.

@jberkel jberkel changed the title crash in sqlite3_prepare_v2 [iOS 9 and iOS 10] Crash when accessing in multi-threaded environment Aug 25, 2021
@jberkel
Copy link
Collaborator

jberkel commented Aug 25, 2021

#259 perhaps related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests