You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Michael Stanford (JIRA)" <ji...@apache.org> on 2014/09/04 20:58:52 UTC

[jira] [Commented] (CB-7109) exec() call to plugin blocked the main thread

    [ https://issues.apache.org/jira/browse/CB-7109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14121764#comment-14121764 ] 

Michael Stanford commented on CB-7109:
--------------------------------------

I get a ton of these in Xcode for the file plugin (Cordova 3.5-0.2.7):

2014-09-04 13:50:13.534 myapp[1867:60b] THREAD WARNING: ['Geolocation'] took '11.253174' ms. Plugin should use a background thread.
2014-09-04 13:50:19.098 myapp[1867:60b] Resetting plugins due to page load.
2014-09-04 13:50:19.578 myapp[1867:60b] Finished load of: file:///var/mobile/Applications/9DE39AC0-A201-49FD-ACBC-AC019684D656/myapp.app/www/talk/index.html
2014-09-04 13:50:21.402 myapp[1867:60b] THREAD WARNING: ['File'] took '24.826904' ms. Plugin should use a background thread.
2014-09-04 13:50:21.875 myapp[1867:60b] THREAD WARNING: ['File'] took '12.821777' ms. Plugin should use a background thread.
2014-09-04 13:50:22.075 myapp[1867:60b] THREAD WARNING: ['File'] took '22.020020' ms. Plugin should use a background thread.
2014-09-04 13:50:22.501 myapp[1867:60b] THREAD WARNING: ['File'] took '72.337891' ms. Plugin should use a background thread.
2014-09-04 13:50:22.527 myapp[1867:60b] THREAD WARNING: ['File'] took '15.635010' ms. Plugin should use a background thread.
2014-09-04 13:50:22.544 myapp[1867:60b] THREAD WARNING: ['File'] took '10.383301' ms. Plugin should use a background thread.
2014-09-04 13:50:22.792 myapp[1867:60b] THREAD WARNING: ['File'] took '123.376953' ms. Plugin should use a background thread.
2014-09-04 13:50:25.605 myapp[1867:60b] THREAD WARNING: ['File'] took '13.333984' ms. Plugin should use a background thread.
2014-09-04 13:51:09.578 myapp[1867:60b] Resetting plugins due to page load.


> exec() call to plugin blocked the main thread
> ---------------------------------------------
>
>                 Key: CB-7109
>                 URL: https://issues.apache.org/jira/browse/CB-7109
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android, Plugin File
>    Affects Versions: 3.5.0
>            Reporter: Rajesh Kumar
>            Priority: Minor
>
> In the file plugin of v3.5.0, I constantly see a warning in logcat in eclipse when I try to write to a file. The warning is:
> THREAD WARNING: exec() call to File.write blocked the main thread for 117ms. Plugin should use CordovaInterface.getThreadPool().
> Similar issue is when I try to exit app. I guess this issue is present for all the plugins. I checked the part of File plugin code:
> final String fname=args.getString(0);
>             final String data=args.getString(1);
>             final int offset=args.getInt(2);
>             final Boolean isBinary=args.getBoolean(3);
>             threadhelper( new FileOp( ){
>                 public void run() throws FileNotFoundException, IOException, NoModificationAllowedException {
>                     long fileSize = write(fname, data, offset, isBinary);
>                     callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, fileSize));
>                 }
>             }, callbackContext);
> And, threadhelper uses: 
> cordova.getThreadPool().execute(new Runnable() {
>     public void run() {}
> });
> This means, the plugin is using a thread to do some async task, but logcat throws the block warning. We need to fix this.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)