Skip to content

Coalesce queued Display size-change events to protect EDT#4593

Merged
shai-almog merged 2 commits intomasterfrom
codex/fix-frequent-size-change-events-in-javaseport
Mar 5, 2026
Merged

Coalesce queued Display size-change events to protect EDT#4593
shai-almog merged 2 commits intomasterfrom
codex/fix-frequent-size-change-events-in-javaseport

Conversation

@shai-almog
Copy link
Collaborator

Motivation

  • Rapid window resizes can enqueue many SIZE_CHANGED events and overflow the fixed-size inputEventStack, overwhelming the EDT and producing exceptions.
  • The change aims to keep only the latest width/height per EDT cycle so resize storms do not fill the queue or spam the EDT.

Description

  • Add a lastSizeChangeOffset field to track a queued size-change slot for the current input-event stack cycle.
  • Reset lastSizeChangeOffset when flipping the input event stacks so coalescing is scoped to a single EDT cycle.
  • Change addSizeChangeEvent(...) to coalesce new size notifications by overwriting the queued width/height if a size-change entry already exists, otherwise enqueue a new 3-int entry and record its offset.
  • Wrap enqueue logic in a try/catch with logging to guard against ArrayIndexOutOfBoundsException, matching defensive patterns used for other high-frequency events.

Testing

  • Ran the quick smoke helper ./scripts/fast-core-unit-smoke.sh, which failed in this environment due to a module/profile mismatch and a top-level module reporting "No tests were executed" (environment issue, not a functional regression).
  • Ran the full core unit tests with mvn -pl core-unittests -am -DunitTests=true -Dmaven.javadoc.skip=true -DfailIfNoTests=false, which completed but reported one unrelated test failure (RSSReaderCoverageTest.testEventHandler) not caused by these changes.
  • Ran the focused DisplayTest via mvn -pl core-unittests -Dtest=DisplayTest test, and the Display-related tests passed.

Codex Task

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

✅ Continuous Quality Report

Test & Coverage

Static Analysis

Generated automatically by the PR CI workflow.

@shai-almog
Copy link
Collaborator Author

shai-almog commented Mar 5, 2026

Compared 32 screenshots: 32 matched.

Native Android coverage

  • 📊 Line coverage: 7.31% (3716/50867 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 5.71% (18268/320093), branch 2.76% (858/31113), complexity 3.41% (1015/29746), method 6.01% (833/13858), class 9.83% (180/1831)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/712 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 7.31% (3716/50867 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 5.71% (18268/320093), branch 2.76% (858/31113), complexity 3.41% (1015/29746), method 6.01% (833/13858), class 9.83% (180/1831)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/712 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

@shai-almog
Copy link
Collaborator Author

shai-almog commented Mar 5, 2026

iOS screenshot updates

Compared 32 screenshots: 31 matched, 1 updated.

  • landscape — updated screenshot. Screenshot differs (2556x1179 px, bit depth 8).

    landscape
    Preview info: Preview provided by instrumentation.
    Full-resolution PNG saved as landscape.png in workflow artifacts.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 101 seconds

Detailed Performance Metrics

Metric Duration
Simulator Boot 2000 ms
Simulator Boot (Run) 7000 ms
App Install 3000 ms
App Launch 6000 ms
Test Execution 152000 ms

@shai-almog shai-almog merged commit 2fa407d into master Mar 5, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant