Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 282427 - P2 Installer 3.5 fails with "An error occurred while collecting items to be installed"
Summary: P2 Installer 3.5 fails with "An error occurred while collecting items to be i...
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 blocker (vote)
Target Milestone: 3.5.1   Edit
Assignee: Simon Kaegi CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 238908 282212 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-07-04 08:49 EDT by Cedric Vidal CLA
Modified: 2009-07-17 16:15 EDT (History)
5 users (show)

See Also:
john.arthorne: review+


Attachments
P2 Installer log (69.58 KB, text/plain)
2009-07-04 08:49 EDT, Cedric Vidal CLA
no flags Details
Screenshot of P2 Installer when failure message is displayed (10.52 KB, image/png)
2009-07-04 08:50 EDT, Cedric Vidal CLA
no flags Details
P2 Installer properties (301 bytes, application/octet-stream)
2009-07-04 08:51 EDT, Cedric Vidal CLA
no flags Details
P2 Installer Fiddler session (343.83 KB, application/octet-stream)
2009-07-04 10:01 EDT, Cedric Vidal CLA
no flags Details
Fixes artifact repo disablement and starts framework admin bundles (2.42 KB, patch)
2009-07-04 20:03 EDT, Cedric Vidal CLA
no flags Details | Diff
Fixes artifact repo disablement (1.18 KB, patch)
2009-07-14 14:12 EDT, Cedric Vidal CLA
simon_kaegi: iplog+
Details | Diff
mylyn/context/zip (2.42 KB, application/octet-stream)
2009-07-14 14:13 EDT, Cedric Vidal CLA
no flags Details
tweak of previous patch (1.71 KB, text/plain)
2009-07-17 13:57 EDT, Simon Kaegi CLA
no flags Details
tweak of tweak of previous patch (1.62 KB, patch)
2009-07-17 14:47 EDT, Cedric Vidal CLA
no flags Details | Diff
mylyn/context/zip (2.60 KB, application/octet-stream)
2009-07-17 14:47 EDT, Cedric Vidal CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Cedric Vidal CLA 2009-07-04 08:49:33 EDT
Created attachment 140798 [details]
P2 Installer log

Build ID: P2 Installer 1.0.100.v20090528

Steps To Reproduce:
1. Launch a freshly downloaded copy of P2 Installer 3.5. I used equinox.p2.installer-3.5-win32.win32.x86.zip from
http://download.eclipse.org/equinox/drops/R-3.5-200906111540/index.php
2. Enter any empty valid product install directory
3. Select stand-alone or shared install
4. Click Install

It should display "Installing ..." then "An error occurred while collecting items to be installed"


More information:
Comment 1 Cedric Vidal CLA 2009-07-04 08:50:43 EDT
Created attachment 140799 [details]
Screenshot of P2 Installer when failure message is displayed
Comment 2 Cedric Vidal CLA 2009-07-04 08:51:39 EDT
Created attachment 140800 [details]
P2 Installer properties
Comment 3 Cedric Vidal CLA 2009-07-04 10:01:39 EDT
Created attachment 140801 [details]
P2 Installer Fiddler session

Attached HTTP session recorded with Fiddler.
Comment 4 Cedric Vidal CLA 2009-07-04 20:03:02 EDT
Created attachment 140810 [details]
Fixes artifact repo disablement and starts framework admin bundles

Hi guys,

I managed to find out what the problem was. It was a concurrency issue quite hard to pin point.

The artifact repositories defined in installer.properties are registered in the ArtifactRepositoryManager with the isEnabled flag set to true but in some cases, if the artifact repository URI is also declared as a referenced repository in the transitive closure of loaded XML metadata files, a RepositoryEvent will concurrently be published to the ProvisioningEventBus with the isEnabled flag set to false.

If the event is dispatched to the ArtifactRepositoryManager before the URI gets registered with isEnabled set to true, then the repository will end up being disabled.

Therefore, in the collect phase, the repository will be discarded by the DownloadManager during repository selection before fetching artifacts thus yielding the error "An error occurred while collecting items to be installed".

This patch simply registers the artifact repositories defined in installer.properties to the ArtifactRepositoryManager before it loads it.

Additionally, the FrameworkAdmin bundles are programmatically started because they are needed later to lookup the Manipulator.

Regards,

Cédric Vidal
Comment 5 Simon Kaegi CLA 2009-07-05 13:58:52 EDT
Thanks Cedric, I'll take a look.
Comment 6 Cedric Vidal CLA 2009-07-05 18:02:30 EDT
(In reply to comment #5)
> Thanks Cedric, I'll take a look.
> 

You're welcome. I forgot to mention that this issue is a blocker since it makes the P2 Installer frontend fail in most cases with the galileo update site.

Cheers,

Cédric
Comment 7 John Arthorne CLA 2009-07-06 00:34:08 EDT
*** Bug 238908 has been marked as a duplicate of this bug. ***
Comment 8 Susan McCourt CLA 2009-07-07 12:27:16 EDT
*** Bug 282212 has been marked as a duplicate of this bug. ***
Comment 9 Simon Kaegi CLA 2009-07-07 16:22:58 EDT
Hi Cedric,

I'm curious why you're starting frameworkadmin.equinox. This bundle is already automatically started by default -- e.g. see the product file and bundles.info.

The other part of your patch looks good though.
Comment 10 Cedric Vidal CLA 2009-07-14 14:12:46 EDT
Created attachment 141549 [details]
Fixes artifact repo disablement

Hi Simon,

Sorry for replying so late. You are right, I wasn't using the product definition. Starting the framework admin bundle in code is not necessary at all when correctly using the product definition. 

The attached patch fixes artifact repo disablement but doesn't start framework admin bundles.

Regards,

Cédric Vidal

PS: Trying to post the attachment using Mylyn with context attached. I apologize if something goes wrong.
Comment 11 Cedric Vidal CLA 2009-07-14 14:13:00 EDT
Created attachment 141550 [details]
mylyn/context/zip
Comment 12 John Arthorne CLA 2009-07-17 13:47:46 EDT
+1 for this latest patch for Galileo SR1 (comment #10).
Comment 13 Simon Kaegi CLA 2009-07-17 13:57:48 EDT
Created attachment 141908 [details]
tweak of previous patch

Thanks Cedric. I've added this tweaked version of your last patch to HEAD.

--
This is a tweak on the previous patch that also uses the same "add" logic for metadata repos and modifies the loop to always do add and then load instead of two loops.
Comment 14 Cedric Vidal CLA 2009-07-17 14:37:37 EDT
Hum. Not sure adding and loading inside a single loop is safe. Here is a scenario that I think breaks:

Let's take two artifact repositories A and B where B's URI is declared as a referenced repository in A's transitive closure of loaded XML metadata files:
  - A gets added
  - A gets loaded and B gets lazily registered in the ArtifactRepositoryManager with the isEnabled flag set to false
  - B gets added but is already registered has being disabled so B's addition has no effect on B's enablement in the ArtifactRepositoryManager
  - B gets loaded

Eventually, A is enabled but B is disabled.

I think it is safer to add all artifact repositories in a first loop then load all repositories in a second loop.

What do you think ?

Regards,

Cédric
Comment 15 Cedric Vidal CLA 2009-07-17 14:39:37 EDT
I forgot to +1 applying the same add/load strategy to metadata repositories ;)
Comment 16 Cedric Vidal CLA 2009-07-17 14:47:50 EDT
Created attachment 141912 [details]
tweak of tweak of previous patch

This patch made against CVS HEAD applies the same logic to metadata and artifact repositories but does the adding and the loading in separate loops
Comment 17 Cedric Vidal CLA 2009-07-17 14:47:55 EDT
Created attachment 141913 [details]
mylyn/context/zip
Comment 18 Simon Kaegi CLA 2009-07-17 15:32:07 EDT
Thanks John.
I've also applied the patch to the maintenance branch, bumped versions and tagged.

--
re: comment 14
The "add" is spec'ed to enable a site if it is already present but disabled so this should be ok. I re-looked at the code in AbstractRepositoryManager and it looks safe to me.

It of course still a good plan to try this out while we have plenty of time to make a change.
Comment 19 Cedric Vidal CLA 2009-07-17 16:15:22 EDT
(In reply to comment #18)
> The "add" is spec'ed to enable a site if it is already present but disabled so
> this should be ok. I re-looked at the code in AbstractRepositoryManager and it
> looks safe to me.

Indeed, you're right, I overlooked AbstractRepositoryManager's add method ^^