Commit c24387e9 authored by Maks Orlovich's avatar Maks Orlovich Committed by Commit Bot

Blockfile cache: remove bogus DCHECK

This particular condition can happen due to some failures
committing data, as sort of pointed out by the fuzzer,
and it already had recovery code right after the DCHECK

Bug: 1086727
Change-Id: I80fc64c651f87231e1ae476a01ec3bf34f36e77a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2227230
Commit-Queue: Maksim Orlovich <morlovich@chromium.org>
Reviewed-by: default avatarJosh Karlin <jkarlin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#775130}
parent 3edfebea
......@@ -5279,3 +5279,38 @@ TEST_F(DiskCacheBackendTest, SimpleDontLeakPostDoomCreate) {
// Should not have leaked files here.
}
TEST_F(DiskCacheBackendTest, BlockFileDelayedWriteFailureRecovery) {
// Test that blockfile recovers appropriately when some entries are
// in a screwed up state due to an error in delayed writeback.
//
// https://crbug.com/1086727
InitCache();
const char kKey[] = "Key2";
disk_cache::Entry* entry = nullptr;
ASSERT_THAT(CreateEntry(kKey, &entry), IsOk());
const int kBufSize = 24320;
scoped_refptr<net::IOBuffer> buffer =
base::MakeRefCounted<net::IOBuffer>(kBufSize);
CacheTestFillBuffer(buffer->data(), kBufSize, true);
ASSERT_EQ(kBufSize, WriteSparseData(entry, 0, buffer.get(), kBufSize));
// Setting the size limit artificially low injects a failure on writing back
// data buffered above.
SetMaxSize(4096);
// This causes SparseControl to close the child entry corresponding to
// low portion of offset space, triggering the writeback --- which fails
// due to the space cap, and in particular fails to allocate data for
// a stream, so it gets address 0.
ASSERT_EQ(net::ERR_FAILED, WriteSparseData(entry, 16773118, buffer.get(), 4));
// Now try reading the broken child. This should report an error, not
// DCHECK.
ASSERT_EQ(net::ERR_FAILED, ReadSparseData(entry, 4, buffer.get(), 4));
entry->Close();
}
......@@ -1064,7 +1064,6 @@ int EntryImpl::InternalReadData(int index,
}
address.set_value(entry_.Data()->data_addr[index]);
DCHECK(address.is_initialized());
if (!address.is_initialized()) {
DoomImpl();
return net::ERR_FAILED;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment