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

CAMEL-20152: camel-jetty - Allow to configure the multipart #12240

Merged
merged 1 commit into from Nov 28, 2023

Conversation

essobedo
Copy link
Contributor

@essobedo essobedo commented Nov 28, 2023

Fixes https://issues.apache.org/jira/browse/CAMEL-20152

Motivation

In the case of multipart, the content is kept in memory which can lead to an OOME, it is due to the fact that the fileSizeThreshold is set to 0 by default which should mean that the content is stored on disk according to the Jakarta Javadoc but it is not what the Jetty code expects.

Modifications:

  • Propose new properties to be able to configure the multipart
  • Add a unit test to ensure that the file content is stored on disk

Copy link
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟

🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run

  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot.

  • You can label PRs using build-all, build-dependents, skip-tests and test-dependents to fine-tune the checks executed by this PR.

  • Build and test logs are available in the Summary page. Only Apache Camel committers have access to the summary.

  • ⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@essobedo essobedo force-pushed the CAMEL-20152/jetty-add-file-size-threshold branch from f59fa05 to 139fec8 Compare November 28, 2023 16:35
@essobedo
Copy link
Contributor Author

Due to jetty/jetty.project#10936

@joakime
Copy link

joakime commented Nov 28, 2023

Is Camel using Jetty 12 with the ee10 environment?

These changes seem to be for Jetty 11, which is for Servlet 5.0.

This API spec behavior, where fileSizeThreshold value of 0 is documented, first shows up on Servlet 6.0.
That language is not present in the API spec on Servlet 5.0. - https://github.com/jakartaee/servlet/blob/5.0.0-RELEASE/api/src/main/java/jakarta/servlet/annotation/MultipartConfig.java#L65-L70

Jetty 12 on the ee10 environment already supports this spec behavior.

@davsclaus
Copy link
Contributor

Yes its Jetty 11 in the source, however we are also working on upgrading to Jetty 12 for the upcoming Camel 4.3 release. But older Camel releases are using Jetty 11 and 9.

@joakime
Copy link

joakime commented Nov 28, 2023

Note, Jetty 9 is now at End of Community Support.

@essobedo
Copy link
Contributor Author

essobedo commented Nov 28, 2023

Please note that even if it is mentioned only in EE 10, it is actually a clarification see jakartaee/servlet#111, for example, in Glassfish and Tomcat, it is how it has been implemented even in very old versions that is why I proposed it in version 11 but I can understand your point of view.

@essobedo essobedo merged commit 41733b2 into main Nov 28, 2023
3 checks passed
@essobedo essobedo deleted the CAMEL-20152/jetty-add-file-size-threshold branch November 28, 2023 20:33
@essobedo
Copy link
Contributor Author

And IMHO, it makes more sense to consider that a threshold set to 0 is immediately reached instead of never being reached like it was set to Integer.MAX_VALUE which is somehow the current behavior in any version of Jetty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants