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

Issue 935383003: Fix BluetoothAdapterProfileChromeOS lifecycle management (Closed)

Created:
5 years, 10 months ago by Marie Janssen
Modified:
5 years, 9 months ago
CC:
chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix BluetoothAdapterProfileChromeOS lifecycle management Have BluetoothAdapterProfileChromeOS remove itself from adapters when it is deleted via it's deconstructor, to avoid references being left behind after deletion. BUG=457978 Committed: https://crrev.com/0cca591aaf6f6a0cbf46840faaead236dd8317a2 Cr-Commit-Position: refs/heads/master@{#318925}

Patch Set 1 #

Total comments: 9

Patch Set 2 : further fix ownership, address comments #

Total comments: 21

Patch Set 3 : address nits / comments #

Patch Set 4 : add DCHECK confirming profiles are gone during shutdown #

Total comments: 10

Patch Set 5 : address comments, fix simultaneous useprofile #

Total comments: 8

Patch Set 6 : address comments from armansito #

Patch Set 7 : rebase, fix call-after-shutdown problems #

Patch Set 8 : fix for leak detected by LSAN #

Unified diffs Side-by-side diffs Delta from patch set Stats (+333 lines, -116 lines) Patch
M chromeos/dbus/fake_bluetooth_profile_manager_client.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M chromeos/dbus/fake_bluetooth_profile_manager_client.cc View 1 2 3 4 5 6 2 chunks +10 lines, -0 lines 0 comments Download
M device/bluetooth/bluetooth_adapter_chromeos.h View 1 2 3 4 5 6 3 chunks +18 lines, -8 lines 0 comments Download
M device/bluetooth/bluetooth_adapter_chromeos.cc View 1 2 3 4 5 6 4 chunks +67 lines, -21 lines 0 comments Download
M device/bluetooth/bluetooth_adapter_profile_chromeos.h View 1 2 3 4 5 6 7 4 chunks +15 lines, -10 lines 0 comments Download
M device/bluetooth/bluetooth_adapter_profile_chromeos.cc View 1 2 3 4 5 6 7 2 chunks +22 lines, -13 lines 0 comments Download
M device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc View 1 2 3 4 5 6 7 8 chunks +106 lines, -22 lines 0 comments Download
M device/bluetooth/bluetooth_chromeos_unittest.cc View 1 2 3 4 5 6 7 chunks +15 lines, -19 lines 0 comments Download
M device/bluetooth/bluetooth_socket_chromeos.h View 1 2 3 4 1 chunk +2 lines, -4 lines 0 comments Download
M device/bluetooth/bluetooth_socket_chromeos.cc View 1 2 3 4 5 chunks +8 lines, -18 lines 0 comments Download
M device/bluetooth/bluetooth_socket_chromeos_unittest.cc View 1 2 chunks +69 lines, -1 line 0 comments Download

Messages

Total messages: 36 (9 generated)
Marie Janssen
Here's a fix which should eliminate these lifecycle bugs that are coming up surrounding BluetoothAdapterProfileChromeOS ...
5 years, 10 months ago (2015-02-19 16:43:56 UTC) #2
Ilya Sherman
Thanks for working on this! The ownership semantics for the profiles are super unclear to ...
5 years, 10 months ago (2015-02-19 20:37:59 UTC) #3
Marie Janssen
Updated CL with a rework of ownership for BluetoothAdapterProfileChromeOS which simplifies things significantly. Added a ...
5 years, 10 months ago (2015-02-20 22:53:46 UTC) #4
Ilya Sherman
Thanks, this looks much better! I still have some more minor questions about the memory ...
5 years, 10 months ago (2015-02-21 01:22:10 UTC) #5
Marie Janssen
Updated the CL for these comments. Thanks! https://codereview.chromium.org/935383003/diff/20001/device/bluetooth/bluetooth_adapter_chromeos.cc File device/bluetooth/bluetooth_adapter_chromeos.cc (right): https://codereview.chromium.org/935383003/diff/20001/device/bluetooth/bluetooth_adapter_chromeos.cc#newcode131 device/bluetooth/bluetooth_adapter_chromeos.cc:131: } On ...
5 years, 10 months ago (2015-02-23 17:49:10 UTC) #6
Ilya Sherman
Thanks, Michael. I think this looks pretty good at this point. I still have questions ...
5 years, 10 months ago (2015-02-24 05:26:06 UTC) #7
Marie Janssen
https://codereview.chromium.org/935383003/diff/20001/device/bluetooth/bluetooth_adapter_chromeos.cc File device/bluetooth/bluetooth_adapter_chromeos.cc (right): https://codereview.chromium.org/935383003/diff/20001/device/bluetooth/bluetooth_adapter_chromeos.cc#newcode131 device/bluetooth/bluetooth_adapter_chromeos.cc:131: } On 2015/02/24 05:26:06, Ilya Sherman wrote: > On ...
5 years, 10 months ago (2015-02-24 18:49:21 UTC) #8
Ilya Sherman
LGTM, thanks. https://codereview.chromium.org/935383003/diff/20001/device/bluetooth/bluetooth_socket_chromeos.cc File device/bluetooth/bluetooth_socket_chromeos.cc (right): https://codereview.chromium.org/935383003/diff/20001/device/bluetooth/bluetooth_socket_chromeos.cc#newcode225 device/bluetooth/bluetooth_socket_chromeos.cc:225: DCHECK(adapter); On 2015/02/24 18:49:21, Michael Janssen wrote: ...
5 years, 10 months ago (2015-02-24 19:00:21 UTC) #9
armansito
https://codereview.chromium.org/935383003/diff/60001/device/bluetooth/bluetooth_adapter_chromeos.cc File device/bluetooth/bluetooth_adapter_chromeos.cc (right): https://codereview.chromium.org/935383003/diff/60001/device/bluetooth/bluetooth_adapter_chromeos.cc#newcode88 device/bluetooth/bluetooth_adapter_chromeos.cc:88: DCHECK(profiles_.empty()); Is this because RemoveAdapter clears |profiles_|? If so, ...
5 years, 10 months ago (2015-02-24 23:32:51 UTC) #10
Marie Janssen
Addressed comments by armansito@ https://codereview.chromium.org/935383003/diff/60001/device/bluetooth/bluetooth_adapter_chromeos.cc File device/bluetooth/bluetooth_adapter_chromeos.cc (right): https://codereview.chromium.org/935383003/diff/60001/device/bluetooth/bluetooth_adapter_chromeos.cc#newcode88 device/bluetooth/bluetooth_adapter_chromeos.cc:88: DCHECK(profiles_.empty()); On 2015/02/24 23:32:51, armansito ...
5 years, 9 months ago (2015-02-27 18:56:58 UTC) #11
armansito
Mostly nits. https://codereview.chromium.org/935383003/diff/80001/device/bluetooth/bluetooth_adapter_chromeos.cc File device/bluetooth/bluetooth_adapter_chromeos.cc (right): https://codereview.chromium.org/935383003/diff/80001/device/bluetooth/bluetooth_adapter_chromeos.cc#newcode90 device/bluetooth/bluetooth_adapter_chromeos.cc:90: DCHECK(profiles_.empty()); Do you need a DCHECK for ...
5 years, 9 months ago (2015-02-27 21:04:57 UTC) #12
Marie Janssen
https://codereview.chromium.org/935383003/diff/80001/device/bluetooth/bluetooth_adapter_chromeos.cc File device/bluetooth/bluetooth_adapter_chromeos.cc (right): https://codereview.chromium.org/935383003/diff/80001/device/bluetooth/bluetooth_adapter_chromeos.cc#newcode90 device/bluetooth/bluetooth_adapter_chromeos.cc:90: DCHECK(profiles_.empty()); On 2015/02/27 21:04:57, armansito wrote: > Do you ...
5 years, 9 months ago (2015-02-27 22:56:07 UTC) #13
armansito
lgtm
5 years, 9 months ago (2015-02-27 22:59:01 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/935383003/100001
5 years, 9 months ago (2015-02-27 23:08:21 UTC) #17
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_rel_ng/builds/30747)
5 years, 9 months ago (2015-02-28 00:43:00 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/935383003/100001
5 years, 9 months ago (2015-03-02 17:42:41 UTC) #21
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_rel_ng/builds/31300)
5 years, 9 months ago (2015-03-02 19:29:35 UTC) #23
Marie Janssen
Had to rebase and fix a few minor things related to functions being called after ...
5 years, 9 months ago (2015-03-02 22:51:18 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/935383003/120001
5 years, 9 months ago (2015-03-03 17:59:01 UTC) #27
commit-bot: I haz the power
Committed patchset #7 (id:120001)
5 years, 9 months ago (2015-03-03 19:15:47 UTC) #28
commit-bot: I haz the power
Patchset 7 (id:??) landed as https://crrev.com/0cca591aaf6f6a0cbf46840faaead236dd8317a2 Cr-Commit-Position: refs/heads/master@{#318925}
5 years, 9 months ago (2015-03-03 19:16:13 UTC) #29
Ilya Sherman
On 2015/03/02 22:51:18, Michael Janssen wrote: > Had to rebase and fix a few minor ...
5 years, 9 months ago (2015-03-03 20:49:30 UTC) #30
Marie Janssen
On 2015/03/03 20:49:30, Ilya Sherman wrote: > On 2015/03/02 22:51:18, Michael Janssen wrote: > > ...
5 years, 9 months ago (2015-03-03 21:17:33 UTC) #31
Ilya Sherman
On 2015/03/03 21:17:33, Michael Janssen wrote: > On 2015/03/03 20:49:30, Ilya Sherman wrote: > > ...
5 years, 9 months ago (2015-03-03 21:45:33 UTC) #32
stgao
FYI: I happened to found this CL might cause a breakage. http://build.chromium.org/p/chromium.memory/builders/Linux%20Chromium%20OS%20ASan%20LSan%20Tests%20%281%29/builds/7185/steps/device_unittests/logs/BluetoothAdapterProfileChromeOSTest.SimultaneousRegisterFail
5 years, 9 months ago (2015-03-03 23:44:46 UTC) #34
armansito
On 2015/03/03 23:44:46, Shuotao wrote: > FYI: > > I happened to found this CL ...
5 years, 9 months ago (2015-03-04 04:04:15 UTC) #35
Finnur
5 years, 9 months ago (2015-03-04 08:49:12 UTC) #36
Message was sent while issue was closed.
A revert of this CL (patchset #7 id:120001) has been created in
https://codereview.chromium.org/975323002/ by finnur@chromium.org.

The reason for reverting is: Leaks detected.
https://build.chromium.org/p/chromium.memory/builders/Linux%20Chromium%20OS%2...

=================================================================
==22324==ERROR: LeakSanitizer: detected memory leaks

Indirect leak of 96 byte(s) in 1 object(s) allocated from:
#0 0x4d9b8b in operator new(unsigned long)
(/mnt/data/b/build/slave/Linux_Chromium_OS_ASan_LSan_Tests__1_/build/src/out/Release/device_unittests+0x4d9b8b)
#1 0x901bd6 in
chromeos::BluetoothAdapterProfileChromeOS::Register(device::BluetoothUUID
const&, chromeos::BluetoothProfileManagerClient::Options const&,
base::Callback<void (chromeos::BluetoothAdapterProfileChromeOS*)> const&,
base::Callback<void (std::string const&, std::string const&)> const&)
device/bluetooth/bluetooth_adapter_profile_chromeos.cc:28:7
#2 0x8f6c47 in
chromeos::BluetoothAdapterChromeOS::UseProfile(device::BluetoothUUID const&,
dbus::ObjectPath const&, chromeos::BluetoothProfileManagerClient::Options
const&, chromeos::BluetoothProfileServiceProvider::Delegate*,
base::Callback<void (chromeos::BluetoothAdapterProfileChromeOS*)> const&,
base::Callback<void (std::string const&)> const&)
device/bluetooth/bluetooth_adapter_chromeos.cc:982:5
#3 0x4ec8e2 in
chromeos::BluetoothAdapterProfileChromeOSTest_SimultaneousRegisterFail_Test::TestBody()
device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc:359:3
#4 0x85da05 in HandleExceptionsInMethodIfSupported<testing::Test, void>
testing/gtest/src/gtest.cc:2420:12
#5 0x85da05 in testing::Test::Run() testing/gtest/src/gtest.cc:2436
#6 0x85f619 in testing::TestInfo::Run() testing/gtest/src/gtest.cc:2612:5
#7 0x86040a in testing::TestCase::Run() testing/gtest/src/gtest.cc:2730:5
#8 0x874063 in testing::internal::UnitTestImpl::RunAllTests()
testing/gtest/src/gtest.cc:4602:11
#9 0x8736b7 in
HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>
testing/gtest/src/gtest.cc:2420:12
#10 0x8736b7 in testing::UnitTest::Run() testing/gtest/src/gtest.cc:4220
#11 0x814bda in RUN_ALL_TESTS testing/gtest/include/gtest/gtest.h:2326:10
#12 0x814bda in base::TestSuite::Run() base/test/test_suite.cc:230
#13 0x80ad38 in Run base/callback.h:396:12
#14 0x80ad38 in base::(anonymous
namespace)::LaunchUnitTestsInternal(base::Callback<int ()> const&, int, bool,
base::Callback<void ()> const&) base/test/launcher/unit_test_launcher.cc:181
#15 0x80a863 in base::LaunchUnitTests(int, char**, base::Callback<int ()>
const&) base/test/launcher/unit_test_launcher.cc:423:10
#16 0x7d25ac in main device/test/run_all_unittests.cc:14:10
#17 0x7f35c8c7276c in __libc_start_main
/build/buildd/eglibc-2.15/csu/libc-start.c:226

Indirect leak of 93 byte(s) in 1 object(s) allocated from:
#0 0x4d9b8b in operator new(unsigned long)
(/mnt/data/b/build/slave/Linux_Chromium_OS_ASan_LSan_Tests__1_/build/src/out/Release/device_unittests+0x4d9b8b)
#1 0x7f35c92df739 in __gnu_cxx::new_allocator<char>::allocate(unsigned long,
void const*)
/build/buildd/gcc-4.6-4.6.3/build/x86_64-linux-gnu/libstdc++-v3/include/ext/new_allocator.h:92
#2 0x7f35c92ded2c in std::string::_Rep::_S_create(unsigned long, unsigned long,
std::allocator<char> const&)
/build/buildd/gcc-4.6-4.6.3/build/x86_64-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:609
#3 0x7f35c92def04 in std::string::_Rep::_M_clone(std::allocator<char> const&,
unsigned long)
/build/buildd/gcc-4.6-4.6.3/build/x86_64-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:631
#4 0x7f35c92dbc48 in std::string::reserve(unsigned long)
/build/buildd/gcc-4.6-4.6.3/build/x86_64-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:512
#5 0x9021d7 in operator+<char, std::char_traits<char>, std::allocator<char> >
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/basic_string.tcc:702:7
#6 0x9021d7 in
chromeos::BluetoothAdapterProfileChromeOS::BluetoothAdapterProfileChromeOS(device::BluetoothUUID
const&) device/bluetooth/bluetooth_adapter_profile_chromeos.cc:47
#7 0x901be8 in
chromeos::BluetoothAdapterProfileChromeOS::Register(device::BluetoothUUID
const&, chromeos::BluetoothProfileManagerClient::Options const&,
base::Callback<void (chromeos::BluetoothAdapterProfileChromeOS*)> const&,
base::Callback<void (std::string const&, std::string const&)> const&)
device/bluetooth/bluetooth_adapter_profile_chromeos.cc:28:11
#8 0x8f6c47 in
chromeos::BluetoothAdapterChromeOS::UseProfile(device::BluetoothUUID const&,
dbus::ObjectPath const&, chromeos::BluetoothProfileManagerClient::Options
const&, chromeos::BluetoothProfileServiceProvider::Delegate*,
base::Callback<void (chromeos::BluetoothAdapterProfileChromeOS*)> const&,
base::Callback<void (std::string const&)> const&)
device/bluetooth/bluetooth_adapter_chromeos.cc:982:5
#9 0x4ec8e2 in
chromeos::BluetoothAdapterProfileChromeOSTest_SimultaneousRegisterFail_Test::TestBody()
device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc:359:3
#10 0x85da05 in HandleExceptionsInMethodIfSupported<testing::Test, void>
testing/gtest/src/gtest.cc:2420:12
#11 0x85da05 in testing::Test::Run() testing/gtest/src/gtest.cc:2436
#12 0x85f619 in testing::TestInfo::Run() testing/gtest/src/gtest.cc:2612:5
#13 0x86040a in testing::TestCase::Run() testing/gtest/src/gtest.cc:2730:5
#14 0x874063 in testing::internal::UnitTestImpl::RunAllTests()
testing/gtest/src/gtest.cc:4602:11
#15 0x8736b7 in
HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>
testing/gtest/src/gtest.cc:2420:12
#16 0x8736b7 in testing::UnitTest::Run() testing/gtest/src/gtest.cc:4220
#17 0x814bda in RUN_ALL_TESTS testing/gtest/include/gtest/gtest.h:2326:10
#18 0x814bda in base::TestSuite::Run() base/test/test_suite.cc:230
#19 0x80ad38 in Run base/callback.h:396:12
#20 0x80ad38 in base::(anonymous
namespace)::LaunchUnitTestsInternal(base::Callback<int ()> const&, int, bool,
base::Callback<void ()> const&) base/test/launcher/unit_test_launcher.cc:181
#21 0x80a863 in base::LaunchUnitTests(int, char**, base::Callback<int ()>
const&) base/test/launcher/unit_test_launcher.cc:423:10
#22 0x7d25ac in main device/test/run_all_unittests.cc:14:10
#23 0x7f35c8c7276c in __libc_start_main
/build/buildd/eglibc-2.15/csu/libc-start.c:226

Indirect leak of 24 byte(s) in 1 object(s) allocated from:
#0 0x4d9b8b in operator new(unsigned long)
(/mnt/data/b/build/slave/Linux_Chromium_OS_ASan_LSan_Tests__1_/build/src/out/Release/device_unittests+0x4d9b8b)
#1 0xd9c743 in chromeos::BluetoothProfileServiceProvider::Create(dbus::Bus*,
dbus::ObjectPath const&, chromeos::BluetoothProfileServiceProvider::Delegate*)
chromeos/dbus/bluetooth_profile_service_provider.cc:251:12
#2 0x90227f in
chromeos::BluetoothAdapterProfileChromeOS::BluetoothAdapterProfileChromeOS(device::BluetoothUUID
const&) device/bluetooth/bluetooth_adapter_profile_chromeos.cc:51:7
#3 0x901be8 in
chromeos::BluetoothAdapterProfileChromeOS::Register(device::BluetoothUUID
const&, chromeos::BluetoothProfileManagerClient::Options const&,
base::Callback<void (chromeos::BluetoothAdapterProfileChromeOS*)> const&,
base::Callback<void (std::string const&, std::string const&)> const&)
device/bluetooth/bluetooth_adapter_profile_chromeos.cc:28:11
#4 0x8f6c47 in
chromeos::BluetoothAdapterChromeOS::UseProfile(device::BluetoothUUID const&,
dbus::ObjectPath const&, chromeos::BluetoothProfileManagerClient::Options
const&, chromeos::BluetoothProfileServiceProvider::Delegate*,
base::Callback<void (chromeos::BluetoothAdapterProfileChromeOS*)> const&,
base::Callback<void (std::string const&)> const&)
device/bluetooth/bluetooth_adapter_chromeos.cc:982:5
#5 0x4ec8e2 in
chromeos::BluetoothAdapterProfileChromeOSTest_SimultaneousRegisterFail_Test::TestBody()
device/bluetooth/bluetooth_adapter_profile_chromeos_unittest.cc:359:3
#6 0x85da05 in HandleExceptionsInMethodIfSupported<testing::Test, void>
testing/gtest/src/gtest.cc:2420:12
#7 0x85da05 in testing::Test::Run() testing/gtest/src/gtest.cc:2436
#8 0x85f619 in testing::TestInfo::Run() testing/gtest/src/gtest.cc:2612:5
#9 0x86040a in testing::TestCase::Run() testing/gtest/src/gtest.cc:2730:5
#10 0x874063 in testing::internal::UnitTestImpl::RunAllTests()
testing/gtest/src/gtest.cc:4602:11
#11 0x8736b7 in
HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>
testing/gtest/src/gtest.cc:2420:12
#12 0x8736b7 in testing::UnitTest::Run() testing/gtest/src/gtest.cc:4220
#13 0x814bda in RUN_ALL_TESTS testing/gtest/include/gtest/gtest.h:2326:10
#14 0x814bda in base::TestSuite::Run() base/test/test_suite.cc:230
#15 0x80ad38 in Run base/callback.h:396:12
#16 0x80ad38 in base::(anonymous
namespace)::LaunchUnitTestsInternal(base::Callback<int ()> const&, int, bool,
base::Callback<void ()> const&) base/test/launcher/unit_test_launcher.cc:181
#17 0x80a863 in base::LaunchUnitTests(int, char**, base::Callback<int ()>
const&) base/test/launcher/unit_test_launcher.cc:423:10
#18 0x7d25ac in main device/test/run_all_unittests.cc:14:10
#19 0x7f35c8c7276c in __libc_start_main
/build/buildd/eglibc-2.15/csu/libc-start.c:226.

Powered by Google App Engine
This is Rietveld 408576698