Skip to content

Mock Lambda event server gets stuck on responses with large response sizes when using Jackson #44551

@c-classen

Description

@c-classen

Describe the bug

When using the Lambda event server and requesting data from an endpoint, the HTTP response gets stuck after sending about 10KB for large responses.

Expected behavior

10 KB should be not issue. AWS Lambda supports up to 10 MB of response size.

Actual behavior

The response to the request never gets completed

How to Reproduce?

Reproducer: lambda-gets-stuck.zip

or

  1. Go to https://code.quarkus.io/ and add AWS Lambda HTTP and REST Jackson.
  2. Replace the content of the hello() method in GreetingResource with
    List<String> greetings = new ArrayList<>();
    for (int i = 0; i < 580; i++) {
        greetings.add("Hello World " + i);
    }
    return greetings;
  3. Start the dev server and run curl localhost:8080/hello

It should just get stuck and never finish, although a lot of the response is displayed.

Output of uname -a or ver

Linux clemens-WAPP-Laptop 6.8.0-45-generic #45~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Sep 11 15:25:05 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk version "21.0.2" 2024-01-16 LTS OpenJDK Runtime Environment Corretto-21.0.2.14.1 (build 21.0.2+14-LTS) OpenJDK 64-Bit Server VM Corretto-21.0.2.14.1 (build 21.0.2+14-LTS, mixed mode, sharing)

Quarkus version or git rev

3.16.3

Build tool (ie. output of mvnw --version or gradlew --version)

wrapperVersion=3.3.2

Additional information

It seems to me that the following factors need to come together to provoke this behavior:

  1. Running the dev server: When deploying to AWS, it seems to work
  2. Large response size:. Interestingly, reducing 580 to 570 will get it stuck earlier, but with 200, it works for me. Since there might be timing issues at play, this could vary and you might need to increase 580 to a sufficiently high number.
  3. JSON serialization: Adding @Produces(MediaType.TEXT_PLAIN) causes the bug to disappear, even when using much higher upper bounds in the for loop such as 10_000.
  4. Lambda HTTP Dependency: Commenting out the quarkus-amazon-lambda-http dependency in the pom.xml will also make the bug disappear.

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