Gunicorn Connection in Use: ('0.0.0.0', 5000)

后端 未结 5 707
不思量自难忘°
不思量自难忘° 2021-02-07 10:33

I installed redis this afternoon and it caused a few errors, so I uninstalled it but this error is persisting when I launch the app with foreman start. Any ideas on

相关标签:
5条回答
  • 2021-02-07 11:13

    Just type

    sudo fuser -k 5000/tcp
    

    .This will kill all process associated with port 5000

    0 讨论(0)
  • 2021-02-07 11:20

    Check your processes. You may have had an unclean exit, leaving a zombie'd process behind that's still running.

    0 讨论(0)
  • 2021-02-07 11:20

    This should do the trick for you:

    kill -9 $(lsof -i:5000 -t) 2> /dev/null

    where 5000 is the port you want to kill

    0 讨论(0)
  • 2021-02-07 11:32

    After some searching on the web, it looks like the following command is the best to use. This kills all of the processes running on port 5000 and appeared to work for me:

    kill `lsof -i :5000`
    

    Source (although a bit more shady than I prefer)

    0 讨论(0)
  • 2021-02-07 11:33

    Find the orphaned process:

    ps -ax |grep gunicorn
    
    11111 ?? 0:03.44 /usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python /usr/local/bin/gunicorn -b :5000 main:app
    

    Locate the Process ID (the number in the first column of the results)

    kill 11111
    

    Replace 11111 with the Process ID

    0 讨论(0)
提交回复
热议问题