Reference
debug counters
Show internal counters placed in the code. This may include glitch counters, bug counters, or other counters placed in the load balancer code using the COUNT_IF()
macro. This feature is primarily aimed at developers, though you may be asked to run this command during a troubleshooting session.
Description Jump to heading
Developers can use the COUNT_IF()
macro during development to place arbitrary event counters anywhere in the load balancer code and check the counters’ values at runtime. For example, glitch counters can provide useful information when they are increasing even though no request is instantiated or no log is produced.
While diagnosing a problem, you might be asked by a developer to run the command such as debug counters show <filter>
to list all available counters of a specific type. The counters are listed along with their count, type, location in the code (file name and line number), function name, the condition that triggered the counter, and any associated description.
The debug counters
command takes one of two optional actions, either show
or reset
. The default action is show
if no action is specified. The available filters for this command are as follows:
Option | Description |
---|---|
bug |
Enables listing the counters for BUG_ON() statements. |
cnt |
Enables listing the counters for COUNT_IF() statements. |
chk |
Enables listing the counters for CHECK_IF() statements. |
glt |
Enables listing the counters for COUNT_GLITCH() statements. |
all |
Enables showing counters that never triggered (value 0). |
Examples Jump to heading
In this example, we use the debug counters all
command to show all counters currently active in the load balancer code with a count of 0. Note that the format and contents of the output may change across versions and should only be used when requested during a debugging session.
Example #1:
Use debug counters all
to show all counters with a value of 0:
nix
echo "debug counters all" | \sudo socat stdio tcp4-connect:127.0.0.1:9999
nix
echo "debug counters all" | \sudo socat stdio tcp4-connect:127.0.0.1:9999
The output may be very extensive depending on how many counters are present. It is shortened for this example:
outputtext
Count Type Location function(): "condition" [comment]0 CHK ev_epoll.c:61 __fd_clo(): "tgid != tgrp && !thread_isolated()"0 BUG ssl_sock.c:6236 ssl_sock_set_servername(): "!(conn->flags & CO_FL_SSL_WAIT_HS)"0 CNT mux_h1.c:5104 h1_fastfwd(): "h1m->state < H1_MSG_DONE" [H1C ERROR before the end of the message][...]
outputtext
Count Type Location function(): "condition" [comment]0 CHK ev_epoll.c:61 __fd_clo(): "tgid != tgrp && !thread_isolated()"0 BUG ssl_sock.c:6236 ssl_sock_set_servername(): "!(conn->flags & CO_FL_SSL_WAIT_HS)"0 CNT mux_h1.c:5104 h1_fastfwd(): "h1m->state < H1_MSG_DONE" [H1C ERROR before the end of the message][...]
Example #2:
Use debug counters reset
to reset the counters to zero.
nix
echo "debug counters reset" | \sudo socat stdio tcp4-connect:127.0.0.1:9999
nix
echo "debug counters reset" | \sudo socat stdio tcp4-connect:127.0.0.1:9999
There is no output from this command.
Do you have any suggestions on how we can improve the content of this page?