{"record":{"id":"87e3924b370e8621","repo":"openjdk/jdk","slug":"vm-warning-the-use-of-signal-and-sigset-for","errorCode":null,"errorMessage":" VM warning: the use of signal() and sigset() for signal chaining was deprecated in version 16.0 and will be removed in a future release. Use sigaction() instead.","messagePattern":" VM warning: the use of signal\\(\\) and sigset\\(\\) for signal chaining was deprecated in version 16\\.0 and will be removed in a future release\\. Use sigaction\\(\\) instead\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java.base/unix/native/libjsig/jsig.c","lineNumber":97,"sourceCode":"   * other than the jvm thread should wait. */\n  if (jvm_signal_installing) {\n    /* tid is not initialized until jvm_signal_installing is set to true. */\n    if (pthread_equal(tid, pthread_self()) == 0) {\n      do {\n        pthread_cond_wait(&cond, &mutex);\n      } while (jvm_signal_installing);\n    }\n  }\n}\n\nstatic void signal_unlock() {\n  pthread_mutex_unlock(&mutex);\n}\n\nstatic void print_deprecation_warning() {\n  if (!warning_printed) {\n    warning_printed = true;\n    fprintf(stderr, HOTSPOT_VM_DISTRO \" VM warning: the use of signal() and sigset() \"\n            \"for signal chaining was deprecated in version 16.0 and will \"\n            \"be removed in a future release. Use sigaction() instead.\\n\");\n  }\n}\n\nstatic sa_handler_t call_os_signal(int sig, sa_handler_t disp,\n                                   bool is_sigset) {\n  sa_handler_t res;\n\n  if (os_signal == NULL) {\n    if (!is_sigset) {\n      os_signal = (signal_function_t)dlsym(RTLD_NEXT, \"signal\");\n    } else {\n      os_signal = (signal_function_t)dlsym(RTLD_NEXT, \"sigset\");\n    }\n    if (os_signal == NULL) {\n      printf(\"%s\\n\", dlerror());\n      exit(0);","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/openjdk/jdk/blob/88dfb74bbeefcf2b0aa11835183bcd949998fc8f/src/java.base/unix/native/libjsig/jsig.c#L79-L115","documentation":"Deprecation notice from libjsig (the JDK's signal-chaining library, preloaded via LD_PRELOAD on Solaris/Linux HotSpot). If application or library code calls signal() or sigset() (instead of sigaction()) to install a signal handler while the JVM is running, libjsig intercepts the call, prints this one-time warning, and forwards the registration to the JVM's chained handling. Behavior is still correct; the API is deprecated because signal()'s unreliable semantics do not compose well with JVM signal chaining.","triggerScenarios":"Any call to signal() or sigset() from JVM-attached native code (JNI library, agent, or the application itself) after libjsig was initialized. Typical sources: C libraries installing SIGINT/SIGTERM/SIGPIPE handlers, legacy code ported from older Unix codebases.","commonSituations":"Running a Java app that loads a third-party native library which registers signal handlers with signal(); using tools or daemons that call signal() during startup before/after JVM init; upgrading to JDK 16+ where the warning was introduced and seeing it in logs.","solutions":["Change the offending native code to install handlers with sigaction() instead of signal()/sigset() — this is the only real fix","Identify the caller: run under a debugger with a breakpoint on signal(), or use tools like 'ltrace -e signal' to catch who calls it","If the caller is a third-party library, upgrade to a version using sigaction or report it upstream","The warning is printed only once per process; it is harmless unless the API is actually removed in a future release — plan the migration before then"],"exampleFix":"// before (C)\nsignal(SIGTERM, my_handler);\n\n// after\nstruct sigaction sa;\nsa.sa_handler = my_handler;\nsigemptyset(&sa.sa_mask);\nsa.sa_flags = 0;\nsigaction(SIGTERM, &sa, NULL);","handlingStrategy":"validation","validationCode":"// Audit native code linked into the process for deprecated calls before shipping:\n//   ltrace -e signal -e sigset -- ./myapp 2>&1 | grep -v '^---'\n// or link-time: nm -D libmynative.so | grep -w signal","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize on sigaction() in all JNI/native libraries that touch signals","Watch JDK release notes: the removal of signal()/sigset() chaining support is planned, so migrate before upgrading","If you must keep JVM signal chaining, preload libjsig and register handlers via sigaction only"],"tags":["jdk","libjsig","signals","deprecation","native","unix"],"backgroundTag":null,"analyzedSha":"88dfb74bbeefcf2b0aa11835183bcd949998fc8f","analyzedAt":"2026-08-14T11:45:09.665Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}