Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Issue 114533002: Chrome Now notificationGroups Storage Race Condition Fix (Closed)

Created:
7 years ago by robliao
Modified:
7 years ago
Reviewers:
vadimt, rgustafson, skare_
CC:
chromium-reviews, arv+watch_chromium.org
Visibility:
Public.

Description

Chrome Now notificationGroups Storage Race Condition Fix Updating cards involves updating the notificationGroups in rapid succession, leading to race conditions between storage.get and storage.set. The queued up storage.gets may dispatch all at once before each storage.set, meaning that the storage.set will set stale values. In other words, we get storage.get storage.get storage.set storage.set instead of storage.get storage.set storage.get storage.set The fix here is to move the requests outside of the for loop, adding arguments to functions where necessary to work around this gotcha. BUG=164227 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=240798

Patch Set 1 #

Total comments: 9

Patch Set 2 : CR Feedback #

Total comments: 4

Patch Set 3 : CR Feedback #

Unified diffs Side-by-side diffs Delta from patch set Stats (+111 lines, -85 lines) Patch
M chrome/browser/resources/google_now/background.js View 1 2 7 chunks +63 lines, -43 lines 0 comments Download
M chrome/browser/resources/google_now/cards.js View 1 5 chunks +48 lines, -42 lines 0 comments Download

Messages

Total messages: 10 (0 generated)
robliao
7 years ago (2013-12-12 21:31:12 UTC) #1
rgustafson
lgtm https://codereview.chromium.org/114533002/diff/1/chrome/browser/resources/google_now/background.js File chrome/browser/resources/google_now/background.js (right): https://codereview.chromium.org/114533002/diff/1/chrome/browser/resources/google_now/background.js#newcode542 chrome/browser/resources/google_now/background.js:542: recordEvent(GoogleNowEvent.CARDS_PARSE_SUCCESS); tiny comment: This should probably be before ...
7 years ago (2013-12-12 22:52:27 UTC) #2
robliao
https://codereview.chromium.org/114533002/diff/1/chrome/browser/resources/google_now/background.js File chrome/browser/resources/google_now/background.js (right): https://codereview.chromium.org/114533002/diff/1/chrome/browser/resources/google_now/background.js#newcode542 chrome/browser/resources/google_now/background.js:542: recordEvent(GoogleNowEvent.CARDS_PARSE_SUCCESS); Indeed. I was going to save this for ...
7 years ago (2013-12-12 23:01:20 UTC) #3
vadimt
Thanks for taking this! Below are some notes. https://codereview.chromium.org/114533002/diff/1/chrome/browser/resources/google_now/background.js File chrome/browser/resources/google_now/background.js (right): https://codereview.chromium.org/114533002/diff/1/chrome/browser/resources/google_now/background.js#newcode328 chrome/browser/resources/google_now/background.js:328: chrome.storage.local.set({notificationsData: ...
7 years ago (2013-12-13 18:20:54 UTC) #4
robliao
https://codereview.chromium.org/114533002/diff/1/chrome/browser/resources/google_now/background.js File chrome/browser/resources/google_now/background.js (right): https://codereview.chromium.org/114533002/diff/1/chrome/browser/resources/google_now/background.js#newcode328 chrome/browser/resources/google_now/background.js:328: chrome.storage.local.set({notificationsData: notificationsData}); Took a different approach here and delegated ...
7 years ago (2013-12-13 19:31:26 UTC) #5
vadimt
https://codereview.chromium.org/114533002/diff/20001/chrome/browser/resources/google_now/background.js File chrome/browser/resources/google_now/background.js (right): https://codereview.chromium.org/114533002/diff/20001/chrome/browser/resources/google_now/background.js#newcode543 chrome/browser/resources/google_now/background.js:543: combineAndShowNotificationCards(updatedGroups, nit: please start "updatedGroups," from new line https://codereview.chromium.org/114533002/diff/20001/chrome/browser/resources/google_now/background.js#newcode1145 ...
7 years ago (2013-12-13 20:07:39 UTC) #6
robliao
https://codereview.chromium.org/114533002/diff/20001/chrome/browser/resources/google_now/background.js File chrome/browser/resources/google_now/background.js (right): https://codereview.chromium.org/114533002/diff/20001/chrome/browser/resources/google_now/background.js#newcode543 chrome/browser/resources/google_now/background.js:543: combineAndShowNotificationCards(updatedGroups, On 2013/12/13 20:07:40, vadimt wrote: > nit: please ...
7 years ago (2013-12-13 20:38:17 UTC) #7
vadimt
lgtm
7 years ago (2013-12-13 20:39:32 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/robliao@chromium.org/114533002/40001
7 years ago (2013-12-13 20:43:18 UTC) #9
commit-bot: I haz the power
7 years ago (2013-12-13 23:30:54 UTC) #10
Message was sent while issue was closed.
Change committed as 240798

Powered by Google App Engine
This is Rietveld 408576698