Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(893)

Unified Diff: net/socket/client_socket_pool_base.cc

Issue 2888623011: Fix for HTTP2 request hanging bug. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/socket/client_socket_pool_base_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/client_socket_pool_base.cc
diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc
index 912dfeeaff137b4752f896e91eacf779b791966a..f5978625bd2e0ce2ae805ae55f2ff565b5ef1728 100644
--- a/net/socket/client_socket_pool_base.cc
+++ b/net/socket/client_socket_pool_base.cc
@@ -902,37 +902,36 @@ void ClientSocketPoolBaseHelper::ReleaseSocket(
}
void ClientSocketPoolBaseHelper::CheckForStalledSocketGroups() {
- // If we have idle sockets, see if we can give one to the top-stalled group.
- std::string top_group_name;
- Group* top_group = NULL;
- if (!FindTopStalledGroup(&top_group, &top_group_name)) {
- // There may still be a stalled group in a lower level pool.
- for (std::set<LowerLayeredPool*>::iterator it = lower_pools_.begin();
- it != lower_pools_.end();
- ++it) {
- if ((*it)->IsStalled()) {
- CloseOneIdleSocket();
- break;
- }
+ // Loop until there's nothing more to do.
+ while (true) {
+ // If we have idle sockets, see if we can give one to the top-stalled group.
+ std::string top_group_name;
+ Group* top_group = NULL;
+ if (!FindTopStalledGroup(&top_group, &top_group_name)) {
+ // There may still be a stalled group in a lower level pool.
+ for (std::set<LowerLayeredPool*>::iterator it = lower_pools_.begin();
+ it != lower_pools_.end(); ++it) {
+ if ((*it)->IsStalled()) {
+ CloseOneIdleSocket();
+ break;
davidben 2017/05/18 20:22:51 What's causing the socket pools to react to the fr
mmenke 2017/05/18 20:44:57 Destroying the socket will do that. So suppose th
davidben 2017/05/18 20:52:31 I guess the vague analogy to our sync-return || ER
mmenke 2017/05/18 21:00:43 Ideally, we really should only have at most one (n
+ }
+ }
+ return;
}
- return;
- }
- if (ReachedMaxSocketsLimit()) {
- if (idle_socket_count() > 0) {
- CloseOneIdleSocket();
- } else {
- // We can't activate more sockets since we're already at our global
- // limit.
- return;
+ if (ReachedMaxSocketsLimit()) {
+ if (idle_socket_count() > 0) {
+ CloseOneIdleSocket();
+ } else {
+ // We can't activate more sockets since we're already at our global
+ // limit.
+ return;
+ }
}
- }
- // Note: we don't loop on waking stalled groups. If the stalled group is at
- // its limit, may be left with other stalled groups that could be
- // woken. This isn't optimal, but there is no starvation, so to avoid
- // the looping we leave it at this.
davidben 2017/05/18 20:22:51 Previously we tried to avoid infinite looping here
mmenke 2017/05/18 20:44:57 Correct. I can't see how we'd get into an infinit
- OnAvailableSocketSlot(top_group_name, top_group);
+ // Note that this may delete top_group.
+ OnAvailableSocketSlot(top_group_name, top_group);
+ }
}
// Search for the highest priority pending request, amongst the groups that
« no previous file with comments | « no previous file | net/socket/client_socket_pool_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698