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
Resource temporarily unavailable with default unix socket configuration #1449
Comments
Hm, that does seem wrong. |
@eprothro I talked to Evan about this, he said this behavior is not intentional and is definitely a bug. We should change the default Unix backlog to 1024. |
Hi all, I have updated to latest version of Puma (3.12.0) and I'm still having the same issue: Nginx returns 502 (Bad Gateway) error codes, and I see error messages like this in the logs:
It only happens when connecting Nginx and Puma using Unix Sockets and under heavy load (300 new connections per second). I have tried setting the backlog to 1024 in the configuration file:
And I have also tried to leave it empty, which should default the value to 1024 as well, but nothing works. Any idea? |
Any news regarding the 5xx error on load? |
I believe the behaviour is influenced by the linux kernel parameters too. I had the same problem but I was able to resolve it as follows: I set I took a look at this example: https://easyengine.io/tutorials/linux/sysctl-conf and changed the default somaxconn from 128 to 4096. You can see the current somaxconn with I also used https://github.com/wg/wrk to load test my demo app Used the default example For starters, I ran only one puma worker behind nginx; the response was very slow but I got no errors in /var/logs/nginx/error.log References: |
Hi @ernestojpg I'm kinda facing the same issue, and the solution of nkokkos doesn't work for me. I guess there's something else involved (linux kernel settings, linux networking settings...) that I didn't find out yet. Did you resolve your issue? If you did, could you share how? 🙏 Thanks |
any more infos on this? when i set worker to 1 no error with worker 2 i get the same errors any idea how to debug this more? |
Same issue here, adding ?backlog=1024 didn't help, any ideas? |
There seems to be similar problem here: https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/5752 From what I read here: https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/5752, it is resolved by setting somaxconn to puma default backlog. So if you set the same number to both somaxconn and backlog, you should be ok? Try this and see if it works: echo 1024 > /proc/sys/net/core/somaxconn stop your puma server set bind 'unix:///tmp/run/puma.sock?backlog=1024' in puma.rb start your puma server See this too: https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/4688 : |
During some recent load testing and optimization, we switched from a TCP socket to UNIX socket.
With high throughput (>500 connections/sec), the client (nginx reverse proxy in this case) experienced errors connecting to the socket. We saw no such issues with the TCP socket.
Trying to isolate/debug I noticed that the default backlog for unix sockets is
nil
(not1024
like with TCP). And further, that with a falsy backlog,listen
is not called on the socket.Setting a backlog (via bind path uri query param) resolved the connection issues in our tests.
Excuse any ignorance as I'm no unix socket expert, but is the
backlog=nil
default and not callinglisten
intentional and desirable for UNIX sockets?If it is intentional/recommended, how should users expect to buffer bursty clients?
If not, I'm happy to issue PR.
The text was updated successfully, but these errors were encountered: