New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 685755 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: May 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

DCHECK in DocumentMarkerController::renderedRectsForMarkers when browsing chrome://sync-internals

Project Member Reported by s...@chromium.org, Jan 26 2017

Issue description

visit chrome://sync-internals, select "Sync Node Browser" tab, I was browsing sessions data, browse around, and make changes on another device with the same account. Eventually (<1 minute) you should get a crash like the below stack

Received signal 6
#0 0x7f2ab5f8f694 base::debug::(anonymous namespace)::StackDumpSignalHandler()
#1 0x7f2ab610f330 <unknown>
#2 0x7f2aac594c37 gsignal
#3 0x7f2aac598028 abort
#4 0x7f2ab5f8d912 base::debug::BreakDebugger()
#5 0x7f2ab5fb3ed2 logging::LogMessage::~LogMessage()
#6 0x7f2aa7ebada1 blink::DocumentMarkerController::renderedRectsForMarkers()
#7 0x7f2aa7f4136d blink::FrameView::getTickmarks()
#8 0x7f2aaffbf0fe blink::ScrollbarTheme::paintTickmarks()
#9 0x7f2aafe31101 blink::WebScrollbarThemePainter::paintTickmarks()
#10 0x7f2aab486317 cc_blink::ScrollbarImpl::PaintPart()
#11 0x7f2ab2462c82 cc::PaintedScrollbarLayer::RasterizeScrollbarPart()
#12 0x7f2ab24627ea cc::PaintedScrollbarLayer::Update()
#13 0x7f2ab253b06a cc::LayerTree::UpdateLayers()
#14 0x7f2ab2540215 cc::LayerTreeHost::DoUpdateLayers()
#15 0x7f2ab253fb4f cc::LayerTreeHost::UpdateLayers()
#16 0x7f2ab25864ad cc::ProxyMain::BeginMainFrame()
#17 0x7f2ab2584f24 _ZN4base8internal12InvokeHelperILb1EvE8MakeItSoIRKMN2cc9ProxyMainEFvSt10unique_ptrINS4_28BeginMainFrameAndCommitStateESt14default_deleteIS7_EEERKNS_7WeakPtrIS5_EEJSA_EEEvOT_OT0_DpOT1_
#18 0x7f2ab2584e08 _ZN4base8internal7InvokerINS0_9BindStateIMN2cc9ProxyMainEFvSt10unique_ptrINS3_28BeginMainFrameAndCommitStateESt14default_deleteIS6_EEEJNS_7WeakPtrIS4_EENS0_13PassedWrapperIS9_EEEEEFvvEE3RunEPNS0_13BindStateBaseE
#19 0x7f2ab5f905be base::debug::TaskAnnotator::RunTask()
#20 0x7f2aaff8d740 blink::scheduler::TaskQueueManager::ProcessTaskFromWorkQueue()
#21 0x7f2aaff8b2df blink::scheduler::TaskQueueManager::DoWork()
#22 0x7f2aaff8fb05 _ZN4base8internal13FunctorTraitsIMN5blink9scheduler16TaskQueueManagerEFvbEvE6InvokeIRKNS_7WeakPtrIS4_EEJRKbEEEvS6_OT_DpOT0_
#23 0x7f2ab5f905be base::debug::TaskAnnotator::RunTask()
#24 0x7f2ab5fc132d base::MessageLoop::RunTask()
#25 0x7f2ab5fc1cc6 base::MessageLoop::DoWork()
#26 0x7f2ab5fc3729 base::MessagePumpDefault::Run()
#27 0x7f2ab5fc1085 base::MessageLoop::RunHandler()
#28 0x7f2ab5ff4e1c base::RunLoop::Run()
#29 0x7f2ab3df32e8 content::RendererMain()
#30 0x7f2ab3f4998e content::RunZygote()
#31 0x7f2ab3f4a0b8 content::RunNamedProcessTypeMain()
#32 0x7f2ab3f4aad6 content::ContentMainRunnerImpl::Run()
#33 0x7f2ab3f493f0 content::ContentMain()
#34 0x7f2ab6aac851 ChromeMain
#35 0x7f2aac57ff45 __libc_start_main
#36 0x7f2ab6aac6e9 <unknown>
  r8: ffffa1007b4aa5b8  r9: ffffa1007b4aa5a8 r10: 0000000000000008 r11: 0000000000000202
 r12: 000028835be283a8 r13: 0000000f000004e7 r14: 00007ffe72fa9f20 r15: 00007ffe72fa9f10
  di: 0000000000000001  si: 0000000000000001  bp: 00002fdf23a53cf8  bx: 0000000000000000
  dx: 0000000000000006  ax: 0000000000000000  cx: ffffffffffffffff  sp: 00007ffe72fa9918
  ip: 00007f2aac594c37 efl: 0000000000000202 cgf: 0000000000000033 erf: 0000000000000000
 trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]


 

Comment 1 by s...@chromium.org, Jan 26 2017

This was on a tip of tree developer build (58.0.2994.0)

Comment 2 by e...@chromium.org, Jan 27 2017

Components: -Blink

Comment 3 by pav...@chromium.org, Jan 28 2017

Components: Blink>Editing>IME
Owner: rlanday@chromium.org
Summary: DCHECK in DocumentMarkerController::renderedRectsForMarkers when browsing chrome://sync-internals (was: [Sync] chrome://sync-internals keeps crashing)
Ryan, you made a change recently related to DocumentMarkerController::m_markers. Do you know someone familiar with DocumentMarkerController who could look at the cause of DCHECK in DocumentMarkerController::renderedRectsForMarkers?
This appears to be a bug in DocumentMarkerController, m_possiblyExistingMarkerTypes should be getting reset whenever m_markers becomes empty. It's unclear to me whether this is just the code missing out on a performance optimization somewhere (resetting the list possibly existing marker types) or if we have a bug causing data corruption somewhere (similar to the bug in addMarker() I fixed: https://codereview.chromium.org/2594123003 )

Doesn't seem hi-pri though

Comment 5 by yosin@chromium.org, Jan 30 2017

Cc: rlanday@chromium.org
Components: -Services>Sync -Blink>Editing>IME Blink>Editing>Spellcheck
Owner: ----
Status: Available (was: Untriaged)
It seems DocumentMarkerController::removeMarkers(DocumentMarker::MarkerTypes markerTypes)|, called by |SpellChecerk|, doesn't reset m_possiblyExistingMarkerTypes.

|DOcumentMarkerController| is very old code and it is over abstraction, we should simplify its implementation.
I just ran into this DCHECK on Android while testing my Voice IME work...interesting
Cc: xiaoche...@chromium.org
Owner: rlanday@chromium.org
I just saw another location of this DCHECK get hit in RemoveMarkers():
https://chromium.googlesource.com/chromium/src/+/3639139a6216af6f66840f8348622d45ba06d5b9/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp#165

We should track this down as part of the DocumentMarkerController refactor efforts
Cc: yosin@chromium.org
It's unclear to me how this is happening. The DCHECK verifies that markers_ is not empty if possibly_existing_marker_types_ != 0. The only way this can fail is if either we have some method on DocumentMarkerController that violates this invariant by setting possibly_existing_marker_types to a non-zero value while markers_ is empty(), or making markers_ empty without resetting possibly_existing_marker_types_ to 0, and I can't find any way this should be able to happen unless we're experiencing memory corruption somehow.
I talked to xiaochengh and he pointed out that the map in question only stores weak references to its keys:
https://chromium.googlesource.com/chromium/src/+/d38becdb2a4dda654d795cb841111778673c0b1d/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h#119

We think what's happening is that the map is becoming empty due to garbage collection of the Nodes in question. Garbage collection doesn't update possibly_has_marker_types_. This doesn't actually break anything, but it means the condition the DCHECK checks fails in rare cases. We think the only realistic solution is to remove the DCHECKs.

Comment 14 by yosin@chromium.org, May 18 2017

This isn't regression. From beginning of migrating to Oilpan[1], this issue has existed.

[1] http://crrev.com/288173004: Oilpan: Move DocumentMarkerController to the Oilpan heap and use builtin


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

FYI

DocumentMarkerController in WebKit[1] uses 
HashMap<RefPtr<Node>, std::unique_ptr<MarkerList>> with node removal callbacks[2] on 2015.


Blink uses HashMap<const Node*, OwnPtr<MarkerLists>[3] before Oilpan GC with remove callback.
And it remove callback was moved to Node::WillBeDeletedFromDocument()[4].

When Node::WillBeDeletedFromDocument() removed by Oilpan, Blink DMC doesn't remove entry
for removed node.

Interesting history. (^_^)

[1] https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/dom/DocumentMarkerController.h
[2] http://wkb.ug/140999 Removing text node does not remove its associated markers
[3] http://crrev.com/82633002: Use const Node* in HashMap of DocumentMarkerController
[4] http://crrev.com/98273002: Remove node key from document marker set in Node::willBeDeletedFromDocument()

Project Member

Comment 16 by bugdroid1@chromium.org, May 20 2017

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

commit 37c906bd514195222ab091fa98a461cc40b25577
Author: rlanday <rlanday@chromium.org>
Date: Sat May 20 01:17:16 2017

Fix bug causing DCHECKs to be hit in DocumentMarkerController

These DCHECKs check that we're resetting the possibly_has_marker_types_ flag
when markers_ becomes empty. Resetting this flag properly enables a performance
optimization. These DCHECKs are causing sporadic crashes in debug builds; we
believe this is because the markers_ map is holding weak references to its keys
(Node objects), so it's possible for the map to become empty through garbage
collection, which doesn't reset possibly_has_marker_types_.

This CL modifies DocumentMarkerController::PossiblyHasMarkers() to catch this
case. Alternatively, we could handle this case at garbage collection time, but
we believe this approach has better performance characteristics.

BUG= 685755 

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

[modify] https://crrev.com/37c906bd514195222ab091fa98a461cc40b25577/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp

Status: Fixed (was: Available)

Sign in to add a comment