New issue
Advanced search Search tips

Issue 886892 link

Starred by 1 user

Issue metadata

Status: Started
Owner:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug

Blocking:
issue 812168



Sign in to add a comment

Add support to serialize operations in the GeneratedCodeCache

Project Member Reported by mythria@chromium.org, Sep 19

Issue description

Read and Write can overlap in some corner cases. This leads to reading an empty entry. For example, 

The API this cache exposes are Read, Write and Clear. 
On Writes we do the following:
1. Initiate Open
2. Open Complete: 
     If open failed: Initiate Create
     Else: Initiate a write
3. Create Complete:
      If Create failed: Nothing
      Else: Initiate a write
On Reads:
1. Initiate Open
2. Open Complete:
     If open failed: Return null data
     Else: Initiate Read
3. Read Complete:
     If Read failed: Return null data
     Else: Return data.
So, I think if we have a write and a read request almost simultaneously (which in my opinion could happen) then may be we could have the scenario you described:
Create (on write request)
Open (for read request)
Read (for read request)
Write (for write request).

More context in this cl: https://chromium-review.googlesource.com/c/chromium/src/+/1228123

 
Blocking: 812168
Components: -Admin>LabelRequest
Owner: mythria@chromium.org
Hi Mythri, 

It looks like this bug was accidentally filed under the wrong component (Admin>LabelRequest). Could you please file it back under the right component?

Thanks!
Components: Blink>JavaScript
oops. sorry about that. 
Status: Started (was: Available)
Project Member

Comment 5 by bugdroid1@chromium.org, Jan 17 (5 days ago)

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

commit c7528ed7d6b186a5ab11e3aebf671ba10402b609
Author: Mythri Alle <mythria@chromium.org>
Date: Thu Jan 17 14:21:17 2019

Serialize read/write operations corresponding to a key in GeneratedCodeCache

Since read and write involves multiple operations (for ex: open entry,
create entry, write data) it is possible that these operations overlap
and we may read an incomplete entry. Hence it is safer to serialize
the operations at the GeneratedCodeCache layer.

Bug: 886892
Change-Id: Idc26079b6e3d4682a030b9ba04b11c624119dad4
Reviewed-on: https://chromium-review.googlesource.com/c/1398085
Commit-Queue: Mythri Alle <mythria@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Cr-Commit-Position: refs/heads/master@{#623676}
[modify] https://crrev.com/c7528ed7d6b186a5ab11e3aebf671ba10402b609/content/browser/code_cache/generated_code_cache.cc
[modify] https://crrev.com/c7528ed7d6b186a5ab11e3aebf671ba10402b609/content/browser/code_cache/generated_code_cache.h
[modify] https://crrev.com/c7528ed7d6b186a5ab11e3aebf671ba10402b609/content/browser/storage_partition_impl_unittest.cc

Sign in to add a comment