Bug 28238 - [resources] Infinite loop renaming folder
Summary: [resources] Infinite loop renaming folder
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P1 critical (vote)
Target Milestone: 2.1 M4   Edit
Assignee: Debbie Wilson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 28330
Blocks:
  Show dependency tree
 
Reported: 2002-12-13 04:21 EST by Jerome Lanneluc CLA
Modified: 2002-12-16 17:02 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jerome Lanneluc CLA 2002-12-13 04:21:47 EST
Build 20021210

Running the internal JDT Core test suites (not available on dev.eclipse.org), 
one of the test runs into an infinite loop while attempting to rename a folder.

Here is the stack when I suspended the main thread:
Thread [main] (Suspended)
	Path.computeSegments(String) line: 395
	Path.initialize(String, String) line: 504
	Path.<init>(String) line: 98
	HistoryStoreEntry.getPath() line: 94
	HistoryStore$1.visit(HistoryStoreEntry) line: 201
	HistoryStore.accept(byte[], IHistoryStoreVisitor, boolean) line: 57
	HistoryStore.accept(IPath, IHistoryStoreVisitor, boolean) line: 69
	HistoryStore.copyHistory(IPath, IPath) line: 219
	ResourceTree.copyLocalHistory(IResource, IResource) line: 66
	ResourceTree.movedFolderSubtree(IFolder, IFolder) line: 171
	ResourceTree.standardMoveFolder(IFolder, IFolder, int, 
IProgressMonitor) line: 894
	Folder(Resource).move(IPath, int, IProgressMonitor) line: 979
	Folder(Resource).move(IPath, boolean, IProgressMonitor) line: 939
	ResourceDeltaTests.testPackageFragmentMove() line: 196
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not 
available [native method]
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 [local 
variables unavailable]
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 [local 
variables unavailable]
	Method.invoke(Object, Object[]) line: 324 [local variables unavailable]
	ResourceDeltaTests(TestCase).runTest() line: 154
	ResourceDeltaTests(TestCase).runBare() line: 127
	TestResult$1.protect() line: 106
	TestResult.runProtected(Test, Protectable) line: 124
	TestResult.run(TestCase) line: 109
	ResourceDeltaTests(TestCase).run(TestResult) line: 118
	TestSuite.runTest(Test, TestResult) line: 208
	TestSuite.run(TestResult) line: 203
	JavaModelRegressionTestSetup(TestDecorator).basicRun(TestResult) line: 
22
	TestSetup$1.protect() line: 19
	TestResult.runProtected(Test, Protectable) line: 124
	JavaModelRegressionTestSetup(TestSetup).run(TestResult) line: 23
	TestSuite.runTest(Test, TestResult) line: 208
	TestSuite.run(TestResult) line: 203
	JavaModelRegressionTestSetup(TestDecorator).basicRun(TestResult) line: 
22
	TestSetup$1.protect() line: 19
	TestResult.runProtected(Test, Protectable) line: 124
	JavaModelRegressionTestSetup(TestSetup).run(TestResult) line: 23
	TestSuite.runTest(Test, TestResult) line: 208
	TestSuite.run(TestResult) line: 203
	RemotePluginTestRunner(RemoteTestRunner).runTests(String[]) line: 360
	RemotePluginTestRunner(RemoteTestRunner).run() line: 246
	RemotePluginTestRunner.main(String[]) line: 30
	CoreTestApplication.run(Object) line: 26
	InternalBootLoader.run(String, URL, String, String[], Runnable) line: 
845
	BootLoader.run(String, URL, String, String[]) line: 432
	EclipseRuntimeLauncher.main(String[]) line: 24

The test is trying to move '/Compiler/src/com/ibm/compiler/java' 
to '/Compiler/src/com/ibm/compiler/javac'. The toString() of the 
HistoryStoreEntry is suspicious:

Path: /Compiler/src/com/ibm/compiler/javac/javac/javac/javac/javac/javac/javac/j
avac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/jav
ac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac
/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/j
avac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/jav
ac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac
/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/j
avac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/jav
ac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac
/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/javac/j
avac/javac/javac/javac/javac/javac/javac/ast/FalseLiteral.java
Last Modified: 1039771345581
Count: 0
UUID: {48,57,-6,101,124,14,0,23,19,74,-97,49,-6,88,-124,-120,}

Also note that running the test by itself doesn't show the problem.

Finally running the same tests with the 20021204 version of 
org.eclipse.core.resource doesn't show the problem either.
Comment 1 DJ Houghton CLA 2002-12-13 09:25:47 EST
I will investigate this today and try to come up with a reproducable test case.

A likely suspect is the partial match algorithm in the History Store visitor 
mechanism.
Comment 2 Jerome Lanneluc CLA 2002-12-13 09:36:28 EST
Maybe you can ask Olivier if you need to get the code for our internal test 
suite.
Comment 3 DJ Houghton CLA 2002-12-14 17:00:33 EST
The history store visitor is incorrect (see bug 28330).

Inside the visitor we created we were adding states to the history store. 
Because we were adding to the same table that we were visiting...we bail when 
the keys get too long. This is because the partial matching is incorrect. (see 
above referenced bug)

As a work-around, I have changed the #copyhistory method to not modify the 
table in the visitor, but to collect all states to copy and then add all the 
states at the end.
Comment 4 DJ Houghton CLA 2002-12-15 22:44:59 EST
Closing bug since this problem is fixed.

Added comment with FIXME as a reminder to change the code to be more performant 
once the referenced bug is resolved.

Leaving referenced bug open.
Comment 5 DJ Houghton CLA 2002-12-16 17:02:30 EST
Referenced bug is closed and fixed.

Changed #copyHistory implementation back to original form. (adding states from 
within the visitor)