Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 324227

Summary: CVSProviderPlugin.isAutoshareOnImport() is unreliable
Product: [Eclipse Project] Platform Reporter: John Cortell <john.cortell>
Component: CVSAssignee: platform-cvs-inbox <platform-cvs-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug
Attachments:
Description Flags
Patch which rigs CVS code to show the problem. NOT A FIX! none

Description John Cortell CLA 2010-09-01 12:59:51 EDT
This applies to any attributes of CVSProviderPlugin that are set by the CVS UI plugin, not just the 'auto share on import' one.

I ran into a situation where some code calls into CVSProviderPlugin.isAutoshareOnImport() and that returns false (unexpected value), but if I delay the call a bit, it returns true (expected value). The problem is that the CVSProviderPlugin implementation depends on the CVS UI plugin having been loaded, which may be in progress, but not far enough where CVSProviderPlugin has been updated by it.In general, having a non-UI plugin claim and publish knowledge that is truly only known by its UI counterpart seems misleading and fragile.

This unreliability can be demonstrated in stock eclipse with just a couple of tweaks. I've attached a patch file. To reproduce the problem, apply the patch and launch a clean runtime workbench (one that has no projects). In that workbench, do the following

1. Add a CVS repository for whatever projects you normally work with.
2. Do 'File > Import > General > Existing Projects into Workspace'
3. Hit the 'Browse...' to select a root directory. Pick any project you already have checked out from the repository in step 1, in any workspace. Doesn't matter which or where it is.
4. Hit Finish to initiate the import operation

In the console of the development workbench, you will see something similar to this:

CVS auto share on import is off at this point (0ms elapsed)
CVS auto share on import is off at this point (94ms elapsed)
[...snip]
CVS auto share on import is off at this point (3766ms elapsed)
CVS auto share on import is off at this point (3875ms elapsed)
Finally...CVS auto share on import is ON (3969ms elapsed)

This proves that CVSTeamProviderType would proceed under the impression that auto-share-on-import is off when in fact the preference is on. And if you tweak the code to not wait at all, then you'll see that the imported project ends up lacking CVS awareness. Of course, this is all due to the sleep in the CVSUIPlugin.start(). But this is a rig just to show the race condition can happen. Believe me, this happened without any rigging in my situation. The workaround for me is to force the loading of the CVS UI plugin. However, this is really an ugly remedy, and of course it was only obvious after many hours of troubleshooting.
Comment 1 John Cortell CLA 2010-09-01 13:01:26 EDT
Created attachment 177986 [details]
Patch which rigs CVS code to show the problem. NOT A FIX!

See repro instructions
Comment 2 Eclipse Webmaster CLA 2019-09-06 16:11:29 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.
Comment 3 Eclipse Genie CLA 2021-11-12 17:35:08 EST
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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.