-
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: file descriptor overflow when use request-id plugin nanoid algorithm #8931
Comments
APISIX uses lua nanoid. It might be caused by the nanoid lib. |
Eureka!The code of lua-resty-nanoid lib does not execute the close method. @tokers |
You may try to submit a PR for the lua-resty-nanoid repo, then let's upgrade the dependency in APISIX. |
Interesting, but I found the upstream lua-resty-nanoid project doesn't provide the "Issues" section... What's more, the |
And I believe lua-resty-nanoid also has a memory leak issue. The ID buffer was allocated by malloc() but was never freed. It should be freed by the caller, i.e., the Lua C interface. |
On the other hand, I almost finished implementing a new Nano ID module for Lua (and C). I'll need to polish a bit more and try to get it onto LuaRocks. And I'll report back then. |
@liweitianux, any updates? |
Sorry. I've finished the nanoid code, but I haven't tried to publish it to LuaRocks yet. Will try it this weekend. |
@liweitianux, looking forward to it. |
Hi @shreemaan-abhishek , so I've polished the nanoid code and submitted it to LuaRocks at https://luarocks.org/modules/liweitianux/lua-nanoid . I've documented the module usage in the README at https://github.com/liweitianux/nanoid . Please give it a try. Sorry for the delay. I'd like it to be used in APISIX, which requires another MR. Let's see. Cheers. |
Furthermore, that code doesn't NUL-terminate the C string, so I sometimes saw garbled code in the generated IDs... It's quite messy. |
@liweitianux I get the following error when installing the luarock:
|
Hi @shreemaan-abhishek , please report the issues regarding my The above issue is because |
Done! |
@liweitianux, any updates? |
@liweitianux @shreemaan-abhishek if its done, we can close the issue now |
My nanoid module should work, although there is more optimization to improve the performance on old systems (e.g., CentOS 7). |
sorry, I haven't paid attention to this place for a long time. I have read your previous discussion, and what I need to do now seems to be in two ways:
|
Hi @aikin-vip,
This should be Cheers. |
Hi @liweitianux |
Description
When i use request-id plugin nanoid algorithm,file descriptor increse to the limit of worker_rlimit_nofile : 20480,then cause the error : Too many open files。
I use lsof -p command, find a lot of file descriptors like this:
openresty 955 nfsnobody 45r CHR 1,9 0t0 71005690 /dev/urandom
openresty 955 nfsnobody 46r CHR 1,9 0t0 71005690 /dev/urandom
openresty 955 nfsnobody 47r CHR 1,9 0t0 71005690 /dev/urandom
openresty 955 nfsnobody 48r CHR 1,9 0t0 71005690 /dev/urandom
openresty 955 nfsnobody 49r CHR 1,9 0t0 71005690 /dev/urandom
openresty 955 nfsnobody 50r CHR 1,9 0t0 71005690 /dev/urandom
Thanks!
Environment
The text was updated successfully, but these errors were encountered: