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

Resteasy Reactive - Multipart does not accept text/plain bigger than 2048 bytes #16422

Closed
Postremus opened this issue Apr 11, 2021 · 8 comments · Fixed by #16432
Closed

Resteasy Reactive - Multipart does not accept text/plain bigger than 2048 bytes #16422

Postremus opened this issue Apr 11, 2021 · 8 comments · Fixed by #16432
Labels
area/resteasy-reactive kind/bug Something isn't working
Milestone

Comments

@Postremus
Copy link
Member

Describe the bug

I am currently migrating a small app from Resteasy Classic to Resteasy Reactive.

One of my resources uses multipart to accept form input from users.

2048 or less bytes work, the text field contains the input text.
If the users enters more than 2048 bytes, the text field is null.
No exception is thrown.

My resource:

@POST
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    @Produces(MediaType.TEXT_PLAIN)
    public String hello(@MultipartForm SomeData data)
import org.jboss.resteasy.reactive.PartType;

import javax.ws.rs.FormParam;

public class SomeData {
    @FormParam("text")
    @PartType("text/plain")
    private String text;
}

Expected behavior

A text/plain field should not be arbitary limited to 2048 bytes.

It should work like with Resteasy Classic, with the only limit being the configured quarkus.http.limits.max-body-size.

Actual behavior

@PartType("text/plain") is left null if input text is longer than 2048 bytes.

To Reproduce

Steps to reproduce the behavior:

  1. Download the reproducer: rr-large-multipart.zip
  2. Run the GreetingResourceTest test class. testLargeText will fail.
  3. Add another byte to the src/test/resources/2048.rj file.
  4. Run the tests again. Now also test2048Bytes will fail.

Environment (please complete the following information):

Output of uname -a or ver

Linux martin 5.8.0-48-generic #54~20.04.1-Ubuntu SMP Sat Mar 20 13:40:25 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk version "15.0.1" 2020-10-20
OpenJDK Runtime Environment Zulu15.28+13-CA (build 15.0.1+8)
OpenJDK 64-Bit Server VM Zulu15.28+13-CA (build 15.0.1+8, mixed mode, sharing)

Quarkus version or git rev

1.13.1.Final

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

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /home/martin/.sdkman/candidates/maven/current
Java version: 15.0.1, vendor: Azul Systems, Inc., runtime: /home/martin/.sdkman/candidates/java/15.0.1-zulu
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.8.0-48-generic", arch: "amd64", family: "unix"

@Postremus Postremus added the kind/bug Something isn't working label Apr 11, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Apr 11, 2021

/cc @FroMage, @geoand, @stuartwdouglas

@geoand
Copy link
Contributor

geoand commented Apr 11, 2021

Thanks for reporting. I'll have a look tomorrow

geoand added a commit to geoand/quarkus that referenced this issue Apr 12, 2021
Vert.x defaults to 2K and prior to this PR we didn't have
a way to configure it.

Fixes: quarkusio#16422
@geoand
Copy link
Contributor

geoand commented Apr 12, 2021

@Postremus #16432 will address the issue.

However I have a question: Did you really mean to send the input as a form attribute or as a file? Because if you meant to do the latter, you are not doing it correctly :)

@Postremus
Copy link
Member Author

@geoand Yes, that is intended :)

Back then when I created this app, this was the only way I know how to achieve this.
The text is input into a simple html form, which is then send as multipart/form-data to the application.

The app also has another multipart endpoint for accepting a complete file - which is working fine already in resteasy reactive :)

@geoand
Copy link
Contributor

geoand commented Apr 12, 2021

Understood, thanks for the info

geoand added a commit to geoand/quarkus that referenced this issue Apr 12, 2021
Vert.x defaults to 2K and prior to this PR we didn't have
a way to configure it.
When the a form attribute is too large in multipart request,
return HTTP 413.

Fixes: quarkusio#16422
geoand added a commit to geoand/quarkus that referenced this issue Apr 12, 2021
Vert.x defaults to 2K and prior to this PR we didn't have
a way to configure it.
When the a form attribute is too large in multipart request,
return HTTP 413.

Fixes: quarkusio#16422
geoand added a commit to geoand/quarkus that referenced this issue Apr 12, 2021
Vert.x defaults to 2K and prior to this PR we didn't have
a way to configure it.
When the a form attribute is too large in multipart request,
return HTTP 413.

Fixes: quarkusio#16422
gsmet pushed a commit to geoand/quarkus that referenced this issue Apr 12, 2021
Vert.x defaults to 2K and prior to this PR we didn't have
a way to configure it.
When the a form attribute is too large in multipart request,
return HTTP 413.

Fixes: quarkusio#16422
gsmet added a commit that referenced this issue Apr 13, 2021
Add the ability to configure the maximum form attribute size
@quarkus-bot quarkus-bot bot added this to the 2.0 - main milestone Apr 13, 2021
gsmet pushed a commit to gsmet/quarkus that referenced this issue Apr 13, 2021
Vert.x defaults to 2K and prior to this PR we didn't have
a way to configure it.
When the a form attribute is too large in multipart request,
return HTTP 413.

Fixes: quarkusio#16422
(cherry picked from commit 19eb163)
gsmet pushed a commit to gsmet/quarkus that referenced this issue Apr 13, 2021
Vert.x defaults to 2K and prior to this PR we didn't have
a way to configure it.
When the a form attribute is too large in multipart request,
return HTTP 413.

Fixes: quarkusio#16422
(cherry picked from commit 19eb163)
@gsmet gsmet modified the milestones: 2.0 - main, 1.13.2.Final Apr 14, 2021
DavideD pushed a commit to DavideD/quarkus that referenced this issue Apr 14, 2021
Vert.x defaults to 2K and prior to this PR we didn't have
a way to configure it.
When the a form attribute is too large in multipart request,
return HTTP 413.

Fixes: quarkusio#16422
@technical-debt-collector
Copy link
Contributor

@geoand Kind of late to the party here, but this should probably be mentioned in the migration documentation as well.
quarkus.http.limits.max-form-attribute-size is only ever mentioned as a possible configuration, but hardly anything more from what I can find.
https://quarkus.io/guides/resteasy-reactive-migration#multipart-support

@geoand
Copy link
Contributor

geoand commented Jul 19, 2022

Feel free to open a PR with your suggestion.

Thanks

@technical-debt-collector
Copy link
Contributor

Sure, will do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/resteasy-reactive kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants