Skip to content

Commit

Permalink
sess_fail_* detailled accept error counters
Browse files Browse the repository at this point in the history
We already emitted Debug log records for accept failures, but for
all practical purposes this is useless for forensics.

These counters will point directly to the root cause for the most
common issues with sess_fail (accept failures). sess_fail is preserved
as an overall counter as it will most likely be already monitored for
many installations.

Ref	varnishcache#2622
  • Loading branch information
nigoroll committed Apr 4, 2018
1 parent 929dd59 commit 2511e6d
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 8 deletions.
43 changes: 40 additions & 3 deletions bin/varnishd/VSC_main.vsc
Expand Up @@ -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
Expand Down
19 changes: 14 additions & 5 deletions bin/varnishd/cache/cache_acceptor.c
Expand Up @@ -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;
}
Expand Down

0 comments on commit 2511e6d

Please sign in to comment.