Analyzer ngx-dump-timers

Name

ngx-dump-timers - Dump nginx timers in the rbtree

This analyzer dumps all active timers in the nginx event timer red-black tree. It outputs timer handler functions along with the count of timers associated with each handler, providing a comprehensive view of scheduled timer events. This is useful for diagnosing timer-related issues, understanding event scheduling patterns, and identifying potential timer leaks or misconfigurations in nginx-based applications such as OpenResty, Kong, and APISIX.

Resource Category

Miscellaneous.

Application Type & Technical Stack

  • OpenResty
  • Nginx
  • Kong
  • APISIX

Command Line Syntax

The analyzer can be invoked directly on the command-line via the orxray utility from the openresty-xray-cli software package.

Alternatively, the analyzer can also be invoked manually or automatically on the web console UI of OpenResty XRay (like on the Advanced web page).

# PID is the target process PID.
orxray analyzer run ngx-dump-timers -p PID

# trace a shell command directly
orxray analyzer run ngx-dump-timers -c SHELL_CMD

Tracing Multiple Processes

Not supported.

Output Formats

  • Tables
  • Plain Texts

Output Example

[
  {
      "data": [
          [
              "handler function",
              "timers count"
          ],
          [
              "ngx_http_lua_pipe_reap_timer_handler",
              "1"
          ]
      ],
      "title": "cancelable timers",
      "type": "table",
      "ver": 1
  },
  {
      "data": [
          [
              "handler function",
              "timers count"
          ],
          [
              "ngx_http_upstream_handler",
              "37"
          ],
          [
              "ngx_http_lua_timer_handler",
              "28"
          ],
          [
              "ngx_quic_input_handler",
              "4"
          ],
          [
              "ngx_stream_lua_request_handler",
              "2"
          ],
          [
              "ngx_stream_lua_timer_handler",
              "5"
          ],
          [
              "ngx_http_lua_balancer_close_handler",
              "11"
          ],
          [
              "ngx_http_lua_sema_timeout_handler",
              "2"
          ],
          [
              "ngx_stream_lua_sema_timeout_handler",
              "1"
          ],
          [
              "ngx_stream_lua_socket_tcp_handler",
              "1"
          ],
          [
              "ngx_http_keepalive_handler",
              "5"
          ],
          [
              "ngx_http_v2_idle_handler",
              "15"
          ],
          [
              "ngx_http_lua_socket_keepalive_rev_handler",
              "3"
          ],
          [
              "ngx_http_lua_socket_tcp_handler",
              "2"
          ],
          [
              "ngx_http_v3_keepalive_handler",
              "4"
          ]
      ],
      "title": "no cancelable timers",
      "type": "table",
      "ver": 1
  }
]

Author

The OpenResty Inc. Team.

Copyright (C) by OpenResty Inc. All rights reserved.