Flow: preferIPv6Addresses in dev mode

Created on 29 Nov 2020  路  6Comments  路  Source: vaadin/flow

Description of the bug / feature

Starting vaadin 17 in dev mode and with -Djava.net.preferIPv6Addresses=true results in

java.net.ConnectException: Connection refused: no further information
    at java.base/sun.nio.ch.Net.pollConnect(Native Method) ~[na:na]
    at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:660) ~[na:na]
    at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:549) ~[na:na]
    at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597) ~[na:na]
    at java.base/java.net.Socket.connect(Socket.java:648) ~[na:na]
    at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:177) ~[na:na]
    at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:474) ~[na:na]
    at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:569) ~[na:na]
    at java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:242) ~[na:na]
    at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:341) ~[na:na]
    at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:362) ~[na:na]
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1261) ~[na:na]
    at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1194) ~[na:na]
    at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1082) ~[na:na]
    at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1016) ~[na:na]
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1600) ~[na:na]
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1528) ~[na:na]
    at com.vaadin.flow.server.frontend.FrontendUtils.getFileFromWebpack(FrontendUtils.java:602) ~[flow-server-4.0.7.jar:4.0.7]
    at com.vaadin.flow.server.frontend.FrontendUtils.getFileContent(FrontendUtils.java:462) ~[flow-server-4.0.7.jar:4.0.7]

Versions:

- Vaadin / Flow version: 17.0.10
- Java version: 15.0.1.9-hotspot
- OS version: windows 10
- IDE (if applicable): eclipse
Low Major bug investigation

All 6 comments

Hi @BrunoEberhard and thank you for the ticket! Is this issue reproduced on your side with Java 15 only, or with older versions as well?

I have same behaviour with Jdk 11.0.9.11-hotspot

Thanks @BrunoEberhard , let me reproduce it locally and investigate the root cause and impact.

When the application is running you can reproduce the bug with

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.stream.Collectors;

public class Test {

    public static void main(String[] args) throws Exception {
        URL uri = new URL("http://localhost:57088/VAADIN/index.html");

        HttpURLConnection connection = (HttpURLConnection) uri.openConnection();
        connection.setRequestMethod("GET");

        try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) {
            String pageText = reader.lines().collect(Collectors.joining("\n"));
            System.out.println(pageText);
        }

    }

}

(of course with adjusted port number)

I'm able to reproduce this issue on mac OS with the various java versions (15, 11, 8) in dev mode. @BrunoEberhard could you please give your use case and why do you need to set this option in dev mode?

I use MS SQL Server. In the example how to connect to that DB the flag is listed. I did just copy/paste all the flags and wasn't aware of the side effects. It works without the flag so no high prio for me. It just was annoying to debug for several hours so I sent you this issues.

Was this page helpful?
0 / 5 - 0 ratings