Bug 129365 - Running multiple instances of Eclipse using the same configuration location
Summary: Running multiple instances of Eclipse using the same configuration location
Status: RESOLVED WONTFIX
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Framework (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Thomas Watson CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-24 11:36 EST by Oleg Besedin CLA
Modified: 2019-08-05 08:48 EDT (History)
3 users (show)

See Also:


Attachments
patch to agressively read/write the next bundle id (6.94 KB, patch)
2006-03-08 16:21 EST, Thomas Watson CLA
no flags Details | Diff
new patch (5.58 KB, patch)
2006-03-09 12:28 EST, Thomas Watson CLA
no flags Details | Diff
updated patch (5.65 KB, patch)
2007-04-16 15:08 EDT, Thomas Watson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Oleg Besedin CLA 2006-02-24 11:36:19 EST
It turns out that nothing prevents users from running multiple instances of Eclipse using the same configuration location. This might not be a problem if the configuration information is not modified by such Eclipse instances; however, it becomes an issue if they do.

For instance, in the bug 128138 we discovered that should both instances install bundles, the new bindle IDs used by the instances will be the same. The Instance1 will install Bundle1 and it will be given Id of 101; the Instance2 will install Bundle2 and it will be given the same Id of 101.

Both Bundle1 and Bundle2 will be assigned the same location (in our case workspace\.metadata\.plugins\org.eclipse.pde.core\All Runtime Tests\org.eclipse.osgi\bundles\101\1\bundlefile) causing manifest information from one bundle to be overwritten by another bundle.

It turns out that there is no mechanism for discovering proper bundle Id to use in this situation.

Also, any other information cached in the configuration might be vulnerable in this use case.

On the other hand, we can't just prohibit using multiple instance of Eclipse over the same configuration location because of the shared installs.
Comment 1 Jeff McAffer CLA 2006-02-25 01:33:47 EST
The framework is actually designed and intended to support running multiple instances of one configuration simultaneously.  Ther may be a bug but this is what the FileManager code is all about.  We can't prevent concurrent installs but we can detect when there is a potential lost update.  Are you saying there is a bug?
Comment 2 Oleg Besedin CLA 2006-02-27 09:14:00 EST
If design intent was to allow multipe instances of Eclipse to be run using the same configuration location while installing new bundles, then it is certainly a bug.
Comment 3 Thomas Watson CLA 2006-02-27 18:33:45 EST
Here is the "bug".  When bundles are installed we cache the bundle information (including the next bundle id) in memory and periodically save this information to disk.  If two instances using the same configuration install bundles at the same time then the same bundle id will be used by both instances.  But this is the least of my concerns.

When this situation occurs one instance does not know what the other instance has installed, it only knows about what bundles were installed at the time it was launched.  IMO the correct thing to do is to lock the configuration once an instance modifies the configuration.  No other currently running instance should be able to modify the configuration until the modifying instance has saved that bundle data and the other instance has been loaded from the newly saved data (this would likely require these instances to be relaunched).
Comment 4 Jeff McAffer CLA 2006-03-02 23:48:54 EST
yup.  We could even fail the install if  you are in teh second one and the config area is locked.
Comment 5 Pascal Rapicault CLA 2006-03-06 08:47:48 EST
>No other currently running instance should be able to modify the configuration until the modifying instance has saved that bundle data and the other instance has been loaded from the newly saved data" (this would likely require these instances to be relaunched).

I think this is very restrictive. We should try to read and write eagerly the bundle id (this would have a hit on first startup).
Comment 6 Thomas Watson CLA 2006-03-06 09:22:03 EST
re: comment 5

Again the bundle ID is the least of my concerns.  One session has no clue what the other session has installed.  If you have two sessions running from the same configuration, session 1 installs Bundle A, B, and C.  Then session 2 tries to install Bundle A, B, and C.  If you only saved the bundle ID eagerly then session 2 will install bundle A, B, and C even though they were already installed by session 1 (but the bundle ID's would not be reused at least ;-)

Just to be clear this is not a new problem, been there since 3.0.  The correct solution would involve something like this.

1)  When the bundle data is changed the modifying session locks the configuration  then it must check that it has the latest .bundledata.  If it does not then it should fail the modification and unlock the configuration.
2)  After an agent (e.g. update.configurator) has finished modifying the configuration then it can call some method (maybe on PlatformAdmin) to force a save and unlock the configuration.

This should allow the session tests to work because the launching session will have finished modifying the bundledata (and will have synch'ed the .bundledata) before the session test is launched from the same configuration.  So the session test should be able to modify the bundledata.

A more advanced solution would allow the second session to attempt to reload the .bundledata from disk if it detected that the one from memory was out of sync with the one on disk.
Comment 7 Jeff McAffer CLA 2006-03-06 09:56:10 EST
+1 to comment 6
Comment 8 Thomas Watson CLA 2006-03-06 10:12:49 EST
I will investgate the solution for M6.

The more advanced solution (reloading the bundledata from the second session) is too much for M6 IMO.
Comment 9 Jeff McAffer CLA 2006-03-06 10:23:08 EST
agreed
Comment 10 Thomas Watson CLA 2006-03-06 11:18:54 EST
putting milestone back for the less advanced solution.
Comment 11 Thomas Watson CLA 2006-03-08 14:39:52 EST
I discussed this more with Pascal.  He reminded me of a design decision which we made back in Eclipse 3.0 WRT shared configuration areas.

We allow multiple instances of eclipse to run from the same configuration.  If more than one of the running configurations attempts to modify the configuration (by installing/uninstalling/updating bundles etc.) then the last one that persists wins.  If we stick with this same design (which I think we should this late in the 3.2 cycle) then we really only have a bug in the fact that two different instances may attampt to use the same bundle ID when installing bundles into the same configuration at the same time.  To prevent this we should use Pascals suggestion in comment 5 as a solution.
Comment 12 Thomas Watson CLA 2006-03-08 16:21:32 EST
Created attachment 35937 [details]
patch to agressively read/write the next bundle id

Pascal, can you review this patch.  I may have gone overboard with the extra locker, but I did not see another safe way to synchronize the next bundle id between multiple instances.
Comment 13 Thomas Watson CLA 2006-03-08 23:16:30 EST
Pascal, disregard the patch.  It needs work.  Session tests fail ...
Comment 14 Jeff McAffer CLA 2006-03-08 23:45:10 EST
Have to be careful about startup time (even if it is first startup).  Writing a the latest bundle number for every new bundle seem problematic.  We should be able to do something with all the locking support we have.
Comment 15 Thomas Watson CLA 2006-03-09 12:28:55 EST
Created attachment 35994 [details]
new patch

Ok, here is a new patch.  This uses a different strategy.  

Instead of locking in the framework this patch assumes the agent installer is going to lock.  Perhaps this can happen by locking the configuration location before a modification is made to the configuration and unlocking it after the  configuration has been modified.

This patch ensures that the latest bundle id (still stored in .bundledata) is saved to disk after a batch process has finished and at least one bundle was installed.  Currently the only batch process is when bundles are resolving/refreshing.

When a bundle is installed we make sure the latest bundle id is loaded from the latest version of the .bundledata file.

Note that currently install agents (EclipseStarter and update.configurator) are not locking the configuration.  This can lead to issues if more than one instance is installing bundles concurrently.

Pascal, please review.  Thanks.
Comment 16 Thomas Watson CLA 2006-03-27 15:43:59 EST
Pascal, any chance to review?  Not sure I would want to release this late in M6 cycle anyway.
Comment 17 Pascal Rapicault CLA 2006-03-27 17:05:53 EST
I'm not confident with releasing that now. Why don't we hold on until 3.3?
Comment 18 Thomas Watson CLA 2006-03-27 17:55:55 EST
slipping milestone
Comment 19 Thomas Watson CLA 2007-04-16 15:08:15 EDT
Created attachment 63943 [details]
updated patch

updated patch for 3.3.  When this patch is applied some of the session tests are failing.  It is unclear why they are failing.  We should not do anything this late in 3.3.
Comment 20 Robert Pollak CLA 2010-06-15 05:09:45 EDT
Hello Thomas, do you still plan to work on this?

Why has Pascal Rapicault meant (on 2006-05-01), that
"Sharing the configuration has nothing of adventureous", when this bug is still open?
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=139319#c13)

BTW., could someone please fix this bug's summary to "multiple instances"?
Comment 21 Thomas Watson CLA 2010-06-15 11:26:18 EDT
(In reply to comment #20)
> Hello Thomas, do you still plan to work on this?
> 
> Why has Pascal Rapicault meant (on 2006-05-01), that
> "Sharing the configuration has nothing of adventureous", when this bug is still
> open?
> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=139319#c13)
> 
> BTW., could someone please fix this bug's summary to "multiple instances"?

Are you seeing this issue cause you problems in the field.  I think Pascal was trying to say that running many instances from a shared configuration is pretty common and that we don't see any major issues that are forcing users of eclipse to have a separate install of eclipse for each instance they want to run.  Most eclipse committers I know have many instances running at the same time and do not run into issues.
Comment 22 Robert Pollak CLA 2010-06-20 18:01:15 EDT
(In reply to comment #21)
> Are you seeing this issue cause you problems in the field [?]

No, thank you for asking. I want to be able to work in parallel on different branches of my programming project and I found this bug while researching how to do this. But it seems not to pose any problems to me.
Comment 23 Eclipse Genie CLA 2019-07-31 14:31:01 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 24 Thomas Watson CLA 2019-08-05 08:48:08 EDT
No plans to address this issue.