AbstractReplicatedMap#init() is as follows. ===== protected void init(....) { ...skip... this.rpcChannel = new RpcChannel(this.mapContextName, channel, this); //add this map as a message listener this.channel.addChannelListener(this); //listen for membership notifications this.channel.addMembershipListener(this); try { //broadcast our map, this just notifies other members of our existence broadcast(MapMessage.MSG_INIT, true); //transfer state from another map transferState(); //state is transferred, we are ready for messaging broadcast(MapMessage.MSG_START, true); } catch (ChannelException x) { log.warn("Unable to send map start message."); throw new RuntimeException("Unable to start replicated map.",x); } } ===== When ChannelException is thrown after this(AbstractReplicatedMap) is added to channel, RuntimeException is thrown. And AbstractReplicatedMap#init() is called from the constructor of AbstractReplicatedMap(LazyReplicatedMap or ReplicatedMap). In a word, no one can remove this(AbstractReplicatedMap) added to channel. As a result, trivial memory leak and IllegalArgumentException("Listener already exists:...) are caused. Best regards.
Created attachment 25485 [details] AbstractReplicatedMap's patch I made a patch. This patch contains the same fix about RpcChannel.
Fixed in trunk and proposed for 6.0.x.
This fix applied to 6.0, will be in 6.0.30 onwards.