sudomudo
sudomudo

Reputation: 94

Getting a 500 Internal server error on my flask application, does not kill process running on a particular port when application is stopped

When I run the app for the first time, it is working fine but when I stop the app and try to run it again, then it gives error "Internal server error, server overloaded". It is due to the process running on that port does not get killed when the app is stopped.

I run my Flask app by,

app.run(port=5555)

And I don't want to do app.debug = True Any help on how to kill the process when the app is stopped, without debug = on

Upvotes: 0

Views: 506

Answers (1)

Jaldhi Mehta
Jaldhi Mehta

Reputation: 721

You can kill the port using this command:

 lsof -i:<port_number>
 kill -9 <pid>

In your case, you can use something like this:

 lsof -i:5555
 kill -9 <pid>

Upvotes: 1

Related Questions