New issue
Advanced search Search tips

Issue 727854 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Oct 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Collision case of CreateOrFindActiveEntry buggy.

Project Member Reported by morlovich@chromium.org, May 30 2017

Issue description

When we hit the hash collision case in CreateOrFindActiveEntry:
https://cs.chromium.org/chromium/src/net/disk_cache/simple/simple_backend_impl.cc?rcl=5828a72d5f5d969ce71280572604f3439123c524&l=672

... we doom the old entry, which moves it active_entries_ -> entries_pending_doom_, and then re-try CreateOrFindActiveEntry which succeeds now the entry is not active. Trouble is, the I/O for the doom is asynchronously pending, so the actual creation op is likely to fail since the file is still there. It should probably rather append the creation op to the completion queue in entries_pending_doom_, the way the callers to CreateOrFindActiveEntry would if the entry was being doomed at entrance time. 

One way of doing it would be to combine the doom + active checks in one function. Probably too rare to be a big deal, but it meshes with some 
of the refactoring TODOs in the area --- pretty much impossible to test, though.

 
Project Member

Comment 1 by bugdroid1@chromium.org, Oct 2 2017

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

commit 4f9c5145d544b2e3418f69a77bae715d6faf3714
Author: Maks Orlovich <morlovich@chromium.org>
Date: Mon Oct 02 19:40:21 2017

SimpleCache: fix buglet on collision when creating entry.

In particular we need to serialize with the doom of the previous
entry for the hash, since otherwise our new files' creation will race
the old one's deletion --- and retrying the old CreateOrFindActiveEntry
in case of collision was insufficient for fixing that since it was
unaware of entries_pending_doom_

Bug:  727854 
Change-Id: Ibd13896056bcd6d9557b392e2e5f52bc65bc6ee3
Reviewed-on: https://chromium-review.googlesource.com/660719
Reviewed-by: Julia Tuttle <juliatuttle@chromium.org>
Commit-Queue: Maks Orlovich <morlovich@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505728}
[modify] https://crrev.com/4f9c5145d544b2e3418f69a77bae715d6faf3714/net/disk_cache/entry_unittest.cc
[modify] https://crrev.com/4f9c5145d544b2e3418f69a77bae715d6faf3714/net/disk_cache/simple/simple_backend_impl.cc
[modify] https://crrev.com/4f9c5145d544b2e3418f69a77bae715d6faf3714/net/disk_cache/simple/simple_backend_impl.h

Status: Fixed (was: Untriaged)

Sign in to add a comment