libjsig deprecation warning, lenience for signal(SIGPIPE, SIG_IGN)?
David Holmes
david.holmes at oracle.com
Mon Apr 14 03:20:04 UTC 2025
Hi Mikael,
On 11/04/2025 2:59 pm, Mikael Sterner wrote:
> Hi,
>
> During migration of a desktop software from Java 11 to
> Java 21 we started seeing the libjsig deprecation warnings.
> That's fine and appreciated as a heads-up, and I also notice
> that some nice changes to the message logic have been done
> for Java 25.
>
> However, tracing what triggered our warnings, I wonder if you
> think it could make sense to be lenient about calls to deprecated
> signal() method that just want to ignore a signal with SIG_IGN,
> in particular SIGPIPE?
I have been trying to think of a rationale that would justify this
leniency for this case, but I'm struggling to formulate one. The warning
is about the use of the API not about how the API is used (i.e. the
given signal and the way it is to be handled does not come into it).
Would it help in your case if there was a way to disable the warning via
a command-line flag? This has been requested in the past but we haven't
needed to go down that path due to other adjustments (and sometimes it
won't help as control of the command-line is problematic).
Just to get a clearer picture here, the fact you are using libjsig
indicates there are other signals that are actually handled and which
you need to be chained - is that correct?
> This pattern seems to be used in several
> Gnome libraries:
>
> - https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkmain.c?ref_type=heads#L555
> - https://gitlab.gnome.org/GNOME/glib/-/blob/main/gio/gsocket.c?ref_type=heads#L967
> - https://gitlab.gnome.org/GNOME/gvfs/-/blob/master/client/gdaemonvfs.c#L304
>
> Or would it be better to report such calls as deficiencies in
> these libraries, with the libjsig warnings as evidence?
The "evidence" would be the specification for signal on Linux:
https://man7.org/linux/man-pages/man2/signal.2.html
WARNING: the behavior of signal() varies across UNIX versions, and
has also varied historically across different versions of Linux.
Avoid its use: use sigaction(2) instead.
Cheers,
David Holmes
>
> Yours,
> Mikael Sterner
More information about the hotspot-runtime-dev
mailing list