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

Issue 328903004: SSL Connect Job Waiting (Closed)

Created:
6 years, 6 months ago by mshelley
Modified:
6 years, 5 months ago
Reviewers:
wtc, Ryan Sleevi, mshelley1
CC:
chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Visibility:
Public.

Description

This CL alters the way in which multiple sockets connect to the same server so that only one complete SSL handshake must be carried out. This is accomplished by preventing all but one of the parallel connections from proceeding until the first connection has completed. As a result, the remaining connections will be able to us an abbreviated SSL Handshake.

Patch Set 1 : Rough CL that holds back SSLConnectjobs when a connection is already in progress. Note: This is DEF… #

Patch Set 2 : Fixed error where next_state_ was not set in WAIT stage, and added a command line flag to enable my… #

Patch Set 3 : Added a command line flag that enables my changes. #

Total comments: 56

Patch Set 4 : Fixed various issues #

Patch Set 5 : Redesigned cache accessing functions. #

Total comments: 60

Patch Set 6 : Fixed bugs related to memory management and early exits in DoSSLConnectComplete #

Total comments: 39

Patch Set 7 : Fixed memory leak issues. #

Total comments: 19

Patch Set 8 : Fixed commenting issues and prevented PendingJobs from modifying pending_jobs_. #

Total comments: 8

Patch Set 9 : Add separate state for ProcessPendingJobs #

Total comments: 12
Unified diffs Side-by-side diffs Delta from patch set Stats (+258 lines, -54 lines) Patch
M chrome/browser/chrome_browser_main.cc View 1 2 3 2 chunks +5 lines, -0 lines 0 comments Download
M chrome/common/chrome_switches.h View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/chrome_switches.cc View 1 2 3 4 5 1 chunk +4 lines, -0 lines 0 comments Download
M net/socket/ssl_client_socket.h View 1 2 3 4 5 6 7 1 chunk +4 lines, -0 lines 0 comments Download
M net/socket/ssl_client_socket_openssl.h View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M net/socket/ssl_client_socket_openssl.cc View 1 2 3 4 5 6 7 1 chunk +8 lines, -0 lines 1 comment Download
M net/socket/ssl_client_socket_pool.h View 1 2 3 4 5 6 7 8 9 chunks +49 lines, -14 lines 3 comments Download
M net/socket/ssl_client_socket_pool.cc View 1 2 3 4 5 6 7 8 17 chunks +169 lines, -39 lines 8 comments Download
M net/socket/ssl_session_cache_openssl.h View 1 2 3 4 5 1 chunk +3 lines, -0 lines 0 comments Download
M net/socket/ssl_session_cache_openssl.cc View 1 2 3 4 5 6 3 chunks +14 lines, -1 line 0 comments Download

Messages

Total messages: 20 (0 generated)
mshelley1
This is definitely unpolished/buggy. I know of one issue right now that only happens the ...
6 years, 6 months ago (2014-06-11 19:23:32 UTC) #1
mshelley1
6 years, 6 months ago (2014-06-13 00:17:25 UTC) #2
mshelley1
6 years, 6 months ago (2014-06-13 21:35:45 UTC) #3
wtc
Review comments on patch set 3: I haven't reviewed the meat of this CL in ...
6 years, 6 months ago (2014-06-13 22:47:25 UTC) #4
Ryan Sleevi
Note: When sending reviews, use my "rsleevi" alias (as it suggests) This is just a ...
6 years, 6 months ago (2014-06-13 23:24:23 UTC) #5
mshelley1
I corrected all of the more concrete issues. I'm currently looking into correcting the design ...
6 years, 6 months ago (2014-06-16 19:02:51 UTC) #6
mshelley1
This patch implements a different method of accessing the session cache that avoids using a ...
6 years, 6 months ago (2014-06-17 00:26:34 UTC) #7
wtc
Review comments on patch set 5: The CL looks much better. I reviewed the whole ...
6 years, 6 months ago (2014-06-17 17:44:41 UTC) #8
mshelley1
https://codereview.chromium.org/328903004/diff/180001/chrome/common/chrome_switches.cc File chrome/common/chrome_switches.cc (right): https://codereview.chromium.org/328903004/diff/180001/chrome/common/chrome_switches.cc#newcode503 chrome/common/chrome_switches.cc:503: // maximize the number of full SSL handshakes completed. ...
6 years, 6 months ago (2014-06-18 18:53:51 UTC) #9
wtc
Review comments on patch set 6: I reviewed the CL carefully today. I believe the ...
6 years, 6 months ago (2014-06-19 19:38:11 UTC) #10
Ryan Sleevi
https://codereview.chromium.org/328903004/diff/180001/net/socket/ssl_client_socket_pool.cc File net/socket/ssl_client_socket_pool.cc (right): https://codereview.chromium.org/328903004/diff/180001/net/socket/ssl_client_socket_pool.cc#newcode653 net/socket/ssl_client_socket_pool.cc:653: group_name, new SSLConnectJob::PendingJobList())); On 2014/06/18 18:53:49, mshelley1 wrote: > ...
6 years, 6 months ago (2014-06-19 20:20:43 UTC) #11
wtc
On 2014/06/19 20:20:43, Ryan Sleevi wrote: > > .insert() will always update the value of ...
6 years, 6 months ago (2014-06-20 15:36:48 UTC) #12
mshelley1
Please confirm my use of a scoped_ptr to prevent pending_jobs_map from being leaked https://codereview.chromium.org/328903004/diff/200001/net/socket/ssl_client_socket.cc File ...
6 years, 6 months ago (2014-06-24 17:04:00 UTC) #13
Ryan Sleevi
https://codereview.chromium.org/328903004/diff/240001/net/socket/ssl_client_socket.h File net/socket/ssl_client_socket.h (right): https://codereview.chromium.org/328903004/diff/240001/net/socket/ssl_client_socket.h#newcode88 net/socket/ssl_client_socket.h:88: // cache shard. This second half an implementation detail; ...
6 years, 6 months ago (2014-06-24 23:40:44 UTC) #14
mshelley1
https://codereview.chromium.org/328903004/diff/240001/net/socket/ssl_client_socket.h File net/socket/ssl_client_socket.h (right): https://codereview.chromium.org/328903004/diff/240001/net/socket/ssl_client_socket.h#newcode88 net/socket/ssl_client_socket.h:88: // cache shard. On 2014/06/24 23:40:44, Ryan Sleevi wrote: ...
6 years, 6 months ago (2014-06-25 17:03:56 UTC) #15
Ryan Sleevi
I think this looks good, although I have a few final comments and a request ...
6 years, 6 months ago (2014-06-25 19:13:21 UTC) #16
mshelley1
https://codereview.chromium.org/328903004/diff/260001/net/socket/ssl_client_socket_pool.cc File net/socket/ssl_client_socket_pool.cc (right): https://codereview.chromium.org/328903004/diff/260001/net/socket/ssl_client_socket_pool.cc#newcode257 net/socket/ssl_client_socket_pool.cc:257: next_state_ = STATE_CREATE_SSL_SOCKET; On 2014/06/25 19:13:21, Ryan Sleevi wrote: ...
6 years, 6 months ago (2014-06-25 20:50:29 UTC) #17
Ryan Sleevi
lgtm
6 years, 6 months ago (2014-06-26 01:49:35 UTC) #18
Ryan Sleevi
On 2014/06/26 01:49:35, Ryan Sleevi wrote: > lgtm Actually, lemme say "Not LGTM" since we're ...
6 years, 6 months ago (2014-06-26 01:50:06 UTC) #19
wtc
6 years, 6 months ago (2014-06-26 17:48:17 UTC) #20
Patch set 9 LGTM. Please wait for Ryan's approval.

I only reviewed the diffs between patch sets 6 and 9.

High-level comments:

1. I understand this CL is missing tests. I am fine with committing this CL
first to facilitate future code reviews.

2. Please try building without use_openssl=1 in your GYP_DEFINES. I think you'll
need a stub implementation of InSessionCache() in ssl_client_socket_nss.*.

I suggest some small changes below.

https://codereview.chromium.org/328903004/diff/280001/net/socket/ssl_client_s...
File net/socket/ssl_client_socket_openssl.cc (right):

https://codereview.chromium.org/328903004/diff/280001/net/socket/ssl_client_s...
net/socket/ssl_client_socket_openssl.cc:370: // cache shard.

Nit: A comment at this location usually describes what the function
(InSessionCache) does. But this comment describes the cache_key local variable.
So this comment should be moved into the function at line 373, or to the
GetSocketSessionCacheKey function at line 92.

https://codereview.chromium.org/328903004/diff/280001/net/socket/ssl_client_s...
File net/socket/ssl_client_socket_pool.cc (right):

https://codereview.chromium.org/328903004/diff/280001/net/socket/ssl_client_s...
net/socket/ssl_client_socket_pool.cc:355: // resumption SSL handshake.

Move this comment to line 358.

https://codereview.chromium.org/328903004/diff/280001/net/socket/ssl_client_s...
net/socket/ssl_client_socket_pool.cc:373: return OK;

Nit: it is possible to rewrite lines 361-373 to eliminate the duplicate
pending_jobs_->push_back(this) calls:

  int rv;
  if (pending_jobs_->empty()) {
    // If there are no pending jobs, continue the full SSL handshake
    // because a resumption handshake is not possible.
    rv = OK;
  } else {
    // If there are pending jobs, wait.
    rv = ERR_IO_PENDING;
  }

  pending_jobs_->push_back(this);
  return rv;

The comment I asked you to add at lines 370-371 would be very confusing in the
restructured code, so I didn't include it.

If the restructured code is not clear to you, you can ignore this suggestion.

https://codereview.chromium.org/328903004/diff/280001/net/socket/ssl_client_s...
net/socket/ssl_client_socket_pool.cc:518: void
SSLConnectJob::ProcessPendingJobs(int result) {

Nit: I would get rid of the ProcessPendingJobs function. Just inline the code in
DoProcessPendingJobs.

https://codereview.chromium.org/328903004/diff/280001/net/socket/ssl_client_s...
net/socket/ssl_client_socket_pool.cc:528: for (PendingJobList::iterator job =
pending_jobs.begin();

Nit: this can be a const_iterator.

https://codereview.chromium.org/328903004/diff/280001/net/socket/ssl_client_s...
net/socket/ssl_client_socket_pool.cc:546: next_state_ = STATE_SSL_CONNECT;

Delete this line.

https://codereview.chromium.org/328903004/diff/280001/net/socket/ssl_client_s...
net/socket/ssl_client_socket_pool.cc:550: bool
SSLConnectJob::GetEnableJobWaiting() {

Move this to line 178, to follow the definition of EnableJobWaiting. This
matches their declaration order in the .h file.

https://codereview.chromium.org/328903004/diff/280001/net/socket/ssl_client_s...
net/socket/ssl_client_socket_pool.cc:669: std::pair<PendingJobMap::iterator,
bool> iter =

Nit: it is a little confusing to have variables named "it" and "iter" in
proximity. I suggest renaming this variable, such as "result" or "inserted".

https://codereview.chromium.org/328903004/diff/280001/net/socket/ssl_client_s...
net/socket/ssl_client_socket_pool.cc:670:
pending_jobs_map_->insert(PendingJobMap::value_type(

Nit: it seems that this line is indented with three spaces. Please run git cl
format.

https://codereview.chromium.org/328903004/diff/280001/net/socket/ssl_client_s...
File net/socket/ssl_client_socket_pool.h (right):

https://codereview.chromium.org/328903004/diff/280001/net/socket/ssl_client_s...
net/socket/ssl_client_socket_pool.h:107: SSLConnectJob(const std::string&
group_name,

Please move the comment here:

  // Note: the SSLConnectJob does not own pending_jobs_list
  // so it must outlive the job.

https://codereview.chromium.org/328903004/diff/280001/net/socket/ssl_client_s...
net/socket/ssl_client_socket_pool.h:133: static bool GetEnableJobWaiting();

Nit: this function can be named "JobWaitingEnabled" or "JobWaitingIsEnabled".

One naming convention for getter and setter methods is GetFoo() and SetFoo().
Since the setter method EnableJobWaiting doesn't follow this convention, it is
confusing for the getter method to be named this way.

https://codereview.chromium.org/328903004/diff/280001/net/socket/ssl_client_s...
net/socket/ssl_client_socket_pool.h:329: scoped_ptr<PendingJobMap>
pending_jobs_map_;

Please declare this member as a non-pointer, if that works:

  PendingJobMap pending_jobs_map_;

This will save a memory allocation from the heap.

Powered by Google App Engine
This is Rietveld 408576698