test, review & avoid (regressed) mutex behavior #5522
these changes are based on reviewing code for #5520
than there's the actual "wild" fix: https://github.com/jruby/jruby/compare/mutex-fix?expand=1#diff-330867c3ee2ffcb2a20e80af7bf9b4b3R161 ... as this line doing synchronization locking seems to be causing the problem (see explanation at GH-5520)
not entirely sure - why it's happening, yet, maybe it relates to delivering interrupts on the main thread?
to reproduce, just run the test that is added here :
.. changing the line back to a blocking collection should make the test fail e.g.
/** Stack of interrupt masks active for this thread */ - private final List<RubyHash> interruptMaskStack = new CopyOnWriteArrayList<>(); + private final List<RubyHash> interruptMaskStack = new Vector<>();
@headius feel free to push to the branch as/if needed. while I'd like to understand why that line causes such a regression I might not have the time to look in detail (next week).
For 9.2.6 I have pushed a trivial version of the core fix here, the deadlock inside the copy of interrupt handlers. See adcd781.
The deadlock came from having two synchronized lists try to