-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Jetty 12 - Flaky BlockedWritesWithSmallThreadPoolTest.testServerThreadsBlockedInWrites() #9121
Comments
@gregw thoughts? There is a TODO in The However, I would start by making The main reasoning is that we have designed a non-blocking |
This issue has been automatically marked as stale because it has been a |
This issue has been closed due to it having no activity. |
It's important to fix this. |
…readsBlockedInWrites(). The test uncovered a larger problem detailed in the issue: the Handler Callback should be non-blocking. Since all implementations of HttpStream are non-blocking, overridden HttpStream.getInvocationType() to return NON_BLOCKING. This guarantees that even in case of all server threads blocked, blocked/pending writes can be completed. Signed-off-by: Simone Bordet <[email protected]>
…readsBlockedInWrites(). (#12178) The test uncovered a larger problem detailed in the issue: the Handler Callback should be non-blocking. Since all implementations of HttpStream are non-blocking, overridden HttpStream.getInvocationType() to return NON_BLOCKING. This guarantees that even in case of all server threads blocked, blocked/pending writes can be completed. Signed-off-by: Simone Bordet <[email protected]>
Jetty version(s)
12+
Description
In Jetty 11, writes from a
Handler
viaresponse.getOutputStream()
are blocking, but internally that blocking call is converted into a non-blocking call typically via:where
blocker.invocationType==NON_BLOCKING
.For large writes that TCP congest, this means that task
SelectableChannelEndPoint._runCompleteWrite
is non-blocking; in case all threads are taken, unblocking a write is possible because the task is non-blocking and will be run by the selector thread when it wakes up being write-ready.In Jetty 12, writes from a
Handler
receive aCallback
whoseinvocationType
depends on theHttpStream
implementation.All of them do not override
getInvocationType()
so they are all blocking.This means that task
SelectableChannelEndPoint._runCompleteWrite
is blocking; in case all threads are taken the task will be queued, rather than executed by the selector thread, therefore locking up the server as it is the task that would have unblocked a write, but there are no threads to execute it.This is the reason of the flakyness of this test: sometimes there always is a thread that can run the
completeWrite
task, but in some cases there is not and the test fails.The text was updated successfully, but these errors were encountered: