vaadin / flow

Vaadin Flow is a Java framework binding Vaadin web components to Java. This is part of Vaadin 10+.
Apache License 2.0
618 stars 167 forks source link

Vaadin 23 Resynchronizing UI by client's request - If you are using push with a proxy, make sure the push timeout smaller proxy connection timeout #15205

Closed alexanoid closed 1 year ago

alexanoid commented 1 year ago

Description of the bug

Mostly on my iPhone I still receive the following error and my applications shows infinitive bold blue progress bar at the top of the page:

c.v.f.s.communication.ServerRpcHandler   : Resynchronizing UI by client's request. A network message was lost before reaching the client and the client is reloading the full UI state. This typically happens because of a bad network connection with packet loss or because of some part of the network infrastructure (load balancer, proxy) terminating a push (websocket or long-polling) connection. If you are using push with a proxy, make sure the push timeout is set to be smaller than the proxy connection timeout

I understand that this issue maybe related to flaky mobile internet connection, but unfortunately it will be really hard to explain the same to every single user of my application. The application should be able to restore from such situation.

I use NGINX as a proxy and Spring Boot (Tomcat or Undertow) with Vaadin application.

In Vaadin application I use:

@Push(transport = Transport.WEBSOCKET_XHR)

My configs:

SpringBoot application.properties:

server.servlet.session.timeout=30m
server.servlet.session.tracking-modes = cookie
server.servlet.session.cookie.http-only=true
server.servlet.session.cookie.secure=true
server.servlet.session.cookie.max-age=365d

vaadin.heartbeatInterval=45
vaadin.pushLongPollingSuspendTimeout=180000
vaadin.maxMessageSuspendTimeout=5000
vaadin.compatibilityMode = false

NGINX:

proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_read_timeout 300; proxy_connect_timeout 300; proxy_send_timeout 300;

Atmosphere:

@Component
public class AtmosphereConfiguration implements ServletContextInitializer {

    @Override
    public void onStartup(ServletContext servletContext) {
        servletContext.setInitParameter("org.atmosphere.cpr.AtmosphereConfig.getInitParameter", "true");
        servletContext.setInitParameter("org.atmosphere.cpr.AtmosphereInterceptor", "org.atmosphere.interceptor.HeartbeatInterceptor");
        servletContext.setInitParameter("org.atmosphere.interceptor.HeartbeatInterceptor.paddingChar", "{\"command\":\"serverInfo\", \"data\":{}}");
        servletContext.setInitParameter("org.atmosphere.interceptor.HeartbeatInterceptor.heartbeatFrequencyInSeconds", "45");
    }

}

Related SO questions:

https://stackoverflow.com/questions/74350932/vaadin-23-resynchronizing-ui-by-clients-request-if-you-are-using-push-with-a https://stackoverflow.com/questions/74418180/vaadin-23-websockets-iphone-updates-with-delays

Expected behavior

Application should not freeze and continue to operate normally

Minimal reproducible example

Try my application to use for some time on iPhone for example

Versions

alexanoid commented 1 year ago

I'm hoping to deploy my project to production in about 2 weeks, and this issue is bugging me a lot. I will be very grateful if you can take a look at it. I've been struggling with this problem for about a month or more with no success. I am ready to provide you with any necessary logs. Please let me know what I need to enable to debug the app, and I'll collect the logs.

alexanoid commented 1 year ago

This is what I have so far with

logging.level.com.vaadin=DEBUG
logging.level.org.vaadin=DEBUG
logging.level.org.atmosphere = DEBUG
2022-11-19 12:07:19.791 DEBUG 3407512 --- [task-19] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:21.747 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:21.748 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:21.754 DEBUG 3407512 --- [task-20] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:29.663 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:29.664 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:29.671 DEBUG 3407512 --- [task-18] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:34.889 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:34.889  WARN 3407512 --- [XNIO-1 task-4] c.v.f.s.communication.ServerRpcHandler   : Resynchronizing UI by client's request. A network message was lost before reaching the client and the client is reloading the full UI state. This typically happens because of a bad network connection with packet loss or because of some part of the network infrastructure (load balancer, proxy) terminating a push (websocket or long-polling) connection. If you are using push with a proxy, make sure the push timeout is set to be smaller than the proxy connection timeout
2022-11-19 12:07:34.900 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:34.933 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:35.403 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:35.412 DEBUG 3407512 --- [task-24] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:40.629 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:40.630  WARN 3407512 --- [XNIO-1 task-4] c.v.f.s.communication.ServerRpcHandler   : Resynchronizing UI by client's request. A network message was lost before reaching the client and the client is reloading the full UI state. This typically happens because of a bad network connection with packet loss or because of some part of the network infrastructure (load balancer, proxy) terminating a push (websocket or long-polling) connection. If you are using push with a proxy, make sure the push timeout is set to be smaller than the proxy connection timeout
2022-11-19 12:07:40.639 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:40.659 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:41.137 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:41.146 DEBUG 3407512 --- [task-17] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:46.372 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:46.372  WARN 3407512 --- [XNIO-1 task-4] c.v.f.s.communication.ServerRpcHandler   : Resynchronizing UI by client's request. A network message was lost before reaching the client and the client is reloading the full UI state. This typically happens because of a bad network connection with packet loss or because of some part of the network infrastructure (load balancer, proxy) terminating a push (websocket or long-polling) connection. If you are using push with a proxy, make sure the push timeout is set to be smaller than the proxy connection timeout
2022-11-19 12:07:46.385 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:46.405 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:46.863 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:46.872 DEBUG 3407512 --- [task-18] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:52.096 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:52.097  WARN 3407512 --- [XNIO-1 task-4] c.v.f.s.communication.ServerRpcHandler   : Resynchronizing UI by client's request. A network message was lost before reaching the client and the client is reloading the full UI state. This typically happens because of a bad network connection with packet loss or because of some part of the network infrastructure (load balancer, proxy) terminating a push (websocket or long-polling) connection. If you are using push with a proxy, make sure the push timeout is set to be smaller than the proxy connection timeout
2022-11-19 12:07:52.103 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:52.123 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:52.573 DEBUG 3407512 --- [XNIO-1 task-3] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:52.582 DEBUG 3407512 --- [task-22] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:57.796 DEBUG 3407512 --- [XNIO-1 task-3] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:57.797  WARN 3407512 --- [XNIO-1 task-3] c.v.f.s.communication.ServerRpcHandler   : Resynchronizing UI by client's request. A network message was lost before reaching the client and the client is reloading the full UI state. This typically happens because of a bad network connection with packet loss or because of some part of the network infrastructure (load balancer, proxy) terminating a push (websocket or long-polling) connection. If you are using push with a proxy, make sure the push timeout is set to be smaller than the proxy connection timeout
2022-11-19 12:07:57.803 DEBUG 3407512 --- [XNIO-1 task-3] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:57.822 DEBUG 3407512 --- [XNIO-1 task-3] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:58.295 DEBUG 3407512 --- [XNIO-1 task-3] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:07:58.304 DEBUG 3407512 --- [task-21] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:12:13.127 DEBUG 3407512 --- [XNIO-1 task-3] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:12:13.128  WARN 3407512 --- [XNIO-1 task-4] c.v.f.s.communication.ServerRpcHandler   : Resynchronizing UI by client's request. A network message was lost before reaching the client and the client is reloading the full UI state. This typically happens because of a bad network connection with packet loss or because of some part of the network infrastructure (load balancer, proxy) terminating a push (websocket or long-polling) connection. If you are using push with a proxy, make sure the push timeout is set to be smaller than the proxy connection timeout
2022-11-19 12:12:13.134 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:12:13.154 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:12:15.807 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:12:15.815 DEBUG 3407512 --- [task-25] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:12:17.742 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.PushHandler   : New push connection for resource 489fcf51-0975-44a3-9aa3-923be7789b6f with transport LONG_POLLING
2022-11-19 12:12:17.743 DEBUG 3407512 --- [XNIO-1 task-4] org.atmosphere.cpr.DefaultBroadcaster    : Duplicate resource 489fcf51-0975-44a3-9aa3-923be7789b6f. Could be caused by a dead connection not detected by your server. Replacing the old one with the fresh one
2022-11-19 12:12:17.743 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.i.BrowserLiveReloadAccessor        : BrowserLiveReloadAccessImpl::getLiveReload is called in production mode.
2022-11-19 12:12:17.743 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.PushHandler   : Connection unexpectedly closed for resource 489fcf51-0975-44a3-9aa3-923be7789b6f with transport WEBSOCKET
2022-11-19 12:12:17.745 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:12:21.011  WARN 3407512 --- [XNIO-1 task-4] c.v.f.s.communication.ServerRpcHandler   : Resynchronizing UI by client's request. A network message was lost before reaching the client and the client is reloading the full UI state. This typically happens because of a bad network connection with packet loss or because of some part of the network infrastructure (load balancer, proxy) terminating a push (websocket or long-polling) connection. If you are using push with a proxy, make sure the push timeout is set to be smaller than the proxy connection timeout
2022-11-19 12:12:21.019 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:12:21.039 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:12:21.521 DEBUG 3407512 --- [XNIO-1 task-4] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:12:21.531 DEBUG 3407512 --- [task-30] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:12:26.737 DEBUG 3407512 --- [XNIO-1 task-3] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:12:26.739  WARN 3407512 --- [XNIO-1 task-3] c.v.f.s.communication.ServerRpcHandler   : Resynchronizing UI by client's request. A network message was lost before reaching the client and the client is reloading the full UI state. This typically happens because of a bad network connection with packet loss or because of some part of the network infrastructure (load balancer, proxy) terminating a push (websocket or long-polling) connection. If you are using push with a proxy, make sure the push timeout is set to be smaller than the proxy connection timeout
2022-11-19 12:12:26.749 DEBUG 3407512 --- [XNIO-1 task-3] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:12:26.773 DEBUG 3407512 --- [XNIO-1 task-3] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:12:27.261 DEBUG 3407512 --- [XNIO-1 task-3] c.v.f.server.communication.UidlWriter    : * Creating response to client
2022-11-19 12:12:27.272 DEBUG 3407512 --- [task-28] c.v.f.server.communication.UidlWriter    : * Creating response to client
alexanoid commented 1 year ago

also, I may reproduce the following issue https://stackoverflow.com/questions/74418180/vaadin-23-websockets-iphone-updates-with-delays by simply switching on my iPhone the WI-FI connection to LTE. Right after that - XHR requests - work, but WS stop working. WS start working after the full page refresh

mshabarov commented 1 year ago

@alexanoid to address the whole resynchronisation issue we are going to start fixing the following issues: https://github.com/vaadin/flow/issues/15281 https://github.com/vaadin/flow/issues/14887 they are easier to reproduce and we think they are related to the whole problem. Please follow these issues, the next patch releases for 23.2 and 23.3 will address them, once fixed.

alexanoid commented 1 year ago

@mshabarov thanks for the update!

jonasrotilli commented 1 year ago

Issue reported by me last July and still having it: #14232 and other: #14797 In fact, it got worse. I have the latest version (23.2.9) and it happens when I leave the application unused for a few minutes. Curious that it happens a lot more on Mac computers. I tested it on more than one mac computer and it happened on both. Already on a Windows, the problem occurs much less frequently. I tested it in Google Chrome browser and Safari, in both the same behavior. If I open the browsers log, it shows an error:

(in promise) Error: Client is resynchronizing at FlowClient.42a5821f.js:1:42438

We need an urgent solution for this, the situation is becoming unsustainable, many customers are complaining.

jonasrotilli commented 1 year ago

Issue reported by me last July and still having it: #14232 and other: #14797 In fact, it got worse. I have the latest version (23.2.9) and it happens when I leave the application unused for a few minutes. Curious that it happens a lot more on Mac computers. I tested it on more than one mac computer and it happened on both. Already on a Windows, the problem occurs much less frequently. I tested it in Google Chrome browser and Safari, in both the same behavior. If I open the browsers log, it shows an error:

(in promise) Error: Client is resynchronizing at FlowClient.42a5821f.js:1:42438

We need an urgent solution for this, the situation is becoming unsustainable, many customers are complaining.

For me it was resolved with version 23.2.13.

mshabarov commented 1 year ago

@alexanoid could you please upgrade to 23.2.15 and verify if the issue still exists for your setup?

alexanoid commented 1 year ago

@mshabarov I'm on 23.3.4. Right now the application works much more stable than previously

vaadin-bot commented 1 year ago

This ticket/PR has been released with Vaadin 23.2.16.

vaadin-bot commented 1 year ago

This ticket/PR has been released with Vaadin 23.3.6.

vaadin-bot commented 1 year ago

This ticket/PR has been released with Vaadin 14.9.6.

vaadin-bot commented 1 year ago

This ticket/PR has been released with Vaadin 24.0.0.beta2 and is also targeting the upcoming stable 24.0.0 version.

francoRolandoQubika commented 11 months ago

This issue came up again working with Vaadin 24.2.2. Previously in 24.1.4 was not recurring but now is constant.

MichaelPluessErni commented 8 months ago

I'm also experiencing this issue in Vaadin version 24.3.4. Interestingly it only occurs when the Session Replication Kubernetes Kit is active.

lakshmy-ramaswamy commented 4 months ago

"Resynchronizing UI by client's request. A network message was lost before reaching the client and the client is reloading the full UI state. This typically happens because of a bad network connection with packet loss or because of some part of the network infrastructure (load balancer, proxy) terminating a push (websocket or long-polling) connection. If you are using push with a proxy, make sure the push timeout is set to be smaller than the proxy connection timeout" This issue is happening again with vaadin 23.3.7. can someone help?