Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Desktop] Crashes in Adblock Engine #10907

Closed
iefremov opened this issue Jul 24, 2020 · 3 comments · Fixed by brave/brave-core#6250, brave/brave-core#6318 or brave/brave-core#6319
Closed

[Desktop] Crashes in Adblock Engine #10907

iefremov opened this issue Jul 24, 2020 · 3 comments · Fixed by brave/brave-core#6250, brave/brave-core#6318 or brave/brave-core#6319
Assignees
Labels
crash OS/Desktop priority/P1 A very extremely bad problem. We might push a hotfix for it. QA/No release-notes/exclude

Comments

@iefremov
Copy link
Contributor

There is a bunch of similar-looking crashes inside Rust adblocker:

https://brave.sp.backtrace.io/p/brave/triage?time=all&filters=((callstack%2Ccontains%2Crust_panic))&aggregations=((guid%2Cunique)%2C(classifiers%2Chead))

specific example: https://brave.sp.backtrace.io/p/brave/debug?time=all&filters=(_deleted%3D0%2C(callstack%2Ccontains%2Crust_panic))&fingerprint=ca5e3359838d432fd81d41947ce39fed2d38e0a5e560813ad76677b66cfb01f4

...
[ 08 ] _ZN3std7process5abort17h7b0a42a60331a01bE
[ 09 ] rust_panic
[ 10 ] _ZN3std9panicking20rust_panic_with_hook17h1f2449d529a25f22E
[ 11 ] _$LT$adblock..filters..network..NetworkFilter$u20$as$u20$adblock..filters..network..NetworkMatchable$GT$::matches::h57c0d8ed2cbb9c7b
[ 12 ] rust_begin_unwind
[ 13 ] _ZN4core9panicking9panic_fmt17h2c05f81b567d1861E
[ 14 ] _ZN4core6option18expect_none_failed17ha9782a6ef355446fE
[ 15 ] 0x55acbf91fbf0
[ 16 ] 0x55acbf91f9a0
[ 17 ] core::ptr::drop_in_place::ha5bb1979d4cf57bf (.llvm.9443824853129752194)
[ 18 ] adblock::blocker::Blocker::check_parameterised::h0aa7d32f5744fd3c
[ 19 ] adblock::request::Request::from_urls_with_hostname::h7771614cc26ca997
[ 20 ] adblock::request::Request::from_urls_with_hostname::h7771614cc26ca997
[ 21 ] adblock::engine::Engine::check_network_urls_with_hostnames::h7ff76945452fc905
[ 22 ] engine_match
[ 23 ] engine_match
[ 24 ] url::SchemeHostPort::SchemeHostPort(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, unsigned short, url::SchemeHostPort::ConstructPolicy)
[ 25 ] std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long, unsigned long, std::__1::allocator<char> const&)
[ 26 ] adblock::Engine::matches(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool*, bool*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)
[ 27 ] std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long, unsigned long, std::__1::allocator<char> const&)
[ 28 ] brave_shields::AdBlockBaseService::ShouldStartRequest(GURL const&, blink::mojom::ResourceType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool*, bool*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)
[ 29 ] brave_shields::AdBlockBaseService::ShouldStartRequest(GURL const&, blink::mojom::ResourceType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool*, bool*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)
[ 30 ] base::sequence_manager::internal::TaskQueueImpl::TaskRunner::PostDelayedTask(base::Location const&, base::OnceCallback<void ()>, base::TimeDelta)
[ 31 ] brave::OnBeforeURLRequestAdBlockTP(base::RepeatingCallback<void ()> const&, std::__1::shared_ptr<brave::BraveRequestInfo>)
[ 32 ] std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long, unsigned long, std::__1::allocator<char> const&)
[ 33 ] brave::ShouldBlockAdOnTaskRunner(std::__1::shared_ptr<brave::BraveRequestInfo>)
[ 34 ] base::internal::Invoker<base::internal::BindState<void (*)(std::__1::shared_ptr<brave::BraveRequestInfo>), std::__1::shared_ptr<brave::BraveRequestInfo> >, void ()>::RunOnce(base::internal::BindStateBase*)
[ 35 ] base::(anonymous namespace)::PostTaskAndReplyRelay::RunTaskAndPostReply(base::(anonymous namespace)::PostTaskAndReplyRelay)
[ 36 ] 0x55acc2d0a9d0
[ 37 ] base::internal::Invoker<base::internal::BindState<void (*)(base::(anonymous namespace)::PostTaskAndReplyRelay), base::(anonymous namespace)::PostTaskAndReplyRelay>, void ()>::RunOnce(base::internal::BindStateBase*)
[ 38 ] brave::OnBeforeURLRequestAdBlockTP(base::RepeatingCallback<void ()> const&, std::__1::shared_ptr<brave::BraveRequestInfo>)
[ 39 ] base::TaskAnnotator::RunTask(char const*, base::PendingTask*)
[ 40 ] brave::OnBeforeURLRequestAdBlockTP(base::RepeatingCallback<void ()> const&, std::__1::shared_ptr<brave::BraveRequestInfo>)
[ 41 ] mojo::Connector::PostDispatchNextMessageFromPipe()
[ 42 ] mojo::SimpleWatcher::Context::CallNotify(MojoTrapEvent const*)
[ 43 ] base::internal::TaskTracker::RunSkipOnShutdown(base::internal::Task*)
[ 44 ] base::internal::TaskTracker::RunTask(base::internal::Task, base::internal::TaskSource*, base::TaskTraits const&)
[ 45 ] 0x7ffcf1f85cb8
[ 46 ] 0x7fe5757f9ea6
[ 47 ] brave::OnBeforeURLRequestAdBlockTP(base::RepeatingCallback<void ()> const&, std::__1::shared_ptr<brave::BraveRequestInfo>)
[ 48 ] base::internal::TaskTrackerPosix::RunTask(base::internal::Task, base::internal::TaskSource*, base::TaskTraits const&)

...

This may be related to #10765

@iefremov iefremov added crash priority/P1 A very extremely bad problem. We might push a hotfix for it. OS/Desktop labels Jul 24, 2020
@iefremov
Copy link
Contributor Author

cc @bsclifton to triage
cc @antonok-edm @AndriusA

@iefremov
Copy link
Contributor Author

Actually it seems that it is only in Nightly and Beta for now, so I think we don't want it to hit Stable
This signature slowly crawled to top20 for browser process https://brave.sp.backtrace.io/p/brave/debug?filters=(_deleted%3D0%2Cptype%3Dbrowser%2C(ver%2Cregex%2C%228%5B1%7C2%7C3%7C4%5D.*%22))&fingerprint=370b9aea74f715763d1dbeea3409d560b13694882456aa0d331935c0e1bfabe5&debug=(%224be05%22,0,0)

@iefremov
Copy link
Contributor Author

Ok, I think I've found the cause: apparently, AdBlockBaseService::UrlCosmeticResources and AdBlockBaseService::HiddenClassIdSelectors should not be called from UI thread, since ad_block_client_ lives on the custom taskrunner

iefremov added a commit to brave/brave-core that referenced this issue Jul 29, 2020
Fix brave/brave-browser#10907

Some functionality of adblock service must be used only on
certain TaskRunner, so this fixes a couple of methods that
were previously called from UI thread. It also required
making the corresponding extension shields API functions
async. I also did some small code style improvements.
@iefremov iefremov added this to the 1.12.x - Release milestone Aug 3, 2020
iefremov added a commit to brave/brave-core that referenced this issue Aug 3, 2020
iefremov added a commit to brave/brave-core that referenced this issue Aug 3, 2020
iefremov added a commit to brave/brave-core that referenced this issue Aug 4, 2020
Fix brave/brave-browser#10907

Some functionality of adblock service must be used only on
certain TaskRunner, so this fixes a couple of methods that
were previously called from UI thread. It also required
making the corresponding extension shields API functions
async. I also did some small code style improvements.

(cherry picked from commit a5762c3)
iefremov added a commit to brave/brave-core that referenced this issue Aug 4, 2020
iefremov added a commit to brave/brave-core that referenced this issue Aug 4, 2020
Fixes brave/brave-browser#10907

(cherry picked from commit dc82778)
iefremov added a commit to brave/brave-core that referenced this issue Aug 4, 2020
Fix brave/brave-browser#10907

Some functionality of adblock service must be used only on
certain TaskRunner, so this fixes a couple of methods that
were previously called from UI thread. It also required
making the corresponding extension shields API functions
async. I also did some small code style improvements.

(cherry picked from commit a5762c3)
iefremov added a commit to brave/brave-core that referenced this issue Aug 4, 2020
iefremov added a commit to brave/brave-core that referenced this issue Aug 4, 2020
Fixes brave/brave-browser#10907

(cherry picked from commit dc82778)
@iefremov iefremov self-assigned this Aug 4, 2020
@iefremov iefremov removed the QA/Yes label Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash OS/Desktop priority/P1 A very extremely bad problem. We might push a hotfix for it. QA/No release-notes/exclude
Projects
None yet
2 participants