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 E61B510D4F for ; Fri, 21 Jun 2013 13:20:20 +0000 (UTC) Received: (qmail 9935 invoked by uid 500); 21 Jun 2013 13:20:20 -0000 Delivered-To: apmail-cordova-issues-archive@cordova.apache.org Received: (qmail 9906 invoked by uid 500); 21 Jun 2013 13:20:20 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 9895 invoked by uid 99); 21 Jun 2013 13:20:20 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Jun 2013 13:20:20 +0000 Date: Fri, 21 Jun 2013 13:20:19 +0000 (UTC) From: "Andrew Grieve (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CB-3927) Exec Can Fail to Issue Callback Immediately After onCordovaReady 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-3927?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13690265#comment-13690265 ] Andrew Grieve commented on CB-3927: ----------------------------------- Fix from Jeff in review: https://reviews.apache.org/r/12013/ Jeff has a patch that he'll upload which shows how to repro the bug on every start-up by disabling exec chaining and adding a sleep after the call to loadUrl(). Pretty crazy that this bug has been around ever since the switch to a JS Object-based bridge! > Exec Can Fail to Issue Callback Immediately After onCordovaReady > ---------------------------------------------------------------- > > Key: CB-3927 > URL: https://issues.apache.org/jira/browse/CB-3927 > Project: Apache Cordova > Issue Type: Bug > Components: Android, CordovaJS > Reporter: Jeffrey Willms > Assignee: Andrew Grieve > > If javascript issues an exec to native after waiting for onCordovaReady the exec can possibly fail to issue any callback. The bug is caused when CordovaWebViewClient.onPageStarted, which resets the NativeToJsMessageQueue, is called between native queuing the response message and the javascript polling for that response. While webView.loadUrl is called near the entry point of the app, the onPageStarted event can happen very far in the future, after cordova-ready. > These are the order of events that typically need to happen for this bug to manifest: > - webView.loadUrl is called near entry point of app > - At some point in the future after cordova-ready, exec is called by javascript > - Native handler processes exec but gets blocked before the response message can be added to the queue because another thread is currently accessing the queue > - Native exec returns without response > - Handler gets unblocked and adds the response message to the queue and signals to javascript that there are messages to be read > - CordovaWebViewClient.onPageStarted is called which resets the message queue > - javascript receives signal from native and polls for messages, but gets none in response because the queue was reset > The end result is that neither the success or failure callback of the exec ever gets issued. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira