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

Issue 2619583002: Clean up HttpStreamFactoryImpl::JobController when Impl::Jobs complete (Closed)

Created:
3 years, 11 months ago by xunjieli
Modified:
3 years, 11 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Clean up HttpStreamFactoryImpl::JobController when Impl::Jobs complete Background: When a server advertises alternative services support, JobController creates two Jobs (|main_job_| and |alternative_job_|). The controller blocks |main_job_| when connecting the |alternative_job_|. It resumes the |main_job_| when |alternative_job_| fails or when the timeout happens. When both jobs are destroyed, the JobController goes away. Bug: We currently leak JobController in the situation where |alternative_job_| succeeds and |main_job_| is blocked on alt job. OnRequestComplete() will be called which then destroys the alt job but not the main job. This causes MaybeNotifyFactoryOfCompletion() to not clean up the controller. Fix: This CL fixes this leak by resetting |main_job_| if it is blocked (i.e. hasn't started connecting) when |alternative_job_| succeeds. This CL adds a regression test for this. Note that there is no leak when orphaned job completes, because "job_bound_ && bound_job_ != job" will evaluate to true. This CL adds a |!request_| check so it's obvious that we always clean up controller in the orphaned case. This CL adds a test to confirm that we did clean up controller when orphaned job completes (which passes with and without the change). BUG=678768 Review-Url: https://codereview.chromium.org/2619583002 Cr-Commit-Position: refs/heads/master@{#442556} Committed: https://chromium.googlesource.com/chromium/src/+/e368398a3a5357a8742f3829ef08cc45080fb808

Patch Set 1 #

Total comments: 3

Patch Set 2 : Attempt 2. Need to write tests #

Patch Set 3 : self review and need tests #

Patch Set 4 : self review and need tests #

Patch Set 5 : Add one regression test and one functional test for the orphaned case #

Patch Set 6 : self review #

Total comments: 12

Patch Set 7 : Matt's comments #

Total comments: 2

Patch Set 8 : one more find and replace #

Total comments: 8

Patch Set 9 : address wez@ comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+150 lines, -11 lines) Patch
M net/http/http_basic_stream.cc View 1 2 3 4 1 chunk +5 lines, -1 line 0 comments Download
M net/http/http_stream_factory_impl_job_controller.h View 1 2 3 4 5 6 2 chunks +5 lines, -1 line 0 comments Download
M net/http/http_stream_factory_impl_job_controller.cc View 1 2 3 4 5 6 7 8 11 chunks +24 lines, -9 lines 0 comments Download
M net/http/http_stream_factory_impl_job_controller_unittest.cc View 1 2 3 4 5 1 chunk +116 lines, -0 lines 0 comments Download

Messages

Total messages: 56 (31 generated)
xunjieli
I am not sure if this is the right way to solve the problem. It ...
3 years, 11 months ago (2017-01-06 17:34:16 UTC) #2
xunjieli
https://codereview.chromium.org/2619583002/diff/1/net/http/http_stream_factory_impl_job_controller_unittest.cc File net/http/http_stream_factory_impl_job_controller_unittest.cc (right): https://codereview.chromium.org/2619583002/diff/1/net/http/http_stream_factory_impl_job_controller_unittest.cc#newcode426 net/http/http_stream_factory_impl_job_controller_unittest.cc:426: resolver.pending_jobs()[0]->CompleteNow(net::OK); Note: The existing test fixture is a bit ...
3 years, 11 months ago (2017-01-06 17:55:59 UTC) #5
Wez
https://codereview.chromium.org/2619583002/diff/1/net/http/http_stream_factory_impl_job_controller.cc File net/http/http_stream_factory_impl_job_controller.cc (right): https://codereview.chromium.org/2619583002/diff/1/net/http/http_stream_factory_impl_job_controller.cc#newcode149 net/http/http_stream_factory_impl_job_controller.cc:149: main_job_.reset(); So IIUC the issue was that MaybeNotifyFactoryOfCompletion() would ...
3 years, 11 months ago (2017-01-06 18:21:44 UTC) #7
mmenke
I believe the old behavior here was deliberate, since we wanted to let the QUIC ...
3 years, 11 months ago (2017-01-06 18:43:58 UTC) #8
Ryan Sleevi
https://codereview.chromium.org/2619583002/diff/1/net/http/http_stream_factory_impl_job_controller.cc File net/http/http_stream_factory_impl_job_controller.cc (right): https://codereview.chromium.org/2619583002/diff/1/net/http/http_stream_factory_impl_job_controller.cc#newcode149 net/http/http_stream_factory_impl_job_controller.cc:149: main_job_.reset(); On 2017/01/06 18:21:44, Wez wrote: > So IIUC ...
3 years, 11 months ago (2017-01-06 20:24:13 UTC) #11
xunjieli
On 2017/01/06 18:43:58, mmenke wrote: > I believe the old behavior here was deliberate, since ...
3 years, 11 months ago (2017-01-06 22:56:02 UTC) #23
mmenke
The non-test changes LGTM. I'm hoping rch or zhongyi will chime in and review the ...
3 years, 11 months ago (2017-01-09 18:37:20 UTC) #32
xunjieli
https://codereview.chromium.org/2619583002/diff/100001/net/http/http_stream_factory_impl_job_controller.cc File net/http/http_stream_factory_impl_job_controller.cc (right): https://codereview.chromium.org/2619583002/diff/100001/net/http/http_stream_factory_impl_job_controller.cc#newcode159 net/http/http_stream_factory_impl_job_controller.cc:159: if (main_job_ && main_job_is_blocked_) On 2017/01/09 18:37:20, mmenke wrote: ...
3 years, 11 months ago (2017-01-09 18:52:31 UTC) #33
mmenke
https://codereview.chromium.org/2619583002/diff/100001/net/http/http_stream_factory_impl_job_controller.cc File net/http/http_stream_factory_impl_job_controller.cc (right): https://codereview.chromium.org/2619583002/diff/100001/net/http/http_stream_factory_impl_job_controller.cc#newcode159 net/http/http_stream_factory_impl_job_controller.cc:159: if (main_job_ && main_job_is_blocked_) On 2017/01/09 18:52:31, xunjieli wrote: ...
3 years, 11 months ago (2017-01-09 18:56:19 UTC) #34
xunjieli
Thanks! https://codereview.chromium.org/2619583002/diff/100001/net/http/http_stream_factory_impl_job_controller.cc File net/http/http_stream_factory_impl_job_controller.cc (right): https://codereview.chromium.org/2619583002/diff/100001/net/http/http_stream_factory_impl_job_controller.cc#newcode159 net/http/http_stream_factory_impl_job_controller.cc:159: if (main_job_ && main_job_is_blocked_) On 2017/01/09 18:56:19, mmenke ...
3 years, 11 months ago (2017-01-09 19:18:21 UTC) #35
mmenke
https://codereview.chromium.org/2619583002/diff/120001/net/http/http_stream_factory_impl_job_controller.cc File net/http/http_stream_factory_impl_job_controller.cc (right): https://codereview.chromium.org/2619583002/diff/120001/net/http/http_stream_factory_impl_job_controller.cc#newcode305 net/http/http_stream_factory_impl_job_controller.cc:305: if (!request_ || (job_bound_ && bound_job_ != job)) { ...
3 years, 11 months ago (2017-01-09 19:20:23 UTC) #36
xunjieli
https://codereview.chromium.org/2619583002/diff/120001/net/http/http_stream_factory_impl_job_controller.cc File net/http/http_stream_factory_impl_job_controller.cc (right): https://codereview.chromium.org/2619583002/diff/120001/net/http/http_stream_factory_impl_job_controller.cc#newcode305 net/http/http_stream_factory_impl_job_controller.cc:305: if (!request_ || (job_bound_ && bound_job_ != job)) { ...
3 years, 11 months ago (2017-01-09 19:22:22 UTC) #37
Zhongyi Shi
Thanks for helping fix the bug! https://codereview.chromium.org/2619583002/diff/100001/net/http/http_stream_factory_impl_job_controller.cc File net/http/http_stream_factory_impl_job_controller.cc (right): https://codereview.chromium.org/2619583002/diff/100001/net/http/http_stream_factory_impl_job_controller.cc#newcode159 net/http/http_stream_factory_impl_job_controller.cc:159: if (main_job_ && ...
3 years, 11 months ago (2017-01-09 20:09:45 UTC) #38
mmenke
https://codereview.chromium.org/2619583002/diff/100001/net/http/http_stream_factory_impl_job_controller.cc File net/http/http_stream_factory_impl_job_controller.cc (right): https://codereview.chromium.org/2619583002/diff/100001/net/http/http_stream_factory_impl_job_controller.cc#newcode159 net/http/http_stream_factory_impl_job_controller.cc:159: if (main_job_ && main_job_is_blocked_) On 2017/01/09 20:09:45, Zhongyi Shi ...
3 years, 11 months ago (2017-01-09 20:12:27 UTC) #39
Wez
/me drives-by. https://codereview.chromium.org/2619583002/diff/140001/net/http/http_stream_factory_impl_job_controller.cc File net/http/http_stream_factory_impl_job_controller.cc (right): https://codereview.chromium.org/2619583002/diff/140001/net/http/http_stream_factory_impl_job_controller.cc#newcode150 net/http/http_stream_factory_impl_job_controller.cc:150: // Do not reset |alternative_job_| here and ...
3 years, 11 months ago (2017-01-09 22:21:54 UTC) #40
Zhongyi Shi
https://codereview.chromium.org/2619583002/diff/100001/net/http/http_stream_factory_impl_job_controller.cc File net/http/http_stream_factory_impl_job_controller.cc (right): https://codereview.chromium.org/2619583002/diff/100001/net/http/http_stream_factory_impl_job_controller.cc#newcode159 net/http/http_stream_factory_impl_job_controller.cc:159: if (main_job_ && main_job_is_blocked_) On 2017/01/09 20:12:27, mmenke wrote: ...
3 years, 11 months ago (2017-01-09 23:18:49 UTC) #41
mmenke
https://codereview.chromium.org/2619583002/diff/100001/net/http/http_stream_factory_impl_job_controller.cc File net/http/http_stream_factory_impl_job_controller.cc (right): https://codereview.chromium.org/2619583002/diff/100001/net/http/http_stream_factory_impl_job_controller.cc#newcode159 net/http/http_stream_factory_impl_job_controller.cc:159: if (main_job_ && main_job_is_blocked_) On 2017/01/09 23:18:49, Zhongyi Shi ...
3 years, 11 months ago (2017-01-09 23:25:12 UTC) #42
Zhongyi Shi
https://codereview.chromium.org/2619583002/diff/100001/net/http/http_stream_factory_impl_job_controller.cc File net/http/http_stream_factory_impl_job_controller.cc (right): https://codereview.chromium.org/2619583002/diff/100001/net/http/http_stream_factory_impl_job_controller.cc#newcode159 net/http/http_stream_factory_impl_job_controller.cc:159: if (main_job_ && main_job_is_blocked_) On 2017/01/09 23:25:12, mmenke wrote: ...
3 years, 11 months ago (2017-01-09 23:39:46 UTC) #43
Zhongyi Shi
LGTM! Thanks a lot for fixing this and adding new regression tests! https://codereview.chromium.org/2619583002/diff/100001/net/http/http_stream_factory_impl_job_controller.cc File net/http/http_stream_factory_impl_job_controller.cc ...
3 years, 11 months ago (2017-01-10 01:11:32 UTC) #44
xunjieli
Thanks everyone. I will check in this now. Please feel free to leave comments and ...
3 years, 11 months ago (2017-01-10 01:31:55 UTC) #45
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2619583002/160001
3 years, 11 months ago (2017-01-10 01:34:28 UTC) #48
Wez
https://codereview.chromium.org/2619583002/diff/140001/net/http/http_stream_factory_impl_job_controller.cc File net/http/http_stream_factory_impl_job_controller.cc (right): https://codereview.chromium.org/2619583002/diff/140001/net/http/http_stream_factory_impl_job_controller.cc#newcode160 net/http/http_stream_factory_impl_job_controller.cc:160: if (main_job_ && (main_job_is_blocked_ || !main_job_wait_time_.is_zero())) On 2017/01/10 01:31:54, ...
3 years, 11 months ago (2017-01-10 01:52:15 UTC) #49
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_asan_rel_ng on master.tryserver.chromium.linux (JOB_TIMED_OUT, no build URL)
3 years, 11 months ago (2017-01-10 03:36:46 UTC) #51
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2619583002/160001
3 years, 11 months ago (2017-01-10 12:11:17 UTC) #53
commit-bot: I haz the power
3 years, 11 months ago (2017-01-10 12:15:27 UTC) #56
Message was sent while issue was closed.
Committed patchset #9 (id:160001) as
https://chromium.googlesource.com/chromium/src/+/e368398a3a5357a8742f3829ef08...

Powered by Google App Engine
This is Rietveld 408576698