Hello,
GAD version v12.9.0.
Observer behaviour: when two thread has SIGBUS signal, first thread restores previous in chain, but second nulls it.
Reproducible: 100%
This causes C#/Java signals handlers to be removed from chain and they are not able to handle Null Pointer Exceptions in try/catch blocks.
Code to reproduce (RoboVM one):
Runnable NPE = () -> {
try {
((String) null).equals("hello");
} catch (NullPointerException ignored) {}
};
Thread t1 = new Thread(NPE);
Thread t2 = new Thread(NPE);
t1.start();
t2.start();
^^^ this code will crash.
It happens due possible scenarios:
- thread1 and thread2 have both NPE at same time;
- signals are raised in both of these;
- first thread restores valid previous handler, removes GAM from handling and calls it;
- second thread processing signal as it was raised before removed by thread 1;
- second thread restores NULL handlers (e.g. not RoboVM ones) and call it;
- crash
full investigation story