文本文件  |  93行  |  1.93 KB

Index file:
version: 2.1
entries: 3
current id: 1
last crash: 1
head 0: 0x90000002
tail 0: 0x90000002
size 0: 0x1
head 1: 0x90000001             <----
tail 1: 0x90000000
size 1: 0x2
transaction: 0x0
-------------------------

Entry at 0xa0010002
hash: 0x687d1422
next entry: 0x0
rankings: 0x90000000
key length: 13
key: "the first key"
key addr: 0x0
reuse count: 1
----------

Rankings at 0x90000000
next: 0x90000000
prev: 0x90000001
entry: 0xa0010002
dirty: 0
----------

Entry at 0xa0010003
hash: 0x4a70620e
next entry: 0x0
rankings: 0x90000001
key length: 14
key: "the second key"
key addr: 0x0
reuse count: 0                 <---- list 0
----------

Rankings at 0x90000001
next: 0x90000000
prev: 0x90000001               <----- head
entry: 0xa0010003
dirty: 1                       <----- This was actually inserted on list 1
----------

Entry at 0xa0010004
hash: 0x63909ecb
next entry: 0x0
rankings: 0x90000002
key length: 14
key: "some other key"
key addr: 0x0
reuse count: 0
----------

Rankings at 0x90000002
next: 0x90000002
prev: 0x90000002
entry: 0xa0010004
dirty: 0
----------

================================

Generated with:

  SetNewEviction();
  SetMaxSize(20 * 1024 * 1024);
  InitCache();
  const char* kName1 = "the first key";
  const char* kName2 = "the second key";
  disk_cache::Entry* entry;
  ASSERT_EQ(net::OK, CreateEntry(kName1, &entry));
  entry->Close();
  ASSERT_EQ(net::OK, CreateEntry(kName2, &entry));
  entry->Close();
  ASSERT_EQ(net::OK, CreateEntry("some other key", &entry));
  entry->Close();

  ASSERT_EQ(net::OK, OpenEntry(kName1, &entry));
  entry->Close();

  ASSERT_EQ(net::OK, OpenEntry(kName2, &entry));

Set a breakpoint on that last line, and when the entry is moved from one list to another, crash the process:

  rankings_->Remove(entry->rankings(), Rankings::NO_USE);
  rankings_->Insert(entry->rankings(), false, Rankings::LOW_USE);
  entry->entry()->Store();                                           <---- crash here