Reconnect handlers in their reconnect() method should call unregisterEJBReceiver on the ejb context before registering a new one, otherwise it will leak a channel org.jboss.ejb.client.remoting.ClusterContextConnectionReconnectHandler org.jboss.ejb.client.remoting.EJBClientContextConnectionReconnectHandler
Reopened because 1) when EJB client detects that the Remoting channel is broken, unregister is already called from [1] so after this fix, unregister is performed twice (is there some case where [1] is not executed after the connection is broken?) 2) if in some case when unregister is not called from [1] and it is the first reconnect, it will not unregister the receiver, because this.ejbReceiver is always null at line [2] during the first reconnect, and is only initialized after the first reconnect (on line [3]) [1] https://github.com/jbossas/jboss-ejb-client/blob/2.1.4.Final/src/main/java/org/jboss/ejb/client/EJBReceiverContext.java#L57 [2] https://github.com/jbossas/jboss-ejb-client/blob/2.1.7.Final/src/main/java/org/jboss/ejb/client/remoting/EJBClientContextConnectionReconnectHandler.java#L64 [3] https://github.com/jbossas/jboss-ejb-client/blob/2.1.7.Final/src/main/java/org/jboss/ejb/client/remoting/EJBClientContextConnectionReconnectHandler.java#L69
Link in my last comment follows into wrong branch. Right links is below but code is not changed. [1] https://github.com/jbossas/jboss-ejb-client/blob/1.0.36.Final/src/main/java/org/jboss/ejb/client/EJBReceiverContext.java#L59 [2] https://github.com/jbossas/jboss-ejb-client/blob/1.0.37.Final/src/main/java/org/jboss/ejb/client/remoting/EJBClientContextConnectionReconnectHandler.java#L64 [3] https://github.com/jbossas/jboss-ejb-client/blob/1.0.37.Final/src/main/java/org/jboss/ejb/client/remoting/EJBClientContextConnectionReconnectHandler.java#L70