{"action":"created","issue":{"url":"https://api.github.com/repos/Kong/kong/issues/3124","repository_url":"https://api.github.com/repos/Kong/kong","labels_url":"https://api.github.com/repos/Kong/kong/issues/3124/labels{/name}","comments_url":"https://api.github.com/repos/Kong/kong/issues/3124/comments","events_url":"https://api.github.com/repos/Kong/kong/issues/3124/events","html_url":"https://github.com/Kong/kong/issues/3124","id":284490210,"number":3124,"title":"Rate Limiting plugin memory leak issue","user":{"login":"wjxcai","id":6211044,"avatar_url":"https://avatars2.githubusercontent.com/u/6211044?v=4","gravatar_id":"","url":"https://api.github.com/users/wjxcai","html_url":"https://github.com/wjxcai","followers_url":"https://api.github.com/users/wjxcai/followers","following_url":"https://api.github.com/users/wjxcai/following{/other_user}","gists_url":"https://api.github.com/users/wjxcai/gists{/gist_id}","starred_url":"https://api.github.com/users/wjxcai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjxcai/subscriptions","organizations_url":"https://api.github.com/users/wjxcai/orgs","repos_url":"https://api.github.com/users/wjxcai/repos","events_url":"https://api.github.com/users/wjxcai/events{/privacy}","received_events_url":"https://api.github.com/users/wjxcai/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":17,"created_at":"2017-12-26T04:07:30Z","updated_at":"2018-02-15T21:23:04Z","closed_at":null,"author_association":"NONE","body":"### Summary\r\n\r\nAfter set config.second property in ratelimit plugin. The second cache (e.g. dict = kong_cache, key = ratelimit:561f23d4-23d2-4283-9f4c-7c077b5c77d3:118.116.111.5:1514260849000:second, value = 1) will take all cahce memory and never expired. When new API add in or be called. No memory for new API and plugins. Then no memory error show up.\r\n\r\n### Steps To Reproduce\r\n\r\n1. vim kong.conf\r\nmem_cache_size = 100k\r\n2. kong start --vv\r\n3. create 6 APIs\r\n4. Add ratelimit plugin set second \r\n$ curl -X POST http://kong:8001/apis/{api}/plugins \\\r\n    --data \"name=rate-limiting\" \\\r\n    --data \"config.second=100\" \\\r\n    --data \"config.hour=10000\"\r\n5. keep calling the first 5 APIs.\r\n6. After few minutes with no error.\r\n7. call 6th API. you will see the error in error.log \r\n[error] 19343#0: *2427 [lua] responses.lua:107: send_HTTP_INTERNAL_SERVER_ERROR(): failed to get from node cache: could not write to lua_shared_dict: no memory, client: 118.116.111.5, server: kong, request: \"GET /V1/ben_test_1221?auth_key=097C993DF185099B2B7633F4C1778023&t=1514259888796 HTTP/1.1\", host: \"ec2-13-56-255-95.us-west-1.compute.amazonaws.com:8000\"\r\n\r\n### Additional Details & Logs\r\n\r\n- Kong version (0.11.0)\r\n- Kong debug-level startup logs\r\n[startup.log](https://github.com/Kong/kong/files/1586503/startup.log)\r\n- Kong error logs (`<KONG_PREFIX>/logs/error.log`)\r\n[error.log](https://github.com/Kong/kong/files/1586509/error.log)\r\n- Kong configuration (registered APIs/Plugins & configuration file)\r\n- Operating System\r\nubuntu 16.04 LTS"},"comment":{"url":"https://api.github.com/repos/Kong/kong/issues/comments/366066063","html_url":"https://github.com/Kong/kong/issues/3124#issuecomment-366066063","issue_url":"https://api.github.com/repos/Kong/kong/issues/3124","id":366066063,"user":{"login":"davidsiracusa","id":10106082,"avatar_url":"https://avatars3.githubusercontent.com/u/10106082?v=4","gravatar_id":"","url":"https://api.github.com/users/davidsiracusa","html_url":"https://github.com/davidsiracusa","followers_url":"https://api.github.com/users/davidsiracusa/followers","following_url":"https://api.github.com/users/davidsiracusa/following{/other_user}","gists_url":"https://api.github.com/users/davidsiracusa/gists{/gist_id}","starred_url":"https://api.github.com/users/davidsiracusa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidsiracusa/subscriptions","organizations_url":"https://api.github.com/users/davidsiracusa/orgs","repos_url":"https://api.github.com/users/davidsiracusa/repos","events_url":"https://api.github.com/users/davidsiracusa/events{/privacy}","received_events_url":"https://api.github.com/users/davidsiracusa/received_events","type":"User","site_admin":false},"created_at":"2018-02-15T21:23:04Z","updated_at":"2018-02-15T21:23:04Z","author_association":"NONE","body":"Sorry, as mentioned before these incr key/value pairs cannot be reclaimed by the LRU, they persist forever. Only candidates which do specify a ttl fall into the LRU expiry candidate category. Eventually incr uses  enough memory that memory is fully exhausted.  There a window as the ceiling closes in that some LRU eviction of compliant entries may free up holes, at this point \"no memory errors\" are sporadic, as incr closes in, a fatal lack of memory occurs.  This is easily reproduced."}}
{"actor":{"display_login":"davidsiracusa"}}