diaosj opened a new pull request, #14208:
URL: https://github.com/apache/apisix/pull/14208

   ### 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.
   - Both changed documents passed `[email protected]`, matching the 
version pinned in CI.
   - Six regression cases in `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.
   - The final patch merged cleanly in temporary files with #14192 at 
`661609084bd88b61c03762f4719e42f06e256af9`; the same six isolated regressions 
passed with both fixes applied.
   - `git diff --check`: passed.
   - Full Test::Nginx execution is pending CI. The local `prove -I. 
t/utils/batch-processor-timer.t` command could not start because 
`Test::Nginx::Socket::Lua::Stream` is not installed.
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [x] I have updated the documentation to reflect this change
   - [x] I have verified that this change is backward compatible (If not, 
please discuss on the [APISIX mailing 
list](https://github.com/apache/apisix/tree/master#community) first)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to