Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
Debug builds may abort() when revalidating expired output resources
Browse files Browse the repository at this point in the history
As a workaround, remove the LOG(DFATAL) and replace it with a TODO.

#1553
  • Loading branch information
oschaaf committed Jun 5, 2017
1 parent c122121 commit e1eabb3
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
6 changes: 4 additions & 2 deletions net/instaweb/rewriter/output_resource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,10 @@ void OutputResource::SetHash(StringPiece hash) {
void OutputResource::LoadAndCallback(NotCacheablePolicy not_cacheable_policy,
const RequestContextPtr& request_context,
AsyncCallback* callback) {
LOG(DFATAL) << "Output resources shouldn't be loaded via "
"LoadAsync, but rather through FetchResource";
// TODO(oschaaf): Output resources shouldn't be loaded via LoadAsync, but
// rather through FetchResource. ProxyInterfaceTest.TestAbortOnRevalidation
// does manage to hit this code, which caused an abort in debug builds.
// See https://github.com/pagespeed/mod_pagespeed/issues/1553
callback->Done(false /* lock_failure */, writing_complete_);
}

Expand Down
40 changes: 40 additions & 0 deletions pagespeed/automatic/proxy_interface_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,46 @@ TEST_F(ProxyInterfaceTest, LoggingInfo) {
EXPECT_TRUE(logging_info()->is_request_disabled());
}

// Regression test for https://github.com/pagespeed/mod_pagespeed/issues/1553
TEST_F(ProxyInterfaceTest, TestNoDebugAbortAfterMoreThenOneYear) {
GoogleString text;
RequestHeaders request_headers;
ResponseHeaders response_headers;
response_headers.Add(HttpAttributes::kContentType,
kContentTypeHtml.mime_type());
response_headers.SetStatusAndReason(HttpStatus::kOK);

GoogleString url = "http://test.com/flush_subresources.html"
"?PageSpeedFilters=+extend_cache_css,-inline_css";
mock_url_fetcher_.SetResponse("http://test.com/flush_subresources.html",
response_headers,
"<html><head><link rel='stylesheet' "
"type='text/css' href='test.css'></head></html>");

response_headers.Replace(HttpAttributes::kContentType,
kContentTypeCss.mime_type());
mock_url_fetcher_.SetResponse("http://test.com/test.css", response_headers,
kCssContent);

FetchFromProxy(url,
request_headers,
true, /* expect_success */
&text,
&response_headers,
false /* proxy_fetch_property_callback_collector_created */);

SetTimeMs(MockTimer::kApr_5_2010_ms + 2 * Timer::kYearMs);

// This second fetch would end up with VLOG(DFATAL)
FetchFromProxy(url,
request_headers,
true, /* expect_success */
&text,
&response_headers,
false /* proxy_fetch_property_callback_collector_created */);
}


TEST_F(ProxyInterfaceTest, SkipPropertyCacheLookupIfOptionsNotEnabled) {
GoogleString url = "http://www.example.com/";
GoogleString text;
Expand Down

0 comments on commit e1eabb3

Please sign in to comment.