vaadin / flow

Vaadin Flow is a Java framework binding Vaadin web components to Java. This is part of Vaadin 10+.
Apache License 2.0
618 stars 167 forks source link

WAR built in production mode with push reloads endlessly with jetty-runner #9290

Open mvysny opened 4 years ago

mvysny commented 4 years ago

Description of the bug

A simple Vaadin example app built in production mode with push starts to rapidly reload in the browser when the WAR is running using jetty-runner.

The same app works correctly when launched in dev mode (e.g. in Intellij + Tomcat), or via ./gradlew clean build appRun.

Minimal reproducible example

  1. git clone https://github.com/mvysny/vaadin-coroutines-demo/
  2. ./gradlew clean build -Pvaadin.productionMode
  3. run build/libs/vaadin-coroutines-demo.war with jetty-runner.

Expected behavior

The page should load

Actual behavior

The page rapidly reloads in the browser. Also, Vaadin fails to initialize:

Uncaught TypeError: i.register is not a function
    <anonymous> https://vaadin-coroutines-demo.herokuapp.com/VAADIN/build/vaadin-bundle-412e5656bfbd776857c6.cache.js:2255
    s https://vaadin-coroutines-demo.herokuapp.com/VAADIN/build/vaadin-bundle-412e5656bfbd776857c6.cache.js:1
    <anonymous> https://vaadin-coroutines-demo.herokuapp.com/VAADIN/build/vaadin-bundle-412e5656bfbd776857c6.cache.js:2255
    s https://vaadin-coroutines-demo.herokuapp.com/VAADIN/build/vaadin-bundle-412e5656bfbd776857c6.cache.js:1
    <anonymous> https://vaadin-coroutines-demo.herokuapp.com/VAADIN/build/vaadin-bundle-412e5656bfbd776857c6.cache.js:1
    <anonymous> https://vaadin-coroutines-demo.herokuapp.com/VAADIN/build/vaadin-bundle-412e5656bfbd776857c6.cache.js:1

Moreover, when hosted locally on jetty-runner, the page starts to reload rapidly. I'll attach a video soon.

Versions:

- Vaadin / Flow version: 14.4.2 / 2.4.1
- Java version: 11
- OS version: Ubuntu 20.10 x86-64
- Browser version (if applicable): Firefox, Chrome
- Application Server (if applicable): Jetty-Runner only (not reproducible with mvn jetty:run or with Tomcat).
- IDE (if applicable): N/A
mvysny commented 4 years ago

Related to #8615

mvysny commented 4 years ago

bug-2020-11-03_08.49.13.mp4.zip

mvysny commented 4 years ago

Interestingly, this only happens when using jetty-runner (downloaded from https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-runner/9.4.33.v20201020/jetty-runner-9.4.33.v20201020.jar ) - the rapid reload doesn't happen when running from Tomcat.

The rapid reload can be verified on skeleton-starter v14 as well, by using the following MainView:

@Route("")
@Push
public class MainView extends VerticalLayout {

    public MainView() {
        add(new Button("Buy Ticket"));
    }
}

Curiously, skeleton-starter doesn't exhibit the TypeError: i.register is not a function.

Also, the problem can not be reproduced when running mvn -C clean package -Pproduction jetty:run. The problem can only be reproduced with jetty-runner for some reason.