You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/06/06 07:27:00 UTC

[GitHub] [incubator-apisix] Firstsawyou commented on issue #1622: bug: After the plug-in registered for global rule is deleted, all requests for access are abnormal

Firstsawyou commented on issue #1622:
URL: https://github.com/apache/incubator-apisix/issues/1622#issuecomment-640003015


   > > all requests are abnormal.
   > 
   > What is the specific abnormal?
   > Can you give a reproducible example?
   
   1、Register two routes(Upstream_id is local nginx service):
   1)、
   curl http://127.0.0.1:9080/apisix/admin/routes/3 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
   { "uris":["/test01"],
     "upstream_id":"00000000000000000451",
      "plugins":{}
   }'
   
   2)、
   curl http://127.0.0.1:9080/apisix/admin/routes/4 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
   { "uris":["/test02"],
     "upstream_id":"00000000000000000452",
      "plugins":{}
   }'
   
   2、Register global route(limit-count plug-in):
   
   curl http://127.0.01:9080/apisix/admin/global_rules/1  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '{
    "plugins": {
         "limit-count": {
          "time_window": 60,
          "policy": "local",
           "count": 4,
          "key": "remote_addr",
          "rejected_code": 503
         }
      }
   }'
   
   3、Route access test(Normal before global route is deleted):
   1)、access '/test01' route:
   curl http://127.0.0.1:9080/test01
   ----responce data----
   test01
   -----------------------
   
   2)、access '/test02' route:
   curl http://127.0.0.1:9080/test02
   ----responce data----
   test02
   -------------------------
   
   3)、More than 4 requests, global plug-in takes effect:
    curl -l http://127.0.0.1:9080/test02
   ----responce data----
   <html>
   <head><title>503 Service Temporarily Unavailable</title></head>
   <body>
   <center><h1>503 Service Temporarily Unavailable</h1></center>
   <hr><center>openresty</center>
   </body>
   </html>
   ----------------------
   
   
   4、Delete global routing configuration, all requests are abnormal:
   
   1)Delete global routing configuration:
   curl http://127.0.01:9080/apisix/admin/global_rules/1  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X DELETE
   --------responce data----------------
   {"node":{"createdIndex":954,"key":"\/apisix\/global_rules\/1","modifiedIndex":955},"prevNode":{"value":"{\"plugins\":{\"limit-count\":{\"time_window\":60,\"policy\":\"local\",\"rejected_code\":503,\"key\":\"remote_addr\",\"count\":4}}}","createdIndex":954,"key":"\/apisix\/global_rules\/1","modifiedIndex":954},"action":"delete"}
   -----------------------------------------
   
   2)、access '/test01' route:
   curl  http://127.0.0.1:9080/test01
   --------responce data----------------
   curl: (52) Empty reply from server
   ---------------------------------------
   
   3)、access '/test02' route:
   curl  http://127.0.0.1:9080/test02
   --------responce data----------------
   curl: (52) Empty reply from server
   ---------------------------------------
   
   3)、View error log prompts:
   2020/06/06 15:21:39 [error] 11960#11960: *80587 lua entry thread aborted: runtime error: /usr/local/apisix/apisix/init.lua:268: attempt to index local 'global_rule' (a boolean value)
   stack traceback:
   coroutine 0:
   	/usr/local/apisix/apisix/init.lua: in function 'http_access_phase'
   	access_by_lua(nginx.conf:179):2: in main chunk, client: 127.0.0.1, server: , request: "GET /test01 HTTP/1.1", host: "127.0.0.1:9080"
   2020/06/06 15:21:39 [error] 11960#11960: *80587 failed to run header_filter_by_lua*: /usr/local/apisix/apisix/plugin.lua:237: attempt to index local 'user_route' (a boolean value)
   stack traceback:
   	/usr/local/apisix/apisix/plugin.lua:237: in function 'filter'
   	/usr/local/apisix/apisix/init.lua:456: in function 'common_phase'
   	/usr/local/apisix/apisix/init.lua:466: in function 'http_header_filter_phase'
   	header_filter_by_lua:2: in main chunk, client: 127.0.0.1, server: , request: "GET /test01 HTTP/1.1", host: "127.0.0.1:9080"
   2020/06/06 15:21:39 [error] 11960#11960: *80587 failed to run log_by_lua*: /usr/local/apisix/apisix/plugin.lua:237: attempt to index local 'user_route' (a boolean value)
   stack traceback:
   	/usr/local/apisix/apisix/plugin.lua:237: in function 'filter'
   	/usr/local/apisix/apisix/init.lua:456: in function 'common_phase'
   	/usr/local/apisix/apisix/init.lua:475: in function 'http_log_phase'
   	log_by_lua(nginx.conf:259):2: in main chunk while logging request, client: 127.0.0.1, server: , request: "GET /test01 HTTP/1.1", host: "127.0.0.1:9080"
   
   
   5、After restart of apsix, all requests return to normal
   1)、# apisix restart
   2)、access '/test01' route:
   curl http://127.0.0.1:9080/test01
   ----responce data----
   test01
   -----------------------
   
   3)、access '/test02' route:
   curl http://127.0.0.1:9080/test02
   ----responce data----
   test02
   -------------------------


----------------------------------------------------------------
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:
users@infra.apache.org