Reputation: 1357
When activating Push, whenever i leave tabs with my application open for longer than a minute, i get the following INFO level log message:
16:57:17 INFO PushHandler - No UI was found based on data in the request, but a slower lookup based on the AtmosphereResource succeeded. See http://dev.vaadin.com/ticket/14251 for more details.
Ticket 14251 doesn't seem to contain any relevant information for my scenario which is as follows:
The application is a Vaadin Spring application
My UI is annotated with
@Push(transport=Transport.WEBSOCKET_XHR)
I am using an nginx server configured for push like this:
map $http_connection $upgrade_requested {
default upgrade;
'' close;
}
server {
listen 9002;
server_name localhost;
root /;
location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host:$server_port;
proxy_cookie_path ~*^/.* /;
proxy_pass http://127.0.0.1:9003/;
proxy_redirect off;
}
location /vaadinServlet/PUSH {
proxy_pass http://127.0.0.1:9003;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $upgrade_requested;
}
This log message appears when i simply leave some tabs open. No pushes are actually happening (at least none triggered by my application logic). This happens in all browsers i've tested it in: Firefox, Chrome, and Safari. Other than the log message, i have not noticed any problems.
How can i get rid of this log message? Is this perhaps indicative of some problems which i may not have noticed yet?
Upvotes: 0
Views: 248
Reputation: 1822
Based on https://blog.martinfjordvald.com/2013/02/websockets-in-nginx/, websocket connections in nginx use the proxy_read_timeout configuration option, which is set by default to 60s. Thus nginx will cut the ws connection after 60s, and the browser will then establish a new ws connection. When this happens, the request that re-establishes the connection should contain a "v-uiId=" parameter, and based on this the server should find the related UI and everything should continue to work.
Your error message indicates that there is a problem with the v-uiId parameter and for some reason the server cannot find the correct UI instance based on that. The server then falls back to another lookup mechanisms, which iterates through the UI instances and tries to find the correct one. This one succeeds, and everything keeps working.
There is additionally the possibility that your server also has a configured websocket timeout of 60s. In this case, either nginx or the server will cut the connection first. Strange things could happen sometimes, depending on the order of events.
If you do nothing you will have a potential problem of nginx cutting the connection and the server performing a push operation right after that. If the server has not realized that the connection has been cut (because of the way TCP works), then it might push the next message into the void.
Try removing/changing the timeout in nginx and/or in your server.
As a rule of thumb, if the connection close happens on the server then Vaadin will know immediately that there is no active connection and will postpone pushes. If somebody in the middle somewhere cuts the connection without telling the server, things might go wrong.
Upvotes: 2