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

Issue 9667016: Close idle connections / SPDY sessions when needed (Closed)

Created:
8 years, 9 months ago by Ryan Hamilton
Modified:
8 years, 9 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, darin-cc_chromium.org, mmenke1, eroman
Visibility:
Public.

Description

Attempting to re-land the feature. Revert 127730 - Revert 127717 - Revert 118788 - Revert 113405 - Revert 113305 - Revert 113300 - Revert 112134 - Revert 112130 - Close idle connections / SPDY sessions when needed Due to the idle connection state being held by different socket pools, it's possible for one socket pool to hold an idle socket in a lower layer socket pool. From the lower level socket pool's perspective, the socket is being "actively" used. From the higher socket pool's (including SpdySession, which is more of a connection manager) perspective, the connection is idle and can be closed if we have hit a limit. Normally this isn't a big deal, except when we have a lot of idle SPDY connections and are connecting via a proxy, so we have low connection limits through the proxy server. We address this problem by allowing lower-level socket pools to tell higher level socket pools to close a socket. Fixed ASAN test failures by removing .Times(1) and .Times(2) from CloseMultipleIdleSocketsHeldByLayeredPoolWhenNeeded unittest (this removes the tests relying on the order of std::set in CloseOneIdleConnectionInLayeredPool). ASAN is prob ably causing the memory allocator to allocate the pools differently. The std::set is ordered by LayeredPool* which is the address of the LayeredPool (willchan). Added NET_EXPORT for layered_pool class defintion to fix windows shared compile. BUG=62364, 92244, 109876, 110368 TEST= Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=127717 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=127893

Patch Set 1 #

Patch Set 2 : Reland willchan's patch with eroman's fixes. #

Total comments: 10

Patch Set 3 : Fix mmenke's comments #

Patch Set 4 : Rebase #

Total comments: 16

Patch Set 5 : Add effective test of SpdySession::CloseOneIdleConnection #

Patch Set 6 : Change DCHECK to CHECK. #

Patch Set 7 : Fix copyright. #

Patch Set 8 : Add test that exercises the codepath which caused http://crbug.com/109876 #

Patch Set 9 : Add test that exercises the codepath which caused http://crbug.com/109876 #

Patch Set 10 : Rename test to CloseIdleSpdySessionToOpenNewOne #

Total comments: 18

Patch Set 11 : Switch from CHECK to if, since other things can hold ref to SpdySession. #

Patch Set 12 : Address mmenke's comments #

Total comments: 2

Patch Set 13 : Fix nit #

Patch Set 14 : Fix nit #

Patch Set 15 : Rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1351 lines, -37 lines) Patch
M net/http/http_network_transaction_spdy21_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +173 lines, -0 lines 0 comments Download
M net/http/http_network_transaction_spdy2_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +173 lines, -0 lines 0 comments Download
M net/http/http_network_transaction_spdy3_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +173 lines, -0 lines 0 comments Download
M net/http/http_proxy_client_socket_pool.h View 1 2 3 4 5 6 4 chunks +12 lines, -1 line 0 comments Download
M net/http/http_proxy_client_socket_pool.cc View 1 2 3 4 5 6 4 chunks +34 lines, -2 lines 0 comments Download
M net/socket/client_socket_handle.h View 1 2 3 4 5 6 2 chunks +5 lines, -0 lines 0 comments Download
M net/socket/client_socket_handle.cc View 1 2 3 4 5 6 3 chunks +19 lines, -0 lines 0 comments Download
M net/socket/client_socket_pool.h View 1 2 3 4 5 6 3 chunks +21 lines, -0 lines 0 comments Download
M net/socket/client_socket_pool_base.h View 1 2 3 4 5 6 11 chunks +41 lines, -12 lines 0 comments Download
M net/socket/client_socket_pool_base.cc View 1 2 3 4 5 6 7 9 chunks +86 lines, -15 lines 0 comments Download
M net/socket/client_socket_pool_base_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 16 chunks +219 lines, -4 lines 0 comments Download
M net/socket/socks_client_socket_pool.h View 1 2 3 4 5 6 4 chunks +11 lines, -1 line 0 comments Download
M net/socket/socks_client_socket_pool.cc View 1 2 3 4 5 6 4 chunks +26 lines, -1 line 0 comments Download
M net/socket/ssl_client_socket_pool.h View 1 2 3 4 5 6 4 chunks +10 lines, -0 lines 0 comments Download
M net/socket/ssl_client_socket_pool.cc View 1 2 3 4 5 6 4 chunks +33 lines, -0 lines 0 comments Download
M net/socket/transport_client_socket_pool.h View 1 2 3 4 5 6 2 chunks +3 lines, -0 lines 0 comments Download
M net/socket/transport_client_socket_pool.cc View 1 2 3 4 5 6 2 chunks +12 lines, -0 lines 0 comments Download
M net/spdy/spdy_session.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +7 lines, -1 line 0 comments Download
M net/spdy/spdy_session.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +13 lines, -0 lines 0 comments Download
M net/spdy/spdy_session_spdy2_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +140 lines, -0 lines 0 comments Download
M net/spdy/spdy_session_spdy3_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +140 lines, -0 lines 0 comments Download

Messages

Total messages: 24 (0 generated)
Ryan Hamilton
eroman: can you look at this CL? It's is will's original CL + a fix ...
8 years, 9 months ago (2012-03-12 18:32:08 UTC) #1
eroman
Could you have either willchan or mmenke review this change? They are more familiar with ...
8 years, 9 months ago (2012-03-12 22:43:53 UTC) #2
Ryan Hamilton
willchan/mmenke: could one of you please review this cl? It's basically a CL that was ...
8 years, 9 months ago (2012-03-12 22:49:14 UTC) #3
mmenke
On 2012/03/12 22:49:14, Ryan Hamilton wrote: > willchan/mmenke: could one of you please review this ...
8 years, 9 months ago (2012-03-12 22:52:24 UTC) #4
willchan no longer on Chromium
I hope to look at it later, but sheriffing is keeping me busy. On Mon, ...
8 years, 9 months ago (2012-03-12 22:59:50 UTC) #5
mmenke
Still need to take a closer look at this, just a couple preliminary comments. http://codereview.chromium.org/9667016/diff/1001/net/socket/client_socket_pool_base.cc ...
8 years, 9 months ago (2012-03-14 14:44:48 UTC) #6
Ryan Hamilton
Still need to work on a unit test to verify that the hang has been ...
8 years, 9 months ago (2012-03-15 21:44:31 UTC) #7
mmenke
Sorry I've been slow with this review. Trying to be very careful, given the issues ...
8 years, 9 months ago (2012-03-16 18:01:15 UTC) #8
Ryan Hamilton
https://chromiumcodereview.appspot.com/9667016/diff/10005/net/http/http_network_transaction_spdy21_unittest.cc File net/http/http_network_transaction_spdy21_unittest.cc (right): https://chromiumcodereview.appspot.com/9667016/diff/10005/net/http/http_network_transaction_spdy21_unittest.cc#newcode167 net/http/http_network_transaction_spdy21_unittest.cc:167: SpdySession::set_default_protocol(SSLClientSocket::kProtoSPDY21); On 2012/03/16 18:01:15, Matt Menke wrote: > nit: ...
8 years, 9 months ago (2012-03-16 22:21:03 UTC) #9
mmenke
https://chromiumcodereview.appspot.com/9667016/diff/10005/net/http/http_network_transaction_spdy21_unittest.cc File net/http/http_network_transaction_spdy21_unittest.cc (right): https://chromiumcodereview.appspot.com/9667016/diff/10005/net/http/http_network_transaction_spdy21_unittest.cc#newcode167 net/http/http_network_transaction_spdy21_unittest.cc:167: SpdySession::set_default_protocol(SSLClientSocket::kProtoSPDY21); On 2012/03/16 22:21:03, Ryan Hamilton wrote: > On ...
8 years, 9 months ago (2012-03-16 22:25:09 UTC) #10
Ryan Hamilton
https://chromiumcodereview.appspot.com/9667016/diff/10005/net/http/http_network_transaction_spdy21_unittest.cc File net/http/http_network_transaction_spdy21_unittest.cc (right): https://chromiumcodereview.appspot.com/9667016/diff/10005/net/http/http_network_transaction_spdy21_unittest.cc#newcode167 net/http/http_network_transaction_spdy21_unittest.cc:167: SpdySession::set_default_protocol(SSLClientSocket::kProtoSPDY21); On 2012/03/16 22:25:09, Matt Menke wrote: > On ...
8 years, 9 months ago (2012-03-16 22:34:56 UTC) #11
mmenke
Will: Is there a reason we only delete empty groups in CleanupIdleSockets, rather than in ...
8 years, 9 months ago (2012-03-19 18:43:35 UTC) #12
Ryan Hamilton
http://codereview.chromium.org/9667016/diff/21004/net/socket/client_socket_pool_base_unittest.cc File net/socket/client_socket_pool_base_unittest.cc (right): http://codereview.chromium.org/9667016/diff/21004/net/socket/client_socket_pool_base_unittest.cc#newcode394 net/socket/client_socket_pool_base_unittest.cc:394: TestConnectJob::JobType job_type = job_type_; On 2012/03/19 18:43:35, Matt Menke ...
8 years, 9 months ago (2012-03-19 19:04:15 UTC) #13
willchan no longer on Chromium
On 2012/03/19 18:43:35, Matt Menke wrote: > Will: Is there a reason we only delete ...
8 years, 9 months ago (2012-03-19 19:16:30 UTC) #14
willchan no longer on Chromium
On 2012/03/19 19:16:30, willchan wrote: > On 2012/03/19 18:43:35, Matt Menke wrote: > > Will: ...
8 years, 9 months ago (2012-03-19 19:16:53 UTC) #15
Ryan Hamilton
On 2012/03/19 19:16:53, willchan wrote: > On 2012/03/19 19:16:30, willchan wrote: > > On 2012/03/19 ...
8 years, 9 months ago (2012-03-19 19:18:12 UTC) #16
willchan no longer on Chromium
On Mon, Mar 19, 2012 at 12:18 PM, <rch@chromium.org> wrote: > On 2012/03/19 19:16:53, willchan ...
8 years, 9 months ago (2012-03-19 19:18:50 UTC) #17
mmenke
On 2012/03/19 19:18:50, willchan wrote: > I'd vote a later one. You're asking for trouble ...
8 years, 9 months ago (2012-03-19 19:21:00 UTC) #18
Ryan Hamilton
On 2012/03/19 19:21:00, Matt Menke wrote: > On 2012/03/19 19:18:50, willchan wrote: > > I'd ...
8 years, 9 months ago (2012-03-19 19:25:29 UTC) #19
mmenke
Everything looks fine to me, I just want to convince myself CloseOneIdleConnection() is correct before ...
8 years, 9 months ago (2012-03-19 19:29:28 UTC) #20
Ryan Hamilton
http://codereview.chromium.org/9667016/diff/26002/net/spdy/spdy_session.cc File net/spdy/spdy_session.cc (right): http://codereview.chromium.org/9667016/diff/26002/net/spdy/spdy_session.cc#newcode1185 net/spdy/spdy_session.cc:1185: // Since the underlying socket it only returned when ...
8 years, 9 months ago (2012-03-19 22:34:26 UTC) #21
mmenke
LGTM.
8 years, 9 months ago (2012-03-20 14:30:54 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/rch@chromium.org/9667016/28009
8 years, 9 months ago (2012-03-20 16:18:07 UTC) #23
commit-bot: I haz the power
8 years, 9 months ago (2012-03-20 17:37:31 UTC) #24
Change committed as 127717

Powered by Google App Engine
This is Rietveld 408576698