Bug 576999 - [Test] testBug573547_insideLambda_onOuterScopeVariable_whileOnPreviousFrame failing on windows
Summary: [Test] testBug573547_insideLambda_onOuterScopeVariable_whileOnPreviousFrame f...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.21   Edit
Hardware: All Windows 10
: P3 normal (vote)
Target Milestone: 4.24 M1   Edit
Assignee: Jonah Graham CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 577186 (view as bug list)
Depends on:
Blocks: 573547
  Show dependency tree
 
Reported: 2021-11-02 03:25 EDT by Sarika Sinha CLA
Modified: 2022-03-14 10:22 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sarika Sinha CLA 2021-11-02 03:25:33 EDT
Follow up from 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=573547#c5
Comment 1 Sarika Sinha CLA 2021-11-10 12:45:36 EST
*** Bug 577186 has been marked as a duplicate of this bug. ***
Comment 2 Alexandr Miloslavskiy CLA 2021-11-10 21:09:35 EST
I'm the author of Bug 575787. I tried to debug the test, but eventually I didn't manage to build.

I to build from repo 'eclipse.platform.releng.aggregator', but didn't succeed.
I also tried to use Eclipse SDK jars, also didnt' succeed.

Are there ready-to-use jars for this project and its dependencies I could get to test?
Comment 3 Sarika Sinha CLA 2021-11-11 00:33:48 EST
(In reply to Alexandr Miloslavskiy from comment #2)
> I'm the author of Bug 575787. I tried to debug the test, but eventually I
> didn't manage to build.
> 
> I to build from repo 'eclipse.platform.releng.aggregator', but didn't
> succeed.
> I also tried to use Eclipse SDK jars, also didnt' succeed.
> 
> Are there ready-to-use jars for this project and its dependencies I could
> get to test?

You can use JDT Debug gerrit also, 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=573547#c14

If you add the "triggerWinGerrit" message in commit, JDT debug gerrit will also run on Windows.
Comment 5 Alexandr Miloslavskiy CLA 2021-11-11 18:18:24 EST
The problem was caused by a mistake in patch for Bug 575787. The patch is currently reverted, so tests should pass again. Sorry for the trouble!
Comment 6 Sarika Sinha CLA 2021-11-15 05:42:11 EST
Not seeing the failure, hope it's fixed indirectly.
Comment 8 Jonah Graham CLA 2022-03-10 10:59:25 EST
There is a method called org.eclipse.jdt.debug.tests.ui.AbstractDebugUiTests.processUiEvents(long) which looks like it should run UI events for long number of milliseconds. However its current implementation does a "Thread.sleep()" and then clears all queued events (With org.eclipse.jdt.debug.tests.TestUtil.runEventLoop())

I have hit similar problems before that the eventloop can be empty more easily on some platforms than other. Instead I propose processUiEvents runs the event loop for the given number of milliseconds.

On my local test making this change made the test pass when it used to fail.

Gerrit coming soon with a triggerWinGerrit in the commit message.
Comment 9 Eclipse Genie CLA 2022-03-10 11:13:36 EST
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.debug/+/191731
Comment 10 Jonah Graham CLA 2022-03-10 11:38:58 EST
(In reply to Eclipse Genie from comment #9)
> New Gerrit change created:
> https://git.eclipse.org/r/c/jdt/eclipse.jdt.debug/+/191731

Nope - that doesn't solve the issue.
Comment 11 Jonah Graham CLA 2022-03-10 12:27:09 EST
What makes this test different from all the rest is that it selects a different frame as part of the test.

Selecting a frame (via SourceDisplayJob) does a AbstractTextEditor.selectAndReveal on the new frame's location in the editor.

A few lines later in the test the key AbstractTextEditor.selectAndReveal is done on the target of the test.

The select a frame involves some complicated aysnc behaviour before the selectAndReveal and is scheduled on the UI thread, and this causes a race condition.

You can see this by instrumenting StyledText.setSelection - it will be called twice (within key code) - once from SourceDisplayJob and once from the test. 

I will attempt to provide something to make the code wait properly on select frame - rather than just increase the amount of time we sleep.
Comment 12 Eclipse Genie CLA 2022-03-10 13:04:05 EST
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.debug/+/191738
Comment 14 Sarika Sinha CLA 2022-03-14 10:22:43 EDT
Tests have not failed in couple of days.

Thank you Jonah!