Skip to content

Quarkus vertx issues with Vite dev mode connection #15744

Closed

Description

@MarcinVaadin

Description of the bug

Discovered during Quarkus update:
2023-01-24 09:15:41,523 WARN [io.ver.cor.imp.BlockedThreadChecker] (vertx-blocked-thread-checker) Thread Thread[vert.x-eventloop-thread-3,5,main] has been blocked for 3895 ms, time limit is 2000 ms: io.vertx.core.VertxException: Thread blocked

Quarkus build works using java.net.preferIPv4Stack=true

On development mode connecting to dev server is not possible while using IPv6.

Related to #15689

Expected behavior

Localhost IP should not be hardcoded?

Minimal reproducible example

Build app in dev mode

Versions

  • Vaadin / Flow version: 24.0-SNAPSHOT
  • OS version: Any with IPv6

Activity

  1. changed the title [-]ViteWebsocketConnection is listening on 127.0.0.1 - fails on IPv6[/-] [+]ViteWebsocketConnection is trying to connect to 127.0.0.1 - failing on IPv6[/+] on Jan 24, 2023
  2. changed the title [-]ViteWebsocketConnection is trying to connect to 127.0.0.1 - failing on IPv6[/-] [+]Quarkus vertx issues with Vite dev mode connection[/+] on Jan 24, 2023
  3. Artur- commented on Jan 24, 2023

    @Artur-
    Member

    Is IPv4 not available? Vite is configured to bind to 127.0.0.1

        server: {
          host: '127.0.0.1',
    

    but based on the logs it seems like it does not bind to that but to IPv6?

  4. Artur- commented on Jan 24, 2023

    @Artur-
    Member

    It would probably be possible to parse the

    Local: http://host:port/VAADIN/
    

    from the Vite output and always use the address from there, then it would work no matter how it is bound

  5. MarcinVaadin commented on Jan 24, 2023

    @MarcinVaadin
    ContributorAuthor

    Broader stacktrace:
    2023-01-24 11:55:02,088 WARN [io.ver.cor.imp.BlockedThreadChecker] (vertx-blocked-thread-checker) Thread Thread[vert.x-eventloop-thread-0,5,main] has been blocked for 604084 ms, time limit is 2000 ms: io.vertx.core.VertxException: Thread blocked at java.base@17.0.2/jdk.internal.misc.Unsafe.park(Native Method) at java.base@17.0.2/java.util.concurrent.locks.LockSupport.park(LockSupport.java:211) at java.base@17.0.2/java.util.concurrent.CompletableFuture$Signaller.block(CompletableFuture.java:1864) at java.base@17.0.2/java.util.concurrent.ForkJoinPool.unmanagedBlock(ForkJoinPool.java:3463) at java.base@17.0.2/java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3434) at java.base@17.0.2/java.util.concurrent.CompletableFuture.waitingGet(CompletableFuture.java:1898) at java.base@17.0.2/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2072) at com.vaadin.base.devserver.viteproxy.ViteWebsocketConnection.<init>(ViteWebsocketConnection.java:73) <---- HERE at com.vaadin.base.devserver.viteproxy.ViteWebsocketProxy.<init>(ViteWebsocketProxy.java:55) at com.vaadin.base.devserver.viteproxy.ViteWebsocketEndpoint.onOpen(ViteWebsocketEndpoint.java:95) at io.undertow.websockets.EndpointSessionHandler.connected(EndpointSessionHandler.java:119)

  6. mcollovati commented on Jan 24, 2023

    @mcollovati
    Collaborator

    It seems like a deadlock in the onMessage callback provided by ViteWebsocketProxy to ViteWebsocketConnection when there are many concurrent clients, such as in Quarkus tests

    The following one blocks on sendText

    browserSession.getBasicRemote().sendText(msg);
    getLogger().debug("Message sent to browser: " + msg);

    Refactoring it with asynchronous call seems to work and Quarkus test pass

    browserSession.getAsyncRemote().sendText(msg, result -> {
        getLogger().debug("Message sent to browser: " + msg);
    });

    Just to clarify, the deadlock happens on Undertow stack

  7. Artur- commented on Jan 24, 2023

    @Artur-
    Member

    If that helps, I see no reason why not to change it

  8. mcollovati commented on Jan 25, 2023

    @mcollovati
    Collaborator

    The problem with IPv6 is probably because the development mode integration tests modules set -Dvaadin.devmode.vite.options=--host.
    This configuration is not needed anymore, not that we proxy the Vite websocket

  9. added a commit that references this issue on Jan 25, 2023
    bf6ebe9
  10. added a commit that references this issue on Jan 25, 2023
    41080d0
  11. vaadin-bot commented on Feb 3, 2023

    @vaadin-bot
    Collaborator

    This ticket/PR has been released with Vaadin 24.0.0.alpha10 and is also targeting the upcoming stable 24.0.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions