0

I'm trying to set up a unix socket for gunicorn and to ping it from curl (running curl --unix-socket /run/gunicorn.sock http://www.example.com --trace-ascii dump.txt). Unfortunately, the response from Curl Each time is a curl: (56) Recv failure: Connection reset by peer .

Looking into the dump log, it shows :

# cat dump.txt 
== Info: About to connect() to www.example.com port 80 (#0)
== Info:   Trying /run/gunicorn.sock...
== Info: Failed to set TCP_KEEPIDLE on fd 4
== Info: Failed to set TCP_KEEPINTVL on fd 4
== Info: Connected to www.example.com (/run/gunicorn.sock) port 80 (#0)
=> Send header, 79 bytes (0x4f)
0000: GET / HTTP/1.1
0010: User-Agent: curl/7.29.0
0029: Host: www.example.com
0040: Accept: */*
004d: 
== Info: Recv failure: Connection reset by peer
== Info: Closing connection 0

I can see that there is a hangup with setting TCP_KEEPIDLE and TCP_KEEPINTVL on fd (file descriptor ?) 4, but not sure what I can do to fix that.

My gunicorn.sock file looks like this :

[Unit]
Description=gunicorn socket

[Socket]
ListenStream=/run/gunicorn.sock

[Install]
WantedBy=sockets.target

Edit : I'm trying to follow this guide : https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-18-04

NSinha
  • 1
  • 2
  • *"I can see that there is a hangup with setting TCP_KEEPIDLE and TCP_KEEPINTVL on fd (file descriptor ?) 4, but not sure what I can do to fix that."* - There is nothing to fix here. These are simply socket options which are relevant for TCP and cannot be set on a UNIX domain socket. But these options are not actually needed to provide the functionality. The real problem is the connection reset from the server. You need to look at the server side (logs etc) on why this happens. – Steffen Ullrich May 15 '21 at 07:00
  • @SteffenUllrich Thanks for the suggestion. It seems that there was a user permission issue somewhere. Switching to the root user fixed it, so that's probably the way to trace out which file's ownership is messed up. – NSinha May 15 '21 at 10:00

0 Answers0