vertx-web icon indicating copy to clipboard operation
vertx-web copied to clipboard

HTTP status 500 without description when using several handlers for one route unchunked

Open amorozow42 opened this issue 3 years ago • 0 comments

Description

If I use more than one handler for a route client get 500 error in response while there is no error message on server.

Version

4.0.3

Code sample

  @Override
  public void start(Promise<Void> startPromise) {

    final HttpServer server = vertx
        .createHttpServer(
            new HttpServerOptions()
                .setLogActivity(true)
        );

    final Router router = Router.router(vertx);

    router
        .get("/somepath")
        .handler(this::someHandler1)
        .handler(this::someHandler2);

    server
        .requestHandler(router)
        .listen(8080)
        .onSuccess(s -> System.out.format(
            "HTTP server is listening on port %s.",
            s.actualPort()));
  }

  private void someHandler1(final RoutingContext context) {

    context
        .response()
        .write("Request is correct\n");

    context.next();
  }

  private void someHandler2(final RoutingContext context) {

    context
        .response()
        .end("Request accepted\n");
  }

Log sample

19:00:56.812 [vert.x-eventloop-thread-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0x592eb54c, L:/127.0.0.1:8080 - R:/127.0.0.1:52052] READ: 86B
         +-------------------------------------------------+
         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |
+--------+-------------------------------------------------+----------------+
|00000000| 47 45 54 20 2f 73 6f 6d 65 70 61 74 68 20 48 54 |GET /somepath HT|
|00000010| 54 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 6c 6f |TP/1.1..Host: lo|
|00000020| 63 61 6c 68 6f 73 74 3a 38 30 38 30 0d 0a 55 73 |calhost:8080..Us|
|00000030| 65 72 2d 41 67 65 6e 74 3a 20 63 75 72 6c 2f 37 |er-Agent: curl/7|
|00000040| 2e 36 34 2e 31 0d 0a 41 63 63 65 70 74 3a 20 2a |.64.1..Accept: *|
|00000050| 2f 2a 0d 0a 0d 0a                               |/*....          |
+--------+-------------------------------------------------+----------------+
19:00:56.838 [vert.x-eventloop-thread-1] DEBUG io.netty.handler.codec.compression.ZlibCodecFactory - -Dio.netty.noJdkZlibDecoder: false
19:00:56.838 [vert.x-eventloop-thread-1] DEBUG io.netty.handler.codec.compression.ZlibCodecFactory - -Dio.netty.noJdkZlibEncoder: false
19:00:56.853 [vert.x-eventloop-thread-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0x592eb54c, L:/127.0.0.1:8080 - R:/127.0.0.1:52052] WRITE: 79B
         +-------------------------------------------------+
         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |
+--------+-------------------------------------------------+----------------+
|00000000| 48 54 54 50 2f 31 2e 31 20 35 30 30 20 49 6e 74 |HTTP/1.1 500 Int|
|00000010| 65 72 6e 61 6c 20 53 65 72 76 65 72 20 45 72 72 |ernal Server Err|
|00000020| 6f 72 0d 0a 63 6f 6e 74 65 6e 74 2d 6c 65 6e 67 |or..content-leng|
|00000030| 74 68 3a 20 32 31 0d 0a 0d 0a 49 6e 74 65 72 6e |th: 21....Intern|
|00000040| 61 6c 20 53 65 72 76 65 72 20 45 72 72 6f 72    |al Server Error |
+--------+-------------------------------------------------+----------------+
19:00:56.854 [vert.x-eventloop-thread-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0x592eb54c, L:/127.0.0.1:8080 - R:/127.0.0.1:52052] READ COMPLETE
19:00:56.855 [vert.x-eventloop-thread-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0x592eb54c, L:/127.0.0.1:8080 - R:/127.0.0.1:52052] FLUSH
19:00:56.857 [vert.x-eventloop-thread-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0x592eb54c, L:/127.0.0.1:8080 - R:/127.0.0.1:52052] READ COMPLETE
19:00:56.859 [vert.x-eventloop-thread-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0x592eb54c, L:/127.0.0.1:8080 ! R:/127.0.0.1:52052] INACTIVE
19:00:56.859 [vert.x-eventloop-thread-1] DEBUG io.netty.handler.logging.LoggingHandler - [id: 0x592eb54c, L:/127.0.0.1:8080 ! R:/127.0.0.1:52052] UNREGISTERED
19:01:15.491 [vert.x-eventloop-thread-1] DEBUG io.netty.buffer.PoolThreadCache - Freed 2 thread-local buffer(s) from thread: vert.x-eventloop-thread-1

amorozow42 avatar Apr 08 '21 08:04 amorozow42