Repository navigation
Conversation
Signed-off-by: Shoujun (Adrian) Diao <shoujun.diao@gmail.com>
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.
Description
When OpenResty drops an expired batch timer at
lua_max_running_timers, its callback never runs and its entries remain pending forever. Enough dropped batches exhaust the manager's backlog limit, so the logger keeps discarding new entries even after timer pressure has ended. A dropped buffer timer also leaves timeout-based flushing disabled.Track scheduled timers until their callbacks begin. One worker-wide
ngx.timer.every()sweep counts overdue, unstarted batches as dropped and restores lost buffer timers. The deadline includes any retry delay plus a one-second grace period. Running callbacks are excluded, and late callbacks cannot send or account for a recovered batch again. Buffer timer tokens keep an old callback from invalidating a replacement.ngx.timer.every()schedules its next tick before OpenResty's running-timer check, so the recovery timer itself can miss a tick under pressure and still resume. Recovery reports aggregate dropped entries per processor.This addresses the dropped-callback case explicitly left out of #14192. It does not include that PR's callback-exception or timer-creation-failure changes.
Which issue(s) this PR fixes:
Fixes #14204
Validation
make lint: passed, including 410 Lua files and test-file style checks.markdownlint-cli@0.25.0, matching the version pinned in CI.t/utils/batch-processor-timer.t: their Lua bodies and output/log expectations passed in an isolated OpenResty 1.29.2.4 runner with real timers. Unrelated APISIX schema, metadata and metrics services used fixtures; this was not the full integration suite. Cases 1, 2, 5 and 6 fail against the unchanged implementation; the normal slow-send and delayed-partial-retry controls pass there.661609084bd88b61c03762f4719e42f06e256af9; the same six isolated regressions passed with both fixes applied.git diff --check: passed.prove -I. t/utils/batch-processor-timer.tcommand could not start becauseTest::Nginx::Socket::Lua::Streamis not installed.Checklist