Bug 1691399
| Summary: | [GSS](6.4.z) Remote Naming EJB Invocation is not releasing EJBClientContext after close and leaking memory | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [JBoss] JBoss Enterprise Application Platform 6 | Reporter: | Brad Maxwell <bmaxwell> | ||||||
| Component: | EJB | Assignee: | Tomas Hofman <thofman> | ||||||
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Peter Mackay <pmackay> | ||||||
| Severity: | unspecified | Docs Contact: | |||||||
| Priority: | unspecified | ||||||||
| Version: | 6.4.21 | CC: | aogburn, david.lloyd, pmackay, thofman | ||||||
| Target Milestone: | CR1 | ||||||||
| Target Release: | EAP 6.4.22 | ||||||||
| Hardware: | Unspecified | ||||||||
| OS: | Unspecified | ||||||||
| Whiteboard: | |||||||||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |||||||
| Doc Text: | Story Points: | --- | |||||||
| Clone Of: | Environment: | ||||||||
| Last Closed: | 2019-08-19 12:40:46 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: | 1613417, 1691431 | ||||||||
| Attachments: |
|
||||||||
Created attachment 1546523 [details]
singleton-timer.jar
EJBClientContext.close() method stack trace: at org.jboss.ejb.client.EJBClientContext.close(EJBClientContext.java:1317) - locked <0x1fbf> (a org.jboss.ejb.client.EJBClientContext) at org.jboss.naming.remote.client.ejb.RemoteNamingStoreEJBClientHandler$RemoteNamingEJBClientContextCloseTask.close(RemoteNamingStoreEJBClientHandler.java:123) at org.jboss.naming.remote.client.RemoteContext.close(RemoteContext.java:290) at javax.naming.InitialContext.close(InitialContext.java:556) at javax.naming.InitialContext.close(InitialContext.java:556) at com.jboss.examples.ee6.ejb.EE6ExampleSingletonTimer.timeout(EE6ExampleSingletonTimer.java:83) Created attachment 1546573 [details]
ejbclient.btm
Regression tests passed Verified with EAP 6.4.22.CP.CR1 |
Remote Naming used to invoke EJB is not releasing EJBClientContext. remoteNamingContext.close() is resulting in EJBClientContext.close() which closes the connections, but it looks like the EJBClientContext objects are unable to finalize as it appears TCCLEJBClientContextSelectorService is still referencing them. private Context getRemoteNamingInitialContext(String host, Integer port, String user, String pass, boolean useEjbContext) throws NamingException { Properties env = new Properties(); env.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); if(useEjbContext) env.put("jboss.naming.client.ejb.context", "true"); env.put("java.naming.factory.initial", "org.jboss.naming.remote.client.InitialContextFactory"); env.put("java.naming.provider.url", String.format("remote://%s:%d", host, port)); env.put(Context.SECURITY_PRINCIPAL, user); env.put(Context.SECURITY_CREDENTIALS, pass); return new InitialContext(env); } Context ctx = null; try { ctx = getRemoteNamingInitialContext(host, port, user, pass, true); Hello ejb = (Hello) ctx.lookup("singleton-timer/HelloBean!com.jboss.examples.ejb.Hello"); ejb.hello(); } catch(Throwable t) { t.printStackTrace(); } finally { try { if(ctx != null) { ctx.close(); ctx = null; } } catch(Throwable t) { t.printStackTrace(); } } The EJBClientContexts are all retained in org.jboss.as.ejb3.remote.TCCLEJBClientContextSelectorService's identifiableContexts map: Class Name | Ref. Objects | Shallow Heap | Ref. Shallow Heap | Retained Heap ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ org.jboss.threads.JBossThread @ 0x76f2e50d0 EJB default - 9 Thread | 6,405 | 128 | 512,400 | 9,152 '- contextClassLoader org.jboss.modules.ModuleClassLoader @ 0x76e819c60 | 6,405 | 88 | 512,400 | 137,496 '- classes java.util.Vector @ 0x76ec1d098 | 6,405 | 32 | 512,400 | 112,352 '- elementData java.lang.Object[640] @ 0x76f3cb800 | 6,405 | 2,576 | 512,400 | 112,320 '- [160] class org.jboss.as.ejb3.remote.DefaultEJBClientContextSelector @ 0x76eed97d8 | 6,405 | 16 | 512,400 | 312 '- INSTANCE org.jboss.as.ejb3.remote.DefaultEJBClientContextSelector @ 0x76eed9848 | 6,405 | 24 | 512,400 | 24 |- tcclEJBClientContextService org.jboss.as.ejb3.remote.TCCLEJBClientContextSelectorService @ 0x76ef8ba50| 6,404 | 24 | 512,320 | 2,308,232 | '- identifiableContexts java.util.concurrent.ConcurrentHashMap @ 0x76ef8bb18 | 6,404 | 64 | 512,320 | 2,307,992 | '- table java.util.concurrent.ConcurrentHashMap$Node[16384] @ 0x7bd508000 | 6,404 | 65,552 | 512,320 | 2,307,928 | |- [3054] java.util.concurrent.ConcurrentHashMap$Node @ 0x770900950 | 5 | 32 | 400 | 1,752 | | | |- val org.jboss.ejb.client.EJBClientContext @ 0x76fec29f8 | 1 | 80 | 80 | 2,816 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ So finalize not possible yet. The remove from this map not occurring upon close like it should?