-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
help request: traffic-split plugin occurs error #9831
Comments
what I concern is in the following code: traffic-split.lua code A:
` it also have a lru cache
` when traffic-split config is the following:
` if the request hit the following config:
` so this time. the upstream_obj has upstream_obj.upstream. it is "plugin#upstream#is#empty". and it's type is string. so next time. when another request comes. the lrucache also exists. so it hit :
` I don't know if it is true, so please evalute it. thanks a lot. |
@lingsamuel Please assign this to me. |
@jujiale I am investigating this. Although what you said made sense at first but the |
@jujiale I am not able repro this with your configuration. Can you send the exact route configuration present in running APISIX on the route where you get this error? |
thanks a lot. I will try my best to reproduce it. once get it, I will present it. |
@Revolyssup hello, as you said. though the hope for your reply, thanks |
@jujiale The caching is done on the whole plugin config and not just the weighted upstreams field, so that if the config passed is the same then we can use the result in the cache. |
@Revolyssup this problem occurs in our prod env, and it is not occurs always. after several days. it will have some error like this. I try my best to reproduce it in my local env. but failed. I will do some research on this. it seems this could occurs in some occasional situation. just as I methioned in #5607 , there is other man who also suffered such problem. |
what you want to do ? |
when the error occurs: if we reput the config in etcd again(config is not changed, such as just replace A with A) through apisix-dashboard, the error immediately vanish, and everything is ok, but after several time, the error occurs yet. |
@jujiale Before reputting the config in etcd, can you check what is the config value for traffic split plugin in etcd at the time of error? |
Though I created a PR here #9995 to make sure that upstream is an object for the logic to go there, it still needs to be debugged on etcd's end on why and how the config is being manipulated. |
Summarising the issue and fix:
|
no, because I donnot have the prod env permission. in my dev env, I cannot reproduce it. so I also add some logic in order the upstream is obj , is not string |
@jujiale Did you set the upstream via the dashboard on the prod env? |
as we know, dashboard is composed of dashboard-portal and dashboard-backend-api, we use our own portal and dashboard-api set the config. |
Did you add the schema check for the property |
if this problem reason is your thought. I think it should be occur frequently, but when we reput the config, the problem is vanish, after several days or sever week, it suddenly occurs. |
I will close this issue now considering that this is an issue related to data corruption in etcd. We can reopen this is other users experience the same issue. |
fixed by #11932 |
Description
hello.
as this issue methioned: #5607
I also suffered such a situation. but I can not reproduce it. the error log is :
`
`
according the source code. when the traffic-split plugin config "weighted_upstreams" . it's element has no property "upstream". but have property "upstream_id", it should not invode the follwing code (line 209, because elseif upstream_obj.upstream then return false )
![image](https://private-user-images.githubusercontent.com/48037235/253203091-1f602a6c-318e-45dd-8764-a0357fde732a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNjUwNzAsIm5iZiI6MTczOTM2NDc3MCwicGF0aCI6Ii80ODAzNzIzNS8yNTMyMDMwOTEtMWY2MDJhNmMtMzE4ZS00NWRkLTg3NjQtYTAzNTdmZGU3MzJhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDEyNTI1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM0NjIyM2YxNzJiYWUzZjVmZmQ5MjUwMzRjM2U4YzMwZGI3N2ExMTA5ZTBkNjQ5NzEwNDlhMjFhZjkwMTllYTQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.mxPWOT7jfmGXQkIayZrUbLrSr1dbCZ4vw1ExJR1Z95s)
so I confused why line 209 is invoked.
traffic_split config is below:
`
}
`
Environment
apisix version
): v2.12.0uname -a
):openresty -V
ornginx -V
):curl http://127.0.0.1:9090/v1/server_info
):3.5.0luarocks --version
):The text was updated successfully, but these errors were encountered: