nic-6443 opened a new pull request, #13901: URL: https://github.com/apache/apisix/pull/13901
### Description `traffic-label`'s `access()` compiles each rule's `match` expression on the first request and stores the result in `conf.rules_arr` — inside the plugin configuration itself. For the `ipmatch` operator, `resty.expr` compiles the right-hand side into an `ipmatcher` (`resty/expr/v1.lua`), and an ipmatcher's `ipv4` / `ipv4_mask` lookup tables are keyed by integers (the 32-bit address and the prefix length). cjson refuses to serialise such a table: ``` failed to encode: Cannot serialise table: excessively sparse array force: true ``` So from the first request that reaches the plugin onwards, the route configuration can no longer be JSON encoded. With the error log at `info` level, every line that dumps the route comes out empty and each one emits two warnings (`log_wrapper` evaluates a `__tostring` argument twice): ``` [warn] json.lua:179: failed to encode: Cannot serialise table: excessively sparse array force: true [warn] json.lua:179: failed to encode: Cannot serialise table: excessively sparse array force: true [info] init.lua:862: http_access_phase(): matched route: ``` `matched route`, `insert uri route` and `route conf` are all affected, i.e. the debugging output you turned `info` on for is exactly what is lost. Cache the compiled expressions in an lrucache keyed by `conf.rules` instead — the same way the plugin already caches its round-robin objects — and leave the configuration untouched. ### Which issue(s) this PR fixes N/A ### 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 -- 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]
