2

I'm starting a Java process using nohup and & (running it in the background). This process gets terminated frequently. There is no pattern on when it is getting terminated. From the application (java process) logs it was evident that it was receiving a SIGTERM signal. So I used strace to figure out the source of the SIGTERM signal and it turned out to be systems.

Why would systemd try to kill a process that it does not manage?

Strace Output

13:35:20.838755 futex(0x7f1ef1ae49d0, FUTEX_WAIT, 16917, NULL) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
22:17:17.211643 --- SIGTERM {si_signo=SIGTERM, si_code=SI_USER, si_pid=1, si_uid=0} ---
22:17:17.211876 futex(0x7f1ef0e9c720, FUTEX_WAKE_PRIVATE, 1) = 1
22:17:17.211974 rt_sigreturn({mask=[]}) = 202
22:17:17.212183 futex(0x7f1ef1ae49d0, FUTEX_WAIT, 16917, NULL) = ?
22:17:17.538874 +++ exited with 143 +++

I've already combed through DMESG and messages logs and there was nothing that points to why the process was killed.

Edit: The java process is started by a user as a bash command. But the user login is controlled using pblocald which is a systemd unit.

4
  • 2
    Technically, PID1 (systemd) does manage your process, as it manages (parents) each user space process. Your issue reeks of an OOM (out of memory) condition. What exactly did you search for in which logs? Have you considered running a tool like sar or vmstat to collect/archive resource performance data? Commented Jul 21, 2023 at 9:50
  • @Edward I checked the kernel logs using the command dmesg -T | egrep -i 'killed process' and grep -i 'killed process' /var/log/messages. The issue is not due to resource constraints or OOM because it happens even when the application is completely idle. Commented Jul 21, 2023 at 14:40
  • 1
    Did you start the java process from inside a systemd unit? Did you start it from inside a user slice scope? Have you set loginctl enable-linger for the user? Commented Jul 21, 2023 at 15:35
  • @meuh The java process is started by a user as a bash command. But the user login is controlled using pblocald which is a systemd unit. I will check on the enable-linger option and update the question. Commented Jul 21, 2023 at 16:05

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.