auto-ssl / auto-ssl/lua-resty-auto-ssl
Couldn't obtain lock and too many open files error
- Dominant language
- Lua
- Stars
- 2k
- Forks
- 184
- PR merge metrics
- No merged PRs in 30d
Description
Hi everyone!
I am using OpenResty and lua-resty-auto-ssl to generate SSL on the fly. OpenResty is acting as a reverse proxy to our Node.js app. It works great, but sometimes it just crashes with the following errors and never recovers.
```
issue_cert(): auto-ssl: failed to obtain lock: timeout, context: ssl_certificate_by_lua*,
```
and
```
[crit] 30999#0: accept4() failed (24: Too many open files)
```
I have to manually kill the process and restart to make it work. What could be the reason?
### Some Info
OpenResty version: 1.11.2.2
lua-resty-auto-ssl: 0.12.0-1
Single core CPU with 3GB RAM
lua_shared_dict auto_ssl: 1024m;
lua_shared_dict auto_ssl_settings: 64k;
Also, it appears that this error occurs whenever there is an SSL generation error for specific domains. This issue might even be related to [this](https://github.com/GUI/lua-resty-auto-ssl/issues/136) -- I am not entirely sure though. Any help will be highly appreciated. :)
### Update
Further investigation revealed that this happens whenever the certification generation is not able to complete for any reason. For example, when any domain is behind Cloudflare, the SSL generation fails and OpenResty becomes unresponsive.
Sandeep
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the ssl_certificate_by_lua* entry point and trace the lock acquisition and certificate-generation path described in the report. Reproduce a failed generation, such as for a domain behind Cloudflare, while monitoring the lock timeout and open-file error. Done means the failure is explained and the process no longer becomes unresponsive after certificate generation cannot complete.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, nginx, node.js
- Domain
- backend, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100