Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work around some mgr:forward accounting/reporting bugs #1969

Closed
Changes from 1 commit
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
14 changes: 11 additions & 3 deletions src/FwdState.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1349,26 +1349,34 @@ FwdState::reforward()
return Http::IsReforwardableStatus(s);
}

// TODO: Refactor to fix multiple mgr:forward accounting/reporting bugs. See
// https://lists.squid-cache.org/pipermail/squid-users/2024-December/027331.html
static void
fwdStats(StoreEntry * s)
{
int i;
int j;
storeAppendPrintf(s, "Status");

for (j = 1; j < MAX_FWD_STATS_IDX; ++j) {
// XXX: Missing try#0 heading for FwdReplyCodes[0][i]
for (j = 1; j <= MAX_FWD_STATS_IDX; ++j) {
storeAppendPrintf(s, "\ttry#%d", j);
}

storeAppendPrintf(s, "\n");

for (i = 0; i <= (int) Http::scInvalidHeader; ++i) {
yadij marked this conversation as resolved.
Show resolved Hide resolved
if (FwdReplyCodes[0][i] == 0)
// XXX: Missing reporting of status codes for which logReplyStatus() was
// only called with n_tries exceeding 1. To be more precise, we are
// missing (the equivalent of) logReplyStatus() calls for attempts done
// outside of FwdState. Relying on n_tries<=1 counters is too fragile.
if (!FwdReplyCodes[0][i] && !FwdReplyCodes[1][i])
continue;

storeAppendPrintf(s, "%3d", i);

for (j = 0; j <= MAX_FWD_STATS_IDX; ++j) {
// XXX: Missing FwdReplyCodes[0][i] reporting
for (j = 1; j <= MAX_FWD_STATS_IDX; ++j) {
storeAppendPrintf(s, "\t%d", FwdReplyCodes[j][i]);
}

Expand Down