Analyzer lj-dump-traces

Name

lj-dump-traces - Dump LuaJIT Traces

This analyzer uses dynamic tracing to capture and display detailed information about JIT-compiled traces in the LuaJIT virtual machine at runtime. It works with applications like OpenResty, Kong, and APISIX to extract trace metadata including trace numbers, parent-child relationships, bytecode locations, machine code addresses, and compilation status. The analyzer helps developers understand JIT compilation behavior, diagnose trace abort issues, analyze trace linking patterns, and optimize hot code paths by revealing which Lua code sections have been successfully compiled to native machine code.

Resource Category

CPU.

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-dump-traces -p PID

# trace a shell command directly
orxray analyzer run lj-dump-traces -c SHELL_CMD

# PGID is the process group ID or any process's PID within the target process
# group.
orxray analyzer run lj-dump-traces -p -PGID

# trace any processes started from the specified executable path.
orxray analyzer run lj-dump-traces --exe /path/to/exe/file

Tracing Multiple Processes

Supported.

Output Formats

  • Plain Texts

Output Example

trace#1:request.lua:165, MCode:0x7f6e1e4bfd51-0x7f6e1e4c0000, startins: 2145388623, startpc: 0x7f6e0e49c730
trace#3:base.lua:252, MCode:0x7f6e1e4bfaf0-0x7f6e1e4bfbc5, startins: 601, startpc: 0x7f6e0e4f0c70

Author

The OpenResty Inc. Team.

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