Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-6801

EJBClientContext leak: EJBClientContext is not unregistered from TCCLEJBClientContextSelectorService when it's closed

    XMLWordPrintable

Details

    • Hide

      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, "myuser"); props.put(Context.SECURITY_CREDENTIALS, "mypassword"); InitialContext context = new InitialContext(props); context.close(); }

      }
      }

      Show
      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, "myuser"); props.put(Context.SECURITY_CREDENTIALS, "mypassword"); InitialContext context = new InitialContext(props); context.close(); } } }

    Description

      After running our code with several days, we found there are many EJbClientContext instances are cached in the heap and could not be GC. And cause the memory leak issue.

      Attachments

        Activity

          People

            Unassigned Unassigned
            lcheng_nj_jira liang cheng (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: