Created attachment 216874 [details] Calling timer_delete twice from a native methd of java causing a SIGSEGEV Creating a timer and deleting that timer a second time does not set the errno to EINVAL but crashes the whole VM (this happens in OpenBSD too... but not on linux). calling timer_delete twice without returning to java after the first call will succeed without a SIGSEGEV. I don't know if this is an OpenJDK or a LibC bug or just a feature... simply run run.sh here files to reproduce the error file run.sh >>>> #!/bin/sh #linux export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 #freebsd export JAVA_HOME=/usr/local/openjdk14/ gcc -fPIC TimerCreateDelete.c -I $JAVA_HOME/include -I $JAVA_HOME/include/linux -I $JAVA_HOME/include/freebsd -pthread -lrt || exit 1 ./a.out javac TimerCreateDelete.java || exit 1 gcc -c -fPIC TimerCreateDelete.c -I $JAVA_HOME/include -I $JAVA_HOME/include/linux -I $JAVA_HOME/include/freebsd || exit 1 gcc -shared -o libTimerCreateDelete.so TimerCreateDelete.o -pthread -lrt || exit 1 java TimerCreateDelete `pwd` <<<< file TimerCreateDelete.c >>>> #include <jni.h> #include <time.h> #include <errno.h> #ifdef __cplusplus extern "C" { #endif static timer_t myTimer; /* * Class: TimerCreateDelete * Method: timer_create * Signature: ()I */ JNIEXPORT jint JNICALL Java_TimerCreateDelete_timer_1create (JNIEnv *env, jclass clazz) { if (timer_create(CLOCK_MONOTONIC, NULL, &myTimer)) { return errno; } else { return 0; } } /* * Class: TimerCreateDelete * Method: timer_delete * Signature: ()I */ JNIEXPORT jint JNICALL Java_TimerCreateDelete_timer_1delete (JNIEnv *env, jclass clazz) { if (timer_delete(myTimer)) { return errno; } else { return 0; } } int main(void) { puts("Run from native main"); int result; result = Java_TimerCreateDelete_timer_1create(NULL, NULL); printf("time_create: %d\n", result); result = Java_TimerCreateDelete_timer_1delete(NULL, NULL); printf("time_delete: %d\n", result); result = Java_TimerCreateDelete_timer_1delete(NULL, NULL); printf("time_delete: %d\n", result); puts("Timer destroyed"); return 0; } #ifdef __cplusplus } #endif <<<< file TimerCreateDelete.java >>>> /** * * @author aploese */ public class TimerCreateDelete { private static native int timer_create(); private static native int timer_delete(); public static void main(String[] args) { System.load(args[0] + "/libTimerCreateDelete.so"); int errno; System.out.println("Will call timer_create"); errno = timer_create(); System.out.println("timer_create errno: " + errno); System.out.println("Will call timer_delete first time"); errno = timer_delete(); System.out.println("timer_delete errno: " + errno); System.out.println("Will call timer_delete second time"); errno = timer_delete(); System.out.println("timer_delete errno: " + errno); } } <<<<
Thank you for yoru report Arne, What exact port origin (category/portname) or package name is this an issue for?
(In reply to Kubilay Kocak from comment #1) I just installed the FuryBSD-12.1-XFCE.iso, and did a pkg update, pkg install openjdk14 ... Sorry, I'm completely new to FreeBSD, so if you need more informations please let me know and maybe how to obtain them.