Skip to content

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

@xddcode

Description

@xddcode

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions