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

THREAD WARNING: exec() call to SQLitePlugin.backgroundExecuteSqlBatch blocked the main thread #12

Open
ghost opened this issue Sep 17, 2014 · 10 comments

Comments

@ghost
Copy link

ghost commented Sep 17, 2014

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.

@shepsii
Copy link
Owner

shepsii commented Sep 17, 2014

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
#12.

@ghost
Copy link
Author

ghost commented Sep 17, 2014

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.

@ghost
Copy link
Author

ghost commented Sep 17, 2014

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!

@shepsii
Copy link
Owner

shepsii commented Sep 17, 2014

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
#12 (comment)
.

@ghost
Copy link
Author

ghost commented Sep 23, 2014

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?

@shepsii
Copy link
Owner

shepsii commented Sep 23, 2014

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
#12 (comment)
.

@ghost
Copy link
Author

ghost commented Sep 23, 2014

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.

@shepsii
Copy link
Owner

shepsii commented Sep 23, 2014

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
#12 (comment)
.

@ghost
Copy link
Author

ghost commented Sep 23, 2014

Thank you anyway! I'll report the solution I hope soon!

@ghost
Copy link
Author

ghost commented Sep 23, 2014

My second issue was a bug that has been solved by @brodysoft on this issue storesafe/cordova-sqlite-storage#134 people with this problem must refer to this branch

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

1 participant