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

Issue 3107036: Fix a crash where we are checking IsConnected(). If you look into the ... (Closed)

Created:
10 years, 4 months ago by Mike Belshe
Modified:
9 years, 5 months ago
Reviewers:
eroman
CC:
chromium-reviews, cbentzel+watch_chromium.org, darin-cc_chromium.org, Paweł Hajdan Jr.
Visibility:
Public.

Description

Fix a crash where we are checking IsConnected(). If you look into the implementation of IsConnected() on windows, you'll find that it can synchronously check if the socket is connected. This makes it so that a CHECK (or DCHECK) on this attribute is dependent on the peer. The peer could send us a TCP-FIN at any time - even 1 nanosecond before our call to IsConnected(). We can only use CHECK(!IsConnected()) to check before we connect, we simply can't use it at runtime. I searched the code and found 4 other instances of this broken check. Most were DCHECKs, which is good, but I've removed them just the same. Turns out our MockSockets have a mechanism for simulating this error, but it wasn't tested nor plumbed through the MockSSLClientSocket. In the process I added a couple of basic proxy test cases, which may be slightly redundant with other test cases that are more advanced. But they seem like a good idea to cover anyway. Added 6 tests in total. BUG=53099 TEST=ProxyTunnelGetHangup, RecycleDeadSSLSocket Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=57295

Patch Set 1 #

Patch Set 2 : nits, extra EXPECTS() in test cases added #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+326 lines, -6 lines) Patch
M net/http/http_network_transaction_unittest.cc View 1 2 chunks +319 lines, -0 lines 0 comments Download
M net/http/http_proxy_client_socket.cc View 1 chunk +0 lines, -1 line 0 comments Download
M net/http/http_stream_parser.cc View 2 chunks +2 lines, -2 lines 2 comments Download
M net/socket/socket_test_util.h View 1 chunk +1 line, -0 lines 0 comments Download
M net/socket/socket_test_util.cc View 1 1 chunk +4 lines, -0 lines 0 comments Download
M net/socket/socks5_client_socket.cc View 1 chunk +0 lines, -1 line 0 comments Download
M net/socket/socks_client_socket.cc View 1 chunk +0 lines, -1 line 0 comments Download
M net/socket/ssl_client_socket_pool.cc View 1 chunk +0 lines, -1 line 0 comments Download

Messages

Total messages: 3 (0 generated)
Mike Belshe
10 years, 4 months ago (2010-08-25 02:11:25 UTC) #1
eroman
LGTM http://codereview.chromium.org/3107036/diff/8001/9003 File net/http/http_stream_parser.cc (right): http://codereview.chromium.org/3107036/diff/8001/9003#newcode582 net/http/http_stream_parser.cc:582: if (!connection_->socket() || !connection_->socket()->IsConnected()) we weren't previously checking ...
10 years, 4 months ago (2010-08-25 05:26:47 UTC) #2
Mike Belshe
10 years, 4 months ago (2010-08-25 06:22:32 UTC) #3
http://codereview.chromium.org/3107036/diff/8001/9003
File net/http/http_stream_parser.cc (right):

http://codereview.chromium.org/3107036/diff/8001/9003#newcode582
net/http/http_stream_parser.cc:582: if (!connection_->socket() ||
!connection_->socket()->IsConnected())
On 2010/08/25 05:26:47, eroman wrote:
> we weren't previously checking to see if socket is non-NULL, under what
> circumstances is that valid?

It's not really valid.  I was just making it the same as the check on line 593.

Powered by Google App Engine
This is Rietveld 408576698