THREAD WARNING: exec() call to SQLitePlugin.backgroundExecuteSqlBatch blocked the main thread
I'm getting this error:
THREAD WARNING: exec() call to SQLitePlugin.backgroundExecuteSqlBatch blocked the main thread for 474ms. Plugin should use CordovaInterface.getThreadPool().
When doing sync() operation over stores with proxy sqlitestorage. When loading my app, i need to download almost 2000 records over 12 stores, and the error happens when the stores.sync() operation is called, blocking the UI thread.
This is an issue with the SQLite Plugin for Cordova, not the Sencha Touch proxy here. That said, it's best to use Sencha's own proxy with my custom overrides at this point.
On Wed, Sep 17, 2014 at 7:41 AM, Juan Luis Barreda <[email protected]
wrote:
I'm getting this error:
THREAD WARNING: exec() call to SQLitePlugin.backgroundExecuteSqlBatch blocked the main thread for 474ms. Plugin should use CordovaInterface.getThreadPool().
When doing sync() operation over stores with proxy sqlitestorage. When loading my app, i need to download almost 2000 records over 12 stores, and the error happens when the stores.sync() operation is called, blocking the UI thread.
— Reply to this email directly or view it on GitHub https://github.com/shepsii/SQLite-Proxy-ST2/issues/12.
So using sencha sql proxy with your overrides seems to be the solution. I have just a question. SQL proxy from sencha uses SQLite or WebSQL? Because I need to deal with SQLite.
Ok, I found the answer in the getDatabaseObject at the end of the Sql.js, you're managing the sqlitePlugin there. Ok, I'm going to test this overrides and give you the feedback,
thanks!
Yes which one you use depends on window. or sqlite. - the query language is the same and the latter requires the plugin. Hope this helps!
On Wed, Sep 17, 2014 at 8:08 AM, Juan Luis Barreda <[email protected]
wrote:
Ok, I found the answer in the getDatabaseObject at the end of the Sql.js, you're managing the sqlitePlugin there. Ok, I'm going to test this overrides and give you the feedback,
thanks!
— Reply to this email directly or view it on GitHub https://github.com/shepsii/SQLite-Proxy-ST2/issues/12#issuecomment-55856794 .
Hi @shepsii , everything is working fine with the override except two things:
- I'm still getting the thread warning, blocking the main thread even using last version of SQLiteplugin for cordova from @brodysoft (1.0.2)
- A strange situation is happening. When changing the active app in android, (i.e. when pressing the home button of the device) the app gets paused in android, and when it's resumed, it doesnt work, Android loads the app again, and debugging I can see the app is stopping when I do a store.load().(the plugin seems to open the db because in the console prints "DB opened: myDbName" )
Should I manage the onPause event to close any database?
Don't worry about the block main thread thing. That's just a warning. Just make sure if it's for a significant enough amount of time, that the UI is locked out for the user. There's no requirement to avoid that, it's just a piece of advice that the main thread was locked up.
I've not experienced your second issue there at all - this hasn't happened on my android builds so unable to help there I'm afraid!
On Tue, Sep 23, 2014 at 1:43 PM, Juan Luis Barreda <[email protected]
wrote:
Hi @shepsii https://github.com/shepsii , everything is working fine with the override except two things:
- I'm still getting the thread warning, blocking the main thread even using last version of SQLiteplugin for cordova from @brodysoft https://github.com/brodysoft (1.0.2)
- A strange situation is happening. When changing the active app in android, (i.e. when pressing the home button of the device) the app gets paused in android, and when it's resumed, it doesnt work, Android loads the app again, and debugging I can see the app is stopping when I do a store.load().
Should I manage the onPause event to close any database?
— Reply to this email directly or view it on GitHub https://github.com/shepsii/SQLite-Proxy-ST2/issues/12#issuecomment-56513675 .
I've debugged and I've seen the main thread is blocked while doing store.sync() operation with aprox 1000 registers, the thing is the UI is locked and app seems to be hang.
The second issue I'm trying to find out the reason.
That sounds like you are trying to do too much in one go! Without seeing the code though it's difficult to say. Sorry I can't be of much further help!
On Tue, Sep 23, 2014 at 2:30 PM, Juan Luis Barreda <[email protected]
wrote:
I've debugged and I've seen the main thread is blocked while doing store.sync() operation with aprox 1000 registers, the thing is the UI is locked and app seems to be hang.
The second issue I'm trying to find out the reason.
— Reply to this email directly or view it on GitHub https://github.com/shepsii/SQLite-Proxy-ST2/issues/12#issuecomment-56519324 .
Thank you anyway! I'll report the solution I hope soon!
My second issue was a bug that has been solved by @brodysoft on this issue https://github.com/brodysoft/Cordova-SQLitePlugin/issues/134 people with this problem must refer to this branch