jetty.project
jetty.project copied to clipboard
Many servlet mappings using URL suffixes may get lost in Jetty 9.4
Jetty version(s) 9.4.x. It is unclear to me if "End of community support" means that major issues should not even be reported anymore.
Java version/vendor (use: java -version)
openjdk version "11.0.14.1" 2022-02-08
OpenJDK Runtime Environment Temurin-11.0.14.1+1 (build 11.0.14.1+1)
OpenJDK 64-Bit Server VM Temurin-11.0.14.1+1 (build 11.0.14.1+1, mixed mode)
OS type/version
Windows
Description
My application uses a couple of servlet mappings like this:
<servlet-mapping>
<servlet-name>SimpleHtml</servlet-name>
<url-pattern>*.simple</url-pattern>
</servlet-mapping>
At some point I added another mapping and large parts of the application stopped working.
After some debugging the root cause was found here:
// grow the capacity of the Trie
_suffixMap = new ArrayTernaryTrie<>((ArrayTernaryTrie<MappedResource<E>>)_prefixMap, 1.5);
https://github.com/eclipse/jetty.project/blob/jetty-9.4.x/jetty-http/src/main/java/org/eclipse/jetty/http/pathmap/PathMappings.java#L347
Code tries to resize _suffixMap but it accidentally initializes the new map from _prefixMap instead of _suffixMap.
How to reproduce?
Create a webapplication where the total number of characters of suffixes in url-patterns is large (roughly larger than 128 which is the default size of ArrayTernaryTrie). Then try to call one of the first sevlets.
Use Jetty 9.4.48.v20220622
See: https://github.com/eclipse/jetty.project/issues/8184
After some debugging the root cause was found here:
// grow the capacity of the Trie _suffixMap = new ArrayTernaryTrie<>((ArrayTernaryTrie<MappedResource<E>>)_prefixMap, 1.5);https://github.com/eclipse/jetty.project/blob/jetty-9.4.x/jetty-http/src/main/java/org/eclipse/jetty/http/pathmap/PathMappings.java#L347
Code tries to resize
_suffixMapbut it accidentally initializes the new map from_prefixMapinstead of_suffixMap.
This is a legitimate bug. And needs to be fixed.
This bug does not exist in Jetty 10+
This issue has been automatically marked as stale because it has been a full year without activity. It will be closed if no further activity occurs. Thank you for your contributions.
@joakime can this be closed?
Closed with issue #8184