r13388 (cache_peer standby=N) moved noteUses() call from Comm to FwdState, to
avoid exposing Comm to pconn pools. Unfortunately, the closing handler does
not get a valid FD value when the closing callback shares the Connection
object with the code that called conn->close(). It gets -1. The FD of the
FwdState connection itself is already -1 at that point, for similar reasons.
The code thinks it got a matching FD and calls noteUses() with an invalid FD.
This temporary workaround prevents noteUses() calls when FD is unknown.
Without those calls, pconn usage statistics will be wrong. A different
long-term solution is needed.
{
debugs(17, 2, "FD " << fd << " " << entry->url() << " after " <<
fd_table[fd].pconn.uses << " requests");
- if (serverConnection()->fd == fd) // should be, but not critical to assert
+ if (fd >= 0 && serverConnection()->fd == fd) // XXX: fd is often -1 here
fwdPconnPool->noteUses(fd_table[fd].pconn.uses);
retryOrBail();
}