Skip to content
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

sqlite can be non-reenterant #32

Closed
sergeych opened this issue Sep 10, 2011 · 2 comments
Closed

sqlite can be non-reenterant #32

sergeych opened this issue Sep 10, 2011 · 2 comments

Comments

@sergeych
Copy link

Just found that running a resultset in one thread and executeQuery in another often causes crash in the sqlite code. Typical crash stack is:

Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsqlite3.dylib 0x3265929c sqlite3_extended_errcode + 18104
1 libsqlite3.dylib 0x32659342 sqlite3_extended_errcode + 18270
2 libsqlite3.dylib 0x3266cc08 sqlite3_column_bytes16 + 7160
3 libsqlite3.dylib 0x32687002 sqlite3_open16 + 42242
4 libsqlite3.dylib 0x32644954 sqlite3_step + 56
5 iGlomp 0x00010d46 -FMResultSet next

Well, it might depend on the sqlite version, but I'd better add a mutex to all sqlite calls. Does a new thread contain a workaround fot it already?

@ccgus
Copy link
Owner

ccgus commented Sep 10, 2011

Check out the threadtests branch:
https://github.com/ccgus/fmdb/tree/threadtests

Instead of using the same FMDatabase instance, make a pool and use that for thread safety.

@ccgus ccgus closed this as completed Sep 10, 2011
@sergeych
Copy link
Author

thanks, it works.

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

No branches or pull requests

2 participants