New issue
Advanced search Search tips

Issue 838988 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

BookmarkModelTask is using functions on BookmarkModel on the wrong thread

Project Member Reported by sky@chromium.org, May 2 2018

Issue description

If I'm reading the code right it looks like BookmarkModelTask (in chrome/browser/android/provider) adds an observer on a thread other than the ui thread. BookmarkModel is generally not thread safe, so this is risky and could cause problems. The call, to BlockTillLoaded is thread safe, but not adding/removing an observer.

Ted, any idea who could own this?
 
Cc: yfried...@chromium.org
+yfriedman as we're actively trying to kill all of that code

That being said, your investigation looks correct to me as well.  It looks like RemoveBookmarkTask and UpdateBookmarkTask are the two things that would need to be updated.

From what I can tell, it seems like we could get rid of the Add/Remove observer in the base class.  I think we could just add and remove the observer at the beginning of their corresponding RunOnUIThread calls.  Right now, they assume the observers are synchronous so that should work based on what I can tell.

That being said, this is old crufty code and I don't recall if Yaron has any better knowledge of this than I do.
Labels: android-fe-triagedlabel
Status: Available (was: Untriaged)
Labels: -android-fe-triagedlabel android-fe-triaged
Owner: tedc...@chromium.org
Status: Started (was: Available)
Project Member

Comment 6 by bugdroid1@chromium.org, Jun 8 2018

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

commit f5e25550afc8a4ab53915764b7a8edfe0684329f
Author: Ted Choc <tedchoc@google.com>
Date: Fri Jun 08 17:21:26 2018

Fix ChromeBrowserProvider bookmark observer thread issue.

The BookmarkModelObserverTask added a bookmark model observer
on a background thread, which is not allowed.

In both cases of Remove and Update, there is no need for listening
to the observer as we can just track whether we are updating the
bookmark node internally.  This is consistent with how
AddBookmarkTask already worked.

BUG= 838988 

Change-Id: I43bf054b70e78907a99ba2a11fac62df0af6bc67
Reviewed-on: https://chromium-review.googlesource.com/1089497
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Commit-Queue: Ted Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565667}
[modify] https://crrev.com/f5e25550afc8a4ab53915764b7a8edfe0684329f/chrome/browser/BUILD.gn
[delete] https://crrev.com/3af77af733bd2cd498b2aef95d080037c4929d3a/chrome/browser/android/provider/bookmark_model_observer_task.cc
[delete] https://crrev.com/3af77af733bd2cd498b2aef95d080037c4929d3a/chrome/browser/android/provider/bookmark_model_observer_task.h
[add] https://crrev.com/f5e25550afc8a4ab53915764b7a8edfe0684329f/chrome/browser/android/provider/bookmark_model_task.cc
[add] https://crrev.com/f5e25550afc8a4ab53915764b7a8edfe0684329f/chrome/browser/android/provider/bookmark_model_task.h
[modify] https://crrev.com/f5e25550afc8a4ab53915764b7a8edfe0684329f/chrome/browser/android/provider/chrome_browser_provider.cc

Status: Fixed (was: Started)

Sign in to add a comment