Repository navigation
Conversation
An output writer can hold an application response lock while calling complete() after an IO failure. A concurrent completion listener can wait for that response lock while holding the async context monitor, preventing the writer from returning from complete(). Select synchronous completion actions while holding the monitor, then run them after releasing it. Use the same preparation step for forced and IO-thread completion, preserving deferred and queued completion. Add bounded concurrency regressions for initial-request, dispatched, IO-thread, and async-worker completion paths. Signed-off-by: KKtwo <38353785+KKtwo@users.noreply.github.com>
Author
|
I tried to create the corresponding UNDERTOW issue after registering and The PR includes a self-contained servlet reproducer, a bounded regression |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An async output writer can hold an application response lock while an IO
failure leads it to call
AsyncContext.complete(). Concurrent completioncan invoke an
AsyncListener.onCompletethat needs the same response lock.Calling that listener while holding the async context monitor creates a
lock cycle: the writer waits for the context monitor and the listener
waits for the writer's response lock.
Keep the completion flag, timeout cancellation, and completion-path
selection protected by the monitor. Run synchronous completion actions
after releasing it, using the same preparation helper for forced and
IO-thread completion. Complete the captured previous async context outside
the current context's monitor as well. Queued completion continues to use
the existing async task queue.
The regression test uses a real servlet request and a second thread with
an application lock. The listener must acquire that lock while the second
thread calls
complete(). Latches force the relevant ordering, and boundedwaits allow the original code to fail without leaving the test JVM
permanently deadlocked. It covers completion before the initial request
returns, completion after dispatch, IO-thread completion, and completion
from an async worker.
Validation with Corretto 21:
cannot acquire the writer's lock.
mvn -B -ntp -pl servlet -am verify -Dmaven.javadoc.skip=truepasses,including Checkstyle. Core: 971 tests, 18 skipped; Servlet: 386 tests,
7 skipped. Neither module reports failures or errors.
2.3.24.Final, where all fourconcurrency regressions also pass.
This is a draft proposal under the contributing guide's planned-changes
process. An associated Red Hat Jira issue is still needed; no issue number
has been invented or substituted with a private tracker.