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

Quarkus vertx issues with Vite dev mode connection #15744

Closed
MarcinVaadin opened this issue Jan 24, 2023 · 7 comments · Fixed by #15747
Closed

Quarkus vertx issues with Vite dev mode connection #15744

MarcinVaadin opened this issue Jan 24, 2023 · 7 comments · Fixed by #15747

Comments

@MarcinVaadin
Copy link
Member

MarcinVaadin commented Jan 24, 2023

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
@MarcinVaadin MarcinVaadin 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 Jan 24, 2023
@MarcinVaadin MarcinVaadin changed the title ViteWebsocketConnection is trying to connect to 127.0.0.1 - failing on IPv6 Quarkus vertx issues with Vite dev mode connection Jan 24, 2023
@Artur-
Copy link
Member

Artur- commented Jan 24, 2023

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?

@Artur-
Copy link
Member

Artur- commented Jan 24, 2023

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

@MarcinVaadin
Copy link
Member Author

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)

@mcollovati
Copy link
Collaborator

mcollovati commented Jan 24, 2023

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

@Artur-
Copy link
Member

Artur- commented Jan 24, 2023

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

@mcollovati
Copy link
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

@vaadin-bot
Copy link
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants