tzssangglass commented on issue #3740: URL: https://github.com/apache/apisix/issues/3740#issuecomment-789852741
here are the reasons for the bugs I found: 1. the first time execute `curl http://127.0.0.1:9080/hello`, the match rule is verified, and will go to this line https://github.com/apache/apisix/blob/0d40f81259dfc5f18b45579cbc456dbb28b20311/apisix/plugins/traffic-split.lua#L323 2. then `upstream_id` changed from `1` to `2` 3. this change modifies the `ctx.matched_route` table, which is not held by `api_ctx`, so when `api_ctx` is released with the end of request, `matched_route` still exists, I think `matched_route` is the `radixtree_uri.lua`'s module-level variable, which has a lifecycle across requests. 4. on the second request, execute `curl http://127.0.0.1:9080/hello12`, the match rule verification fails, but `matched_route.value.upstream_id` has already been changed to ` `2` by the previous request. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected]
