Bug 1277294

Summary: [GSS](6.4.z) Reconnect handlers leaking channels, need to unregister the ejb receiver
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Brad Maxwell <bmaxwell>
Component: EJBAssignee: Radovan STANCEL <rstancel>
Status: CLOSED NEXTRELEASE QA Contact: Jan Martiska <jmartisk>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.4.4CC: david.lloyd, dtikhomi, jawilson, jbilek, jtruhlar, msochure, ppalaga, rstancel
Target Milestone: CR1   
Target Release: EAP 6.4.12   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1398692 (view as bug list) Environment:
Last Closed: 2016-11-25 15:35:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1375585, 1377318, 1398692    

Description Brad Maxwell 2015-11-03 00:08:35 UTC
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

Comment 6 Jiří Bílek 2016-11-25 13:55:16 UTC
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