[jgroups-users] ArrayIndexOutOfBounds exception in STABLE.installView()
Questions/problems related to using JGroups <[email protected]> Mon, 5 Jun 2017 14:51:41 -0700
| Newsgroups | gmane.comp.java.javagroups.general |
|---|---|
| Message-ID | <mailman.330.1496763400.16886.javagroups-users@lists.sourceforge.net> |
Hi,
In Apache Geode I have a small protocol stack with no GMS where I manage
and install my own membership view into the channel. During one
transition I need to clear the view from the stack so I create a View
with no members and send it in a view-change to the channel.
Unfortunately STABLE isn't using View.getCoord() to get the current
membership coordinator and is using getMembers().get(0) instead, causing
an exception.
ViewId vid = new ViewId(new JGAddress(), 0);
List<Address> members = new ArrayList<>();
View jgv = new View(vid, members);
this.myChannel.down(new Event(Event.VIEW_CHANGE, jgv));
java.lang.ArrayIndexOutOfBoundsException: 0
at java.util.Arrays$ArrayList.get(Arrays.java:3841)
at java.util.Collections$UnmodifiableList.get(Collections.java:1309)
at org.jgroups.protocols.pbcast.STABLE.handleViewChange(STABLE.java:365)
at org.jgroups.protocols.pbcast.STABLE.down(STABLE.java:328)
at org.jgroups.protocols.FlowControl.down(FlowControl.java:347)
at org.jgroups.protocols.FlowControl.down(FlowControl.java:347)
at org.jgroups.protocols.FRAG2.down(FRAG2.java:136)
at org.jgroups.stack.ProtocolStack.down(ProtocolStack.java:1039)
at org.jgroups.JChannel.down(JChannel.java:790)
at
org.apache.geode.distributed.internal.membership.gms.messenger.JGroupsMessenger.start(JGroupsMessenger.java:310)
It seems like any use of View.getMembers().get(0) should be changed to
View.getCoord() and the code should be prepared to deal with a null
return value.
Bruce Schuchardt
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot