Skip to content

Conversation

@HeikoKlare
Copy link
Contributor

When executing tests for Edge, UI events are processed on teardown of the test (or more precisely on widget disposal) as there may still be resources related to the OS WebView component being cleaned up. The current implementation was only supposed to be used for testing purposes as an attempt to address non-deterministic timeouts in tests. However, the timeouts still occur and the current implementation is prone to break as it may never terminate when new events to be process arrive frequently.

This change simplifies the cleanup functionality to process UI events only once instead of looping it. This mitigates the risk of a long-running loop and reduces unnecessary complexity.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 29, 2025

Test Results

   494 files  ±0     494 suites  ±0   11m 50s ⏱️ + 2m 4s
 4 333 tests ±0   4 320 ✅ ±0   13 💤 ±0  0 ❌ ±0 
16 574 runs  ±0  16 466 ✅ ±0  108 💤 ±0  0 ❌ ±0 

Results for commit c214d90. ± Comparison against base commit 48be417.

♻️ This comment has been updated with latest results.

When executing tests for Edge, UI events are processed on teardown of
the test (or more precisely on widget disposal) as there may still be
resources related to the OS WebView component being cleaned up. The
current implementation was only supposed to be used for testing purposes
as an attempt to address non-deterministic timeouts in tests. However,
the timeouts still occur and the current implementation is prone to
break as it may never terminate when new events to be process arrive
frequently.

This change simplifies the cleanup functionality to process UI events
only once instead of looping it. This mitigates the risk of a
long-running loop and reduces unnecessary complexity.
@HeikoKlare HeikoKlare force-pushed the edge_tests_cleanup_simplification branch from 2f12b20 to c214d90 Compare January 29, 2025 20:14
@HeikoKlare HeikoKlare marked this pull request as ready for review January 29, 2025 20:14
@HeikoKlare
Copy link
Contributor Author

Avoids non-terminating test executions like https://github.com/eclipse-platform/eclipse.platform.swt/actions/runs/13039267968/job/36377127641?pr=1776:

[2025-01-29 19:59:40 +0000] org.eclipse.swt.tests.junit.Test_org_eclipse_swt_browser_Browser.test_evaluate_array_strings[browser flags: 0]() ran for more than 60 seconds
totalMemory:             140509184
freeMemory (before GC):   86642488
freeMemory (after GC):    58301096
"main" prio=5 Id=1 TIMED_WAITING
	at [email protected]/java.lang.Thread.sleep0(Native Method)
	at [email protected]/java.lang.Thread.sleep(Thread.java:509)
	at app//org.eclipse.swt.tests.junit.Test_org_eclipse_swt_browser_Browser.afterDispose(Test_org_eclipse_swt_browser_Browser.java:262)
	at app//org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Widget$1.dispose(Test_org_eclipse_swt_widgets_Widget.java:73)
	at app//org.eclipse.test.Screenshots$ScreenshotOnFailure.finished(Screenshots.java:47)
	at app//org.junit.rules.TestWatcher.finishedQuietly(TestWatcher.java:122)
	at app//org.junit.rules.TestWatcher.access$400(TestWatcher.java:52)
	at app//org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:70)
	...
"Reference Handler" daemon prio=10 Id=9 RUNNABLE
	at [email protected]/java.lang.ref.Reference.waitForReferencePendingList(Native Method)
	at [email protected]/java.lang.ref.Reference.processPendingReferences(Reference.java:246)
	at [email protected]/java.lang.ref.Reference$ReferenceHandler.run(Reference.java:208)
"Finalizer" daemon prio=8 Id=10 WAITING on java.lang.ref.NativeReferenceQueue$Lock@4533ca8f
	at [email protected]/java.lang.Object.wait0(Native Method)
	-  waiting on java.lang.ref.NativeReferenceQueue$Lock@4533ca8f
	at [email protected]/java.lang.Object.wait(Object.java:366)
	at [email protected]/java.lang.Object.wait(Object.java:339)
	at [email protected]/java.lang.ref.NativeReferenceQueue.await(NativeReferenceQueue.java:48)
	at [email protected]/java.lang.ref.ReferenceQueue.remove0(ReferenceQueue.java:158)
	at [email protected]/java.lang.ref.NativeReferenceQueue.remove(NativeReferenceQueue.java:89)
	at [email protected]/java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:173)
"Signal Dispatcher" daemon prio=9 Id=11 RUNNABLE
"Attach Listener" daemon prio=5 Id=12 RUNNABLE
"Notification Thread" daemon prio=9 Id=18 RUNNABLE
"Common-Cleaner" daemon prio=8 Id=19 TIMED_WAITING on java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@20e16691
	at [email protected]/jdk.internal.misc.Unsafe.park(Native Method)
	-  waiting on java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@20e16691
	at [email protected]/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:269)
	at [email protected]/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1852)
	at [email protected]/java.lang.ref.ReferenceQueue.await(ReferenceQueue.java:71)
	at [email protected]/java.lang.ref.ReferenceQueue.remove0(ReferenceQueue.java:143)
	at [email protected]/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:218)
	at [email protected]/jdk.internal.ref.CleanerImpl.run(CleanerImpl.java:140)
	at [email protected]/java.lang.Thread.runWith(Thread.java:1596)
	...
"surefire-forkedjvm-stream-flusher" daemon prio=5 Id=23 TIMED_WAITING on java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@2c34eefb
	at [email protected]/jdk.internal.misc.Unsafe.park(Native Method)
	-  waiting on java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@2c34eefb
	at [email protected]/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:269)
	at [email protected]/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1763)
	at [email protected]/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1182)
	at [email protected]/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:899)
	at [email protected]/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1070)
	at [email protected]/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at [email protected]/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	...
"surefire-forkedjvm-command-thread" daemon prio=5 Id=25 RUNNABLE (in native)
	at [email protected]/java.io.FileInputStream.readBytes(Native Method)
	at [email protected]/java.io.FileInputStream.read(FileInputStream.java:287)
	at [email protected]/java.io.BufferedInputStream.read1(BufferedInputStream.java:345)
	at [email protected]/java.io.BufferedInputStream.implRead(BufferedInputStream.java:420)
	at [email protected]/java.io.BufferedInputStream.read(BufferedInputStream.java:399)
	at [email protected]/java.io.BufferedInputStream.fill(BufferedInputStream.java:291)
	at [email protected]/java.io.BufferedInputStream.read1(BufferedInputStream.java:347)
	at [email protected]/java.io.BufferedInputStream.implRead(BufferedInputStream.java:420)
	...
	Number of locked synchronizers = 2
	- java.util.concurrent.locks.ReentrantLock$NonfairSync@5deec0c2
	- java.util.concurrent.locks.ReentrantLock$NonfairSync@6520e42
"ForkJoinPool.commonPool-worker-3" daemon prio=5 Id=35 TIMED_WAITING on java.util.concurrent.ForkJoinPool@2d2c35f7
	at [email protected]/jdk.internal.misc.Unsafe.park(Native Method)
	-  waiting on java.util.concurrent.ForkJoinPool@2d2c35f7
	at [email protected]/java.util.concurrent.locks.LockSupport.parkUntil(LockSupport.java:449)
	at [email protected]/java.util.concurrent.ForkJoinPool.awaitWork(ForkJoinPool.java:1891)
	at [email protected]/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1809)
	at [email protected]/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)
"Timer-0" daemon prio=5 Id=36 RUNNABLE
	at [email protected]/sun.management.ThreadImpl.dumpThreads0(Native Method)
	at [email protected]/sun.management.ThreadImpl.dumpAllThreads(ThreadImpl.java:518)
	at app//org.eclipse.test.TracingSuite$DumpTask.dumpStackTraces(TracingSuite.java:249)
	at app//org.eclipse.test.TracingSuite$DumpTask.run(TracingSuite.java:203)
	at [email protected]/java.util.TimerThread.mainLoop(Timer.java:566)
	at [email protected]/java.util.TimerThread.run(Timer.java:516)
AWT screenshot saved to: C:\Users\RUNNER~1\AppData\Local\Temp\org.eclipse.test.TracingSuite.0.png

@HeikoKlare HeikoKlare merged commit 9aa7973 into eclipse-platform:master Jan 29, 2025
14 checks passed
@HeikoKlare HeikoKlare deleted the edge_tests_cleanup_simplification branch January 29, 2025 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant