Return-Path: X-Original-To: apmail-cordova-issues-archive@minotaur.apache.org Delivered-To: apmail-cordova-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 63C5A10651 for ; Mon, 5 Jan 2015 18:53:34 +0000 (UTC) Received: (qmail 54406 invoked by uid 500); 5 Jan 2015 18:53:35 -0000 Delivered-To: apmail-cordova-issues-archive@cordova.apache.org Received: (qmail 54379 invoked by uid 500); 5 Jan 2015 18:53:35 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 54364 invoked by uid 99); 5 Jan 2015 18:53:35 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Jan 2015 18:53:35 +0000 Date: Mon, 5 Jan 2015 18:53:35 +0000 (UTC) From: "Ian Clelland (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CB-7109) exec() call to plugin blocked the main thread MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CB-7109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14264903#comment-14264903 ] Ian Clelland commented on CB-7109: ---------------------------------- It doesn't look like any code has been committed to the file plugin. It still parses JSON on the main thread, in the master branch. Agreed that we should keep this issue on-topic, and open others for other (core) plugins if they are also slowed by JSON args handling. Non-core plugins are best handled through education and documentation. If overriding the String version of {{execute}} is better for plugins which handle large JSON payloads, then we should mention that on the plugin development pages. > 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) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org For additional commands, e-mail: issues-help@cordova.apache.org