Vaadin flow threads syncronization and lifycycle

Hello, where i can read about this?

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) {
    }
}

Seems threads is syncronized (i hope for it), but client is send event from component which missing on server already. Combobox component bug?

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 :))

yes, this happens also in 14.1.2, and the page becomes unusable…

Have you checked this chapter in documentation: https://vaadin.com/docs/v14/flow/advanced/tutorial-push-access.html

Hi!

This happens in 14.1.3 too.

I am using this code:

        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:

this.getUI().get().access(() → notificationBroadcastHtml(…my html…));

I got the same issue.

Thomas

Hi there,

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

Maik Blümel:
Hi there,

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” … ).

Like https://vaadin.com/forum/thread/18034776/18254796

logging.level.com.vaadin.flow.server.communication.rpc.AbstractRpcInvocationHandler=ERROR

Vitalii Lipovetskii:
Like https://vaadin.com/forum/thread/18034776/18254796

logging.level.com.vaadin.flow.server.communication.rpc.AbstractRpcInvocationHandler=ERROR

I am wondering if this is correct. This assumes we can safely ignore this message. But this is not the case, is not it?

Just want to check if this is still valid with 14.4.0.

I have a simple button with addClickListener and addClickShortcut. It works without any issue if clicked on button with mouse.

But when I use ENTER key as a shortcut it generates:

2020-10-19 13:20:00.231 WARN 7228 — [io-8080-exec-25]
c.v.f.s.c.r.AbstractRpcInvocationHandler : Got an RPC for non-existent node: 51

ignorable or not ?

		proceedButton.addClickShortcut(Key.ENTER);
		proceedButton.addClickListener(e->
		{
			LOGGER.info("button clicked");
			UI.getCurrent().navigate(PublicPage.class);
		});

Okan BEKATLI:
Just want to check if this is still valid with 14.4.0.

I have a simple button with addClickListener and addClickShortcut. It works without any issue if clicked on button with mouse.

But when I use ENTER key as a shortcut it generates:

2020-10-19 13:20:00.231 WARN 7228 — [io-8080-exec-25]
c.v.f.s.c.r.AbstractRpcInvocationHandler : Got an RPC for non-existent node: 51

ignorable or not ?

		proceedButton.addClickShortcut(Key.ENTER);
		proceedButton.addClickListener(e->
		{
			LOGGER.info("button clicked");
			UI.getCurrent().navigate(PublicPage.class);
		});

This error message seems to be caused by this bug: https://github.com/vaadin/flow/issues/8037

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);
            }
		});