[root@localhost appp_dai]# python3 run_app.py
Traceback (most recent call last):
File “run_app.py”, line 33, in < module>
app. The run (debug = True, the host = ‘0.0.0.0’, the port = 5000)
the File “/ usr/local/python3/lib/python3.6/site – packages/flask/app. Py”, line 841, in the run
run_simple(host, port, self, **options)
the File “/ usr/local/python3/lib/python3.6/site – packages/werkzeug/serving. Py”, line 795, in run_simple
s.b ind (get_sockaddr (hostname, port, address_family))
OSError: [Errno 98] Address already in use
[root@localhost appp_dai]#
ps -elf|grep 500
4 S root 14674 14513 0 80 0-47537 futex_ April 02?00:00:00/usr/libexec/docker/docker – proxy – current proto TCP – host – IP 0.0.0.0 – host – port 50070 – container – IP 172.17.0.2 – container – port 50070
0 S root 17743 1076 0 80 0-28170 pipe_w 18:34 PTS /0 00:00:00 grep –color=auto 500
[root @ localhost appp_dai] #
[root@localhost appp_dai]#
net
netreport netstat
[root@localhost appp_dai]#
netstat -tlnp|grep 5000
TCP 0 0 0.0.0.0:5000 0.0.0.0: * LISTEN 2345/python
[root@localhost appp_dai]#
kill -9 2345
[root@localhost appp_dai]#
netstat -tlnp|grep 5000
[1]+ python run_app.py killed
View all ongoing processes on the machine
[root@localhost appp_dai]# ps -elf|grep 500
View the native 5000 port process
[root@localhost appp_dai]# netstat -tlnp|grep 5000
Reason: Close the IDE without stopping the project.
Or the previous project did not stop and the project was run again.
Solution: The former is simple and kills the process. The latter is easier to stop a project that is running.
The order to kill the process (a little insulting to everyone’s intelligence, but to add) :
lsof -i :
5000
This command is for the hostport5000 I am using. Please change it by yourself.
1
If you are viewing all ongoing processes on the machine:
ps aux
# See all processes with PS-A
1
Kill process:
kill
–
9
PID
# PID is the process number, which is displayed when viewing a process, such as 23645