nic-6443 opened a new pull request, #13512: URL: https://github.com/apache/apisix/pull/13512
### Description When the `workflow` plugin is configured in a global rule with a `limit-conn` action, and a route-level plugin finishes the request in the rewrite phase (e.g. `cors` answering an OPTIONS preflight with 200), every such request floods the error log with: ``` failed to run log_by_lua*: apisix/plugins/workflow.lua:182: attempt to index field '_workflow_cache' (a nil value) ``` The log handler introduced in #12465 assumes `ctx._workflow_cache` always exists, but it is only created in the access phase. Route plugins' rewrite phase runs before the global rule's access phase, so when rewrite short-circuits the request, `workflow.access` never runs while `workflow.log` still does (the log phase always runs global rules). This PR returns early from `workflow.log` when `ctx._workflow_cache` is missing. This is safe: if the access phase never ran, no `limit-conn` counter was incremented, so there is nothing to clean up in the log phase. #### Which issue(s) this PR fixes: Fixes #13479 ### 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 - [ ] 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]
