1

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?

Barmar
  • 741,623
  • 53
  • 500
  • 612
Susan
  • 431
  • 1
  • 4
  • 16

1 Answers1

0

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

  • 1
    Welcome to Stack Overflow! Whilst this may theoretically answer the question, [it would be preferable](//meta.stackexchange.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. – Barmar Aug 26 '22 at 03:06
  • @Barmar thanks, but I prefer to not plagiarize. Also, I am not that great at para-phrasing. =) – Joe Musashi Aug 26 '22 at 03:08
  • The Stack Exchange license allows copying, it's not plagiarism. – Barmar Aug 26 '22 at 03:10
  • @Barmar, thanks, I will try my best on my next answers! – Joe Musashi Aug 26 '22 at 03:11
  • Hello Joe, I already went through that website. It still does not help me how to troubleshoot what is the root cause. – Susan Aug 26 '22 at 03:12
  • @Susan I have edited my answer, it looks like it is the OOM killer. Try going through your code again. – Joe Musashi Aug 26 '22 at 03:14
  • @Joe, I also tried ```dmesg -T| grep -E -i -B100 'killed process'``` but it does not give any out of memory message. No message I got. As I don't get out of memory message, may I know does my program related to out of memory? May I know is there any way to find out? – Susan Aug 26 '22 at 03:16