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

Thread starvation in ThreadLimitHandler #11764

Open
arcticmosquito opened this issue May 8, 2024 · 0 comments
Open

Thread starvation in ThreadLimitHandler #11764

arcticmosquito opened this issue May 8, 2024 · 0 comments
Labels
Bug For general bugs on Jetty side

Comments

@arcticmosquito
Copy link

Jetty version(s)
12.0.x

Jetty Environment
core (ThreadLimitHandler) + ee8 (ServletContextHandler)

Java version/vendor (use: java -version)

openjdk 21.0.2 2024-01-16 LTS
OpenJDK Runtime Environment Corretto-21.0.2.13.1 (build 21.0.2+13-LTS)
OpenJDK 64-Bit Server VM Corretto-21.0.2.13.1 (build 21.0.2+13-LTS, mixed mode, sharing)

OS type/version
macOS Sonoma 14.4.1

Description
ThreadLimitHandler might block a request execution forever if write operation is completed from another thread (e.g., when TCP tx buffer is saturated). Suppose that ThreadLimitHandler is set to 1 thread per remote, there is a single inbound request, the thread handling the request obtains a permit and tries to write a response ServletOutputStream if write operation could not be finished by the handling thread it will block waiting for a callback invocation (could not find ee8 version, but I assume ee10 is subjected to the same problem - HttpOutput). When the write operation is finished the notification thread will try obtaining a permit (ThreadLimitHandler) however this attempt will never succeed as the only permit is held by the processing thread.
This issue could reproduce with any number of permits as long as there are as many in progress requests.

@arcticmosquito arcticmosquito added the Bug For general bugs on Jetty side label May 8, 2024
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
Projects
None yet
Development

No branches or pull requests

1 participant