[GitHub] [apisix] tzssangglass commented on issue #8118: help request: The upstream route selection affects the next request

2022-10-20 Thread GitBox


tzssangglass commented on issue #8118:
URL: https://github.com/apache/apisix/issues/8118#issuecomment-1285508116

   ok


-- 
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: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [apisix] tzssangglass commented on issue #8118: help request: The upstream route selection affects the next request

2022-10-19 Thread GitBox


tzssangglass commented on issue #8118:
URL: https://github.com/apache/apisix/issues/8118#issuecomment-1284170951

   ref: 
https://github.com/apache/apisix/blob/332928e0d2c519b68279273394687ac72e492c38/apisix/plugins/traffic-split.lua#L148-L192
   
   you can learn from `traffic-split` code, `new_nodes` and `up_conf ` are new 
tables. don't change `up_conf.nodes`, deepcopy `up_conf.nodes` and use the copy 
object. 


-- 
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: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [apisix] tzssangglass commented on issue #8118: help request: The upstream route selection affects the next request

2022-10-19 Thread GitBox


tzssangglass commented on issue #8118:
URL: https://github.com/apache/apisix/issues/8118#issuecomment-1284022125

   I think you can try the traffic-split plugin. After looking at your code, I 
think that traffic-split can do the job of splitting traffic based on headers


-- 
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: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [apisix] tzssangglass commented on issue #8118: help request: The upstream route selection affects the next request

2022-10-19 Thread GitBox


tzssangglass commented on issue #8118:
URL: https://github.com/apache/apisix/issues/8118#issuecomment-1283979949

   > 是的 目前定位到在经过init.lua _M.http_access_phase() 
router.router_http.match(api_ctx) —> radixtree_uri.lua _M.match(api_ctx)—> 
radixtree_uri.lua base_router.match_uri(uri_router, match_opts, api_ctx) 
—>route.lua _M.match_uri(uri_router, match_opts, api_ctx) 经过 local ok = 
uri_router:dispatch(api_ctx.var.uri, match_opts, api_ctx, match_opts) 
一行获取到的match_opts中 matched_route upstream node为上次修改后的upstream api_ctx参数中也如此
   
   I reproduced the problem you mentioned.
   
   I found out first because `up_conf.nodes` came from `matched_route`, and 
`matched_route` came from the `route` when `creating 
create_radixtree_uri_router`, which is cross-requested.
   
   In short, the `up_conf.nodes` you modified is cross-request, and we should 
not modify `up_conf.nodes` directly.
   
   you can deepcopy `up_conf.nodes` and use the copy object.


-- 
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: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [apisix] tzssangglass commented on issue #8118: help request: The upstream route selection affects the next request

2022-10-19 Thread GitBox


tzssangglass commented on issue #8118:
URL: https://github.com/apache/apisix/issues/8118#issuecomment-1283903252

   > In addition, please consult uri_router:dispatch(api_ctx. var.uri, 
match_opts, api_ctx, match_opts), where this method is defined, I can't point 
it here
   
   
https://github.com/api7/lua-resty-radixtree/blob/master/lib/resty/radixtree.lua#L687


-- 
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: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [apisix] tzssangglass commented on issue #8118: help request: The upstream route selection affects the next request

2022-10-19 Thread GitBox


tzssangglass commented on issue #8118:
URL: https://github.com/apache/apisix/issues/8118#issuecomment-1283629880

   > 但是发现下次请求时init.lua 中api_ctx 的node (字段:matched_route value upstream 
node)仍为上次筛选过的node, 非etcd中存储的全量 请问是否存在数据污染问题?
   
   Are you saying that if the nodes in the `matched_upstream` are modified in 
the first request, the nodes in the `matched_upstream` in the next request will 
be the ones modified 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.

To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [apisix] tzssangglass commented on issue #8118: help request: The upstream route selection affects the next request

2022-10-19 Thread GitBox


tzssangglass commented on issue #8118:
URL: https://github.com/apache/apisix/issues/8118#issuecomment-1283616691

   > 但是发现下次请求时init.lua 中api_ctx 的node (字段:matched_route value upstream 
node)仍为上次筛选过的node,
   
   The `api_ctx` stores per-request data, and the nodes are also the upstream 
nodes associated with the current matching route.
   
   Modifying the nodes in the `api_ctx` of the current request does not affect 
the nodes in the `api_ctx` of the next request, by design.


-- 
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: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org