Analyzer lj-tab-chain-loops

Name

lj-tab-chain-loops - Find loops in LuaJIT table node chains.

This analyzer detects circular references in LuaJIT table hash chain structures within OpenResty, Kong, and APISIX applications. It examines the internal node chain pointers to identify infinite loops that can cause memory corruption or application hangs. The analyzer generates bar charts displaying the count and location of detected loops, helping troubleshoot table-related memory issues and prevent runtime failures.

Resource Category

Memory.

Application Type & Technical Stack

  • OpenResty
  • 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 lj-tab-chain-loops -p PID

# trace a shell command directly
orxray analyzer run lj-tab-chain-loops -c SHELL_CMD

Tracing Multiple Processes

Not supported.

Output Formats

  • Bar Charts
  • Plain Texts

Output Example

[
  {
      "title": "Find Loops in LuaJIT Table Node Chains",
      "subtitle": "",
      "series": {
          "data": {
              "Hash table chains": 54826,
              "Loops": 0,
              "Lua tables": 10218,
              "Hash table nodes": 74958
          },
          "name": "Count"
      },
      "ver": 1,
      "type": "bar"
  }
]

Author

The OpenResty Inc. Team.

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