From 7da01767d03ed6e6c5e8cfafc00b426dc77c4da5 Mon Sep 17 00:00:00 2001 From: "willchan@chromium.org" Date: Fri, 7 May 2010 23:45:30 +0000 Subject: Fix IO thread hang on releasing a socket. The problem was we assumed ProcessPendingRequest() would always make progress once the group's releasing socket went down to zero. However, in OnAvailableSocketSlot(), since the top stalled group might still have a releasing socket, it won't necessarily make progress. The algorithmic solution is to simply never do any socket slot processing in DoReleaseSocket() if there are any releasing sockets. This requires us to search for any stalled groups after releasing sockets gets back down to 0, so it requires the full group scan each time num_releasing_sockets goes back to 0. There is a performance hit here, but I think a linear search through 256~ groups in the worst case is ok. TODO(willchan): evaluate the perf hit and consider adding a secondary data structure to improve the stalled group search. BUG=42267 Review URL: http://codereview.chromium.org/2013009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46757 0039d316-1c4b-4281-b951-d872f2087c98 --- net/socket/tcp_client_socket_pool_unittest.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'net/socket/tcp_client_socket_pool_unittest.cc') diff --git a/net/socket/tcp_client_socket_pool_unittest.cc b/net/socket/tcp_client_socket_pool_unittest.cc index 6df566ba..cba12b5 100644 --- a/net/socket/tcp_client_socket_pool_unittest.cc +++ b/net/socket/tcp_client_socket_pool_unittest.cc @@ -731,6 +731,13 @@ TEST_F(TCPClientSocketPoolTest, BackupSocketConnect) { // One socket is stalled, the other is active. EXPECT_EQ(0, pool_->IdleSocketCount()); handle.Reset(); + + pool_ = new TCPClientSocketPool(kMaxSockets, + kMaxSocketsPerGroup, + "TCPUnitTest", + host_resolver_, + &client_socket_factory_, + NULL); } } -- cgit v1.1