How to locate the reason why the Python application is dead?

there is a Python application that provides some Api interfaces such as affective participle, but occasionally finds that the application is unavailable, that is, the application process exists, but returns

when calling the Api interface.
curl: (56) Recv failure: Connection reset by peer

netstat check the application port to get the following information

netstat -aultnp | grep 8000
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        6      0 0.0.0.0:8000            0.0.0.0:*               LISTEN      9712/python
tcp        0      0 172.16.XXX.XX:8000      172.16.XXX.XX:33652     SYN_RECV    -
tcp        0      0 172.16.XXX.XX:8000      118.31.xx.xxx:51470     SYN_RECV    -
tcp        0   1125 172.16.XXX.XX:33652     172.16.XXX.XX:8000      ESTABLISHED 7048/java
tcp       19      0 172.16.XXX.XX:8000      39.104.xx.xxx:40968     CLOSE_WAIT  -
tcp        5      0 172.16.XXX.XX:8000      39.104.xx.xxx:39672     CLOSE_WAIT  -
tcp       13      0 172.16.XXX.XX:8000      39.104.xx.xxx:41628     CLOSE_WAIT  -
tcp        0      0 172.16.XXX.XX:8000      39.104.xx.xxx:39500     ESTABLISHED 9712/python
tcp        0      0 172.16.XXX.XX:55160     182.92.xx.xx:8000       ESTABLISHED 16173/staragent-cor
tcp       54      0 172.16.XXX.XX:8000      39.104.xx.xxx:42286     CLOSE_WAIT  -
tcp       14      0 172.16.XXX.XX:8000      39.104.xx.xxx:43734     CLOSE_WAIT  -
tcp       42      0 172.16.XXX.XX:8000      39.104.xx.xxx:43036     CLOSE_WAIT  -

restarting the application solves the problem of what seems to be caused by resource exhaustion, but is not sure what resource
I don"t know how to locate the cause of the problem if it is a Python process. If it is a Java process, you can use some tools provided by JVM to analyze the cause of the problem, such as jstack

.
Mar.06,2021

this has been asked https://codeshelper.com/q/10.
. You say," it seems that some resources are exhausted, but you are not sure what resources are caused by exhaustion. Here we recommend the cProfiler, related link python.jobbole.com/87621/" rel=" nofollow noreferrer "> http://python.jobbole.com/87621/. Can display function calls, memory, time and other related information, hope to be useful

Menu