nginx.org C Module Debugging Best Practices
Comprehensive debugging guide for nginx C modules, derived from the official nginx development documentation and production debugging experience. Contains 45 rules across 8 categories, prioritized by impact to guide systematic diagnosis of crashes, memory bugs, and behavioral issues in nginx modules.
Companion skills: This skill complements nginx-c-modules (correctness) and nginx-c-module-perf-reliability (performance). This skill covers debugging and diagnosis.
When to Apply
Reference these guidelines when:
- Diagnosing nginx worker crashes (segfaults, SIGABRT, SIGSEGV)
- Finding memory bugs (use-after-free, leaks, pool corruption, buffer overruns)
- Setting up GDB and core dump analysis for nginx
- Tracing request flow through phases, subrequests, and filter chains
- Instrumenting nginx modules with debug logging and dynamic tracing tools
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|----------|----------|--------|--------|
| 1 | Crash Diagnosis & Signals | CRITICAL | crash- |
| 2 | Memory Bug Detection | CRITICAL | memdbg- |
| 3 | GDB & Core Dump Analysis | HIGH | gdb- |
| 4 | Request Flow Tracing | HIGH | trace- |
| 5 | Debug Logging Patterns | MEDIUM-HIGH | dbglog- |
| 6 | State & Lifecycle Debugging | MEDIUM | state- |
| 7 | Dynamic Tracing Tools | MEDIUM | probe- |
| 8 | Build & Sanitizer Configuration | LOW-MEDIUM | build- |