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

Bug 527869

Summary: Intermittent failures in DelegateCreatorTests
Product: [Eclipse Project] JDT Reporter: Stephan Herrmann <stephan.herrmann>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: noopur_gupta
Version: 4.7.1a   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard: stalebug

Description Stephan Herrmann CLA 2017-11-28 09:06:15 EST
I'm seeing intermittent failures in DelegateCreatorTests, locally I see it failing in testf03, testf04, remotely (during Object Teams build) I see it failing in testm10.

I could narrow it down to the fact that tearDown() (from RefactoringTest) does perform
	tryDeletingAllJavaChildren(getPackageP());
but afterwards package 'p' still contains CU A.java.


Deletion is supposed to happen in JavaProjectHelper.delete(IJavaElement).

If I instrument that method like so ...

System.out.println(">> del "+elem.getResource()+" "+elem.getResource().exists()+" "+elem.exists());
		delete(elem.getResource());
System.out.println("<< del "+elem.getResource()+" "+elem.getResource().exists()+" "+elem.exists());

... this prints:

>> del L/TestProject1511877555462/src/p/A.java true true
<< del L/TestProject1511877555462/src/p/A.java false true

i.e.: the resource is deleted, but the IJavaElement still exists. 

In the good case
	emptyDisplayLoop();
is enough to ensure that the IJavaElement no longer exists().

In the bad case the IJavaElement survives this ...

Is this a bug in JDT/Core or should tests do more to catch up with the resource change?
Comment 1 Noopur Gupta CLA 2017-11-28 09:32:13 EST
See also bug 409704 and its fix.

Does increasing RETRY_DELAY or MAX_RETRY help?
Comment 2 Stephan Herrmann CLA 2017-11-28 10:11:20 EST
(In reply to Noopur Gupta from comment #1)
> See also bug 409704 and its fix.
> 
> Does increasing RETRY_DELAY or MAX_RETRY help?

Yes, related. Thanks for the link.

However, while that bug speaks of problem deleting a package's resource, in DelegateCreatorTests we delete only the children of the package. Furthermore, resource deletion succeeds, it just doesn't update the JavaModel.

Same problem still exists with MAX_RETRY=15 and RETRY_DELAY=10000 (instead of original 5, 1000).
Comment 3 Noopur Gupta CLA 2017-11-29 00:04:33 EST
(In reply to Stephan Herrmann from comment #2)
> Furthermore, resource deletion succeeds, it just doesn't update the
> JavaModel.

It could be a bug in JDT Core that the Java model is not getting updated.

If you are seeing these intermittent failures recently then we should try with R4_6_maintenance branches which don't have the new jdt.core changes. I don't see any recent change in jdt.ui which look related.
Comment 4 Eclipse Genie CLA 2020-03-11 19:22:08 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. 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.