Signal handling in Java

Michael Stahl mstahl at redhat.com
Thu Jun 22 19:11:20 UTC 2017


On 22.06.2017 19:53, Noel Grandin wrote:
> if we care about playing nicely with pre-existing signal handles
> installed by the JVM, then surely the right answer is that we too should
> implement signal-chaining.
> i.e. when we install our signal handlers, we should store the address of
> the previously installed handler (if any) and call that inside our
> signal handler.

On 22.06.2017 18:23, Chris Sherlock wrote:
>> Pre-installed signal handlers (A) are supported by means of saving
>> existing signal handlers, for signals that are used by the VM, when
>> the VM is first created. Later, when any of these signals are raised
>> and found not to be targeted at the Java HotSpot VM, the
>> pre-installed
>> handlers are invoked. In other words, pre-installed handlers are
>> "chained" behind the VM handlers for these signals.

the key phrase here is "found not to be targeted at the Java HotSpot VM"
- the JVM knows from the address associated with the signal whether it's
an "expected" one that it can handle itself, or an unexpected one that
it can pass along the chain.

LO however has no idea which signals the JVM would "expect", and as far
as LO itself is concerned there are no "expected" SIGSEGVs, every one is
a crash.

as furthermore the signal handler functions don't have a return value, i
don't see how the chaining in that direction can ever work.

>> The signal-chaining facility also allows an application to link and
>> load a shared library libjsig.so before libc/libthread/libpthread.
>> This library ensures that calls such as signal(), sigset(),
>> andsigaction() are intercepted so that they do not actually replace
>> the Java HotSpot VM's signal handlers if the handlers conflict with
>> those already installed by the Java HotSpot VM (B). Instead, these

so effectively the only way this can work if we somehow locate and
LD_PRELOAD this libjsig.so somewhere before soffice.bin is invoked.

to me this does rather not sound like it would reduce the number of
hoops to jump through or make anything more reliable.



More information about the LibreOffice mailing list