vaadin / vaadin/framework

[Feature] Implement Configurable XHR Request Timeout in com.vaadin.client.communication.XhrConnection Vaadin 8

Open
#12,123 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
1.8k
Forks
717
Avg merge
2d 6h
Merged PRs (30d)
3

Description

Current Issue

In Vaadin 8.11, our clients are experiencing intermittent issues where some UIDL XHR requests are taking ~5 minutes to resolve at random. Upon looking into configurable timeouts for XHR requests I found that this feature is currently a TODO in com.vaadin.client.communication.XhrConnection#send(JsonObject) in both v8.11 and v8.12:

    RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, getUri());

    addXsrfHeaderFromCookie(rb);

    // TODO enable timeout
    // rb.setTimeoutMillis(timeoutMillis);
    // TODO this should be configurable
    rb.setHeader("Content-Type", JsonConstants.JSON_CONTENT_TYPE);
    rb.setRequestData(payload.toJson());
Expected behavior

A configurable value, whether this is done as a Servlet initial parameter, or through the UI instance, to set a timeout on XHR requests from the Client-side browser -> Vaadin Webserver.

Actual behavior

XHR Requests never timeout and if the response is never received the application is completely frozen until the user hard refreshes.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in com.vaadin.client.communication.XhrConnection#send(JsonObject), where the TODO and commented RequestBuilder timeout call are shown. Read the surrounding client communication code and determine how the timeout should be configured, since the issue lists servlet initialization and UI-instance options without choosing one. Done means browser XHR requests use the configured timeout instead of waiting indefinitely.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.