0

Typically, in development mode, right after the application relaunch, I might encounter the following warning (WARN):

WARN 14936 --- [nio-8080-exec-6] c.v.f.s.c.UidlRequestHandler             : Invalid security key received from 0:0:0:0:0:0:0:1

and then resync:

WARN 14936 --- [nio-8080-exec-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

I suspect that this resync is somehow connected to the Invalid security key received warning.

Could you please explain the meaning of this warning in the context of Vaadin internals? Additionally, where should I begin the debugging process to identify the underlying cause of this issue? Thank you.

alexanoid
  • 24,051
  • 54
  • 210
  • 410

1 Answers1

2

Each Vaadin instance in webbrowsers have a unique security key/identifier. This key is sent with each request to the server.

The server then validates if this security key is known and valid. If yes, operation continues as usual.

But when the request can't be matched to a valid ui server instance, then this warning is logged on server side. Then the server side sends a command to rebuild/sync the client ui instance with the server instance. This way the client UI becommes valid again

This can happen when server+client sessions don't match, many lost packets and so on

André Schild
  • 4,592
  • 5
  • 28
  • 42
  • Thanks! The issue is that when a resync of this type occurs, it's due to an application restart and a mismatch between the server-side security key (associated with the new application instance) and the old client-side security key (belonging to the open browser with the old application client) - after the resync done, I can see the application's user interface; however, upon clicking on Router links, the responsiveness becomes sluggish. The more significant problem is that the PUSH using the LONG_POLLING model completely ceases to function. – alexanoid Aug 14 '23 at 22:59
  • Only refreshing the browser with an F5 key press restores the application to its typical state. Should I report the issue on github? – alexanoid Aug 14 '23 at 22:59
  • Have you added the `@PreserveOnRefresh` annotation to your application? https://vaadin.com/docs/latest/advanced/preserving-state-on-refresh – André Schild Aug 15 '23 at 06:33
  • You would also make your server store/restore the session information over the restart. – cfrick Aug 15 '23 at 08:26
  • no, I don't use `@PreserveOnRefresh` – alexanoid Aug 15 '23 at 09:34
  • https://github.com/vaadin/flow/issues/17445 – alexanoid Aug 18 '23 at 21:30