storesafe / cordova-sqlite-storage

A Cordova/PhoneGap plugin to open and use sqlite databases on Android, iOS and Windows with HTML5/Web SQL API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iOS threading issue with openDatabase?

craig-at-rsg opened this issue · comments

I have intermittent crashes when my app starts up on iOS, and my guess is it's related to calling openDatabase from different places. I need to restart my app multiple times before I hit this. Here's a screenshot - if this doesn't point to the cause, let me know and I'll try creating a test app.

screen shot 2017-09-05 at 4 37 38 pm

openDBs is an NSMutableDictionary, which isn't designed for thread safety...

I used a thread safe dictionary (https://gist.github.com/steipete/5928916) in my local build for openDBs, and that fixed the problem I was seeing. I tried to branch this plugin, but I haven't gotten that working yet..

Marking this as a bug, with possible data loss risk. Will integrate the proposed workaround / solution in the near future.

Proposed workaround solution and flag fix for #703 are now integrated with cordova-sqlite-ext, will be integrated with this version in the near future.

Proposed workaround solution is now integrated with this plugin version (cordova-sqlite-storage), will be merged into the other plugin versions in the near future. Thanks again for the contribution.