When I create a component, for example a Tree represented by TreeGrid class. I can attach a selection listener for it.
If code in listener do some hard work and then update user UI i need to worry about syncronization? Because my listener code is run in different theads (I check it).
Second… I want to freeze user UI while the my handler do work.
Now client can select nodes fast, and browser allow do this (despite blue loading bar on the top of web page). Yes, this events later come to server, seems like they processing in queue. But when i click nodes fast and my server code is slow in server logs i see this:
[qtp1697752980-17]
WARN com.vaadin.flow.server.communication.rpc.AbstractRpcInvocationHandler - Got an RPC for non-existent node: 743
[qtp1697752980-17]
WARN com.vaadin.flow.server.communication.rpc.AbstractRpcInvocationHandler - Got an RPC for non-existent node: 739
[qtp1697752980-17]
WARN com.vaadin.flow.server.communication.rpc.AbstractRpcInvocationHandler - Got an RPC for non-existent node: 735
[qtp1697752980-17]
WARN com.vaadin.flow.server.communication.rpc.AbstractRpcInvocationHandler - Got an RPC for non-existent node: 731
[qtp1697752980-17]
WARN com.vaadin.flow.server.communication.rpc.AbstractRpcInvocationHandler - Got an RPC for non-existent node: 727
[qtp1697752980-17]
WARN com.vaadin.flow.server.communication.rpc.AbstractRpcInvocationHandler - Got an RPC for non-existent node: 723
[qtp1697752980-17]
WARN com.vaadin.flow.server.communication.rpc.AbstractRpcInvocationHandler - Got an RPC for non-existent node: 719
[qtp1697752980-17]
WARN com.vaadin.flow.server.communication.rpc.AbstractRpcInvocationHandler - Got an RPC for non-existent node: 715
[qtp1697752980-17]
WARN com.vaadin.flow.server.communication.rpc.AbstractRpcInvocationHandler - Got an RPC for non-existent node: 711
[qtp1697752980-17]
WARN com.vaadin.flow.server.communication.rpc.AbstractRpcInvocationHandler - Got an RPC for non-existent node: 707
[qtp1697752980-17]
WARN com.vaadin.flow.server.communication.rpc.AbstractRpcInvocationHandler - Got an RPC for non-existent node: 703
[qtp1697752980-15]
WARN com.vaadin.flow.server.communication.rpc.MapSyncRpcHandler - Property update request for disabled element is received from the client side. The property is 'invalid'. Request is ignored.
Looks scary.
P.S. To be clear - I do not spawn my threads, just regular code from examples.
Well, have some news. This bug is appear when you try to remove and add a combobox to UI. And if this take some time, and user produce another events - we will see this messages in log. Textfield work ok with this case.
code for reproduce (you have to click on button fast to see a message):
@HtmlImport("frontend://styles/shared-styles.html")
@Route("web-app")
@Viewport("width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes")
public class MainLayout2 extends VerticalLayout implements RouterLayout, PageConfigurator {
FormLayout form = null;
VerticalLayout innerLayout = new VerticalLayout();
public MainLayout2() {
Button button = new Button("test");
button.addClickListener(buttonClickEvent -> {
// represent some thread work, but this is not required, if user is fast enough :)
sleep(100);
innerLayout.removeAll();
// buggy with combobox
innerLayout.add(createCombobox());
// ok with textfield
// innerLayout.add(createTextField());
});
add(button);
add(innerLayout);
}
private void sleep(int millis) {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
e.printStackTrace();
Thread.currentThread().interrupt();
}
}
private Component createCombobox() {
ComboBox<String> comboBox = new ComboBox<>();
comboBox.setItems("1", "2", "3", "4");
comboBox.setSizeFull();
return comboBox;
}
private Component createTextField() {
TextField textField = new TextField();
textField.setValue("value");
textField.setSizeFull();
return textField;
}
@Override
public void configurePage(InitialPageSettings settings) {
}
}
same issue here, if we keep click on many different components enough quick, then this issue happens.
temporary solution is to avoid click too fast on UI components :))
final com.vaadin.flow.component.notification.Notification note = new com.vaadin.flow.component.notification.Notification();
final com.vaadin.flow.component.Html html = new com.vaadin.flow.component.Html(
newHtmlText);
note.add(html);
note.addThemeVariants(com.vaadin.flow.component.notification.NotificationVariant.LUMO_PRIMARY);
note.setPosition(com.vaadin.flow.component.notification.Notification.Position.BOTTOM_START);
note.setDuration(10000);
note.open();
It shows the notification for 10 seconds. In between I am doing some navigation and it draws another small blue empty notification and so on. If I trigger notification there will be a lot of blue and empty notifications. I see following error at console: [com.vaadin.flow.server.communication.rpc.AbstractRpcInvocationHandler]
(default task-7) Got an RPC for non-existent node: 1906
If I change the above code to use text instead of html in my notification and then triggering navigation again it shows the text-notification n-times with the correct text - and the known error on console.
I think that there are two erros. While triggering navigation i draws the notification again and again. And if the operation takes too long (e.g. using html instead of text in notification) it breaks the notification and shows an empty small blue notification without any text.
I tried writing the new method notificationBroadcastHtml with above code and used access:
is there any progress on this issue?
I got the same behaviour as mentioned above.
My scenario is as follows:
I have horizontal layout which contains another horizontal layout called ‘filterContent’ and a button.
If the button is pressed, a new custom component ‘filter-edit’ will be added to the ‘filterContent’. This ‘filter-edit’ component consists of a vaadin-combobox and a vaadin-textfield.
On creation of this component following listeners will be registered:
KeyEventListener enterKeyListener = new KeyEventListener(e -> this.handleEnterKey(), Key.ENTER);
KeyEventListener escapeKeyListener = new KeyEventListener(e -> this.handleEscapeKey(), Key.ESCAPE);
this.addListener(KeyDownEvent.class, enterKeyListener);
this.addListener(KeyDownEvent.class, escapeKeyListener);
When enter-key or escape-key will be hit, this component will be removed from the ‘filterContent’ - Layout.
With the data entered in ‘filter-edit’ a new custom component ‘filter-show’ will be created, which displays the data and consists of two labels.
This filter-show registers a doubleClickListener with a @DomEvent(“dblclick”) - custom event.
When updating the filterContent-Layout all components will be removed (removeAll()) and then new ones will be created.
I still got this message ‘Got an RPC for non-existent node: 1149’ everytime I switch from filter-edit.
I dont event see an impact in the ui-behaviour, but on log console.
No idea, why the client still sends an event for a removed component.
is there any progress on this issue?
I got the same behaviour as mentioned above.
My scenario is as follows:
I have horizontal layout which contains another horizontal layout called ‘filterContent’ and a button.
If the button is pressed, a new custom component ‘filter-edit’ will be added to the ‘filterContent’. This ‘filter-edit’ component consists of a vaadin-combobox and a vaadin-textfield.
On creation of this component following listeners will be registered:
KeyEventListener enterKeyListener = new KeyEventListener(e -> this.handleEnterKey(), Key.ENTER);
KeyEventListener escapeKeyListener = new KeyEventListener(e -> this.handleEscapeKey(), Key.ESCAPE);
this.addListener(KeyDownEvent.class, enterKeyListener);
this.addListener(KeyDownEvent.class, escapeKeyListener);
When enter-key or escape-key will be hit, this component will be removed from the ‘filterContent’ - Layout.
With the data entered in ‘filter-edit’ a new custom component ‘filter-show’ will be created, which displays the data and consists of two labels.
This filter-show registers a doubleClickListener with a @DomEvent(“dblclick”) - custom event.
When updating the filterContent-Layout all components will be removed (removeAll()) and then new ones will be created.
I still got this message ‘Got an RPC for non-existent node: 1149’ everytime I switch from filter-edit.
I dont event see an impact in the ui-behaviour, but on log console.
No idea, why the client still sends an event for a removed component.
Maik
I have the same problem changing controls visivility via addEventListener(“dblclick” … ).
Apparently, the click listener is triggered twice when the Button is focused. In your case, it is the second triggering that causes the error since the server is receiving an RPC from a Button that should have been discarded already (since you navigate away).
Meanwhile, a hacky workaround to make the error go away is to have a counter that gets incremented per click event. Then you can use that to do the navigation only when the second click event is received:
int counter = 0;
proceedButton.addClickShortcut(Key.ENTER);
proceedButton.addClickListener(e->
{
counter++;
LOGGER.info("button clicked");
if ((counter % 2) == 0) {
UI.getCurrent().navigate(PublicPage.class);
}
});