Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vaadin Push Client stuck if Push annotation is used in OpenLiberty with Turkish Localization #14162

Open
abdullahtellioglu opened this issue Jul 11, 2022 · 5 comments

Comments

@abdullahtellioglu
Copy link
Collaborator

abdullahtellioglu commented Jul 11, 2022

Description of the bug

When I set push annotation @Push(value = PushMode.AUTOMATIC, transport = Transport.LONG_POLLING) as Long Polling or WEBSOCKET, in the browser FlowClient sends request infinitely.

Open Liberty Push

Even though it is set to LONG_POLLING, Flow client is using Atmosphere library to send request.

Also in the Javascript console FlowClient logs re-opening push connection infinitely.

Reopening push connection infinitely

Expected behavior

It should send request with an interval. Should not stuck at infinite loop. Maybe do not use the atmosphere library if transport method is set to LONG_POLLING.

Minimal reproducible example

See https://github.com/abdullahtellioglu/openliberty-push-example and run mvn clean install liberty:dev to create a reproducible example. Open the url http://localhost:9080/push/ and open the network tab in development tool.

Versions

  • Vaadin / Flow version: 23.1.2
  • Java version: 11
  • OS version: MacOS Monterey 12.4
  • Browser version (if applicable):
  • Application Server (if applicable): OpenLiberty 22.0.0.7, also OpenLiberty 19.0.0.12
  • IDE (if applicable):
@abdullahtellioglu abdullahtellioglu changed the title FlowClient stuck if Push annotation is used in OpenLiberty. Vaadin Push Client stuck if Push annotation is used in OpenLiberty. Jul 11, 2022
@mcollovati
Copy link
Collaborator

Just tried your example and I can't reproduce the problem.
Long polling for push is handled by Atmosphere, so it is ok.
On the network tab I see a PUSH connection being established (v-r=push&X-Atmosphere-Transport=long-polling) and stay pending until there's some interaction.

@mcollovati mcollovati added this to Needs triage in OLD Vaadin Flow bugs & maintenance (Vaadin 10+) via automation Jul 12, 2022
@MarcinVaadin
Copy link
Member

Tested on MacOS 12.4 on Safari Version 15.5 (17613.2.7.1.8) and Chrome Version 103.0.5060.114 (Official Build) (arm64)
and on both it looks the same - no push reopening:
image

@abdullahtellioglu
Copy link
Collaborator Author

I tested and tried to find out what might be the reason and in AtmosphereFramework.java it checks the header of X-Atmosphere-tracking-id which is not sent from Client in any time. That is why it tries to reconnect.

Atmosphere Framework

An Example Client Request:

GET /Portal/app/?v-r=push&v-uiId=1&v-pushId=190bda15-e36a-4c48-ac9b-2f8f0c4973d2&X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=3.1.2-javascript&X-Atmosphere-Transport=long-polling&X-Atmosphere-TrackMessageSize=true&Content-Type=application%2Fjson%3B%20charset%3DUTF-8&X-atmo-protocol=true&_=1657622041682 HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: tr-TR,tr;q=0.9,en-US;q=0.8,en;q=0.7
Connection: keep-alive
Content-Type: application/json; charset=UTF-8
Cookie: JSESSIONID=0000aHx57ou1ixMOl64THUUTWA2:f3fbf528-471a-41ac-a18c-9f6e160a0f8c
Host: localhost:9080
Referer: http://localhost:9080/Portal/app/layout
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36
sec-ch-ua: ".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "macOS"

Response of that request

HTTP/1.1 200 OK
X-Powered-By: Servlet/4.0
X-Atmosphere-first-request: true
X-Atmosphere-tracking-id: 0e031acc-6dbf-489c-81cf-203f36475342
Expires: -1
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
X-XSS-Protection: 1; mode=block
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Content-Language: tr-TR
Transfer-Encoding: chunked
Date: Tue, 12 Jul 2022 10:34:01 GMT

X-Atmosphere-id on the next request is not send again and it creates an infinite loop like this.

@abdullahtellioglu
Copy link
Collaborator Author

The problem is happening if locale is set Turkish in JVM options. If JVM property is set -Duser.language=tr and create a js bundle, this bug is happening.

@abdullahtellioglu abdullahtellioglu changed the title Vaadin Push Client stuck if Push annotation is used in OpenLiberty. Vaadin Push Client stuck if Push annotation is used in OpenLiberty with Turkish Localization Jul 19, 2022
@Artur-
Copy link
Member

Artur- commented Jul 19, 2022

Turkish locale issues are most often caused by using toLowerCase without specifying an English locale to convert an I to i and you end up with a Turkish i instead. When matching for fields/methods/headers/cookies it then fails at some point because the expected key is not found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🔖 Normal Priority (P2)
Development

No branches or pull requests

4 participants