New issue
Advanced search Search tips

Issue 718835 link

Starred by 10 users

Issue metadata

Status: Fixed
Owner:
Closed: May 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Bug
Team-Security-UX



Sign in to add a comment

Assertion failure on start-up: "Used from multiple threads before initialization complete."

Project Member Reported by emx@chromium.org, May 5 2017

Issue description

Chrome Version: 60.0.3090.0 (Developer Build) (64-bit) 
Revision	464917671cd0b64288e11b10982f2b8d6ce26711
OS: Windows 10

What steps will reproduce the problem?
(1) Run chome.exe --user-data-dir=C:\src\userdata\vsdebug2

Assertion fails:

[6416:21840:0505/141746.392:FATAL:host_content_settings_map.cc(243)] Check failed: used_from_thread_id_ != base::kInvalidThreadId (0 vs. 0)Used from multiple threads before initialization complete.
Backtrace:
	base::debug::StackTrace::StackTrace [0x0000000000B91905+69] (c:\src\chromium2\src\base\debug\stack_trace_win.cc:217)
	base::debug::StackTrace::StackTrace [0x0000000000B91428+24] (c:\src\chromium2\src\base\debug\stack_trace.cc:199)
	logging::LogMessage::~LogMessage [0x0000000000C030F0+112] (c:\src\chromium2\src\base\logging.cc:553)
	HostContentSettingsMap::RegisterProvider [0x0000000005ABA9A8+488] (c:\src\chromium2\src\components\content_settings\core\browser\host_content_settings_map.cc:247)
	ExtensionService::RegisterContentSettings [0x00000000063D0D35+565] (c:\src\chromium2\src\chrome\browser\extensions\extension_service.cc:2058)
	ProfileManager::DoFinalInitForServices [0x000000000771BC87+423] (c:\src\chromium2\src\chrome\browser\profiles\profile_manager.cc:1237)
	ProfileManager::DoFinalInit [0x000000000771B8C4+244] (c:\src\chromium2\src\chrome\browser\profiles\profile_manager.cc:1183)
	ProfileManager::AddProfile [0x000000000771866B+843] (c:\src\chromium2\src\chrome\browser\profiles\profile_manager.cc:1379)
	ProfileManager::CreateAndInitializeProfile [0x000000000771A834+420] (c:\src\chromium2\src\chrome\browser\profiles\profile_manager.cc:1394)
	ProfileManager::GetProfile [0x000000000771E9E5+277] (c:\src\chromium2\src\chrome\browser\profiles\profile_manager.cc:497)
	GetStartupProfile [0x00000000070684BD+109] (c:\src\chromium2\src\chrome\browser\ui\startup\startup_browser_creator.cc:964)
	`anonymous namespace'::CreatePrimaryProfile [0x0000000005109ABF+543] (c:\src\chromium2\src\chrome\browser\chrome_browser_main.cc:440)
	ChromeBrowserMainParts::PreMainMessageLoopRunImpl [0x000000000510EA0B+3659] (c:\src\chromium2\src\chrome\browser\chrome_browser_main.cc:1632)
	ChromeBrowserMainParts::PreMainMessageLoopRun [0x000000000510DABA+314] (c:\src\chromium2\src\chrome\browser\chrome_browser_main.cc:1257)
	content::BrowserMainLoop::PreMainMessageLoopRun [0x0000000012CC0DE9+265] (c:\src\chromium2\src\content\browser\browser_main_loop.cc:1165)
	base::internal::FunctorTraits<int (__cdecl content::BrowserMainLoop::*)(void) __ptr64,void>::Invoke<content::BrowserMainLoop * __ptr64> [0x0000000012CB2494+36] (c:\src\chromium2\src\base\bind_internal.h:215)
	base::internal::InvokeHelper<0,int>::MakeItSo<int (__cdecl content::BrowserMainLoop::*const & __ptr64)(void) __ptr64,content::BrowserMainLoop * __ptr64> [0x0000000012CB2A17+55] (c:\src\chromium2\src\base\bind_internal.h:287)
	base::internal::Invoker<base::internal::BindState<int (__cdecl content::BrowserMainLoop::*)(void) __ptr64,base::internal::UnretainedWrapper<content::BrowserMainLoop> >,int __cdecl(void)>::RunImpl<int (__cdecl content::BrowserMainLoop::*const & __ptr64)(vo [0x0000000012CB31B9+73] (c:\src\chromium2\src\base\bind_internal.h:365)
	base::internal::Invoker<base::internal::BindState<int (__cdecl content::BrowserMainLoop::*)(void) __ptr64,base::internal::UnretainedWrapper<content::BrowserMainLoop> >,int __cdecl(void)>::Run [0x0000000012CC1553+51] (c:\src\chromium2\src\base\bind_internal.h:343)
	base::Callback<int __cdecl(void),1,1>::Run [0x0000000013E869AA+42] (c:\src\chromium2\src\base\callback.h:81)
	content::StartupTaskRunner::RunAllTasksNow [0x0000000013EE330F+143] (c:\src\chromium2\src\content\browser\startup_task_runner.cc:45)
	content::BrowserMainLoop::CreateStartupTasks [0x0000000012CBB9DE+782] (c:\src\chromium2\src\content\browser\browser_main_loop.cc:961)
	content::BrowserMainRunnerImpl::Initialize [0x0000000012CC896A+1386] (c:\src\chromium2\src\content\browser\browser_main_runner.cc:126)
	content::BrowserMain [0x0000000012CAE8D4+116] (c:\src\chromium2\src\content\browser\browser_main.cc:42)
	content::RunNamedProcessTypeMain [0x00000000150C4EF4+212] (c:\src\chromium2\src\content\app\content_main_runner.cc:412)
	content::ContentMainRunnerImpl::Run [0x00000000150C4D1D+733] (c:\src\chromium2\src\content\app\content_main_runner.cc:705)
	content::ContentServiceManagerMainDelegate::RunEmbedderProcess [0x00000000150C21BF+47] (c:\src\chromium2\src\content\app\content_service_manager_main_delegate.cc:41)
	service_manager::Main [0x000000000D8CFCB3+1027] (c:\src\chromium2\src\services\service_manager\embedder\main.cc:456)
	content::ContentMain [0x00000000150C2726+54] (c:\src\chromium2\src\content\app\content_main.cc:19)
	ChromeMain [0x000000000348FA33+323] (c:\src\chromium2\src\chrome\app\chrome_main.cc:111)
	MainDllLoader::Launch [0x0000000140034219+1081] (c:\src\chromium2\src\chrome\app\main_dll_loader_win.cc:202)
	wWinMain [0x000000014002CFEC+716] (c:\src\chromium2\src\chrome\app\chrome_exe_main_win.cc:271)
	invoke_main [0x000000014013207D+45] (f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:118)
	__scrt_common_main_seh [0x0000000140131F27+295] (f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:253)
	__scrt_common_main [0x0000000140131DEE+14] (f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:296)
	wWinMainCRTStartup [0x0000000140132099+9] (f:\dd\vctools\crt\vcstartup\src\startup\exe_wwinmain.cpp:17)
	BaseThreadInitThunk [0x00007FF84F7A8102+34]
	RtlUserThreadStart [0x00007FF84FF8C5B4+52]

Stack trace of where used_from_thread_id_ = base::kInvalidThreadId: 

 	chrome.dll!HostContentSettingsMap::UsedContentSettingsProviders() Line 780	C++
 	chrome.dll!HostContentSettingsMap::GetWebsiteSettingInternal(const GURL & primary_url, const GURL & secondary_url, ContentSettingsType content_type, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & resource_identifier, content_settings::SettingInfo * info) Line 842	C++
 	chrome.dll!HostContentSettingsMap::GetWebsiteSetting(const GURL & primary_url, const GURL & secondary_url, ContentSettingsType content_type, const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & resource_identifier, content_settings::SettingInfo * info) Line 816	C++
>	chrome.dll!content_settings::CookieSettings::GetCookieSetting(const GURL & url, const GURL & first_party_url, content_settings::SettingSource * source, ContentSetting * cookie_setting) Line 144	C++
 	chrome.dll!content_settings::CookieSettings::IsCookieAccessAllowed(const GURL & url, const GURL & first_party_url) Line 63	C++
 	chrome.dll!ChromeNetworkDelegate::OnCanEnablePrivacyMode(const GURL & url, const GURL & first_party_for_cookies) Line 536	C++
 	net.dll!net::NetworkDelegate::CanEnablePrivacyMode(const GURL & url, const GURL & first_party_for_cookies) Line 172	C++
 	net.dll!net::LayeredNetworkDelegate::OnCanEnablePrivacyMode(const GURL & url, const GURL & first_party_for_cookies) Line 223	C++
 	net.dll!net::NetworkDelegate::CanEnablePrivacyMode(const GURL & url, const GURL & first_party_for_cookies) Line 172	C++
 	net.dll!net::LayeredNetworkDelegate::OnCanEnablePrivacyMode(const GURL & url, const GURL & first_party_for_cookies) Line 223	C++
 	net.dll!net::NetworkDelegate::CanEnablePrivacyMode(const GURL & url, const GURL & first_party_for_cookies) Line 172	C++
 	net.dll!net::URLRequest::CanEnablePrivacyMode() Line 1124	C++
 	net.dll!net::URLRequestJob::CanEnablePrivacyMode() Line 432	C++
 	net.dll!net::URLRequestHttpJob::Start() Line 293	C++
 	net.dll!net::URLRequest::StartJob(net::URLRequestJob * job) Line 675	C++
 	net.dll!net::URLRequest::BeforeRequestComplete(int error) Line 620	C++
 	net.dll!net::URLRequest::Start() Line 541	C++
 	net.dll!net::ProxyScriptFetcherImpl::Fetch(const GURL & url, std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> > * text, const base::Callback<void __cdecl(int),1,1> & callback) Line 180	C++
 	net.dll!net::ProxyScriptDecider::DoFetchPacScript() Line 340	C++
 	net.dll!net::ProxyScriptDecider::DoLoop(int result) Line 209	C++
 	net.dll!net::ProxyScriptDecider::Start(const net::ProxyConfig & config, const base::TimeDelta wait_delay, bool fetch_pac_bytes, const base::Callback<void __cdecl(int),1,1> & callback) Line 126	C++
 	net.dll!net::ProxyService::InitProxyResolver::DoDecideProxyScript() Line 512	C++
 	net.dll!net::ProxyService::InitProxyResolver::DoLoop(int result) Line 488	C++
 	net.dll!net::ProxyService::InitProxyResolver::Start(std::unique_ptr<net::ProxyResolver,std::default_delete<net::ProxyResolver> > * proxy_resolver, net::ProxyResolverFactory * proxy_resolver_factory, net::ProxyScriptFetcher * proxy_script_fetcher, net::DhcpProxyScriptFetcher * dhcp_proxy_script_fetcher, net::NetLog * net_log, const net::ProxyConfig & config, base::TimeDelta wait_delay, const base::Callback<void __cdecl(int),1,1> & callback) Line 410	C++
 	net.dll!net::ProxyService::InitializeUsingLastFetchedConfig() Line 1635	C++
 	net.dll!net::ProxyService::OnProxyConfigChanged(const net::ProxyConfig & config, net::ProxyConfigService::ConfigAvailability availability) Line 1610	C++
 	proxy_config.dll!ProxyConfigServiceImpl::OnProxyConfigChanged(const net::ProxyConfig & config, net::ProxyConfigService::ConfigAvailability availability) Line 117	C++
 	net.dll!net::PollingProxyConfigService::Core::GetConfigCompleted(const net::ProxyConfig & config) Line 129	C++
 	net.dll!base::internal::FunctorTraits<void (__cdecl net::PollingProxyConfigService::Core::*)(net::ProxyConfig const & __ptr64) __ptr64,void>::Invoke<scoped_refptr<net::PollingProxyConfigService::Core> const & __ptr64,net::ProxyConfig const & __ptr64>(void(net::PollingProxyConfigService::Core::*)(const net::ProxyConfig &) method, const scoped_refptr<net::PollingProxyConfigService::Core> & receiver_ptr, const net::ProxyConfig & <args_0>) Line 215	C++
 	net.dll!base::internal::InvokeHelper<0,void>::MakeItSo<void (__cdecl net::PollingProxyConfigService::Core::*const & __ptr64)(net::ProxyConfig const & __ptr64) __ptr64,scoped_refptr<net::PollingProxyConfigService::Core> const & __ptr64,net::ProxyConfig const & __ptr64>(void(net::PollingProxyConfigService::Core::*)(const net::ProxyConfig &) & functor, const scoped_refptr<net::PollingProxyConfigService::Core> & <args_0>, const net::ProxyConfig & <args_1>) Line 287	C++
 	net.dll!base::internal::Invoker<base::internal::BindState<void (__cdecl net::PollingProxyConfigService::Core::*)(net::ProxyConfig const & __ptr64) __ptr64,scoped_refptr<net::PollingProxyConfigService::Core>,net::ProxyConfig>,void __cdecl(void)>::RunImpl<void (__cdecl net::PollingProxyConfigService::Core::*const & __ptr64)(net::ProxyConfig const & __ptr64) __ptr64,std::tuple<scoped_refptr<net::PollingProxyConfigService::Core>,net::ProxyConfig> const & __ptr64,0,1>(void(net::PollingProxyConfigService::Core::*)(const net::ProxyConfig &) & functor, const std::tuple<scoped_refptr<net::PollingProxyConfigService::Core>,net::ProxyConfig> & bound, base::IndexSequence<0,1> __formal) Line 365	C++
 	net.dll!base::internal::Invoker<base::internal::BindState<void (__cdecl net::PollingProxyConfigService::Core::*)(net::ProxyConfig const & __ptr64) __ptr64,scoped_refptr<net::PollingProxyConfigService::Core>,net::ProxyConfig>,void __cdecl(void)>::Run(base::internal::BindStateBase * base) Line 343	C++
 	base.dll!base::Callback<void __cdecl(void),0,0>::Run() Line 91	C++
 	base.dll!base::debug::TaskAnnotator::RunTask(const char * queue_function, base::PendingTask * pending_task) Line 61	C++
 	base.dll!base::MessageLoop::RunTask(base::PendingTask * pending_task) Line 424	C++
 	base.dll!base::MessageLoop::DeferOrRunPendingTask(base::PendingTask pending_task) Line 437	C++
 	base.dll!base::MessageLoop::DoWork() Line 527	C++
 	base.dll!base::MessagePumpForIO::DoRunLoop() Line 475	C++
 	base.dll!base::MessagePumpWin::Run(base::MessagePump::Delegate * delegate) Line 58	C++
 	base.dll!base::MessageLoop::RunHandler() Line 388	C++
 	base.dll!base::RunLoop::Run() Line 38	C++
 	base.dll!base::Thread::Run(base::RunLoop * run_loop) Line 251	C++
 	content.dll!content::BrowserThreadImpl::IOThreadRun(base::RunLoop * run_loop) Line 279	C++
 	content.dll!content::BrowserThreadImpl::Run(base::RunLoop * run_loop) Line 313	C++
 	base.dll!base::Thread::ThreadMain() Line 336	C++
 	base.dll!base::`anonymous namespace'::ThreadFunc(void * params) Line 91	C++
 	kernel32.dll!BaseThreadInitThunk()	Unknown
 	ntdll.dll!RtlUserThreadStart()	Unknown

 
This looks exactly like https://groups.google.com/a/chromium.org/forum/#!msg/chromium-dev/VHK8Yy3GoXA/hI7duz_qAAAJ

That thread claims updating his checkout seems to have fixed the issue.  Could you try that?
Cc: eroman@chromium.org
Components: Internals>Network>Proxy
Owner: mmenke@chromium.org
Status: Assigned (was: Untriaged)
I think the HostContentSettingsMap (Or at least the extension service, in configuring it) is expecting no request to be issued after we've grabbed a pointer to it for use by the network stack, but before profile initialization is complete.
Components: -Content>Core Platform>Extensions Internals>Permissions>Model
This issue seems more like a content_settings / extensions issue than a network issue, since once the URLRequestContext is created, it should be free to be used.  I'll try to work out a solution, but adding those components, since that's where I think the issue really lies.

Comment 5 Deleted

Comment 6 by emx@chromium.org, May 5 2017

I've updated to 03bf78e3cec7faa7819d87b458ea05ab4b577cab and am still experiencing this problem.
Labels: -Pri-2 Pri-1
Status: Started (was: Assigned)
I'll either revert out today, or have a CL out by EOD.
(And, for the record, I believe the offending CL is https://codereview.chromium.org/2841163002/)
I have a patch out (https://codereview.chromium.org/2866613003/), but looks like the only extensions reviewer who's ever reviewed the classes in question is rdevlin.cronin, who's out this week (His first pass seemed supportive of the approach).

So either need to revert the original CL (Which didn't break anything that wasn't already broken...), wait a week to land the fix, or fish for an extensions reviewer who has never reviewed the classes in question (Ownership/lifetime models here are non-obvious, and relevant to the CL, though they may be common enough in extensions land that this obviously works).
Cc: w...@chromium.org
 Issue 718234  has been merged into this issue.

Comment 11 by emx@chromium.org, May 11 2017

This is still happening a week later. Could you at least comment out the failing assertion, so everyone affected doesn't have to do this (and undo it before every "git cl upload" and re-do it after)?

Comment 12 by emx@chromium.org, May 11 2017

By the way, after commenting/uncommenting this assertion the link takes ~5 minutes on Windows.
Running with "--no-proxy-server" or running off corp probably gets around it.  I'll look into either reverting (And TBRing the reland) or removing the assert later today, though expecting I'll be able to land Monday, anyways.
(To land the fix Monday, that is)

Comment 15 by emx@chromium.org, May 11 2017

Yes, --no-proxy-server works around it - thanks!
Sorry for not being more aggressive here - was hoping for pushback in response to comment 9 if people felt strongly I should be rushing out a workaround.
Status: Fixed (was: Started)
Project Member

Comment 18 by bugdroid1@chromium.org, May 15 2017

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

commit ad5094aba23fb6260d618c3223bb22d2deb85d6f
Author: mmenke <mmenke@chromium.org>
Date: Mon May 15 19:01:14 2017

Solve ProfileIOData, Extension, HostContentSettingsMap ordering issue.

There's a chicken/egg/omelette(?) issue during set up:

* ProfilIOData needs to grab HostContentSettingsMap on creation, and it
can be used at any point after creation to create a URLRequestContext,
which can use the HostContentSettingsMap.
* ExtensionSystem needs to modify the HostContentSettingsMap before the
map is used.
* ExtensionSystem needs access to the URLRequestContextGetter, which
ProfileIOData creates, but needs the HostContentSettingsMap before it
can safely create it.

This CL just makes the ExtensionSystem method to hook into
HostContentSettingsMap static, and the map sets up the hook on
construction.  Since the method to set up hooks wasn't depending on any
members of the ExtensionSystem, this should just "work"

This bug has existed a while, but we never ran into DCHECKs as a
result because while the URLRequestContext was potentially being set
up with the HostContentSettingsMap was fully initialized, we generally
weren't issuing network requests until after the ExtensionSystem set
up the map.

https://codereview.chromium.org/2841163002/ changed that, since the
ProxyService may figure out it needs a PAC file and fetch it any time
after the URLRequestContext is created.

BUG= 718835 

Review-Url: https://codereview.chromium.org/2866613003
Cr-Commit-Position: refs/heads/master@{#471853}

[modify] https://crrev.com/ad5094aba23fb6260d618c3223bb22d2deb85d6f/chrome/browser/content_settings/host_content_settings_map_factory.cc
[modify] https://crrev.com/ad5094aba23fb6260d618c3223bb22d2deb85d6f/chrome/browser/extensions/extension_service.cc
[modify] https://crrev.com/ad5094aba23fb6260d618c3223bb22d2deb85d6f/chrome/browser/extensions/extension_service.h
[modify] https://crrev.com/ad5094aba23fb6260d618c3223bb22d2deb85d6f/chrome/browser/profiles/profile_manager.cc

Sign in to add a comment