-
1. Re: [wildfly]EJBClientContext leak: EJBClientContext is not unregistered from TCCLEJBClientContextSelectorService when it's closed
lcheng_nj Jul 4, 2016 11:55 AM (in response to lcheng_nj)Ok. After debugging wildfly source code, I realize the the reproduce steps are very simple. After running following standalone code, you can check the JVM, there are 10 EJBClientContext instances in the heap and could not be GC.
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
public class EJBClientContextLeakTest {
public static void main(String[] args) throws Exception {
for (int i = 0; i < 10; i++) {
Properties props = new Properties();
props.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
props.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS","JBOSS-LOCAL-USER");
props.put("jboss.naming.client.ejb.context", true);
props.put("org.jboss.ejb.client.scoped.context", true);
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
props.put(Context.PROVIDER_URL, "http-remoting://localhost:8080");
props.put(Context.SECURITY_PRINCIPAL, "vtbaadmin");
props.put(Context.SECURITY_CREDENTIALS, "vitria");
InitialContext context = new InitialContext(props);
context.close();
}
}
}
-
2. Re: [wildfly]EJBClientContext leak: EJBClientContext is not unregistered from TCCLEJBClientContextSelectorService when it's closed
wdfink Jul 5, 2016 4:35 AM (in response to lcheng_nj)Hi,
if you are using scoped-context (note that this will be replaced in a future version- because of drawbacks) it is necessary to handle the close different as the EJBClient.
You need to add context.lookup("ejb:") and close this context!
This will solve the issue. It depends on the JNDI approach and there is no other solution for this.
I recommend to not use scoped context but the jboss-ejb-client.properties or the ejb-client API (WildFly specific)
-
3. Re: [wildfly]EJBClientContext leak: EJBClientContext is not unregistered from TCCLEJBClientContextSelectorService when it's closed
jaikiran Jul 6, 2016 2:42 AM (in response to lcheng_nj)Which exact version of WildFly server is this?
-
4. Re: [wildfly]EJBClientContext leak: EJBClientContext is not unregistered from TCCLEJBClientContextSelectorService when it's closed
lcheng_nj Nov 15, 2017 5:35 AM (in response to wdfink)Thanks. We change the ejb-client way now