4 Replies Latest reply on Nov 15, 2017 5:35 AM by lcheng_nj

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

    lcheng_nj

      I ran into the EJBClientContext leak issue. The call steps are very simple

      1. Initialize one Initialize with following ejb related setting

          Properties props = jndiAnalyser_.getJNDIConfig();

           ....

          props.put("jboss.naming.client.ejb.context", true);

          props.put("org.jboss.ejb.client.scoped.context", true);

         InitialContext context = new InitialContext(props);

       

      2. Look up ejb "myear/MyBean!com.test.myClass" from context

      3. Invoke some ejb method

      4. Close conext

       

      After debugging wildfly source code, I found following cause of EJBClientContext leak

      At step1, EJBClientContext is created at RemoteNamingStoreEJBClientHandler.setupEJBClientContext, meanwhile, this EJBClientContext instance is registered within TCCLEJBClientContextSelectorService.

      At step4, the EJBClientContext instance is closed via RemoteNamingEJBClientContextCloseTask. However, this EJBClientContext instance is still cached by TCCLEJBClientContextSelectorService, and this make EJBClientContext leaked.

       

      I looks like one wildfly bug. Any comment