diff --git a/bin/varnishd/VSC_main.vsc b/bin/varnishd/VSC_main.vsc index fd9a4e68265..f97370cd693 100644 --- a/bin/varnishd/VSC_main.vsc +++ b/bin/varnishd/VSC_main.vsc @@ -30,9 +30,46 @@ .. varnish_vsc:: sess_fail :oneliner: Session accept failures - Count of failures to accept TCP connection. Either the client - changed its mind, or the kernel ran out of some resource like file - descriptors. + Count of failures to accept TCP connection. + + This counter is the sum of the sess_fail_* counters, which + give more detailled information. + +.. varnish_vsc:: sess_fail_econnaborted + :oneliner: Session accept failures: connection aborted + + Detailled reason for sess_fail: Connection aborted by the + client, usually harmless. + +.. varnish_vsc:: sess_fail_eintr + :oneliner: Session accept failures: interrupted system call + + Detailled reason for sess_fail: The accept() call was + interrupted, usually harmless + +.. varnish_vsc:: sess_fail_emfile + :oneliner: Session accept failures: too many open files + + Detailled reason for sess_fail: No file descriptor was + available. Consider raising RLIMIT_NOFILE (see ulimit -n). + +.. varnish_vsc:: sess_fail_ebadf + :oneliner: Session accept failures: bad file descriptor + + Detailled reason for sess_fail: The listen socket file + descriptor was invalid. Should never happen. + +.. varnish_vsc:: sess_fail_enomem + :oneliner: Session accept failures: not enough memory + + Detailled reason for sess_fail: Most likely insufficient + socket buffer memory. Should never happen + +.. varnish_vsc:: sess_fail_other + :oneliner: Session accept failures: other + + Detailled reason for sess_fail: neither of the above, see + Debug log (varnishlog -g raw -I Debug:^Accept). .. varnish_vsc:: client_req_400 :oneliner: Client requests received, subject to 400 errors diff --git a/bin/varnishd/cache/cache_acceptor.c b/bin/varnishd/cache/cache_acceptor.c index 6973d01d8b5..455697fe1f4 100644 --- a/bin/varnishd/cache/cache_acceptor.c +++ b/bin/varnishd/cache/cache_acceptor.c @@ -489,23 +489,32 @@ vca_accept_task(struct worker *wrk, void *arg) if (i < 0) { switch (errno) { case ECONNABORTED: + wrk->stats->sess_fail_econnaborted++; + break; + case EINTR: + wrk->stats->sess_fail_eintr++; break; case EMFILE: - VSL(SLT_Debug, ls->sock, "Too many open files"); + wrk->stats->sess_fail_emfile++; vca_pace_bad(); break; case EBADF: - VSL(SLT_Debug, ls->sock, "Accept failed: %s", - strerror(errno)); + wrk->stats->sess_fail_ebadf++; + vca_pace_bad(); + break; + case ENOBUFS: + case ENOMEM: + wrk->stats->sess_fail_enomem++; vca_pace_bad(); break; default: - VSL(SLT_Debug, ls->sock, "Accept failed: %s", - strerror(errno)); + wrk->stats->sess_fail_other++; vca_pace_bad(); break; } wrk->stats->sess_fail++; + VSL(SLT_Debug, ls->sock, "Accept failed: %s", + strerror(errno)); (void)Pool_TrySumstat(wrk); continue; }