Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 262660 - [transport] ECF not initialized when installing patch
Summary: [transport] ECF not initialized when installing patch
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: 3.5   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P2 normal (vote)
Target Milestone: 3.5 M7   Edit
Assignee: Henrik Lindberg CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 265723 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-01-27 15:49 EST by Pascal Rapicault CLA
Modified: 2009-04-13 12:20 EDT (History)
5 users (show)

See Also:


Attachments
Modified ECFTransport (15.90 KB, patch)
2009-02-23 13:25 EST, Matthew Piggott CLA
no flags Details | Diff
ECFTransport patch (1.04 KB, patch)
2009-02-23 17:54 EST, Matthew Piggott CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pascal Rapicault CLA 2009-01-27 15:49:51 EST
I20090127
There are situations where the ECF transport is not initialized and "Tranport initialization error" is reported. A situation where I can get that to happen regularly is the following:

- Start with a new SDK
- Import a plug-in as source code 
- Export the plug-in using the "install in running instance" option

You will notice the error that I mentioned.
Comment 1 Pascal Rapicault CLA 2009-02-21 00:21:28 EST
*** Bug 265723 has been marked as a duplicate of this bug. ***
Comment 2 Pascal Rapicault CLA 2009-02-22 15:18:28 EST
I have released a hack that forces the ecf.provider.filetransfer to be started on creation of the ECF*Transport instances (see ECFTransport and ECFMetadataTransport).
It would still be good, though much less important to understand who/what is causing ecf.provider.filetransfer to be started when we are running normally.
Comment 3 Andrew Niefer CLA 2009-02-23 08:46:33 EST
Olivier hit this same problem when trying to test for bug 263272.  This test was using the p2.artifact.mirror ant task run from a self hosted workspace.
Comment 4 Matthew Piggott CLA 2009-02-23 13:25:13 EST
Created attachment 126488 [details]
Modified ECFTransport

I've been using the method in bug 263491 to duplicate this problem, in this case the director application is used to install an IU from a local repository using a pre-existing config directory in the workspace.  When this is used, only org.eclipse.ecf.internal.filetransfer.Activator is activated (bug 265723 saw the same.)   However, the first time the configuration directory is used, or if the the repository and file are remote, then 3 all ECF Activators are called:  
org.eclipse.ecf.internal.filetransfer.Activator
org.eclipse.ecf.internal.core.ECFPlugin
org.eclipse.ecf.internal.provider.filetransfer.Activator

Looking at the call stacks at the time of activation, the only cases I saw ECF fail to start occur with SimpleRepositoryManager.  I replaced the code in the org.eclipse.equinox.internal.p2.artifact.repository.ECFTransport with that of org.eclipse.equinox.internal.p2.updatesite.ECFTransport (a few minor changes were required, Pascal's fix is not present in this ECFTransport,) after this change ECF started properly through SimpleRepositoryManager.  It would seem the issue is caused by this particular version of the ECFTransport class.  

I've attached a patch with the copied ECFTransport, and an update Messages file. (This ECFTransport seems to have been missed with a few changes made to the other two.)  Perhaps a long-term solution is to merge the ECFTransports as per bug 216278.
Comment 5 Matthew Piggott CLA 2009-02-23 17:54:12 EST
Created attachment 126507 [details]
ECFTransport patch

Andrew and I took another look at the call stacks, and it looks like that the reason ECF is started when we go through the updatesite.ECFTransport, or ECFMetadataTransport, is that both have a method doGetLastModified which contains a catch block for org.eclipse.ecf.core.ContainerCreateException.  The catch block is evidently enough to start ECF.

artifact.repository.ECFTransport doesn't have a method to determine date of a modification, so doesn't have enough to trigger the main ECF plugin's activation.

Pascal's patch doesn't seem to be starting the main ECF bundle, this modification ought to.
Comment 6 Andrew Niefer CLA 2009-02-24 09:02:01 EST
To be clear, the ECF bundles are being lazily started when classes get loaded.  
org.eclipse.ecf causes lazy activation of org.eclipse.ecf.identity due to ecf.identity interfaces used in method signatures in ecf.
In turn, ecf.identity loads the other bundles by going through the registry extensions.

The updatesite.ECFTransport does not contain any instance variables or method signatures using ecf classes, but it does contain the a try/catch block on an ecf type. 

It is the verifier that loads these classes causing lazy activation.  Tom indicated that this behaviour around the catch block is not spec'ed, and some vms may be more lazy than others with respect to loading these classes.  

We should not be relying on such a tenuous connection to get the transports started.
Comment 7 Matthew Piggott CLA 2009-02-24 10:17:17 EST
Scott, we looking at explicitly starting ECF bundles rather than relying on references in classes.  So we were wondering if starting the org.eclipse.ecf.provider.filetransfer bundle would be enough, or should we also/alternatively start org.eclipse.ecf.identity or even org.eclipse.ecf?  Thanks.
Comment 8 Scott Lewis CLA 2009-02-26 23:04:06 EST
(In reply to comment #7)
> Scott, we looking at explicitly starting ECF bundles rather than relying on
> references in classes.  So we were wondering if starting the
> org.eclipse.ecf.provider.filetransfer bundle would be enough, or should we
> also/alternatively start org.eclipse.ecf.identity or even org.eclipse.ecf? 
> Thanks.
> 

Sorry about the slow response...I missed this one in a personal flood. 

Due to the potential for ClassCircularityErrors, it's necessary to start:

org.eclipse.ecf 
and then
org.eclipse.ecf.provider.filetransfer

Comment 9 Matthew Piggott CLA 2009-03-05 11:58:23 EST
CC'ing Henrik as this may affect him as he works on merging the Transport classes.
Comment 10 Henrik Lindberg CLA 2009-03-05 12:08:33 EST
(In reply to comment #9)
> CC'ing Henrik as this may affect him as he works on merging the Transport
> classes.
> 
Thanks, I will make sure that both bundles get started as per Scott's reply.
Comment 11 Pascal Rapicault CLA 2009-04-09 10:12:40 EDT

*** This bug has been marked as a duplicate of bug 262351 ***
Comment 12 Pascal Rapicault CLA 2009-04-09 10:13:33 EDT
This should not have been closed as dupe
Comment 13 Henrik Lindberg CLA 2009-04-12 16:49:01 EDT
The ECF bundles are now started when the repository Activator method getRetrieveFileTransferFactory is called for the first time. This method is called when a file retrieval factory is required (happens each time a transfer is made).

Can someone verify that the original reported problem is fixed so this issue can be closed?
Comment 14 Pascal Rapicault CLA 2009-04-13 12:20:23 EDT
Closing.