summaryrefslogtreecommitdiffstats
path: root/net/base
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-02 03:14:46 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-02 03:14:46 +0000
commitdcbe168abe7544b040c7a1d945585fd36427db42 (patch)
tree8409022e5d32cd366184560513781951aac0bfba /net/base
parentf68a0aaa17d3f05d1da33cf6098f8d0fd672ca7f (diff)
downloadchromium_src-dcbe168abe7544b040c7a1d945585fd36427db42.zip
chromium_src-dcbe168abe7544b040c7a1d945585fd36427db42.tar.gz
chromium_src-dcbe168abe7544b040c7a1d945585fd36427db42.tar.bz2
Fix preconnect crash when we hit max socket limit.
When we hit the max socket limit, we close an idle socket in order to make space for the new preconnecting socket. It's possible for the selected socket to belong to the same connection group as the one we're preconnecting a socket for. This is obviously broken. The bug currently results in us potentially deleting the ClientSocketPoolHelper::Group associated with that connection group, so the |Group* group| local variable in RequestSocketInternal() is now invalid. Any access to that variable later on in the function results in badness. This was safe before because we would never try to close an idle socket in the connection group we're request a socket for, because the first condition in RequestSocketInternal() checks to see if we can reuse an idle socket. In the preconnect case, since we want to warm up the number of sockets in the connection group, we bypass idle sockets. The solution is to create a new function: CloseOneIdleSocketExceptInGroup(const Group*). This way we avoid this problem. I provide a return value so that the caller can tell whether or not an idle socket was closed. If it was not closed (it's possible that the connection group we're requesting a socket for is the only one with idle sockets), then the caller can tell, so it can pass up the failure so RequestSockets() knows that we've hit the max socket limit and there's no point in trying to preconnect more sockets. BUG=64940 TEST=New unittest. Review URL: http://codereview.chromium.org/5549001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67953 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r--net/base/net_error_list.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/base/net_error_list.h b/net/base/net_error_list.h
index 2998a46..636808c 100644
--- a/net/base/net_error_list.h
+++ b/net/base/net_error_list.h
@@ -191,7 +191,9 @@ NET_ERROR(SSL_SNAP_START_NPN_MISPREDICTION, -131)
// give the user a helpful error message rather than have the connection hang.
NET_ERROR(ESET_ANTI_VIRUS_SSL_INTERCEPTION, -132)
-// Missing -133. Feel free to reuse in the future.
+// We've hit the max socket limit for the socket pool while preconnecting. We
+// don't bother trying to preconnect more sockets.
+NET_ERROR(PRECONNECT_MAX_SOCKET_LIMIT, -133)
// The permission to use the SSL client certificate's private key was denied.
NET_ERROR(SSL_CLIENT_AUTH_PRIVATE_KEY_ACCESS_DENIED, -134)