You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "bakerLecter (via GitHub)" <gi...@apache.org> on 2023/07/04 09:58:36 UTC
[GitHub] [apisix] bakerLecter opened a new issue, #9777: bug: wrong config for plugin workflow caused failed to fetch etcd data problem
bakerLecter opened a new issue, #9777:
URL: https://github.com/apache/apisix/issues/9777
### Current Behavior
Enable Plugin in config and use it restrict some route in dashboard. Because there is no default config sample in dashboard when setting the workflow plugin. So I copy this https://apisix.apache.org/zh/docs/apisix/3.0/plugins/workflow sample to the dashboard and modified it as I expected as below.
```
// I know it's wrong now.
"workflow": {
"_meta": {
"disable": false
},
"actions": [
[
"return",
{
"code": 500
}
]
],
"case": [
[
"uri",
"==",
"/v1/kv.*"
]
]
}
```
After I update this route to apisix, etcd problem pop out at once.
`52#52: *1281175 [lua] config_etcd.lua:595: failed to fetch data from etcd: /usr/local/apisix/apisix/plugins/workflow.lua:118: bad argument #1 to 'ipairs' (table expected, got nil)`
And the route I just add is not available, any new route adding or modified is not working. I remove the plugin from the route and it still working abnormal, but the old routes and plugins are working fine. After I remove the workflow plugin from the route and reboot the apisix, things getting back to normal.
### Expected Behavior
Apisix should warn me for the wrong config in dashboard.
And it should back to normal after I remove the wrong config for plugin workflow without rebooting the whole apisix.
### Error Logs
46#46: *112327 [lua] config_etcd.lua:595: failed to fetch data from etcd: /usr/local/apisix//deps/share/lua/5.1/resty/expr/v1.lua:260: bad argument #1 to 'str_upper' (string expected, got nil)
47#47: *112276 [lua] config_etcd.lua:595: failed to fetch data from etcd: /usr/local/apisix//deps/share/lua/5.1/resty/expr/v1.lua:260: bad argument #1 to 'str_upper' (string expected, got nil)
52#52: *112001 [lua] config_etcd.lua:595: failed to fetch data from etcd: /usr/local/apisix//deps/share/lua/5.1/resty/expr/v1.lua:260: bad argument #1 to 'str_upper' (string expected, got nil)
### Steps to Reproduce
1. Run APISIX(version 3.0.0) with plugin workflow enable
2. Run APISIX Dashboard(version 3.0.1)
3. Adding or modify any route with plugin workflow via dashboard
4. make sure the configuration of plugin workflow is wrong
5. etcd problem should pop up now and any route modified will be failure but without any warning in dashboard
### Environment
- APISIX version (run `apisix version`): version 3.0.0
- Operating system (run `uname -a`):Linux adminapisixgw-6ffb98cb69-5xj9d 4.19.0-10-amd64 #1 SMP Debian 4.19.132-1 (2020-07-24) x86_64 GNU/Linux
- OpenResty / Nginx version (run `openresty -V` or `nginx -V`):nginx version: openresty/1.21.4.1
- APISIX Dashboard version, if relevant: version 3.0.1
- Plugin runner version, for issues related to plugin runners: apisix plguin
- LuaRocks version, for installation issues (run `luarocks --version`): not showing
--
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-unsubscribe@apisix.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] bakerLecter commented on issue #9777: bug: wrong config for plugin workflow caused failed to fetch etcd data problem
Posted by "bakerLecter (via GitHub)" <gi...@apache.org>.
bakerLecter commented on issue #9777:
URL: https://github.com/apache/apisix/issues/9777#issuecomment-1623638594
So strange, this could be something wrong with my environment. Thanks for helping.
--
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-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] jiangfucheng commented on issue #9777: bug: wrong config for plugin workflow caused failed to fetch etcd data problem
Posted by "jiangfucheng (via GitHub)" <gi...@apache.org>.
jiangfucheng commented on issue #9777:
URL: https://github.com/apache/apisix/issues/9777#issuecomment-1620961884
> You said remove the workflow plugin, is that mean you remove the workflow config from route or remove the plugin from apisix at all?
Yes, I removed workflow plugin and reserve other config of the route ,it works well.
--
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-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] jiangfucheng commented on issue #9777: bug: wrong config for plugin workflow caused failed to fetch etcd data problem
Posted by "jiangfucheng (via GitHub)" <gi...@apache.org>.
jiangfucheng commented on issue #9777:
URL: https://github.com/apache/apisix/issues/9777#issuecomment-1620369738
Hi, thanks for you report.
`52#52: *1281175 [lua] config_etcd.lua:595: failed to fetch data from etcd: /usr/local/apisix/apisix/plugins/workflow.lua:118: bad argument #1 to 'ipairs' (table expected, got nil)`
1. For above error, it was schema check error, it casueing null pointer exception. I will fix it.
2.But when I remove workflow plugin, apisix can recognize the route and work normally, it don't need restart apisix.
--
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-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] bakerLecter closed issue #9777: bug: wrong config for plugin workflow caused failed to fetch etcd data problem
Posted by "bakerLecter (via GitHub)" <gi...@apache.org>.
bakerLecter closed issue #9777: bug: wrong config for plugin workflow caused failed to fetch etcd data problem
URL: https://github.com/apache/apisix/issues/9777
--
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-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] jiangfucheng commented on issue #9777: bug: wrong config for plugin workflow caused failed to fetch etcd data problem
Posted by "jiangfucheng (via GitHub)" <gi...@apache.org>.
jiangfucheng commented on issue #9777:
URL: https://github.com/apache/apisix/issues/9777#issuecomment-1621851887
I can't reproduce it, here is my test:
1.set up the route with workflow with right config(via dashboard)
```json
{
"uri": "/*",
"name": "test",
"plugins": {
"workflow": {
"rules": [
{
"actions": [
[
"return",
{
"code": 403
}
]
],
"case": [
[
"uri",
"==",
"/hello/rejected"
]
]
},
{
"actions": [
[
"limit-count",
{
"count": 2,
"rejected_code": 429,
"time_window": 60
}
]
],
"case": [
[
"uri",
"==",
"/hello/v2/appid"
]
]
}
]
}
},
"upstream": {
"nodes": [
{
"host": "127.0.0.1",
"port": 9081,
"weight": 1
}
],
"type": "roundrobin"
},
"status": 1
}
```
2.check the route is working.
```
➜ ~ curl localhost:9080
hello web1%
```
```
➜ ~ curl localhost:9080/hello/rejected -i
HTTP/1.1 403 Forbidden
Date: Wed, 05 Jul 2023 14:11:10 GMT
Content-Type: text/plain; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Server: APISIX/3.3.0
{"error_msg":"rejected by workflow"}
```
3.update workflow plugin with wrong configuration
```
{
"uri": "/*",
"name": "test",
"plugins": {
"workflow": {
"_meta": {
"disable": false
},
"actions": [
[
"return",
{
"code": 500
}
]
],
"case": [
[
"uri",
"==",
"/v1/kv.*"
]
]
}
},
"upstream": {
"nodes": [
{
"host": "127.0.0.1",
"port": 9081,
"weight": 1
}
],
"type": "roundrobin"
},
"status": 1
}
```
4. check if the route is working
```
➜ ~ curl localhost:9080/hello/rejected -i
HTTP/1.1 403 Forbidden
Date: Wed, 05 Jul 2023 14:13:11 GMT
Content-Type: text/plain; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Server: APISIX/3.3.0
{"error_msg":"rejected by workflow"}
➜ ~ curl localhost:9080/v1/kv.1 -i
HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Content-Length: 10
Connection: keep-alive
Date: Wed, 05 Jul 2023 14:13:19 GMT
Server: APISIX/3.3.0
hello web1%
```
5.remote workflow plugin
```
{
"uri": "/*",
"name": "test",
"upstream": {
"nodes": [
{
"host": "127.0.0.1",
"port": 9081,
"weight": 1
}
],
"type": "roundrobin"
},
"status": 1
}
```
6. check result(it works well)
```
➜ ~ curl localhost:9080/hello/rejected -i
HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Content-Length: 10
Connection: keep-alive
Date: Wed, 05 Jul 2023 14:14:37 GMT
Server: APISIX/3.3.0
hello web1%
```
--
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-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] bakerLecter commented on issue #9777: bug: wrong config for plugin workflow caused failed to fetch etcd data problem
Posted by "bakerLecter (via GitHub)" <gi...@apache.org>.
bakerLecter commented on issue #9777:
URL: https://github.com/apache/apisix/issues/9777#issuecomment-1620958468
Thanks for reply. Glad to help.
You said remove the workflow plugin, is that mean you remove the workflow config from route or remove the plugin from apisix at all?
--
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-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] bakerLecter commented on issue #9777: bug: wrong config for plugin workflow caused failed to fetch etcd data problem
Posted by "bakerLecter (via GitHub)" <gi...@apache.org>.
bakerLecter commented on issue #9777:
URL: https://github.com/apache/apisix/issues/9777#issuecomment-1620983422
Here is what I do to reproduce
1.set up the route with workflow with right config(via dashboard)
2.check the route is working(and it is)
3.make the workflow config wrong(via dashboard)
**4.route working just like step 1, modified on step 3 was ignored by gateway.**
5.remove the workflow config from the route and reserve others.(via dashboard)
**6.route still working just like step 1, modified on step 5 was ignored by gateway.**
7.reboot the gateway and things OK now, workflow config remove from the route completely
dashboard do not need to reboot, it working fine on the step above.
--
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-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org