Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

931
Visualizações
unix:///var/run/supervisor.sock refused connection during restarting supervisor

When I created a new .conf file inside /etc/supervisor/conf.d/ and tried to start this program it was showing some errors (fatal error) and restarting frequently by itself. Then I ran the command sudo service supervisor restart but now the supervisor also stopped and couldn't be restarted it. During solving my error the nginx server also got stuck also.

After spending a vast time I recovered it Alhamdulillah and writing the solution in the answer section.

Don't trust the solution entirely for your problem. Your problem may belong to another issues as well.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Sometime Supervisor can show the below horrible error when you restart the service (by the command sudo service supervisor restart):

unix:///var/run/supervisor.sock refused connection

Try to diagnosis the problem with the command supervisord. You can also run journalctl -xe.

Problems and Solutions:

  1. When you write a new .conf file to inside the /etc/supervisor/conf.d directory which contains some statements that are generating error. Like, you write some statements that will run a script. That script contains some statements that runsGunicorn to deploy a python web apps. In the script you wrote a statement to bind an unix socket. But the mentioned directory where the unix socket will be created doesn't give permission to create the .sock file there. This can lead the permission error.

    The demo gunicorn command is below:

SOCKFILE = /home/shamim/python_project/another_directroy/gunicorn.sock
gunicorn ${DJANGO_WSGI_MODULE}:application \
 --name $NAME \
 --bind=unix:$SOCKFILE

If the another_directory doesn't give the permission to create a .sock file inside it then an error can be occurred. So give it enough permission to create something here from outside. Or, Bind IP and port instead unix socket (like 127.0.0.1:ANY_PORT). Be sure first the port is not used by another application.

  1. Sometimes the error can be occurred if any directory path is used inside .conf file but actually that directory doesn't exist at all.

  2. Now run the command supervisord. If the error persists after fixing the above issues and now shows a error like - another program is already listening on a port that one of our HTTP servers is configured to use

    then run the below command to fix this issue:

    sudo unlink /var/run/supervisor.sock

    If the command above does not work you should check run unlink the file at /tmp/supervisor.sock

Keep in mind that the nginx server can also show some errors and fail to restart (or start) if any .conf file contains some statement where a socket is used but actually the socket file doesn't exist or doesn't have enough permission to be executed.

Example: If you write the below code in any nginx file config:

upstream surveyapp_payment_stripe {
    server unix:/home/shamim/python_project/another_directroy/gunicorn.sock fail_timeout=0 weight=5 max_fails=3;
}

If the above socket doesn't exist or not have enough permission then some error may be occurred.

Nginx can also show error if any directory path is used here but not exists at all. To run nginx at this time quickly just delete the .conf file or edit it's extension (make another another extension type other than .conf).

Hopefully this explanation will help someone in future.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda