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

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

Open
xddcode opened this issue Sep 10, 2024 · 3 comments
Labels

Comments

@xddcode
Copy link

xddcode commented Sep 10, 2024

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 xddcode added the bug label Sep 10, 2024
@tsegismont
Copy link
Contributor

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?

@xddcode
Copy link
Author

xddcode commented Nov 13, 2024

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

@tsegismont
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants