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

Enhanced fix for #5855 #5858

Conversation

gregw
Copy link
Contributor

@gregw gregw commented Jan 6, 2021

Avoid the race on request queue size by enhancing Pool to track demand.

Avoid the race on request queue size by enhancing Pool to track demand.
@gregw gregw requested review from sbordet and lorban January 6, 2021 12:16
gregw added 6 commits January 6, 2021 13:26
increment demand even if pool is at max size.
removed duplicate code to FutureConnection.
moved pending from Pool to AbstractConnectionPool
fixed javadoc
better atomic usage
updates from review:
 + always call tryCreate, now passing demanded to indicate if demand should be incremented
 + simplify demand > supply calculation
 + if not multiplexing reduce demand on connection failure.  If multiplexing, failure will not decrease demand, so some additional connections may be created until supply catches up.
{
int connectionCount = getConnectionCount();
if (LOG.isDebugEnabled())
LOG.debug("Try creating connection {}/{} with {}/{} pending", connectionCount, getMaxConnectionCount(), getPendingConnectionCount(), maxPending);
LOG.debug("Try creating connection {}/{} with {} pending", connectionCount, getMaxConnectionCount(), getPendingConnectionCount());
Copy link
Contributor

Choose a reason for hiding this comment

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

You should log the boolean demanded parameter.

gregw and others added 4 commits January 6, 2021 23:06
revert to using destination queue size for demand
Fix from review
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@@ -30,6 +29,6 @@ public static Connection acquire(AbstractConnectionPool connectionPool, boolean

public static void tryCreate(AbstractConnectionPool connectionPool, int pending)
Copy link
Contributor

Choose a reason for hiding this comment

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

This helper is only used for testing, so its signature should have been changed to reflect the new ConnectionPool.tryCreate(boolean) one.

Copy link
Contributor

@lorban lorban left a comment

Choose a reason for hiding this comment

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

Two small nits, otherwise LGTM.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@sbordet sbordet merged commit 6f14c1c into jetty-9.4.x-5855_httpclient_may_not_send_queued_request Jan 7, 2021
@sbordet sbordet deleted the jetty-9.4.x-5855_httpclient_may_not_send_queued_request2 branch January 7, 2021 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants