| Summary: | Out-of-date .snap file prevents Eclipse from running | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Sergey Prigogin <eclipse.sprigogin> | ||||
| Component: | Resources | Assignee: | Sergey Prigogin <eclipse.sprigogin> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | major | ||||||
| Priority: | P3 | CC: | daniel_megert, david_williams, el_gaseron, john.arthorne, sptaszkiewicz | ||||
| Version: | 4.4 | ||||||
| Target Milestone: | 4.4.1 | ||||||
| Hardware: | PC | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Sergey Prigogin
Can you please attach the affected workspace? (In reply to Szymon Ptaszkiewicz from comment #1) > Can you please attach the affected workspace? I cannot attach the affected workspace since it contains proprietary information. I'll work on a fix myself when I have time. The problem was caused by a leftover .snap file that was older than the tree:
/home/sprigogin/workspaces/bug_437005/.metadata/.plugins/org.eclipse.core.resources:
total 48
drwxr-x--- 6 sprigogin eng 4096 Jun 9 15:20 .
drwxr-x--- 55 sprigogin eng 4096 May 22 15:59 ..
drwxr-x--- 258 sprigogin eng 4096 Apr 24 14:44 .history
drwxr-x--- 20 sprigogin eng 4096 May 30 16:50 .projects
drwxr-x--- 3 sprigogin eng 4096 Jun 9 15:10 .root
drwxr-x--- 2 sprigogin eng 4096 Jun 9 15:10 .safetable
-rw-r----- 1 sprigogin eng 24570 Jun 6 04:49 .snap
/home/sprigogin/workspaces/bug_437005/.metadata/.plugins/org.eclipse.core.resources/.root:
total 292
drwxr-x--- 3 sprigogin eng 4096 Jun 9 15:10 .
drwxr-x--- 6 sprigogin eng 4096 Jun 9 15:20 ..
-rw-r----- 1 sprigogin eng 284231 Jun 9 15:10 106.tree
drwxr-x--- 2 sprigogin eng 4096 Oct 11 2013 .indexes
The .snap file is 3 days older than the tree!
The type of the resulting inconsistency can be illustrated by the following code:
DeltaDataTree trees[] = new DeltaDataTree[4];
// These trees come from 106.tree file.
AbstractDataTreeNode n;
n = new DataTreeNode("one", "/one", new AbstractDataTreeNode[] {});
n = new DataTreeNode("", "/", new AbstractDataTreeNode[] {n});
trees[0] = new DeltaDataTree(n);
trees[0].immutable();
n = new DataTreeNode("three", "/one/two/three");
n = new DataTreeNode("two", "/one/two", new AbstractDataTreeNode[] {n});
n = new DataDeltaNode("one", "/one", new AbstractDataTreeNode[] {n});
n = new DataDeltaNode("", "/", new AbstractDataTreeNode[] {n});
trees[1] = new DeltaDataTree(n, trees[0]);
trees[1].immutable();
// These trees come from the out-of-date .snap file.
n = new DataTreeNode("other", "/other");
n = new NoDataDeltaNode("", new AbstractDataTreeNode[] {n});
trees[2] = new DeltaDataTree(n, trees[0]); // Here is the the problem
trees[2].immutable();
n = new DataDeltaNode("three", "/one/two/three");
n = new NoDataDeltaNode("two", new AbstractDataTreeNode[] {n});
n = new NoDataDeltaNode("one", new AbstractDataTreeNode[] {n});
n = new DataDeltaNode("", "/", new AbstractDataTreeNode[] {n});
trees[3] = new DeltaDataTree(n, trees[2]);
trees[3].immutable();
trees[3].reroot(); // throws ObjectNotFoundException: Tree element '/one/two/three' not found.
The proposed fix is in https://git.eclipse.org/r/#/c/28845/ The fix changes the name of the tree snapshot file from .snap to <sequence_number>.snap, where the sequence number matches the sequence number of the tree file. With this change a failure to delete a snapshot file after creating a new tree file is no longer fatal since the leftover snapshot file would not match the sequence number of the tree file and will be ignored while restoring the workspace. Backward compatibility is achieved by checking for the .snap file if the <sequence_number>.snap file is not found. The .snap file is accepted only if its last modification time is not lower than the last modification time of the tree file. I couldn't figure out how to write an automated test that would test workspace loading with an out-of-date snapshot file. Any ideas on how to do that will be appreciated. The fix looks good to me, and I have merged into master: http://git.eclipse.org/c/platform/eclipse.platform.resources.git/commit/?id=e332a711becfbd40358308857dd4b69defbd1299 We have a suite of "session" tests in org.eclipse.core.tests.resources.session. I think this infrastructure could be used to write a test for this scenario. I see you want to target this for 4.4.1, so I will leave this open and we'll first confirm that all is well in the 4.5/master branch. (In reply to John Arthorne from comment #6) > I see you want to target this for 4.4.1, so I will leave this open and we'll > first confirm that all is well in the 4.5/master branch. We haven't seen any problems in 4.5. We should probably either cherry pick the fix to R4_4_maintenance now or retarget the bug. (In reply to Sergey Prigogin from comment #7) > (In reply to John Arthorne from comment #6) > > I see you want to target this for 4.4.1, so I will leave this open and we'll > > first confirm that all is well in the 4.5/master branch. > > We haven't seen any problems in 4.5. We should probably either cherry pick > the fix to R4_4_maintenance now or retarget the bug. Mars M1 was released last Friday so it hasn't been tested thoroughly, but the fix looks good so we can go ahead with the backport. Fixed in R4_4_maintenance: http://git.eclipse.org/c/platform/eclipse.platform.resources.git/commit/?h=R4_4_maintenance&id=6d731e6a228429caed8a0077302e31bd4f8d8185 I'm still getting this error: Version: Mars.1 Release (4.5.1) Build id: 20150924-1200 I noticed, it happens when you start eclipse and while the projects of the current workspace are still building you switch to another workspace-> xx.snap files are created in the .metadata/.plugins/org.eclipse.core.resources directory. After you try to switch back to this workspace you get the error quite annoying. kind regards rome (In reply to Roman A. from comment #9) > I'm still getting this error: > Version: Mars.1 Release (4.5.1) > Build id: 20150924-1200 > I noticed, it happens when you start eclipse and while the projects of the > current workspace are still building you switch to another workspace-> > xx.snap files are created in the > .metadata/.plugins/org.eclipse.core.resources directory. After you try to > switch back to this workspace you get the error > > quite annoying. > kind regards > rome Please open a new bug with steps to reproduce and cc me. |