I'm running openjdk 1.8u191 on rather clean Ubuntu 16.04 and 18.04 systems, x86_64 hosts.
I run this simple application:
package net.iponweb;
import java.time.ZonedDateTime;
public class Main {
public static void main(String[] args) throws InterruptedException {
while(true) {
System.out.println(ZonedDateTime.now());
Thread.sleep(1000);
}
}
}
with this command line:
java -jar sigalrm-1.0-SNAPSHOT.jar
Now when I send a SIGALRM signal to this java process by kill -14 ${PID}
, I experience its immediate termination with the following output:
2019-03-07T18:36:13.150+03:00[Europe/Moscow]
2019-03-07T18:36:14.151+03:00[Europe/Moscow]
2019-03-07T18:36:15.152+03:00[Europe/Moscow]
Alarm clock
What bothers me is that I spent a couple hours trying to find any information regarding SIGALRM terminating JVM, but did not find any. My question is, is it an expected behavior, or an implementation-specific detail and the next stop for me is the JVM source code? Because I was not expecting SIGALRM to terminate my applications, and now I'm wandering if there's more.