简体   繁体   中英

Python script is stopped due to "Terminated" in linux

I need to run python script 24/7 in screen. But my script got "terminated" and stopped.

I don't know why my script is stopped and show only "Terminated" message without getting any error message.

Therefore I run strace -p 253141 in another screen. I got the below message when the python script receive "Terminated".

pselect6(0, NULL, NULL, NULL, {tv_sec=0, tv_nsec=0}, NULL) = 0 (Timeout)
pselect6(0, NULL, NULL, NULL, {tv_sec=0, tv_nsec=0}, NULL) = 0 (Timeout)
pselect6(-514, NULL, NULL, NULL, {tv_sec=0, tv_nsec=15232515}, NULL <unfinished ...>
--- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=253891, si_uid=1000} ---
<... pselect6 resumed> <unfinished ...>) = ?
+++ killed by SIGTERM +++

May I know why my python script stopped?

How can I troubleshoot the root cause?

How can I solve this issue?

The process is being killed by the OOM killer (Out Of Memory Killer), which is a process of the operating system whose job it is to kill jobs that are taking up too much memory before they crash your machine.

Try tweaking your code, as-is it is taking up too much processing power, and thus on the verge of crashing your machine.

This answer is for the Unix OS, but because they are so similar, maybe it will work:

https://unix.stackexchange.com/questions/614950/python-programs-suddenly-get-killed?adlt=strict&toWww=1&redig=5673AE4D36F84AF8A2CA9EB5A1E3EA62

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM