Vaadin web app goes unresponsive until I clear browsing data/use incognito


I created a Vaadin web app that I compile as a war and deploy in Tomcat.

The web app is simple:

  • Servlet 3.0 with Push
  • Navigator with several views
  • CRUD with a local MySQL db

I use Push to update the table of data displayed every time I add data.

After I deploy the webapp (to either Google Cloud or Amazon EC2), I can use it for a variable amount of time (15 minutes - 1 hour), with no issues.

When it works, it works fine, with no errors, every button works, every Push is registered.

At some point the page stops loading. The Vaadin loading bar gets stuck at about 98%, and I can no longer connect to the webapp. When I clear my browsing data or use incognito browsing (with no data), in Google Chrome and Firefox, the web app is still working.

There is some issue with cookies or cache but I am unable to diagnose the problem.

I have deployed in 3 different environments to rule out the deployment as the issue:

  • Google Cloud Compute Engine instance with load balancer
  • Google Cloud Compute Engine instance with public ip
  • Amazon AWS EC2 instance with public ip

I also tried disabling Tomcat cache, and some other solutions in Vaadin (disabling Push, changing Push from Websocket to Long polling).

Any ideas?

Thanks, Sevag

I had similar problems that were solved by using adding a heartbeat interceptor.
One can be added to your servlet class using these annotations:

@WebServlet(value = “/*”, asyncSupported = true, initParams = {
@WebInitParam(name = “org.atmosphere.cpr.AtmosphereInterceptor”,
value = “org.atmosphere.interceptor.HeartbeatInterceptor”)})

By default, this will setup a 30 second heartbeat. It seems that over zealous proxies / firewalls will close connections that appear idle for more than a few minutes.

Worked for me :slight_smile:

Thanks David,

I will try this suggestion and report back.

I think the fix worked. I tightened the timing to 5 seconds to have less downtime - is there a disadvantage of having such a frequent heartbeat?

Glad to hear it might have worked. The idea of the heartbeat is to stop the connection being closed prematurely. Hence firing it more often than necessary won’t improve the response but may waste a few CPU cycles and bandwidth. The default 30s heart was sufficient for me. In fact every 3 minutes would probably have been good enough but traffic every 5 minutes was not. I guess it depends on whatever is monitoring the connection state.