Re: [jgroups-users] ArrayIndexOutOfBounds exception in STABLE.installView()
Questions/problems related to using JGroups <[email protected]> Wed, 7 Jun 2017 08:49:34 +0200
| Newsgroups | gmane.comp.java.javagroups.general |
|---|---|
| Message-ID | <mailman.2188.1496818186.5325.javagroups-users@lists.sourceforge.net> |
I checked the code and changed all occurrences of view.getMembers().get(0) // or iterator.next() to View.getCoord(), as this wasn't much work. Committed to master (will be 4.0.4) [1] https://issues.jboss.org/browse/JGRP-2193 On 05/06/17 23:51, Questions/problems related to using JGroups wrote: > 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 > _______________________________________________ > javagroups-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/javagroups-users -- Bela Ban | http://www.jgroups.org ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot