Question

gunicorn.socket: Failed with result 'service-start-limit-hit'

Posted June 5, 2021 2.9k views
NginxDigitalOceanDjangoInitial Server SetupUbuntu 20.04

As i was following the guide
https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-20-04

when i used

sudo journalctl -u gunicorn.socket
-- Logs begin at Mon 2021-05-31 02:03:42 UTC, end at Sat 2021-06-05 13:11:38 UTC. --
Jun 02 11:04:28 ubuntu-s-1vcpu-1gb-blr1-01 systemd[1]: Listening on gunicorn socket.
Jun 02 11:06:38 ubuntu-s-1vcpu-1gb-blr1-01 systemd[1]: gunicorn.socket: Failed with result 'service-start-limit-hit'.
Jun 02 11:12:10 ubuntu-s-1vcpu-1gb-blr1-01 systemd[1]: Listening on gunicorn socket.
Jun 02 15:01:32 ubuntu-s-1vcpu-1gb-blr1-01 systemd[1]: gunicorn.socket: Failed with result 'service-start-limit-hit'.
Jun 02 15:15:35 ubuntu-s-1vcpu-1gb-blr1-01 systemd[1]: Listening on gunicorn socket.
Jun 02 15:18:37 ubuntu-s-1vcpu-1gb-blr1-01 systemd[1]: gunicorn.socket: Failed with result 'service-start-limit-hit'.
-- Reboot --
Jun 02 15:20:08 ubuntu-s-1vcpu-1gb-blr1-01 systemd[1]: Listening on gunicorn socket.
Jun 02 15:22:28 ubuntu-s-1vcpu-1gb-blr1-01 systemd[1]: gunicorn.socket: Failed with result 'service-start-limit-hit'.
Jun 02 15:23:31 ubuntu-s-1vcpu-1gb-blr1-01 systemd[1]: Listening on gunicorn socket.
Jun 02 15:43:25 ubuntu-s-1vcpu-1gb-blr1-01 systemd[1]: gunicorn.socket: Failed with result 'service-start-limit-hit'.
Jun 02 15:46:44 ubuntu-s-1vcpu-1gb-blr1-01 systemd[1]: Listening on gunicorn socket.

my gunicorn.socket file

[Unit]
Description=gunicorn socket

[Socket]
ListenStream=/run/gunicorn.sock

[Install]
WantedBy=sockets.target

my gunicorn.service file


[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target

[Service]
User=developer
Group=www-data
WorkingDirectory=/home/developer/myprojectdir
ExecStart=/home/developer/myprojectdir/myprojectenv/bin/gunicorn \
          --access-logfile - \
          --workers 3 \
          --bind unix:/run/gunicorn.sock \
          bharathwajan.wsgi:application

[Install]
WantedBy=multi-user.target

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi @apothecaryre,

It might be a good idea to look at the error message. Unfortunately, you only provided a fragment of the error message: Failed with result ‘service-start-limit-hit’.

Please check the complete error message. Maybe it already gets you on the right track. Without the error message, all we know is “something isn’t working”, and that can mean just about anything or everything. It’s generally a good idea to read and understand the error messages. Surprisingly more often than not, the error messages almost spell out what’s wrong. Having said that, if you need any further assistance once you have the error message, please do let us know, we’ll try to assist.

  • Hello, i got the same error message. I follow the tutorial here:

    https://www.digitalocean.com/community/tutorials/how-to-set-up-django-
    with-postgres-nginx-and-gunicorn-on-ubuntu-18-04

    Can you tell me more about see log and full error check? I dont know where to check it.

    • Hi @dltronganh,

      You should be able to see the error in either Nginx’s error log or Gunicorn’s error log. Both of these should be found in the /var/log/ folder unless specifically configured somewhere else.

    • Hello. I am on the same page and have run into the same error,
      nginx logs give me the following error:

      connect() to unix:/run/gunicorn.sock failed
      

      Whereas, the gunicorn socket gives the following error:

      Active: failed (Result: service-start-limit-hit) since Wed 2021-11-03 06:53:40 UTC; 1h 1min ago
         Triggers: ● gunicorn.service
      

      How would this error be resolved?

      • Hi @hj04033,

        Please check your error log in /var/log. When you have the error you can google it for results or post it here so that we can assists you.

      • I was getting the exact same error, two or three attempts and finally figured it out.

        1. If you are getting this error check if the unicorn. service is correct
        2. Good idea to do a full reboot since I did that when I was running out of ideas.
        3. I had to make one change so in my case the file was updated and I had to reload the daemon.

        sudo systemctl daemon-reload
        sudo systemctl restart gunicorn

        1. Once i did it loads just fine

        See the error I had


        Nov 15 01:27:09 ubuntu-mg systemd[45988]: gunicorn.service: Failed to determine user credentials: No such process
        Nov 15 01:27:09 ubuntu-mg systemd[45988]: gunicorn.service: Failed at step USER spawning /home/sammy/myprojectdir/myprojectenv/bin/gunicorn: No such process
        Nov 15 01:27:09 ubuntu-mg systemd[1]: gunicorn.service: Main process exited, code=exited, status=217/USER
        Nov 15 01:27:09 ubuntu-mg systemd[1]: gunicorn.service: Failed with result ‘exit-code’.
        Nov 15 01:27:09 ubuntu-mg systemd[1]: gunicorn.service: Start request repeated too quickly.
        Nov 15 01:27:09 ubuntu-mg systemd[1]: gunicorn.service: Failed with result 'exit-code’.
        Nov 15 01:27:09 ubuntu-mg systemd[1]: Failed to start gunicorn daemon.
        – Reboot –


        – Reboot –
        Nov 15 02:10:06 ubuntu-mg systemd[1]: Started gunicorn daemon.
        Nov 15 02:10:07 ubuntu-mg gunicorn[1276]: [2021-11-15 02:10:07 +0000] [1276] [INFO] Starting gunicorn 20.1.0
        Nov 15 02:10:07 ubuntu-mg gunicorn[1276]: [2021-11-15 02:10:07 +0000] [1276] [INFO] Listening at: unix:/run/gunicorn.sock (1276)
        Nov 15 02:10:07 ubuntu-mg gunicorn[1276]: [2021-11-15 02:10:07 +0000] [1276] [INFO] Using worker: sync
        Nov 15 02:10:07 ubuntu-mg gunicorn[1287]: [2021-11-15 02:10:07 +0000] [1287] [INFO] Booting worker with pid: 1287
        Nov 15 02:10:07 ubuntu-mg gunicorn[1288]: [2021-11-15 02:10:07 +0000] [1288] [INFO] Booting worker with pid: 1288
        Nov 15 02:10:07 ubuntu-mg gunicorn[1289]: [2021-11-15 02:10:07 +0000] [1289] [INFO] Booting worker with pid: 1289
        Nov 15 02:10:08 ubuntu-mg gunicorn[1287]: - - [15/Nov/2021:02:10:08 +0000] “GET / HTTP/1.1” 200 10697 “-” “curl/7.68.0”
        Nov 15 02:16:21 ubuntu-mg gunicorn[1287]: - - [15/Nov/2021:02:16:21 +0000] “GET / HTTP/1.1” 200 10697 “-” “curl/7.68.0”
        mkgiri@ubuntu-mg:~$ sudo systemctl daemon-reload
        mkgiri@ubuntu-mg:~$ sudo systemctl restart gunicorn
        mkgiri@ubuntu-mg:~$ sudo journalctl -u gunicorn
        – Logs begin at Sat 2021-11-13 19:32:38 UTC, end at Mon 2021-11-15 02:17:20 UTC. –
        Nov 15 01:27:09 ubuntu-mg systemd[1]: Started gunicorn daemon.

        – Reboot –
        Nov 15 02:10:06 ubuntu-mg systemd[1]: Started gunicorn daemon.
        Nov 15 02:10:07 ubuntu-mg gunicorn[1276]: [2021-11-15 02:10:07 +0000] [1276] [INFO] Starting gunicorn 20.1.0
        Nov 15 02:10:07 ubuntu-mg gunicorn[1276]: [2021-11-15 02:10:07 +0000] [1276] [INFO] Listening at: unix:/run/gunicorn.sock (1276)
        Nov 15 02:10:07 ubuntu-mg gunicorn[1276]: [2021-11-15 02:10:07 +0000] [1276] [INFO] Using worker: sync
        Nov 15 02:10:07 ubuntu-mg gunicorn[1287]: [2021-11-15 02:10:07 +0000] [1287] [INFO] Booting worker with pid: 1287
        Nov 15 02:10:07 ubuntu-mg gunicorn[1288]: [2021-11-15 02:10:07 +0000] [1288] [INFO] Booting worker with pid: 1288
        Nov 15 02:10:07 ubuntu-mg gunicorn[1289]: [2021-11-15 02:10:07 +0000] [1289] [INFO] Booting worker with pid: 1289
        Nov 15 02:10:08 ubuntu-mg gunicorn[1287]: - - [15/Nov/2021:02:10:08 +0000] “GET / HTTP/1.1” 200 10697 “-” “curl/7.68.0”
        Nov 15 02:16:21 ubuntu-mg gunicorn[1287]: - - [15/Nov/2021:02:16:21 +0000] “GET / HTTP/1.1” 200 10697 “-” “curl/7.68.0”
        Nov 15 02:17:16 ubuntu-mg gunicorn[1276]: [2021-11-15 02:17:16 +0000] [1276] [INFO] Handling signal: term
        Nov 15 02:17:16 ubuntu-mg systemd[1]: Stopping gunicorn daemon…
        Nov 15 02:17:16 ubuntu-mg gunicorn[1287]: [2021-11-15 02:17:16 +0000] [1287] [INFO] Worker exiting (pid: 1287)
        Nov 15 02:17:16 ubuntu-mg gunicorn[1288]: [2021-11-15 02:17:16 +0000] [1288] [INFO] Worker exiting (pid: 1288)
        Nov 15 02:17:16 ubuntu-mg gunicorn[1289]: [2021-11-15 02:17:16 +0000] [1289] [INFO] Worker exiting (pid: 1289)
        Nov 15 02:17:16 ubuntu-mg gunicorn[1276]: [2021-11-15 02:17:16 +0000] [1276] [WARNING] Worker with pid 1287 was terminated due to signal 15
        Nov 15 02:17:16 ubuntu-mg gunicorn[1276]: [2021-11-15 02:17:16 +0000] [1276] [WARNING] Worker with pid 1289 was terminated due to signal 15
        Nov 15 02:17:16 ubuntu-mg gunicorn[1276]: [2021-11-15 02:17:16 +0000] [1276] [WARNING] Worker with pid 1288 was terminated due to signal 15
        Nov 15 02:17:16 ubuntu-mg gunicorn[1276]: [2021-11-15 02:17:16 +0000] [1276] [INFO] Shutting down: Master
        Nov 15 02:17:16 ubuntu-mg systemd[1]: gunicorn.service: Succeeded.
        Nov 15 02:17:16 ubuntu-mg systemd[1]: Stopped gunicorn daemon.
        Nov 15 02:17:16 ubuntu-mg systemd[1]: Started gunicorn daemon.
        Nov 15 02:17:16 ubuntu-mg gunicorn[1596]: [2021-11-15 02:17:16 +0000] [1596] [INFO] Starting gunicorn 20.1.0
        Nov 15 02:17:16 ubuntu-mg gunicorn[1596]: [2021-11-15 02:17:16 +0000] [1596] [INFO] Listening at: unix:/run/gunicorn.sock (1596)
        Nov 15 02:17:16 ubuntu-mg gunicorn[1596]: [2021-11-15 02:17:16 +0000] [1596] [INFO] Using worker: sync
        Nov 15 02:17:16 ubuntu-mg gunicorn[1609]: [2021-11-15 02:17:16 +0000] [1609] [INFO] Booting worker with pid: 1609
        Nov 15 02:17:16 ubuntu-mg gunicorn[1610]: [2021-11-15 02:17:16 +0000] [1610] [INFO] Booting worker with pid: 1610
        Nov 15 02:17:16 ubuntu-mg gunicorn[1611]: [2021-11-15 02:17:16 +0000] [1611] [INFO] Booting worker with pid: 1611
        mkgiri@ubuntu-mg:~$
        mkgiri@ubuntu-mg:~$