Skip to content

Commit 2466f90

Browse files
Workaround max name limit imposed by Jackson 2.17 (#126806) (#126873)
In Jackson 2.15 a maximum string length of 50k characters was introduced. We worked around that by override the length to max int on all parsers created by xcontent. Jackson 2.17 introduced a similar limit on field names. This commit mimics the workaround for string length by overriding the max name length to be unlimited. relates #58952 Co-authored-by: Elastic Machine <[email protected]>
1 parent 416a7c9 commit 2466f90

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

docs/changelog/126806.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 126806
2+
summary: Workaround max name limit imposed by Jackson 2.17
3+
area: Infra/Core
4+
type: bug
5+
issues: []

libs/x-content/impl/src/main/java/org/elasticsearch/xcontent/provider/XContentImplUtils.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ public class XContentImplUtils {
1717
public static <F extends JsonFactory, B extends TSFBuilder<F, B>> F configure(TSFBuilder<F, B> builder) {
1818
// jackson 2.15 introduced a max string length. We have other limits in place to constrain max doc size,
1919
// so here we set to max value (2GiB) so as not to constrain further than those existing limits.
20-
return builder.streamReadConstraints(StreamReadConstraints.builder().maxStringLength(Integer.MAX_VALUE).build()).build();
20+
// jackson 2.16 further introduced a max name length, which we also relax here temporarily.
21+
// see https://github.com/elastic/elasticsearch/issues/58952
22+
return builder.streamReadConstraints(
23+
StreamReadConstraints.builder().maxStringLength(Integer.MAX_VALUE).maxNameLength(Integer.MAX_VALUE).build()
24+
).build();
2125
}
2226
}

0 commit comments

Comments
 (0)