Dealing with failure

Consider this scenario: A Vaadin app makes a request to the server but the server never manages to send back a response - or takes a very long time. When this happens, the Vaadin app is frozen with the “loading” spinning wheel. At this point, when the user clicks on any other component on the page that makes subsequent calls to the server, the app shows an error.
At this point, a page refresh still brings the same error. Navigating back and coming to the app page also shows the same error. The only way the user can get rid of the error is to close the entire browser and load the page again - so that the user gets a fresh session.

Now what is the proper mechanism to deal with this situation? I am running into this situation more often for various reason. Is there a way to invalidate the session and work fresh without having to restart browser? How would I block calls to the server while a previous operation is still on-going?

Thanks,

Knowing the reasons could help in resolving the issue.

You can add ?restartApplication to the URL to invalidate the session.

Vaadin should be doing that automatically.

Well the reason for the “hung” situation arises due to unexpected situations like some database query taking too long to return value or waiting for some type of lock. In any case, from Vaadin’s point of view, the situation is this: If an event is being processed in the server and has not returned to the client, how does Vaadin blocks subsequent calls before the earlier event has returned back to the browser? In my experience, when this happens, the state of the component tree stored in the server session becomes corrupt and the user is forced to re-open the browser. Adding a “?restartApplication” won’t work for end-users as they won’t know about this feature. Hope I made the situation clear now.

The requests should be queued on the client side and sent to server when the server responds.

Of course. ?restartApplication is only for developers. For end users this should not happen. If you are executing operation that is expected to take longer time, you should do that in a separate thread and use progressbar to show user that a longer operation is going on.

Since Vaadin controls the browser side of things, I am not sure how I would manage such a queue on the client side. Vaadin lets you press a button even when a previous click has not returned yet.

And what Joonas ment was that Vaadin does queue the requests automatically on the client, you don’t need to do anything extra. The user can still press buttons, but if one of the earlier request changes the UI in the parts that the user interacts upon, there will most likely be out-of-sync errors.