Commit 4e6ea99c authored by rtenneti's avatar rtenneti Committed by Commit bot

QUIC - Browser shutdown crash fix. Accessing disk_cache's backend after

it is deleted.

Did a one line fix to reset callback and commented out code that collected
UMA histogram data. Will implement correct fix asap.

TBR=rch@chromium.org
BUG=456524

Review URL: https://codereview.chromium.org/892083006

Cr-Commit-Position: refs/heads/master@{#315243}
parent 7590a6d6
......@@ -104,7 +104,10 @@ int DiskCacheBasedQuicServerInfo::WaitForDataReady(
void DiskCacheBasedQuicServerInfo::CancelWaitForDataReadyCallback() {
DCHECK(CalledOnValidThread());
RecordQuicServerInfoStatus(QUIC_SERVER_INFO_WAIT_FOR_DATA_READY_CANCEL);
// TODO(rtenneti): crbug.com/456524. Implement a better fix. During shutdown,
// HttpCache could be deleted and leads to crash because backend_ is deleted.
// Temporary weekend fix is to return without collecting data in histograms.
// RecordQuicServerInfoStatus(QUIC_SERVER_INFO_WAIT_FOR_DATA_READY_CANCEL);
if (!wait_for_ready_callback_.is_null()) {
RecordLastFailure();
wait_for_ready_callback_.Reset();
......
......@@ -418,6 +418,28 @@ TEST(DiskCacheBasedQuicServerInfo, CancelWaitForDataReadyButDataIsReady) {
RemoveMockTransaction(&kHostInfoTransaction1);
}
TEST(DiskCacheBasedQuicServerInfo, CancelWaitForDataReadyAfterDeleteCache) {
scoped_ptr<QuicServerInfo> quic_server_info;
{
MockHttpCache cache;
AddMockTransaction(&kHostInfoTransaction1);
TestCompletionCallback callback;
QuicServerId server_id("www.google.com", 443, true, PRIVACY_MODE_DISABLED);
quic_server_info.reset(
new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache()));
EXPECT_FALSE(quic_server_info->IsDataReady());
quic_server_info->Start();
int rv = quic_server_info->WaitForDataReady(callback.callback());
quic_server_info->CancelWaitForDataReadyCallback();
EXPECT_EQ(OK, callback.GetResult(rv));
EXPECT_TRUE(quic_server_info->IsDataReady());
RemoveMockTransaction(&kHostInfoTransaction1);
}
// Cancel the callback after Cache is deleted.
quic_server_info->CancelWaitForDataReadyCallback();
}
// Test Start() followed by Persist() without calling WaitForDataReady.
TEST(DiskCacheBasedQuicServerInfo, StartAndPersist) {
MockHttpCache cache;
......
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