vert.x icon indicating copy to clipboard operation
vert.x copied to clipboard

vert.x 4.4.9 and above, http server will not receive requests after deployment

Open xddcode opened this issue 1 year ago • 1 comments

Questions

Do not use this issue tracker to ask questions, instead use one of these channels. Questions will likely be closed without notice.

Version

4.4.9 +

Context

vert.x 4.4.9 and above, http server will not receive requests after deployment

Steps to reproduce

@Slf4j public class HttpDeviceNetwork implements IDeviceNetwork {

private Vertx vertx;

private HttpServer backendServer;

private HttpConfig httpConfig;

private CountDownLatch countDownLatch;

@Override
public void send(String topic, int qos, byte[] content) {

}

@Override
public NetworkType getType() {
    return NetworkType.http;
}

@Override
public void init(NetworkConfig config) {
    try {
        vertx = Vertx.vertx();
        httpConfig = config.getConfig("http", HttpConfig.class);
        backendServer = vertx.createHttpServer();
        log.info("======>>>>>http network init success.");
    } catch (Exception e) {
        log.error("======>>>>>http network init fail.");
    }
}

@Override
public void start() {
    Router router = Router.router(vertx);
    router.route().handler(BodyHandler.create());

    router.get("/test").handler(rc -> {
        log.info("======>>>>>http network request received.");
        HttpServerResponse httpServerResponse = rc.response();
        httpServerResponse.putHeader("content-type", "text/plain");
        httpServerResponse.end("Hello from Thingverse HTTP Server!");
    });

    backendServer.requestHandler(router)
            .listen(httpConfig.getPort(), http -> {
                if (http.succeeded()) {
                    log.info("http server create succeed,port:{}", httpConfig.getPort());
                } else {
                    log.error("http server create failed", http.cause());
                }
            });
}

@Override
public void stop() {
    backendServer.close();
}

}

C:\Users\Administrator>curl -v http://localhost:28888/test

Host localhost:28888 was resolved. IPv6: ::1 IPv4: 127.0.0.1 Trying [::1]:28888... Connected to localhost (::1) port 28888 GET / HTTP/1.1 Host: localhost:28888 User-Agent: curl/8.8.0 Accept: /

Request completely sent off Empty reply from server Closing connection curl: (52) Empty reply from server

Deploy a server instance that starts up with no errors, but just doesn't receive requests.A version 4.4.8 or lower is fine

Extra

  • Anything that can be relevant such as OS version, JVM version
  • springboot 3.2.6
  • jdk21

xddcode avatar Sep 10 '24 02:09 xddcode

The release notes are short and I can't see anything other than a Netty upgrade that could be related.

Given Vert.x is embedded into a Spring app in your case, perhaps there's a dependency conflict somewhere?

tsegismont avatar Sep 12 '24 16:09 tsegismont

image The same code would work fine in version 4.4.8, but would not work at startup if you switched to 4.5.x

xddcode avatar Nov 13 '24 07:11 xddcode

Please share a minimal reproducer on GitHub. This snippet alone works for me with any version.

tsegismont avatar Nov 13 '24 08:11 tsegismont

image The same code would work fine in version 4.4.8, but would not work at startup if you switched to 4.5.x

Do you resolve this issue?

tobe718 avatar Mar 13 '25 08:03 tobe718