close

[Solved] Supervisor: ERROR (spawn error) when trying to launch gunicorn

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Supervisor: ERROR (spawn error) when trying to launch gunicorn in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Supervisor: ERROR (spawn error) when trying to launch gunicorn Error Occurs?

Today I get the following error Supervisor: ERROR (spawn error) when trying to launch gunicorn in python.

How To Solve Supervisor: ERROR (spawn error) when trying to launch gunicorn Error ?

  1. How To Solve Supervisor: ERROR (spawn error) when trying to launch gunicorn Error ?

    To Solve Supervisor: ERROR (spawn error) when trying to launch gunicorn Error I figured this out by adjusting supervisor .conf file which is located at /etc/supervisor/conf.d/Server-CardLearning.conf

  2. Supervisor: ERROR (spawn error) when trying to launch gunicorn

    To Solve Supervisor: ERROR (spawn error) when trying to launch gunicorn Error I figured this out by adjusting supervisor .conf file which is located at /etc/supervisor/conf.d/Server-CardLearning.conf

Solution 1

The root of the problem seemed to be that I had an issue with app.py. I was using some Flask library that I had installed on my local machine but not the server and for some reason I didn’t get big errors when I ran the server via flask run --host=0.0.0.0.

I figured this out by adjusting supervisor .conf file which is located at /etc/supervisor/conf.d/Server-CardLearning.conf

The new .conf file reads:

[program:Server-CardLearning]
environment=SECRET_KEY="some_secret_key"
command=gunicorn app:app -b localhost:8000
directory=/home/alexg/www/Server-CardLearning
user=alexg
autostart=true
stderr_logfile=/var/log/supervisor/test.err.log
stdout_logfile=/var/log/supervisor/test.out.log

By adding the two log files I was able to run:

cat /var/log/supervisor/test.err.log

to see that I had an uninstalled library! ~Gasp!~

After installing the library, I ran:

sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start Server-CardLearning

Now, if that doesn’t fix it, I also found that digging around in the supervisor console was helpful:

$ sudo supervisorctl
supervisor> help
supervisor> status

I hope this helps someone out!

Solution 2

In my case accidentally i removed the logs folder where the supervisor logs was pointing to so creating those folder and restarting the supervisor did the trick.

Sample supervisor.conf

[program:Server-CardLearning]
environment=SECRET_KEY="some_secret_key"
command=gunicorn app:app -b localhost:8000
directory=/home/alexg/www/Server-CardLearning
user=alexg
autostart=true
stderr_logfile=/var/log/supervisor/test.err.log
stdout_logfile=/var/log/supervisor/test.out.log

So all i did was :-

mkdir /var/log/supervisor/

after that :-

sudo supervisorctl status all

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read