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

Many servlet mappings using URL suffixes may get lost in Jetty 9.4 #8396

Closed
quijote opened this issue Aug 1, 2022 · 6 comments
Closed

Many servlet mappings using URL suffixes may get lost in Jetty 9.4 #8396

quijote opened this issue Aug 1, 2022 · 6 comments
Labels
Bug For general bugs on Jetty side Stale For auto-closed stale issues and pull requests

Comments

@quijote
Copy link

quijote commented Aug 1, 2022

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.

@quijote quijote added the Bug For general bugs on Jetty side label Aug 1, 2022
@joakime
Copy link
Contributor

joakime commented Aug 1, 2022

Use Jetty 9.4.48.v20220622

See: #8184

@joakime
Copy link
Contributor

joakime commented Aug 1, 2022

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.

This is a legitimate bug.
And needs to be fixed.

@joakime
Copy link
Contributor

joakime commented Aug 1, 2022

This bug does not exist in Jetty 10+

@github-actions
Copy link

github-actions bot commented Aug 2, 2023

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.

@github-actions github-actions bot added the Stale For auto-closed stale issues and pull requests label Aug 2, 2023
@sbordet
Copy link
Contributor

sbordet commented Aug 2, 2023

@joakime can this be closed?

@joakime
Copy link
Contributor

joakime commented Aug 2, 2023

Closed with issue #8184

@joakime joakime closed this as completed Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side Stale For auto-closed stale issues and pull requests
Projects
None yet
Development

No branches or pull requests

3 participants