| Summary: | ExternalFoldersManager still has synchronization gaps | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Markus Keller <markus.kell.r> | ||||||
| Component: | Core | Assignee: | Jay Arthanareeswaran <jarthana> | ||||||
| Status: | VERIFIED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | amj87.iitr, satyam.kandula | ||||||
| Version: | 3.8 | Flags: | markus.kell.r:
review+
|
||||||
| Target Milestone: | 3.8 M7 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows 7 | ||||||||
| See Also: | https://bugs.eclipse.org/bugs/show_bug.cgi?id=527819 | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Markus Keller
Interestingly some of the synchronized code was altered as part of the fix for bug 310159. I will see what is the best way to ensure thread safety. Created attachment 214365 [details] Proposed fix Moved the code that instantiates pendingFolders inside a synchronized block. Also, added code to call getFolders in the singleton constructor itself to keep things simple. As a side effect of this, the external folder is always created, of course if it's not present already. The other alternative to tackle this, bug 310159 and bug 368152 together would be to use schedule rules, but this would create a problem with UI threads, which is mentioned here: bug 368152, comment #11. Markus, can you please review this patch for 3.8 M7? addFolder was just one example where pendingFolders is accessed without synchronization. removePendingFolder(Object) and the guard at the beginning of createPendingFolders(IProgressMonitor) should also be synchronized to prevent data races. With that, the patch looks good to me. However, there are still open loopholes that could be the cause for bug 244315. I don't see synchronization to ensure that cleanUp and createLinkFolder/createPendingFolders don't delete and create the same folders concurrently. But as you said, we need to be extra careful if tackle that problem, since it can lead to deadlocks via scheduling rules. Created attachment 214487 [details]
Updated patch
Patch contains additional synchronized blocks. I can't come up with scenarios under which race conditions on these two methods would result in inconsistent state of external folders. But synchronization of assignment of pendingFolders is complete now.
Last patch looks good to me. Released in master via commit http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=e43c6ed09b10ae435241ad2d75fd39056b384df8 Verified for 3.8M7 using code inspection. |