Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8345782

Refining the cases that libjsig deprecation warning is issued

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • 25
    • 17
    • hotspot
    • None

      The support for signal() and sigset() has been deprecated since JDK 16 and printed a deprecation warning in src/java.base/unix/native/libjsig/jsig.c to inform users. The warning message states: “Java HotSpot(TM) 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.”

      Currently, the warning is issued under the following scenarios when signal() or sigset() is called:
      1. JVM signals installed and signal number used by the JVM -> No warning
      2. JVM signals installed and signal number not used by the JVM -> Warning
      3. JVM signals not installed -> Warning (e.g. when LD_PRELOAD=libjsig.so is used without running JVM)

      There's no warning in case 1, since the signal()/sigset() function is chained and effectively translated to a sigaction(). This however defeats the purpose of the warning, since when actually removing support for signal()/sigset() in libjsig, the chaining won't be perform and likely break applications -- without the user having been warned.
      Secondly, case 3 can interact with other commands used in e.g. startup-scripts. As an example the xargs command uses signal(), which is hard for a Java user to do anything about. Also, with xargs not interacting with the JVM, the eventual removal of the chaining won't affect the usage.

      In other words, after the change, the warning should be issued in the following cases:
      1. JVM signals installed and signal used by the JVM -> Warning
      2. JVM signals installed and signal not used by the JVM -> Warning
      3. JVM signals not installed -> No warning

      This change improves clarity for users, ensuring they are only warned when it is relevant to the replacement of signal() and sigset() methods.

            jnordstrom Joakim Nordström
            yeren Yagmur Eren
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: