Uploaded image for project: 'JGroups'
  1. JGroups
  2. JGRP-1715

NullPointerException in MessageDispatcher.handleUpEvent

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.4.2, 3.5
    • 3.4
    • None
    • Hide

      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

      configuration:

      <config xmlns="urn:org:jgroups"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/JGroups-3.4.xsd">
      <UDP
      mcast_port="${jgroups.udp.mcast_port:45588}"
      tos="8"
      ucast_recv_buf_size="5M"
      ucast_send_buf_size="640K"
      mcast_recv_buf_size="5M"
      mcast_send_buf_size="640K"
      loopback="true"
      max_bundle_size="64K"
      max_bundle_timeout="30"
      ip_ttl="${jgroups.udp.ip_ttl:8}"
      enable_diagnostics="true"
      thread_naming_pattern="cl"
      singleton_name="tp_singleton1"
      timer_type="new3"
      timer.min_threads="4"
      timer.max_threads="10"
      timer.keep_alive_time="3000"
      timer.queue_max_size="500"

      thread_pool.enabled="true"
      thread_pool.min_threads="2"
      thread_pool.max_threads="8"
      thread_pool.keep_alive_time="5000"
      thread_pool.queue_enabled="true"
      thread_pool.queue_max_size="10000"
      thread_pool.rejection_policy="discard"

      oob_thread_pool.enabled="true"
      oob_thread_pool.min_threads="1"
      oob_thread_pool.max_threads="8"
      oob_thread_pool.keep_alive_time="5000"
      oob_thread_pool.queue_enabled="false"
      oob_thread_pool.queue_max_size="100"
      oob_thread_pool.rejection_policy="discard"/>

      <PING timeout="2000"
      num_initial_members="20"/>
      <MERGE2 max_interval="30000"
      min_interval="10000"/>
      <FD_SOCK/>
      <FD_ALL/>
      <VERIFY_SUSPECT timeout="1500" />
      <BARRIER />
      <pbcast.NAKACK2 xmit_interval="500"
      xmit_table_num_rows="100"
      xmit_table_msgs_per_row="2000"
      xmit_table_max_compaction_time="30000"
      max_msg_batch_size="500"
      use_mcast_xmit="false"
      discard_delivered_msgs="true"/>
      <UNICAST3 xmit_interval="500"
      xmit_table_num_rows="100"
      xmit_table_msgs_per_row="2000"
      xmit_table_max_compaction_time="60000"
      conn_expiry_timeout="0"
      max_msg_batch_size="500"/>
      <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
      max_bytes="4M"/>
      <pbcast.GMS print_local_addr="true" join_timeout="3000"
      view_bundling="true"/>
      <UFC max_credits="2M"
      min_threshold="0.4"/>
      <MFC max_credits="2M"
      min_threshold="0.4"/>
      <FRAG2 frag_size="60K" />
      <RSVP resend_interval="2000" timeout="10000"/>
      <pbcast.STATE_TRANSFER />
      <CENTRAL_LOCK num_backups="2"/>
      </config>

      Show
      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 configuration: <config xmlns="urn:org:jgroups" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/JGroups-3.4.xsd "> <UDP mcast_port="${jgroups.udp.mcast_port:45588}" tos="8" ucast_recv_buf_size="5M" ucast_send_buf_size="640K" mcast_recv_buf_size="5M" mcast_send_buf_size="640K" loopback="true" max_bundle_size="64K" max_bundle_timeout="30" ip_ttl="${jgroups.udp.ip_ttl:8}" enable_diagnostics="true" thread_naming_pattern="cl" singleton_name="tp_singleton1" timer_type="new3" timer.min_threads="4" timer.max_threads="10" timer.keep_alive_time="3000" timer.queue_max_size="500" thread_pool.enabled="true" thread_pool.min_threads="2" thread_pool.max_threads="8" thread_pool.keep_alive_time="5000" thread_pool.queue_enabled="true" thread_pool.queue_max_size="10000" thread_pool.rejection_policy="discard" oob_thread_pool.enabled="true" oob_thread_pool.min_threads="1" oob_thread_pool.max_threads="8" oob_thread_pool.keep_alive_time="5000" oob_thread_pool.queue_enabled="false" oob_thread_pool.queue_max_size="100" oob_thread_pool.rejection_policy="discard"/> <PING timeout="2000" num_initial_members="20"/> <MERGE2 max_interval="30000" min_interval="10000"/> <FD_SOCK/> <FD_ALL/> <VERIFY_SUSPECT timeout="1500" /> <BARRIER /> <pbcast.NAKACK2 xmit_interval="500" xmit_table_num_rows="100" xmit_table_msgs_per_row="2000" xmit_table_max_compaction_time="30000" max_msg_batch_size="500" use_mcast_xmit="false" discard_delivered_msgs="true"/> <UNICAST3 xmit_interval="500" xmit_table_num_rows="100" xmit_table_msgs_per_row="2000" xmit_table_max_compaction_time="60000" conn_expiry_timeout="0" max_msg_batch_size="500"/> <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000" max_bytes="4M"/> <pbcast.GMS print_local_addr="true" join_timeout="3000" view_bundling="true"/> <UFC max_credits="2M" min_threshold="0.4"/> <MFC max_credits="2M" min_threshold="0.4"/> <FRAG2 frag_size="60K" /> <RSVP resend_interval="2000" timeout="10000"/> <pbcast.STATE_TRANSFER /> <CENTRAL_LOCK num_backups="2"/> </config>

      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.

              rhn-engineering-bban Bela Ban
              pcan_jira Pierantonio Cangianiello (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: