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

Body size > 8KB are not returned from quarkus + Azure Function application #31871

Closed
franden opened this issue Mar 15, 2023 · 12 comments · Fixed by #33836
Closed

Body size > 8KB are not returned from quarkus + Azure Function application #31871

franden opened this issue Mar 15, 2023 · 12 comments · Fixed by #33836
Labels
area/funqy env/windows Impacts Windows machines kind/bug Something isn't working
Milestone

Comments

@franden
Copy link

franden commented Mar 15, 2023

Description

We are developing an quarkus applications which will run as Azure Function. The project was created according to the description: https://quarkus.io/guides/azure-functions-http .We are using quarkus-resteasy to be able to use JAX-RS specification for coding.

The application produces response body which can be greater the 8KB, but it is not a problem if the application is started in dev mode with e.g. mvnw quarkus:dev. If the application is started with with Azure Functions Core Tools or deployed zu Azure, it do not respond anymore if the request response exceeds the size of 8KB.

If quarkus-undertow is in additional is added to the pom.xml file, the application hangs only if the body size exceeds 16KB.

The issue does not appear if:

  1. quarkus-funqy-http is used in the application
  2. only Azure APIs are used (without quarkus) to create the function

Expected behavior

Bodies greater then 8KB can be returned from quarkus + Azure Function application

Actual behavior

Bodies greater then 8KB can NOT be returned from quarkus + Azure Function application. The application hangs.

image

How to Reproduce?

I created an example which can be use to reproduce the issue: https://github.com/franden/quarkus-azure-fn-issue-8k-body
This example creates an endpoint which produces a response with a string length depending on the input parameter.

  1. install Azure Functions Core Tools
  2. git clone https://github.com/franden/quarkus-azure-fn-issue-8k-body
  3. mvnw clean package azure-functions:run -DskipTests=true -DenableDebug
  4. curl http://localhost:7071/api/hello/getString?times=79 --get -v
    The last line will let the application produce and return a string with length of 8295 Bytes.

curl http://localhost:7071/api/hello/getString?times=78 --get -v will work, because it produces a string with length 8190 Bytes

Output of uname -a or ver

Microsoft Windows [Version 10.0.19045.2604]

Output of java -version

openjdk version "17.0.2" 2022-01-18
OpenJDK Runtime Environment Temurin-17.0.2+8 (build 17.0.2+8)
OpenJDK 64-Bit Server VM Temurin-17.0.2+8 (build 17.0.2+8, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

No response

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

No response

Additional information

No response

@franden franden added the kind/bug Something isn't working label Mar 15, 2023
@quarkus-bot quarkus-bot bot added area/funqy env/windows Impacts Windows machines labels Mar 15, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented Mar 15, 2023

/cc @matejvasek (funqy), @patriot1burke (funqy)

@patriot1burke
Copy link
Contributor

Might be an issue with azure functions itself.

@franden
Copy link
Author

franden commented Mar 16, 2023

Might be an issue with azure functions itself.

I pasted the link to the example how to reproduce the issue. The example is based on the quarkus sample project which will be generated with the command described in the official quarkus quide The only method I added was to the resource is to generate a String with a dedicated length an return as a body.

 @Path("getString")
    @GET
    public String getString(@QueryParam("times")@DefaultValue("1") Integer times) {
        String basicString = "123456789asdfghjkl3245ffffff23t4rg4rt45zrt57h5g4jhg54kk4jj5k4hj3lk45jh4l5hjk4öl5kjl4ö5jk3lö453lkä4lö";
        StringBuilder sb = new StringBuilder();
        for (int i=0; i<times;i++ ) {
            sb.append(basicString);
        }
        String finalString = sb.toString();
        Logger logger = LoggerFactory.getLogger(getClass());
        logger.info("Built string with {} chars. bytes: {}",finalString.length(), finalString.getBytes(StandardCharsets.UTF_8).length);

        logger.info("java.version: " + System.getProperty("java.version"));
        return finalString;
    }

Which issue could it have?

In additional

  1. the issue does not appear if only Azure APIs are used (without quarkus) to create the function
  2. the issue does not appear if quarkus funqy is used

@patriot1burke
Copy link
Contributor

Try setting quarkus.http.limits.max-body-size to something higher. https://quarkus.io/guides/http-reference#http-limits-configuration

The default chunk size is 8k....which worries me. But try max-body size first.

@franden
Copy link
Author

franden commented Mar 16, 2023

I set the properties to higher values but the issue is still remaining :-(

quarkus.http.limits.max-chunk-size=50000K
quarkus.http.limits.max-body-size=50000K 

@patriot1burke Could you reproduce the issue? Do you have any other ideas to fix the issue?

@patriot1burke
Copy link
Contributor

I'll get back to you later today. I'll need to reproduce and dive in further.

@geoand
Copy link
Contributor

geoand commented Mar 20, 2023

Does the same behavior occur when quarkus-resteasy-reactive is used? My guess is that it does not change things, just wanted to be sure

@franden
Copy link
Author

franden commented Mar 22, 2023

With quarkus-resteasy-reactive the issue does not appear anymore. It seems that the issue is only present with quarkus-resteasy

But, npw combination quarkus-resteasy-reactive + quarkus-resteasy-reactive-jackson leads to the same issue. The issue occurs in this case again, but only for operation which produces application/json. I added an example to a dedicated branch to the example for reptruduction: resteasy_reactive_jackson an added GreetingIT.java integration tests for easy reproduction

here is the summary of my observation:

Quarkus dependencies Content-Type of body @produces() Issue present
resteasy text/plain YES
resteasy application/json YES
resteasy  + jackson text/plain YES
resteasy  + jackson application/json YES
     
resteasy reactive text/plain NO
resteasy reactive application/json NO
resteasy reactive + jackson reactive text/plain NO
resteasy reactive + jackson reactive application/json YES

@geoand
Copy link
Contributor

geoand commented Mar 22, 2023

Thanks for the updated information, that's very useful

@phuckn2015
Copy link

phuckn2015 commented Mar 24, 2023

I faced this problem. When the issue is fixed, plz mention me.

@franden
Copy link
Author

franden commented Mar 28, 2023

we now migrated our Azure function to funqy to avoid the issue. The functionality of funqy seems to be very limited, I don't think that we can use it for production.
This bug is a show stopper in our project to for usage of Qaurkus + Azure function.
@geoand , @patriot1burke: can you somehow estimate the priority of this issue and when it probably will be fixed?

@geoand
Copy link
Contributor

geoand commented Mar 28, 2023

I think @patriot1burke was looking into it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/funqy env/windows Impacts Windows machines kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants