Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions include/tscore/Diags.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,16 @@ is_dbg_ctl_enabled(DbgCtl const &ctl)
} \
} while (false)

#define Debug_bw(tag, fmt, ...) \
do { \
if (unlikely(diags->on())) { \
static const SourceLocation loc = MakeSourceLocation(); \
static LogMessage log_message; \
log_message.debug(tag, loc, "%s", ts::bwprint(ts::bw_dbg, fmt, __VA_ARGS__).c_str()); \
} \
} while (0)
// A BufferWriter version of Debug().
#define Debug_bw(tag__, fmt, ...) \
do { \
if (unlikely(diags()->on())) { \
static DbgCtl Debug_bw_ctl(tag__); \
if (Debug_bw_ctl.ptr()->on) { \
DbgPrint(Debug_bw_ctl, "%s", ts::bwprint(ts::bw_dbg, fmt, __VA_ARGS__).c_str()); \
} \
} \
} while (false)

// printf-like debug output. First parameter must be tag (C-string literal, or otherwise
// a constexpr returning char const pointer to null-terminated C-string).
Expand Down
8 changes: 4 additions & 4 deletions proxy/http/HttpSM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5474,10 +5474,10 @@ HttpSM::mark_host_failure(ResolveInfo *info, ts_time time_down)
int host_len;
const char *host_name_ptr = t_state.unmapped_url.host_get(&host_len);
std::string_view host_name{host_name_ptr, size_t(host_len)};
ts::bwprint(error_bw_buffer,"CONNECT : {::s} connecting to {} for host='{}' url='{}' marking down",
ts::bwf::Errno(t_state.current.server->connect_result), t_state.current.server->dst_addr,host_name,
ts::bwf::FirstOf(url_str, "<none>"));
Log::error("%s", error_bw_buffer.c_str());
ts::bwprint(error_bw_buffer, "CONNECT : {::s} connecting to {} for host='{}' url='{}' marking down",
ts::bwf::Errno(t_state.current.server->connect_result), t_state.current.server->dst_addr, host_name,
ts::bwf::FirstOf(url_str, "<none>"));
Log::error("%s", error_bw_buffer.c_str());

if (url_str) {
t_state.arena.str_free(url_str);
Expand Down
6 changes: 6 additions & 0 deletions proxy/http/HttpTransact.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1790,6 +1790,12 @@ HttpTransact::PPDNSLookup(State *s)
markParentDown(s);
// DNS lookup of parent failed, find next parent or o.s.
if (find_server_and_update_current_info(s) == ResolveInfo::HOST_NONE) {
if (is_cache_hit(s->cache_lookup_result) && is_stale_cache_response_returnable(s)) {
s->source = SOURCE_CACHE;
TxnDebug("http_trans", "All parents are down, serving stale doc to client");
build_response_from_cache(s, HTTP_WARNING_CODE_REVALIDATION_FAILED);
return;
}
ink_assert(s->current.request_to == ResolveInfo::HOST_NONE);
handle_parent_died(s);
return;
Expand Down
2 changes: 1 addition & 1 deletion tests/gold_tests/proxy_protocol/proxy_serve_stale.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def _configure_ts(self):
'proxy.config.http.cache.max_stale_age': 10,
'proxy.config.http.parent_proxy.self_detect': 0,
'proxy.config.diags.debug.enabled': 1,
'proxy.config.diags.debug.tags': 'http|dns|parent_proxy',
'proxy.config.diags.debug.tags': 'cache|http|dns|hostdb|parent_proxy',
})
self.ts_child.Disk.parent_config.AddLine(
f'dest_domain=. parent="{self.ts_parent_hostname}" round_robin=consistent_hash go_direct=false'
Expand Down