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

Issue 2736053003: [Android] Fix port leak in the forwarder. (Closed)

Created:
3 years, 9 months ago by jbudorick
Modified:
3 years, 8 months ago
Reviewers:
Ted C, Nico
CC:
chromium-reviews, mikecase+watch_chromium.org, agrieve+watch_chromium.org, jbudorick+watch_chromium.org, vmpstr+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

[Android] Fix port leak in the forwarder. The forwarder has been using a CommandLine object to run its `adb -s <serial> forward --remove <port>` command since October. CommandLine::AppendSwitchesAndArguments mangles that adb command into `adb -s --remove <serial> forward <port>` in its attempt to keep switches before arguments. That mangled command is not valid, and adb never unmaps the port as a result. The host forwarder recognized this as a failure, though not a fatal one, and removed the port from its serial->port map regardless of whether the unmap command succeeded. This patch adds a variant of base::GetAppOutputAndError that takes a vector<string> s.t. arguments are not reordered. (A similar variant already exists for base::GetAppOutput.) It also switches all uses of base::GetAppOutputWithExitCode to this new variant. BUG=691654 Review-Url: https://codereview.chromium.org/2736053003 Cr-Commit-Position: refs/heads/master@{#460440} Committed: https://chromium.googlesource.com/chromium/src/+/86c756ccdc4ea1293fe6bea1c09b5a627baa0989

Patch Set 1 #

Total comments: 2

Patch Set 2 : tedchoc comments #

Patch Set 3 : tests #

Patch Set 4 : gn check fixes #

Patch Set 5 : use callback for exit notifier fd #

Total comments: 8

Patch Set 6 : tedchoc comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+564 lines, -339 lines) Patch
M base/process/launch.h View 1 chunk +5 lines, -0 lines 0 comments Download
M base/process/launch_posix.cc View 1 chunk +8 lines, -0 lines 0 comments Download
M tools/android/BUILD.gn View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M tools/android/forwarder2/BUILD.gn View 1 2 3 4 4 chunks +33 lines, -2 lines 0 comments Download
M tools/android/forwarder2/command.cc View 1 chunk +1 line, -1 line 0 comments Download
A tools/android/forwarder2/host_controllers_manager.h View 1 2 3 4 5 1 chunk +118 lines, -0 lines 0 comments Download
A tools/android/forwarder2/host_controllers_manager.cc View 1 2 3 4 5 1 chunk +318 lines, -0 lines 0 comments Download
A tools/android/forwarder2/host_controllers_manager_unittest.cc View 1 2 3 4 5 1 chunk +71 lines, -0 lines 0 comments Download
M tools/android/forwarder2/host_forwarder_main.cc View 1 2 3 4 5 3 chunks +9 lines, -336 lines 0 comments Download

Messages

Total messages: 23 (10 generated)
jbudorick
A special Tuesday edition of Friday Forwarder Fun.
3 years, 9 months ago (2017-03-08 04:29:40 UTC) #2
Ted C
lgtm https://codereview.chromium.org/2736053003/diff/1/tools/android/forwarder2/host_forwarder_main.cc File tools/android/forwarder2/host_forwarder_main.cc (right): https://codereview.chromium.org/2736053003/diff/1/tools/android/forwarder2/host_forwarder_main.cc#newcode322 tools/android/forwarder2/host_forwarder_main.cc:322: const std::vector<std::string> split_command = base::SplitString( maybe a comment ...
3 years, 9 months ago (2017-03-08 04:55:06 UTC) #3
jbudorick
+thakis for //base owners https://codereview.chromium.org/2736053003/diff/1/tools/android/forwarder2/host_forwarder_main.cc File tools/android/forwarder2/host_forwarder_main.cc (right): https://codereview.chromium.org/2736053003/diff/1/tools/android/forwarder2/host_forwarder_main.cc#newcode322 tools/android/forwarder2/host_forwarder_main.cc:322: const std::vector<std::string> split_command = base::SplitString( ...
3 years, 9 months ago (2017-03-08 05:37:40 UTC) #5
Nico
Why did the forwarder move to CommandLine? Instead of adding a function to CommandLine just ...
3 years, 9 months ago (2017-03-08 16:18:35 UTC) #6
jbudorick
On 2017/03/08 16:18:35, Nico wrote: > Why did the forwarder move to CommandLine? Instead of ...
3 years, 9 months ago (2017-03-08 16:24:17 UTC) #7
Nico
Please add tests for the bug this fixes and for the bug fixed by https://codereview.chromium.org/2374183008/ ...
3 years, 9 months ago (2017-03-08 16:30:50 UTC) #8
jbudorick
On 2017/03/08 16:30:50, Nico wrote: > Please add tests for the bug this fixes and ...
3 years, 9 months ago (2017-03-08 16:34:12 UTC) #9
jbudorick
PTAL. On 2017/03/08 16:34:12, jbudorick wrote: > On 2017/03/08 16:30:50, Nico wrote: > > Please ...
3 years, 8 months ago (2017-03-28 16:25:33 UTC) #10
Nico
base/ lgtm, but Ted will probably want to look at tools/android again.
3 years, 8 months ago (2017-03-28 16:29:52 UTC) #13
Ted C
lgtm w/ style nits I didn't look much at the code that moved from one ...
3 years, 8 months ago (2017-03-28 23:57:37 UTC) #16
jbudorick
https://codereview.chromium.org/2736053003/diff/80001/tools/android/forwarder2/host_controllers_manager.h File tools/android/forwarder2/host_controllers_manager.h (right): https://codereview.chromium.org/2736053003/diff/80001/tools/android/forwarder2/host_controllers_manager.h#newcode21 tools/android/forwarder2/host_controllers_manager.h:21: enum : int { On 2017/03/28 23:57:37, Ted C ...
3 years, 8 months ago (2017-03-29 01:55:42 UTC) #17
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/2736053003/100001
3 years, 8 months ago (2017-03-29 14:57:29 UTC) #20
commit-bot: I haz the power
3 years, 8 months ago (2017-03-29 17:34:46 UTC) #23
Message was sent while issue was closed.
Committed patchset #6 (id:100001) as
https://chromium.googlesource.com/chromium/src/+/86c756ccdc4ea1293fe6bea1c09b...

Powered by Google App Engine
This is Rietveld 408576698