1) Node A starts and becomes master.
2) Node B starts and Node A crashes.
3) Before becoming the new master, Node B calls channel.getState()
4) NullPointer occurs
Stacktrace:
java.lang.NullPointerException
at java.io.ByteArrayInputStream.<init>(ByteArrayInputStream.java:106)
at org.jgroups.blocks.MessageDispatcher.handleUpEvent(MessageDispatcher.java:567)
at org.jgroups.blocks.MessageDispatcher$ProtocolAdapter.up(MessageDispatcher.java:667)
at org.jgroups.JChannel.up(JChannel.java:643)
at org.jgroups.stack.ProtocolStack.up(ProtocolStack.java:1015)
at org.jgroups.protocols.Locking.up(Locking.java:269)
at org.jgroups.protocols.pbcast.STATE_TRANSFER.handleViewChange(STATE_TRANSFER.java:293)
at org.jgroups.protocols.pbcast.STATE_TRANSFER.up(STATE_TRANSFER.java:168)
at org.jgroups.protocols.RSVP.up(RSVP.java:187)
at org.jgroups.protocols.FRAG2.up(FRAG2.java:165)
at org.jgroups.protocols.FlowControl.up(FlowControl.java:381)
at org.jgroups.protocols.FlowControl.up(FlowControl.java:381)
at org.jgroups.protocols.pbcast.GMS.castViewChange(GMS.java:574)
at org.jgroups.protocols.pbcast.CoordGmsImpl.handleMembershipChange(CoordGmsImpl.java:219)
at org.jgroups.protocols.pbcast.GMS$ViewHandler.process(GMS.java:1633)
at org.jgroups.protocols.pbcast.GMS$ViewHandler.run(GMS.java:1587)
at java.lang.Thread.run(Thread.java:724)
The issue seems to be related to this:
in STATE_TRANSFER, line 292-293:
Exception ex=new EOFException("state provider " + old_coord + " left");
up_prot.up(new Event(Event.GET_STATE_OK, new StateTransferResult(ex)));
(buffer field is not set on event object)
after, in MessageDispatcher 567:
ByteArrayInputStream input=new ByteArrayInputStream(result.getBuffer());
causes NullPointer, since result.getBuffer() returns null.
A null-check here should resolve this issue, or an empty buffer could be set in StateTransferResult class.