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

Fixes #12323 - AsyncMiddleManServlet response flushing. #12542

Open
wants to merge 2 commits into
base: jetty-12.0.x
Choose a base branch
from

Conversation

sbordet
Copy link
Contributor

@sbordet sbordet commented Nov 15, 2024

  • Fixed ProxyWriter.chunks locking.
  • Made writeProxyResponseContent() protected so it can be overridden to flush the response content.
  • Added test case.

* Fixed `ProxyWriter.chunks` locking.
* Made `writeProxyResponseContent()` protected so it can be overridden to flush the response content.
* Added test case.

Signed-off-by: Simone Bordet <[email protected]>
@sbordet sbordet requested a review from lorban November 15, 2024 17:43
@sbordet sbordet linked an issue Nov 15, 2024 that may be closed by this pull request
Signed-off-by: Simone Bordet <[email protected]>
Copy link

@iiliev2 iiliev2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the fields

private Chunk chunk;
private boolean writePending;

shouldn't those be volatile?

@@ -610,7 +612,10 @@ public boolean offer(ByteBuffer content, Callback callback)
{
if (_log.isDebugEnabled())
_log.debug("{} proxying content to downstream: {} bytes {}", getRequestId(clientRequest), content.remaining(), callback);
return chunks.offer(new Chunk(content, callback));
try (AutoLock ignored = lock.lock())
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the benefit of this solution, rather than just using something like ConcurrentLinkedDeque for the chunks ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

AsyncMiddleManServlet response flushing
2 participants