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

limit coerced string length #1142

Merged
merged 3 commits into from
Jan 8, 2024
Merged

limit coerced string length #1142

merged 3 commits into from
Jan 8, 2024

Conversation

boulter
Copy link
Contributor

@boulter boulter commented Jan 4, 2024

When comparing expression values, JUEL will attempt to compare the values as strings if either of the values are strings. If one of those values is a huge collection, it will try to convert that collection to an even larger string, leading to OOMs.

One way to solve this problem is to limit the size of these compared strings the same way that we limit the output. This will throw an OutputTooBigException which is not quite right since it's not output.

I decided to not throw the exception but just limit the length of the string and allow the comparison to fail assuming the first 1M bytes of the string are not the same as the toString() value of the collection.

This doesn't immediately solve the problem of a collection that has a huge collection nested inside it, but it should help in most cases.

@boulter boulter marked this pull request as ready for review January 5, 2024 22:53
@boulter boulter merged commit 05e6579 into master Jan 8, 2024
4 checks passed
@boulter boulter deleted the limit-coerced-strings branch January 8, 2024 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants