When assertions are enabled and certain component is hidden via ui.access(...), AssertError is thrown in com.vaadin.ui.ConnectorTracker.cleanConnectorMap(ConnectorTracker.java:349).
Description
The issue occurs when there are several open UIs and component visibility in one of them is changed in ui.access(...) block. Such blocks are executed before VaadinSession is unlocked right before connector hierarchy checks. When some component is hidden this way, and the currently handled request is for another UI instance, the client is not (yet) notified of those changes and the assertion code complains about it.
Run project with enabled assertions (-ea argument added to VM options)
Open two tabs pointing at http://localhost:8080
Click Switch content on other tabs button on any of the tabs
Expected behavior
No exceptions throwables are thrown.
Actual behavior
Mar 14, 2022 1:09:20 PM com.vaadin.server.VaadinSession unlock
SEVERE: Exception while cleaning connector map for ui 1
java.lang.AssertionError: Connector com.vaadin.ui.VerticalLayout@4c621039 (id = 11) is no longer visible to the client, but no corresponding hierarchy change was sent.
at com.vaadin.ui.ConnectorTracker.cleanConnectorMap(ConnectorTracker.java:349)
at com.vaadin.ui.ConnectorTracker.cleanConnectorMap(ConnectorTracker.java:294)
at com.vaadin.server.VaadinSession.unlock(VaadinSession.java:1036)
at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:42)
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1637)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:464)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
...
Mar 14, 2022 1:09:20 PM com.vaadin.server.VaadinSession unlock
SEVERE: Exception while cleaning connector map for ui 1
java.lang.AssertionError: Connector com.vaadin.ui.Label@2e60a901 (id = 12) is no longer visible to the client, but no corresponding hierarchy change was sent.
at com.vaadin.ui.ConnectorTracker.cleanConnectorMap(ConnectorTracker.java:349)
at com.vaadin.ui.ConnectorTracker.cleanConnectorMap(ConnectorTracker.java:294)
at com.vaadin.server.VaadinSession.unlock(VaadinSession.java:1036)
at com.vaadin.server.VaadinService.requestEnd(VaadinService.java:1491)
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1651)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:464)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
...
Overview
When assertions are enabled and certain component is hidden via
ui.access(...)
,AssertError
is thrown incom.vaadin.ui.ConnectorTracker.cleanConnectorMap(ConnectorTracker.java:349)
.Description
The issue occurs when there are several open UIs and component visibility in one of them is changed in
ui.access(...)
block. Such blocks are executed beforeVaadinSession
is unlocked right before connector hierarchy checks. When some component is hidden this way, and the currently handled request is for another UI instance, the client is not (yet) notified of those changes and the assertion code complains about it.Reproduction
Project: https://github.com/fluorumlabs/vaadin8-connector-not-visible-issue/blob/master/src/main/java/org/test/MyUI.java
Steps to reproduce:
-ea
argument added to VM options)http://localhost:8080
Switch content on other tabs
button on any of the tabsExpected behavior
No
exceptionsthrowables are thrown.Actual behavior