obs: permanent structured emit-decision debug logging#37
Merged
Conversation
Add gated ngx_log_debug at the output emit-decision point in ngx_http_zstd_filter_compress: zstd emit?: outsz:N rc0:N last:N ctx_last:N ctx_flush:N action:N zstd emit: suppressed empty non-terminal buffer NGX_DEBUG-gated (the ngx_log_debug* macros compile to nothing in release builds), so zero runtime cost when off; visible with `error_log ... debug`. Behaviour is unchanged — this only observes the existing guard, it does not alter it. Rationale: this module has a recurring truncation / zero-size-buffer / terminal-frame bug class (a209f96, 2af5889, PR#23/#49, the 2026-05 bug B). Every prior diagnosis required temporarily patching in debug lines and rebuilding, repeatedly. This makes the single most diagnostic probe permanent: the exact state the emit guard saw. Verified during bug-B work — it immediately exposed the forced-flush mechanism without a patch/rebuild loop. Builds clean under the project -Werror flags (nginx 1.31.0).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds two gated
ngx_log_debugcalls at the output emit-decision point inngx_http_zstd_filter_compress:NGX_DEBUG-gated (thengx_log_debug*macros expand to nothing in release builds) → zero runtime cost when off, visible witherror_log ... debug. No behaviour change — it only observes the existing guard.Why
This module has a recurring truncation / zero-size-buffer / terminal-frame bug class (
a209f96,2af5889, PR#23/#49, the in-progress bug B). Every prior diagnosis required temporarily patching debug lines in and rebuilding — repeatedly, this session included. This makes the single most diagnostic probe permanent: exactly what state the emit guard saw and why it suppressed/forwarded a buffer. During bug-B investigation it immediately exposed the forced-flush-under-proxy_buffering offmechanism with no patch/rebuild loop.Scope
Observability only. This is not the bug-B fix (that is unsolved and tracked separately in
BUG-B-PLAN.md/BUG-B-RUNBOOK.md). Shipping this independently so the diagnostic exists in tree for the ongoing investigation and future regressions.Verification
-Werror -Wallflags (nginx 1.31.0).ngx_log_debugblocks).