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

Issue 7399025: Fix instability in SSL client/server sockets (Closed)

Created:
9 years, 5 months ago by Sergey Ulanov
Modified:
9 years, 5 months ago
CC:
chromium-reviews, jamiewalch+watch_chromium.org, hclam+watch_chromium.org, cbentzel+watch_chromium.org, simonmorris+watch_chromium.org, wez+watch_chromium.org, Paweł Hajdan Jr., dmaclach+watch_chromium.org, garykac+watch_chromium.org, lambroslambrou+watch_chromium.org, darin-cc_chromium.org, ajwong+watch_chromium.org, sergeyu+watch_chromium.org
Visibility:
Public.

Description

Fix instability in SSL client/server sockets When writing to a socket, net::StreamSocket::Write() may return immediately, but it may not write the whole buffer passed to it. In this case SSL sockets were not trying to call Write() again to send rest of the data, until client tries to call Write() next time. If client doesn't call Write the remaining data is never sent to the transport socket. remoting_unittests was flaky due to this bug. BUG=88726 TEST=updated net_unittest to catch the bug, remoting_unittests is not flaky Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=93445

Patch Set 1 #

Patch Set 2 : - #

Total comments: 1

Patch Set 3 : Fix similar issue in OnSendComplete() #

Total comments: 11

Patch Set 4 : Simpler fix #

Total comments: 4

Patch Set 5 : Fix test failure #

Patch Set 6 : address feedback, update tests #

Patch Set 7 : Update FakeSocketTest. #

Total comments: 19

Patch Set 8 : - #

Total comments: 2

Patch Set 9 : - #

Patch Set 10 : - #

Unified diffs Side-by-side diffs Delta from patch set Stats (+64 lines, -26 lines) Patch
M net/socket/ssl_client_socket_nss.cc View 1 2 3 4 5 6 7 8 1 chunk +13 lines, -5 lines 0 comments Download
M net/socket/ssl_server_socket_nss.cc View 1 2 3 4 5 6 7 8 1 chunk +13 lines, -5 lines 0 comments Download
M net/socket/ssl_server_socket_unittest.cc View 1 2 3 4 5 6 7 8 9 6 chunks +35 lines, -10 lines 0 comments Download
M remoting/protocol/jingle_session_unittest.cc View 3 chunks +3 lines, -6 lines 0 comments Download

Messages

Total messages: 18 (0 generated)
Sergey Ulanov
9 years, 5 months ago (2011-07-18 17:36:27 UTC) #1
Sergey Ulanov
http://codereview.chromium.org/7399025/diff/4001/net/socket/ssl_client_socket_nss.cc File net/socket/ssl_client_socket_nss.cc (right): http://codereview.chromium.org/7399025/diff/4001/net/socket/ssl_client_socket_nss.cc#newcode1753 net/socket/ssl_client_socket_nss.cc:1753: network_moved = (nsent > 0 || nreceived > 0); ...
9 years, 5 months ago (2011-07-18 17:58:36 UTC) #2
Wez
http://codereview.chromium.org/7399025/diff/5002/net/socket/ssl_client_socket_nss.cc File net/socket/ssl_client_socket_nss.cc (left): http://codereview.chromium.org/7399025/diff/5002/net/socket/ssl_client_socket_nss.cc#oldcode1745 net/socket/ssl_client_socket_nss.cc:1745: network_moved = (nsent > 0 || nreceived >= 0); ...
9 years, 5 months ago (2011-07-18 21:53:33 UTC) #3
Sergey Ulanov
Implemented a simpler fix: now synchronous read/write are handled in DoTransportIO() instead of the code ...
9 years, 5 months ago (2011-07-19 19:26:56 UTC) #4
Wez
LGTM, for what it's worth. Can you create a bug for the delete-in-callback issue, though, ...
9 years, 5 months ago (2011-07-19 20:32:18 UTC) #5
Wez
http://codereview.chromium.org/7399025/diff/9001/net/socket/ssl_client_socket_nss.cc File net/socket/ssl_client_socket_nss.cc (right): http://codereview.chromium.org/7399025/diff/9001/net/socket/ssl_client_socket_nss.cc#newcode1742 net/socket/ssl_client_socket_nss.cc:1742: if (nss_bufs_ != NULL) { nit: Actually, a comment ...
9 years, 5 months ago (2011-07-19 20:33:07 UTC) #6
Sergey Ulanov
Addressed the comments. Also updated the tests so that they would catch this bug. http://codereview.chromium.org/7399025/diff/9001/net/socket/ssl_client_socket_nss.cc ...
9 years, 5 months ago (2011-07-19 21:10:09 UTC) #7
Sergey Ulanov
Wan-Teh, ping? I'd like to fix this problem in M14, i.e. need to land it ...
9 years, 5 months ago (2011-07-20 22:55:56 UTC) #8
wtc
LGTM. Thanks! willchan: I ask you to review a piece of code. Please search for ...
9 years, 5 months ago (2011-07-21 00:27:12 UTC) #9
Sergey Ulanov
http://codereview.chromium.org/7399025/diff/18001/net/socket/ssl_server_socket_nss.cc File net/socket/ssl_server_socket_nss.cc (right): http://codereview.chromium.org/7399025/diff/18001/net/socket/ssl_server_socket_nss.cc#newcode428 net/socket/ssl_server_socket_nss.cc:428: DoTransportIO(); On 2011/07/21 00:27:12, wtc wrote: > IMPORTANT: We ...
9 years, 5 months ago (2011-07-21 00:33:28 UTC) #10
wtc
http://codereview.chromium.org/7399025/diff/5002/net/socket/ssl_client_socket_nss.cc File net/socket/ssl_client_socket_nss.cc (right): http://codereview.chromium.org/7399025/diff/5002/net/socket/ssl_client_socket_nss.cc#newcode1196 net/socket/ssl_client_socket_nss.cc:1196: } while (network_moved); On 2011/07/18 21:53:33, Wez wrote: > ...
9 years, 5 months ago (2011-07-21 00:42:30 UTC) #11
Sergey Ulanov
http://codereview.chromium.org/7399025/diff/18001/net/socket/ssl_server_socket_nss.cc File net/socket/ssl_server_socket_nss.cc (right): http://codereview.chromium.org/7399025/diff/18001/net/socket/ssl_server_socket_nss.cc#newcode531 net/socket/ssl_server_socket_nss.cc:531: // Do as much as possible network I/O between ...
9 years, 5 months ago (2011-07-21 00:51:15 UTC) #12
wtc
sergeyu: thank you for the explanation. I now understand the bug you encountered, and agree ...
9 years, 5 months ago (2011-07-21 00:56:44 UTC) #13
wtc
http://codereview.chromium.org/7399025/diff/24001/net/socket/ssl_client_socket_nss.cc File net/socket/ssl_client_socket_nss.cc (right): http://codereview.chromium.org/7399025/diff/24001/net/socket/ssl_client_socket_nss.cc#newcode1761 net/socket/ssl_client_socket_nss.cc:1761: // because Read() and Write() may return synchronously. This ...
9 years, 5 months ago (2011-07-21 01:06:07 UTC) #14
Sergey Ulanov
>sergeyu: thank you for the explanation. I now understand >the bug you encountered, and agree ...
9 years, 5 months ago (2011-07-21 01:09:51 UTC) #15
Sergey Ulanov
http://codereview.chromium.org/7399025/diff/24001/net/socket/ssl_client_socket_nss.cc File net/socket/ssl_client_socket_nss.cc (right): http://codereview.chromium.org/7399025/diff/24001/net/socket/ssl_client_socket_nss.cc#newcode1761 net/socket/ssl_client_socket_nss.cc:1761: // because Read() and Write() may return synchronously. On ...
9 years, 5 months ago (2011-07-21 01:11:08 UTC) #16
willchan no longer on Chromium
http://codereview.chromium.org/7399025/diff/18001/net/socket/ssl_server_socket_unittest.cc File net/socket/ssl_server_socket_unittest.cc (right): http://codereview.chromium.org/7399025/diff/18001/net/socket/ssl_server_socket_unittest.cc#newcode55 net/socket/ssl_server_socket_unittest.cc:55: ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) { Need compiler_specific.h for this macro. http://codereview.chromium.org/7399025/diff/18001/net/socket/ssl_server_socket_unittest.cc#newcode74 net/socket/ssl_server_socket_unittest.cc:74: ...
9 years, 5 months ago (2011-07-21 08:16:06 UTC) #17
Sergey Ulanov
9 years, 5 months ago (2011-07-21 17:11:12 UTC) #18
http://codereview.chromium.org/7399025/diff/18001/net/socket/ssl_server_socke...
File net/socket/ssl_server_socket_unittest.cc (right):

http://codereview.chromium.org/7399025/diff/18001/net/socket/ssl_server_socke...
net/socket/ssl_server_socket_unittest.cc:55:
ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) {
On 2011/07/21 08:16:06, willchan wrote:
> Need compiler_specific.h for this macro.

Done.

Powered by Google App Engine
This is Rietveld 408576698