You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2016/09/02 13:57:21 UTC

[jira] [Commented] (CB-11355) initPlugins() abuse borking plugins on (ajax) loads, and potential fix

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

ASF subversion and git services commented on CB-11355:
------------------------------------------------------

Commit cc9f2b03b7b64cf89561321c970cfa620640ce3a in cordova-ubuntu's branch refs/heads/4.3.x from [~dbarth]
[ https://git-wip-us.apache.org/repos/asf?p=cordova-ubuntu.git;h=cc9f2b0 ]

initPlugins only once; See CB-11355; Thanks to Pat Deegan for pointing that out


> initPlugins() abuse borking plugins on (ajax) loads, and potential fix
> ----------------------------------------------------------------------
>
>                 Key: CB-11355
>                 URL: https://issues.apache.org/jira/browse/CB-11355
>             Project: Apache Cordova
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: CordovaLib, Ubuntu
>         Environment: Ubuntu 15.10
> $ cordova -v
> 6.1.1
> $ nodejs -v
> v6.2.0
>            Reporter: Pat Deegan
>            Assignee: David Barth
>              Labels: easyfix, plugins, segfault, triaged, ubuntu
>
> I'm working on an (ubuntu) plugin that is thread-safe but was causing segfaults everytime I'd (asynch) load a new page or component.
> Trying to run it under gdb, I found that as long as I avoided moving around there were no issues, but every load of a new page or (html) popup would spawn a new thread and somehow re-init my plugin (which is stateful and needs to stay alive).
> The traces looked like so:
> ======================== snip ========================
> [New Thread 0x7fffcf8a9700 (LWP 26618)]
> Debug: Enable plugin "com.example.MyPlugin"
> Debug: Enable plugin "File"
> Debug: Enable plugin "Notification"
> Debug: Enable plugin "com.cordova.Device"
> Debug: Testing "/path/to/project/platforms/ubuntu/native/prefix/www/logo.png"
> [Thread 0x7fffcf8a9700 (LWP 26618) exited]
> Debug: Testing "/path/to/project/platforms/ubuntu/native/prefix/www/cordova.js"
> Debug: Testing "/path/to/project/platforms/ubuntu/native/prefix/www/cordova_plugins.js"
> Debug: Testing "/path/to/project/platforms/ubuntu/native/prefix/www/pageA.html"
> Debug: Testing "/path/to/project/platforms/ubuntu/native/prefix/www/pageB.html"
> Debug: Testing "/path/to/project/platforms/ubuntu/native/prefix/www/index.html"
> Debug: Testing "/path/to/project/platforms/ubuntu/native/prefix/www/libcoreplugins.so"
> [New Thread 0x7fffcf8a9700 (LWP 26619)]
> [Thread 0x7fffcf8a9700 (LWP 26619) exited]
> Debug: Enable plugin "com.example.MyPlugin"
> Debug: Enable plugin "File"
> Debug: Enable plugin "Notification"
> Debug: Enable plugin "com.cordova.Device"
> Debug: Testing "/path/to/project/platforms/ubuntu/native/prefix/www/logo.png"
> Debug: Testing "/path/to/project/platforms/ubuntu/native/prefix/www/cordova.js"
> Debug: Testing "/path/to/project/platforms/ubuntu/native/prefix/www/cordova_plugins.js"
> Debug: Testing "/path/to/project/platforms/ubuntu/native/prefix/www/pageA.html"
> Debug: Testing "/path/to/project/platforms/ubuntu/native/prefix/www/pageB.html"
> Debug: Testing "/path/to/project/platforms/ubuntu/native/prefix/www/index.html"
> Debug: Testing "/path/to/project/platforms/ubuntu/native/prefix/www/libcoreplugins.so"
> [New Thread 0x7fffcf8a9700 (LWP 26621)]
> Debug: Enable plugin "com.example.MyPlugin"
> Debug: Enable plugin "File"
> Debug: Enable plugin "Notification"
> Debug: Enable plugin "com.cordova.Device"
> Debug: Testing "/path/to/project/platforms/ubuntu/native/prefix/www/logo.png"
> [Thread 0x7fffcf8a9700 (LWP 26621) exited]
> Program received signal SIGSEGV, Segmentation fault.
> ======================== /snip ========================
> I tracked down the reason for all the (redundant?) "Enable plugin" events to initPlugins() calls in loadFinished() (in the Ubuntu package/src/cordova.cpp):
> void Cordova::loadFinished(bool ok) {
>     Q_UNUSED(ok)
>     initPlugins();
> }
> I'm not certain what the purpose of this call is, as the init already happens in Cordova::appLoaded().
> In any case, I've disabled the call and loadFinished() and my plugin is both persistent and has stopped causing segfaults.
> Is there a reason to keep this initPlugins() call in loadFinished()?  If so, could we add some kind of 
>    virtual bool loadOnlyOnce() { return false;}
> to the CPlugin base class so we can check for and skip plugins that override it?  Or is there some other technique I'm not aware of?
> Thanks,
> Pat Deegan



--
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