Skip to content

fix: cache Polymer event handler lookup per deployment - #26973

Merged
caalador merged 2 commits into
mainfrom
fix/cache-polymer-event-handler-lookup
Nov 12, 2026
Merged

caalador merged 2 commits into
mainfrom
fix/cache-polymer-event-handler-lookup

Conversation

@totally-not-ai

Copy link
Copy Markdown
Contributor

Fixes #26972

performance · flow-server · every app without Polymer templates that receives @ClientCallable / $server calls (Grid scrolling, ComboBox filtering, …)

Each non-array argument of a $server call looked up the deprecated Polymer template event handler. When none is registered, which is the normal case, the lookup scanned the classpath with ServiceLoader on every call, because a missing result was never remembered. The lookup now happens once per deployment.

Risks:

  • ⏱️ Removes a classpath scan per decoded RPC argument; one extra servlet-context attribute is stored.
  • ✅ No API, behaviour, security, serialization or threading changes.

Context. Whether the Polymer handler exists is fixed when the Lookup is built, so caching the result is safe. Caching negative results inside Lookup itself was the alternative, but it would change lookup semantics for every service and both lookup implementations, for one hot caller.

  • PublishedServerEventHandlerRpcHandler now stores the handler lookup result, including a missing handler, in a VaadinContext attribute and reuses it.
  • Tests check that the lookup runs once across calls, both when no handler exists and when a handler resolves the arguments.

Decoding each @ClientCallable argument looked up the Polymer template
event handler. When none is registered, the lookup fell back to a
ServiceLoader classpath scan on every call. The result is now stored
once per VaadinContext.

Fixes #26972
@Legioth
Legioth marked this pull request as ready for review November 11, 2026 13:42

@vaadin-review-bot vaadin-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Nothing to flag — the changes look good.

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

Test Results

 1 691 files  ±0   1 781 suites  ±0   2h 13m 40s ⏱️ + 11m 2s
13 481 tests +2  13 401 ✅ +2  80 💤 ±0  0 ❌ ±0 
14 115 runs  +2  14 035 ✅ +2  80 💤 ±0  0 ❌ ±0 

Results for commit 21ed7bb. ± Comparison against base commit 259109a.

@caalador
caalador added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit 14e3e37 Nov 12, 2026
68 checks passed
@caalador
caalador deleted the fix/cache-polymer-event-handler-lookup branch November 12, 2026 08:12
@github-actions

Copy link
Copy Markdown
Contributor

Documentation Bot: No documentation needed for this change.

The change caches the (already-existing) Polymer template event handler lookup per deployment instead of re-running a classpath ServiceLoader scan on every $server RPC call; the PR description confirms there is no API, behavior, security, serialization, or threading change (INTERNAL_ONLY). Nothing a reader of the documentation would observe differently.

Nothing was opened in vaadin/docs. If you disagree, the change has to be documented by hand there.

Generated by Documentation Bot for #26973 · agent · 28.6 AIC · ⊞ 11.7K · ◷

@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with Vaadin 25.4.0-alpha7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Every @ClientCallable argument triggers a ServiceLoader classpath scan (DeprecatedPolymerPublishedEventHandler lookup is never cached)

4 participants