cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Omar Mefire (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CB-9278) Restoring multiple platforms fails
Date Wed, 15 Jul 2015 21:37:04 GMT

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

Omar Mefire edited comment on CB-9278 at 7/15/15 9:36 PM:
----------------------------------------------------------

This issue is due to the npmhelper.loadWithSettingsThenRestore function (https://github.com/apache/cordova-lib/blob/master/cordova-lib/src/util/npm-helper.js#L34)
initializing global values (used across multiple function calls) and javascript/node.js being
reentrant.

There is a kind of 'race condition' which arises when we try and restore multiple platforms.

The solution here would be to run the function we pass to npmhelper.loadWithSettingsThenRestore()
synchronously and not have it interrupted.(https://github.com/apache/cordova-lib/blob/master/cordova-lib/src/cordova/lazy_load.js#L162)


was (Author: omefire):
This issue is due to the npmhelper.loadWithSettingsThenRestore function (https://github.com/apache/cordova-lib/blob/master/cordova-lib/src/util/npm-helper.js#L34)
initializing global values (used across multiple function calls) and javascript/node.js being
reentrant.

There is a kind of 'race condition' which arises when we try and restore multiple platforms.


> Restoring multiple platforms fails
> ----------------------------------
>
>                 Key: CB-9278
>                 URL: https://issues.apache.org/jira/browse/CB-9278
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CordovaLib
>    Affects Versions: Master
>         Environment: OS X
>            Reporter: Dmitry Blotsky
>            Assignee: Omar Mefire
>              Labels: cordova-lib, platform, restore, save
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> Steps to reproduce:
> 1. Create a blank app: {{cordova create test com.app.test test}}
> 2. Add and save a platform: {{cordova platform add --save ios}}
> 3. Add and save another platform: {{cordova platform add --save android}}
> 4. Remove the platforms: {{cordova platform remove android ios}}
> 5. Try to restore platforms automatically: {{cordova prepare}}
> Expected: both platforms installed and prepared
> Actual:
> {noformat}
> Error: Trying to initialize npm when settings have not been restored from a previous
initialization.
> {noformat}
> Running {{cordova prepare}} again fixes the issue.



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


Mime
View raw message