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

JSON response may be truncated at 8192 bytes boundary #22973

Closed
pdolezal opened this issue Jan 18, 2022 · 1 comment · Fixed by #22996
Closed

JSON response may be truncated at 8192 bytes boundary #22973

pdolezal opened this issue Jan 18, 2022 · 1 comment · Fixed by #22996
Labels
env/windows Impacts Windows machines kind/bug Something isn't working
Milestone

Comments

@pdolezal
Copy link

Describe the bug

A JAX-RS endpoint returns a Map instance to be serialized to JSON and returned. In some cases (I was not able to find the actual cause) the response returned to the client is truncated and does not contain the full JSON response.

The code behaves correctly with Quarkus 2.4.1, but when built with a newer version (tried 2.5.1 and 2.6.2), it produces the truncated response. I was able to reproduce the behavior reliably on different systems (Oracle on Windows, Eclipse Temurin on Alpine) with the given example. The interesting thing is that even small changes of the response may cause the response to be rendered correctly. I could not figure out the reason for the behavior. A notable point is that the response chunk that is returned, has 8192 bytes.

Expected behavior

The response returned by the reproducing example should be complete, not truncated.

Actual behavior

The example returns the truncated response, which is truncated at 8192 bytes (ends with {"fileName":"tome2.pdf","modifiedAt":"2021-12-14T09:53:).

How to Reproduce?

  1. Build the example mvn clean package, JDK 17 assumed (toolchains profile may be used to choose the JDK if toolchains is configured).
  2. Run the example application.
  3. Get the response: curl --request GET --url http://localhost:8080/objects

Changes in the POM file's quarkus.version property may deliver different results as noted, the correct behavior should be observed when the property is changed to 2.4.1.

cut-off-bug.zip

Output of uname -a or ver

Microsoft Windows [Version 10.0.19043.1415]

Output of java -version

Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.6.2

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

Apache Maven 3.8.2 (ea98e05a04480131370aa0c110b8c54cf726c06f)

Additional information

As noted in the description, the problem was observed for the first time with the original code in Docker based on eclipse-temurin:17-alpine.

@pdolezal pdolezal added the kind/bug Something isn't working label Jan 18, 2022
@quarkus-bot quarkus-bot bot added env/windows Impacts Windows machines triage/needs-triage labels Jan 18, 2022
@stuartwdouglas
Copy link
Member

Seems to have been introduced by 627e127 , although I think this may have been an existing problem that has just been uncovered by this.

stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Jan 19, 2022
If the response is an exact multiple of the buffer size it is being
truncated.

Fixes quarkusio#22973
stuartwdouglas added a commit to stuartwdouglas/quarkus that referenced this issue Jan 19, 2022
If the response is an exact multiple of the buffer size it is being
truncated.

Fixes quarkusio#22973
@quarkus-bot quarkus-bot bot added this to the 2.8 - main milestone Jan 19, 2022
@gsmet gsmet modified the milestones: 2.8 - main, 2.6.3.Final Jan 19, 2022
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jan 19, 2022
If the response is an exact multiple of the buffer size it is being
truncated.

Fixes quarkusio#22973

(cherry picked from commit 6a7a0f7)
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jan 21, 2022
If the response is an exact multiple of the buffer size it is being
truncated.

Fixes quarkusio#22973

(cherry picked from commit 6a7a0f7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
env/windows Impacts Windows machines kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants