Skip to content

Conversation

@vogella
Copy link
Contributor

@vogella vogella commented Feb 4, 2026

The test ensureCleanUpAddonCleansUp was failing intermittently because CleanupAddon deferred container cleanup via Display.asyncExec(), creating a race condition where event loop pumping during part activation could interfere with async cleanup tasks.

Root cause analysis:

  • When hidePart() is called on parts with REMOVE_ON_HIDE_TAG, it triggers synchronous EMF model change events via UIEventPublisher
  • Event delivery is fully synchronous: EventBroker.send() ->
    EventAdmin.sendEvent() -> Display.syncExec() -> handler execution
  • The subscribeRenderingChanged handler detected visCount==0 but deferred cleanup via asyncExec (line 352)
  • Meanwhile, activate() calls during hidePart() pumped the event loop (via focusGui/SWT focus handling), potentially consuming queued asyncExecs before they could observe the final state
  • This created timing-dependent behavior where cleanup could be skipped

Fix:

  • Remove asyncExec wrapper from subscribeRenderingChanged's visCount==0 path
  • Since event delivery is synchronous, visCount already reflects the actual state at event time - no need to defer and re-check
  • Container is now hidden immediately when last renderable child becomes non-renderable, before any event loop pumping can interfere
  • Update test to use simple spinEventLoop + assertFalse instead of 30-second waitForCondition, as cleanup is now synchronous

This fixes the flaky test that failed ~1-3% of the time even with the 30-second timeout. The subscribeTopicChildren handler still uses asyncExec for children removal/sash unwrapping, but toBeRendered cleanup is now deterministic.

Fixes #3581

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

Test Results

 3 024 files  + 54   3 024 suites  +54   2h 17m 38s ⏱️ - 7m 48s
 8 234 tests ±  0   7 986 ✅ ±  0  248 💤 ± 0  0 ❌ ±0 
23 526 runs  +170  22 735 ✅ +114  791 💤 +56  0 ❌ ±0 

Results for commit 0b45f54. ± Comparison against base commit 676351a.

♻️ This comment has been updated with latest results.

@vogella
Copy link
Contributor Author

vogella commented Feb 4, 2026

AFAICS this is a save change (famous last words) and should finally fix our forever flaky cleanup race condition revealed in the cleanup test.

@vogella
Copy link
Contributor Author

vogella commented Feb 4, 2026

I suggest to wait for the beginn of the next release developement for this one.

@vogella vogella marked this pull request as draft February 4, 2026 13:27
The test ensureCleanUpAddonCleansUp was failing intermittently because
CleanupAddon deferred container cleanup via Display.asyncExec(), creating
a race condition where event loop pumping during part activation could
interfere with async cleanup tasks.

Root cause analysis:
- When hidePart() is called on parts with REMOVE_ON_HIDE_TAG, it triggers
  synchronous EMF model change events via UIEventPublisher
- Event delivery is fully synchronous: EventBroker.send() ->
  EventAdmin.sendEvent() -> Display.syncExec() -> handler execution
- The subscribeRenderingChanged handler detected visCount==0 but deferred
  cleanup via asyncExec (line 352)
- Meanwhile, activate() calls during hidePart() pumped the event loop
  (via focusGui/SWT focus handling), potentially consuming queued asyncExecs
  before they could observe the final state
- This created timing-dependent behavior where cleanup could be skipped

Fix:
- Remove asyncExec wrapper from subscribeRenderingChanged's visCount==0 path
- Since event delivery is synchronous, visCount already reflects the actual
  state at event time - no need to defer and re-check
- Container is now hidden immediately when last renderable child becomes
  non-renderable, before any event loop pumping can interfere
- Update test to use simple spinEventLoop + assertFalse instead of
  30-second waitForCondition, as cleanup is now synchronous

This fixes the flaky test that failed ~1-3% of the time even with the
30-second timeout. The subscribeTopicChildren handler still uses asyncExec
for children removal/sash unwrapping, but toBeRendered cleanup is now
deterministic.

Fixes eclipse-platform#3581

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@vogella vogella force-pushed the fix-cleanup-addon-race-condition branch from aa9e3b7 to 0b45f54 Compare February 13, 2026 09:50
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.

PartRenderingEngineTests.ensureCleanUpAddonCleansUp still fails randomly

1 participant