Potential memory leak with SafeBrowser model |
|||||
Issue description
I ran a long-running test that was navigating to a restricted set of web pages for a whole day. The browser process was kept alive the whole time. Memory dumps using memory-infra are taken at the beginning and at the end of the experiment.
Some remaining allocation are related to safe browsing model. As I get this, this is a model that can be updated periodically. I can't tell if this is a leak or if this is a growing database.
8520 objects
"operator new",
"google::protobuf::Arena::Create<safe_browsing::ClientSideModel_Rule>",
"google::protobuf::internal::RepeatedPtrFieldBase::Add<google::protobuf::RepeatedPtrField<safe_browsing::ClientSideModel_Rule>::TypeHandler>",
"safe_browsing::ClientSideModel::MergePartialFromCodedStream",
"google::protobuf::`anonymous namespace'::InlineMergeFromCodedStream",
"google::protobuf::`anonymous namespace'::InlineParseFromArray",
"safe_browsing::ModelLoader::OnURLFetchComplete",
"net::URLFetcherCore::InformDelegateFetchIsComplete",
"net::URLFetcherCore::OnCompletedURLRequest",
"base::internal::Invoker<base::internal::BindState<void (__cdecl net::URLFetcherCore::*)(base::TimeDelta) __ptr64,scoped_refptr<net::URLFetcherCore>,base::TimeDelta>,void __cdecl(void)>::Run",
"base::debug::TaskAnnotator::RunTask",
"base::MessageLoop::RunTask",
"base::MessageLoop::DoWork",
"base::MessagePumpForUI::DoRunLoop",
"base::MessagePumpWin::Run",
"base::RunLoop::Run",
"ChromeBrowserMainParts::MainMessageLoopRun",
"content::BrowserMainLoop::RunMainMessageLoopParts",
"content::BrowserMainRunnerImpl::Run",
"content::BrowserMain",
"content::RunNamedProcessTypeMain",
"content::ContentMainRunnerImpl::Run",
"service_manager::Main",
"content::ContentMain",
"ChromeMain",
"MainDllLoader::Launch",
"wWinMain",
"__scrt_common_main_seh",
"BaseThreadInitThunk",
"RtlUserThreadStart",
"[Thread: CrBrowserMain]"
8516 objects
"operator new",
"google::protobuf::RepeatedField<int>::Reserve",
"google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive<int,5>",
"safe_browsing::ClientSideModel_Rule::MergePartialFromCodedStream",
"safe_browsing::ClientSideModel::MergePartialFromCodedStream",
"google::protobuf::`anonymous namespace'::InlineMergeFromCodedStream",
"google::protobuf::`anonymous namespace'::InlineParseFromArray",
"safe_browsing::ModelLoader::OnURLFetchComplete",
"net::URLFetcherCore::InformDelegateFetchIsComplete",
"net::URLFetcherCore::OnCompletedURLRequest",
"base::internal::Invoker<base::internal::BindState<void (__cdecl net::URLFetcherCore::*)(base::TimeDelta) __ptr64,scoped_refptr<net::URLFetcherCore>,base::TimeDelta>,void __cdecl(void)>::Run",
"base::debug::TaskAnnotator::RunTask",
"base::MessageLoop::RunTask",
"base::MessageLoop::DoWork",
"base::MessagePumpForUI::DoRunLoop",
"base::MessagePumpWin::Run",
"base::RunLoop::Run",
"ChromeBrowserMainParts::MainMessageLoopRun",
"content::BrowserMainLoop::RunMainMessageLoopParts",
"content::BrowserMainRunnerImpl::Run",
"content::BrowserMain",
"content::RunNamedProcessTypeMain",
"content::ContentMainRunnerImpl::Run",
"service_manager::Main",
"content::ContentMain",
"ChromeMain",
"MainDllLoader::Launch",
"wWinMain",
"__scrt_common_main_seh",
"BaseThreadInitThunk",
"RtlUserThreadStart",
"[Thread: CrBrowserMain]"
5764 objects
"base::debug::StackTrace::StackTrace",
"base::trace_event::AllocationContextTracker::GetContextSnapshot",
"base::trace_event::MallocDumpProvider::InsertAllocation",
"base::trace_event::`anonymous namespace'::HookAlloc",
"malloc",
"operator new",
"std::_Allocate",
"std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Copy",
"std::basic_string<char,std::char_traits<char>,std::allocator<char> >::append",
"google::protobuf::io::CodedInputStream::InternalReadStringInline",
"google::protobuf::internal::WireFormatLite::ReadBytes",
"safe_browsing::ClientSideModel::MergePartialFromCodedStream",
"google::protobuf::`anonymous namespace'::InlineMergeFromCodedStream",
"google::protobuf::`anonymous namespace'::InlineParseFromArray",
"safe_browsing::ModelLoader::OnURLFetchComplete",
"net::URLFetcherCore::InformDelegateFetchIsComplete",
"net::URLFetcherCore::OnCompletedURLRequest",
"base::internal::Invoker<base::internal::BindState<void (__cdecl net::URLFetcherCore::*)(base::TimeDelta) __ptr64,scoped_refptr<net::URLFetcherCore>,base::TimeDelta>,void __cdecl(void)>::Run",
"base::debug::TaskAnnotator::RunTask",
"base::MessageLoop::RunTask",
"base::MessageLoop::DoWork",
"base::MessagePumpForUI::DoRunLoop",
"base::MessagePumpWin::Run",
"base::RunLoop::Run",
"ChromeBrowserMainParts::MainMessageLoopRun",
"content::BrowserMainLoop::RunMainMessageLoopParts",
"content::BrowserMainRunnerImpl::Run",
"content::BrowserMain",
"content::RunNamedProcessTypeMain",
"content::ContentMainRunnerImpl::Run",
"service_manager::Main",
"content::ContentMain",
"ChromeMain",
"MainDllLoader::Launch",
"wWinMain",
"__scrt_common_main_seh",
"BaseThreadInitThunk",
"RtlUserThreadStart",
"[Thread: CrBrowserMain]"
"malloc",
"operator new",
"google::protobuf::Arena::Create<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >",
"google::protobuf::RepeatedPtrField<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::Add",
"safe_browsing::ClientSideModel::MergePartialFromCodedStream",
"google::protobuf::`anonymous namespace'::InlineMergeFromCodedStream",
"google::protobuf::`anonymous namespace'::InlineParseFromArray",
"safe_browsing::ModelLoader::OnURLFetchComplete",
"net::URLFetcherCore::InformDelegateFetchIsComplete",
"net::URLFetcherCore::OnCompletedURLRequest",
"base::internal::Invoker<base::internal::BindState<void (__cdecl net::URLFetcherCore::*)(base::TimeDelta) __ptr64,scoped_refptr<net::URLFetcherCore>,base::TimeDelta>,void __cdecl(void)>::Run",
"base::debug::TaskAnnotator::RunTask",
"base::MessageLoop::RunTask",
"base::MessageLoop::DoWork",
"base::MessagePumpForUI::DoRunLoop",
"base::MessagePumpWin::Run",
"base::RunLoop::Run",
"ChromeBrowserMainParts::MainMessageLoopRun",
"content::BrowserMainLoop::RunMainMessageLoopParts",
"content::BrowserMainRunnerImpl::Run",
"content::BrowserMain",
"content::RunNamedProcessTypeMain",
"content::ContentMainRunnerImpl::Run",
"service_manager::Main",
"content::ContentMain",
"ChromeMain",
"MainDllLoader::Launch",
"wWinMain",
"__scrt_common_main_seh",
"BaseThreadInitThunk",
"RtlUserThreadStart",
"[Thread: CrBrowserMain]"
,
Jun 13 2017
The code loads one or two CSD models from network or cache just after startup, and unmarshals those protos. Then it schedules a re-load for when the model would expire (based on cache TTL), which I think is 7 days. It shouldn't be doing much else in the meantime.
,
Jun 13 2017
Oh, and the models are copied to the renderer so they can be used there.
,
Jun 16 2017
etienneb -- is there a way to reproduce this easily?
,
Jun 19 2017
It could be observed by running the long_running benchmark. % python tools\perf\run_benchmark memory.long_running_desktop_sites The traces will contains memory dumps (memory-infra). > ... or cache just after startup, How long does it take for the model to be loaded. I can check whether it's growing up between day 2 and day 4, instead of just after the startup.
,
Jun 20 2017
It's loaded 10 seconds after startup.
,
Jun 30 2017
,
Nov 10 2017
,
Feb 18 2018
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by etienneb@chromium.org
, Jun 13 2017