New issue
Advanced search Search tips

Issue 749233 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jul 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

GetPortableDeviceManager() uses COM from a thread that isn't ComInitialized

Project Member Reported by fdoray@google.com, Jul 26 2017

Issue description

The EnumerateAttachedDevicesOnBlockingThread task should be posted to a TaskRunner obtained via CreateCOMSTATaskRunnerWithTraits().

Call stack:

  base.dll!base::debug::BreakDebugger() Line 21
  base.dll!logging::LogMessage::~LogMessage() Line 787
  base.dll!base::win::AssertComInitialized(const char * message) Line 72
  base.dll!base::win::`anonymous namespace'::HookManager::DCheckedCoCreateInstance(const _GUID & rclsid, IUnknown * pUnkOuter, unsigned long dwClsContext, const _GUID & riid, void * * ppv) Line 247
> chrome.dll!storage_monitor::`anonymous namespace'::GetPortableDeviceManager(base::win::ScopedComPtr<IPortableDeviceManager> * portable_device_mgr) Line 390
  chrome.dll!storage_monitor::`anonymous namespace'::EnumerateAttachedDevicesOnBlockingThread(std::vector<storage_monitor::PortableDeviceWatcherWin::DeviceDetails,std::allocator<storage_monitor::PortableDeviceWatcherWin::DeviceDetails> > * devices) Line 410
  chrome.dll!base::internal::FunctorTraits<bool (__cdecl*)(std::vector<storage_monitor::PortableDeviceWatcherWin::DeviceDetails,std::allocator<storage_monitor::PortableDeviceWatcherWin::DeviceDetails> > *),void>::Invoke<std::vector<storage_monitor::PortableDeviceWatcherWin::DeviceDetails,std::allocator<storage_monitor::PortableDeviceWatcherWin::DeviceDetails> > * const &>(bool(*)(std::vector<storage_monitor::PortableDeviceWatcherWin::DeviceDetails,std::allocator<storage_monitor::PortableDeviceWatcherWin::DeviceDetails> > *) function, std::vector<storage_monitor::PortableDeviceWatcherWin::DeviceDetails,std::allocator<storage_monitor::PortableDeviceWatcherWin::DeviceDetails> > * const & <args_0>) Line 151
  chrome.dll!base::internal::InvokeHelper<0,bool>::MakeItSo<bool (__cdecl*const &)(std::vector<storage_monitor::PortableDeviceWatcherWin::DeviceDetails,std::allocator<storage_monitor::PortableDeviceWatcherWin::DeviceDetails> > *),std::vector<storage_monitor::PortableDeviceWatcherWin::DeviceDetails,std::allocator<storage_monitor::PortableDeviceWatcherWin::DeviceDetails> > * const &>(bool(*)(std::vector<storage_monitor::PortableDeviceWatcherWin::DeviceDetails,std::allocator<storage_monitor::PortableDeviceWatcherWin::DeviceDetails> > *) & functor, std::vector<storage_monitor::PortableDeviceWatcherWin::DeviceDetails,std::allocator<storage_monitor::PortableDeviceWatcherWin::DeviceDetails> > * const & <args_0>) Line 262
  chrome.dll!base::internal::Invoker<base::internal::BindState<bool (__cdecl*)(std::vector<storage_monitor::PortableDeviceWatcherWin::DeviceDetails,std::allocator<storage_monitor::PortableDeviceWatcherWin::DeviceDetails> > *),std::vector<storage_monitor::PortableDeviceWatcherWin::DeviceDetails,std::allocator<storage_monitor::PortableDeviceWatcherWin::DeviceDetails> > *>,bool __cdecl(void)>::RunImpl<bool (__cdecl*const &)(std::vector<storage_monitor::PortableDeviceWatcherWin::DeviceDetails,std::allocator<storage_monitor::PortableDeviceWatcherWin::DeviceDetails> > *),std::tuple<std::vector<storage_monitor::PortableDeviceWatcherWin::DeviceDetails,std::allocator<storage_monitor::PortableDeviceWatcherWin::DeviceDetails> > *> const &,0>(bool(*)(std::vector<storage_monitor::PortableDeviceWatcherWin::DeviceDetails,std::allocator<storage_monitor::PortableDeviceWatcherWin::DeviceDetails> > *) & functor, const std::tuple<std::vector<storage_monitor::PortableDeviceWatcherWin::DeviceDetails,std::allocator<storage_monitor::PortableDeviceWatcherWin::DeviceDetails> > *> & bound, base::IndexSequence<0> __formal) Line 338
  chrome.dll!base::internal::Invoker<base::internal::BindState<bool (__cdecl*)(std::vector<storage_monitor::PortableDeviceWatcherWin::DeviceDetails,std::allocator<storage_monitor::PortableDeviceWatcherWin::DeviceDetails> > *),std::vector<storage_monitor::PortableDeviceWatcherWin::DeviceDetails,std::allocator<storage_monitor::PortableDeviceWatcherWin::DeviceDetails> > *>,bool __cdecl(void)>::Run(base::internal::BindStateBase * base) Line 316
  chrome.dll!base::Callback<bool __cdecl(void),0,0>::Run() Line 91
  chrome.dll!base::internal::ReturnAsParamAdapter<bool>(base::Callback<bool __cdecl(void),0,0> func, bool * result) Line 20
  chrome.dll!base::internal::FunctorTraits<void (__cdecl*)(base::Callback<bool __cdecl(void),0,0>,bool *),void>::Invoke<base::Callback<bool __cdecl(void),0,0>,bool *>(void(*)(base::Callback<bool __cdecl(void),0,0>, bool *) function, base::Callback<bool __cdecl(void),0,0> && <args_0>, bool * && <args_1>) Line 151
  chrome.dll!base::internal::InvokeHelper<0,void>::MakeItSo<void (__cdecl*)(base::Callback<bool __cdecl(void),0,0>,bool *),base::Callback<bool __cdecl(void),0,0>,bool *>(void(*)(base::Callback<bool __cdecl(void),0,0>, bool *) && functor, base::Callback<bool __cdecl(void),0,0> && <args_0>, bool * && <args_1>) Line 262
  chrome.dll!base::internal::Invoker<base::internal::BindState<void (__cdecl*)(base::Callback<bool __cdecl(void),0,0>,bool *),base::Callback<bool __cdecl(void),0,0>,bool *>,void __cdecl(void)>::RunImpl<void (__cdecl*)(base::Callback<bool __cdecl(void),0,0>,bool *),std::tuple<base::Callback<bool __cdecl(void),0,0>,bool *>,0,1>(void(*)(base::Callback<bool __cdecl(void),0,0>, bool *) && functor, std::tuple<base::Callback<bool __cdecl(void),0,0>,bool *> && bound, base::IndexSequence<0,1> __formal) Line 338
  chrome.dll!base::internal::Invoker<base::internal::BindState<void (__cdecl*)(base::Callback<bool __cdecl(void),0,0>,bool *),base::Callback<bool __cdecl(void),0,0>,bool *>,void __cdecl(void)>::RunOnce(base::internal::BindStateBase * base) Line 303
  base.dll!base::Callback<void __cdecl(void),0,0>::Run() Line 91
  base.dll!base::`anonymous namespace'::PostTaskAndReplyRelay::RunTaskAndPostReply() Line 46
  base.dll!base::internal::FunctorTraits<void (__thiscall base::`anonymous namespace'::PostTaskAndReplyRelay::*)(void),void>::Invoke<base::`anonymous namespace'::PostTaskAndReplyRelay *>(void(base::`anonymous-namespace'::PostTaskAndReplyRelay::*)() method, base::`anonymous-namespace'::PostTaskAndReplyRelay * && receiver_ptr) Line 197
  base.dll!base::internal::InvokeHelper<0,void>::MakeItSo<void (__thiscall base::`anonymous namespace'::PostTaskAndReplyRelay::*)(void),base::A0xe667f948::PostTaskAndReplyRelay *>(void(base::`anonymous-namespace'::PostTaskAndReplyRelay::*)() && functor, base::`anonymous-namespace'::PostTaskAndReplyRelay * && <args_0>) Line 262
  base.dll!base::internal::Invoker<base::internal::BindState<void (__thiscall base::`anonymous namespace'::PostTaskAndReplyRelay::*)(void),base::internal::UnretainedWrapper<base::`anonymous namespace'::PostTaskAndReplyRelay> >,void __cdecl(void)>::RunImpl<void (__thiscall base::`anonymous namespace'::PostTaskAndReplyRelay::*)(void),std::tuple<base::internal::UnretainedWrapper<base::`anonymous namespace'::PostTaskAndReplyRelay> >,0>(void(base::`anonymous-namespace'::PostTaskAndReplyRelay::*)() && functor, std::tuple<base::internal::UnretainedWrapper<base::`anonymous namespace'::PostTaskAndReplyRelay> > && bound, base::IndexSequence<0> __formal) Line 338
  base.dll!base::internal::Invoker<base::internal::BindState<void (__thiscall base::`anonymous namespace'::PostTaskAndReplyRelay::*)(void),base::internal::UnretainedWrapper<base::`anonymous namespace'::PostTaskAndReplyRelay> >,void __cdecl(void)>::RunOnce(base::internal::BindStateBase * base) Line 303
  base.dll!base::Callback<void __cdecl(void),0,0>::Run() Line 91
  base.dll!base::debug::TaskAnnotator::RunTask(const char * queue_function, base::PendingTask * pending_task) Line 61
  base.dll!base::internal::TaskTracker::PerformRunTask(std::unique_ptr<base::internal::Task,std::default_delete<base::internal::Task> > task, base::internal::Sequence * sequence) Line 335
  base.dll!base::internal::TaskTracker::RunNextTask(base::internal::Sequence * sequence) Line 252
  base.dll!base::internal::SchedulerWorker::Thread::ThreadMain() Line 84
  base.dll!base::`anonymous namespace'::ThreadFunc(void * params) Line 91
 
fdoray: Thanks for the info. I'll send you a fix straightaway.
Project Member

Comment 2 by sheriffbot@chromium.org, Jul 27 2017

Labels: Hotlist-Google
Project Member

Comment 3 by bugdroid1@chromium.org, Jul 27 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/8e7b09023501bc23c8c38c09c2b30e23c40f3523

commit 8e7b09023501bc23c8c38c09c2b30e23c40f3523
Author: Tommy C. Li <tommycli@chromium.org>
Date: Thu Jul 27 16:21:45 2017

Storage Monitor: Make PortableDeviceWatcherWin use a COM-ready thread

Bug:  749233 
Change-Id: If21a37358492d41db11a1557a6f2cf68520226be
Reviewed-on: https://chromium-review.googlesource.com/587423
Reviewed-by: Francois Doray <fdoray@chromium.org>
Commit-Queue: Tommy Li <tommycli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#489961}
[modify] https://crrev.com/8e7b09023501bc23c8c38c09c2b30e23c40f3523/components/storage_monitor/portable_device_watcher_win.cc

Status: Fixed (was: Assigned)

Sign in to add a comment