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

Issue 2013009: Fix IO thread hang on releasing a socket. (Closed)

Created:
10 years, 7 months ago by willchan no longer on Chromium
Modified:
9 years, 7 months ago
Reviewers:
eroman
CC:
chromium-reviews
Base URL:
http://src.chromium.org/git/chromium.git
Visibility:
Public.

Description

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 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=46757

Patch Set 1 #

Total comments: 2

Patch Set 2 : Add infinite loop check. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+104 lines, -26 lines) Patch
M net/socket/client_socket_pool_base.h View 1 chunk +3 lines, -0 lines 0 comments Download
M net/socket/client_socket_pool_base.cc View 1 5 chunks +30 lines, -26 lines 0 comments Download
M net/socket/client_socket_pool_base_unittest.cc View 1 chunk +64 lines, -0 lines 0 comments Download
M net/socket/tcp_client_socket_pool_unittest.cc View 1 chunk +7 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
willchan no longer on Chromium
10 years, 7 months ago (2010-05-07 18:47:13 UTC) #1
eroman
lgtm. this part of our code makes my head spin. (i am in favor of ...
10 years, 7 months ago (2010-05-07 23:26:25 UTC) #2
willchan no longer on Chromium
10 years, 7 months ago (2010-05-07 23:44:58 UTC) #3
Thanks for the recommendation.

http://codereview.chromium.org/2013009/diff/1/2
File net/socket/client_socket_pool_base.cc (right):

http://codereview.chromium.org/2013009/diff/1/2#newcode501
net/socket/client_socket_pool_base.cc:501: while (num_releasing_sockets_ == 0) {
On 2010/05/07 23:26:25, eroman wrote:
> Please add a max iterations counter, and CHECK that it is never exceeded.
> 
> This way if we still have problems (or get problems in the future), we will
get
> crash reports about it.
> 
> Plus it is better for the user to crash on shutdown, than hang on shutdown.

Done.

Powered by Google App Engine
This is Rietveld 408576698