[JBoss JIRA] (WFLY-12031) Memory leak in wildfly transaction client
by Cheng Fang (Jira)
[ https://issues.jboss.org/browse/WFLY-12031?page=com.atlassian.jira.plugin... ]
Cheng Fang edited comment on WFLY-12031 at 4/30/19 12:54 PM:
-------------------------------------------------------------
When adding to {{openFilePaths}} set, the file name part (the last element in the path) is used. So when removing it, we should also use the file name part of the path {{filePath}}.
I think changing the remove line to the following should work (around line 272):
{code:java}
openFilePaths.remove(filePath.getFileName().toString());
{code}
/cc [~flavia.rainone]
was (Author: cfang):
When adding to {{openFilePaths}} set, the file name part (the last element in the path) is used. So when removing it, we should also use the file name part of the path {{filePath}}.
I think changing the remove line to the following should work:
{code:java}
openFilePaths.remove(filePath.getFileName().toString());
{code}
/cc [~flavia.rainone]
> Memory leak in wildfly transaction client
> -----------------------------------------
>
> Key: WFLY-12031
> URL: https://issues.jboss.org/browse/WFLY-12031
> Project: WildFly
> Issue Type: Bug
> Components: Transactions
> Affects Versions: 15.0.1.Final
> Environment: wildfly-transaction-client-1.1.3.Final
> wildfly.15.0.1.Final
> Window 10
> Reporter: Joachim Petrich
> Assignee: Cheng Fang
> Priority: Critical
>
> After a volume run of our system we recognized millions of entries in the openFilePaths Object of class FileSystemXAResourceRegistry. When enabling traces for org.wildfly.transaction it seems that for adding an entry a xid string is used
> {code:java}
> XAResourceRegistryFile(Xid xid) throws SystemException {
> xaRecoveryPath.toFile().mkdir(); // create dir if non existent
> final String xidString = SimpleXid.of(xid).toHexString('_');
> this.filePath = xaRecoveryPath.resolve(xidString);
> openFilePaths.add(*xidString*);
> {code}
> and for removing the entire file path:
> {code:java}
> protected void removeResource(XAResource resource) throws XAException {
> if (resources.remove(resource)) {
> if (resources.isEmpty()) {
> // delete file
> try {
> if (fileChannel != null) {
> fileChannel.close();
> }
> Files.delete(filePath);
> // deleting using the filepath as key caused a memory leak,
> // if xid string have been added, therefore build the xid string for removing
> openFilePaths.remove(*filePath.toString()*);
> {code}
> We didn't find any code where this xid are cleaned up.
> As workaround we additionally extract the xid String from the file path and remove the corresponding entry.
> {code:java}
> String xidString = filePath.toString().substring(filePath.toString().indexOf(
> xaRecoveryPath.toString()) + xaRecoveryPath.toString().length() + 1);
> openFilePaths.remove(xidString);
> {code}
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
6 years, 5 months
[JBoss JIRA] (WFLY-12031) Memory leak in wildfly transaction client
by Cheng Fang (Jira)
[ https://issues.jboss.org/browse/WFLY-12031?page=com.atlassian.jira.plugin... ]
Cheng Fang commented on WFLY-12031:
-----------------------------------
When adding to {{openFilePaths}} set, the file name part (the last element in the path) is used. So when removing it, we should also use the file name part of the path {{filePath}}.
I think changing the remove line to the following should work:
{code:java}
openFilePaths.remove(filePath.getFileName().toString());
{code}
/cc [~flavia.rainone]
> Memory leak in wildfly transaction client
> -----------------------------------------
>
> Key: WFLY-12031
> URL: https://issues.jboss.org/browse/WFLY-12031
> Project: WildFly
> Issue Type: Bug
> Components: Transactions
> Affects Versions: 15.0.1.Final
> Environment: wildfly-transaction-client-1.1.3.Final
> wildfly.15.0.1.Final
> Window 10
> Reporter: Joachim Petrich
> Assignee: Cheng Fang
> Priority: Critical
>
> After a volume run of our system we recognized millions of entries in the openFilePaths Object of class FileSystemXAResourceRegistry. When enabling traces for org.wildfly.transaction it seems that for adding an entry a xid string is used
> {code:java}
> XAResourceRegistryFile(Xid xid) throws SystemException {
> xaRecoveryPath.toFile().mkdir(); // create dir if non existent
> final String xidString = SimpleXid.of(xid).toHexString('_');
> this.filePath = xaRecoveryPath.resolve(xidString);
> openFilePaths.add(*xidString*);
> {code}
> and for removing the entire file path:
> {code:java}
> protected void removeResource(XAResource resource) throws XAException {
> if (resources.remove(resource)) {
> if (resources.isEmpty()) {
> // delete file
> try {
> if (fileChannel != null) {
> fileChannel.close();
> }
> Files.delete(filePath);
> // deleting using the filepath as key caused a memory leak,
> // if xid string have been added, therefore build the xid string for removing
> openFilePaths.remove(*filePath.toString()*);
> {code}
> We didn't find any code where this xid are cleaned up.
> As workaround we additionally extract the xid String from the file path and remove the corresponding entry.
> {code:java}
> String xidString = filePath.toString().substring(filePath.toString().indexOf(
> xaRecoveryPath.toString()) + xaRecoveryPath.toString().length() + 1);
> openFilePaths.remove(xidString);
> {code}
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
6 years, 5 months
[JBoss JIRA] (JBJCA-1389) NullPointerException raised when calling isWrapperFor(...) on a closed connection
by Stephen Fikes (Jira)
[ https://issues.jboss.org/browse/JBJCA-1389?page=com.atlassian.jira.plugin... ]
Stephen Fikes commented on JBJCA-1389:
--------------------------------------
The root cause seems to be that, unlike other code paths, there is no {{checkStatus()}} call prior to the execution of {{mc.getRealConnection()}} in {{getWrappedObject()}}.
> NullPointerException raised when calling isWrapperFor(...) on a closed connection
> ---------------------------------------------------------------------------------
>
> Key: JBJCA-1389
> URL: https://issues.jboss.org/browse/JBJCA-1389
> Project: IronJacamar
> Issue Type: Bug
> Components: JDBC
> Affects Versions: 1.4.9
> Reporter: Stephen Fikes
> Priority: Major
>
> When calling {{Connection.isWrapperFor(...)}} on a connection which has been closed previously, a {{NullPointerException}} is raised. The exception should be "Connection is not associated with a managed connection: ..."
> {code}
> ... java.lang.NullPointerException
> at org.jboss.jca.adapters.jdbc.WrappedConnection.getWrappedObject(WrappedConnection.java:1914)
> at org.jboss.jca.adapters.jdbc.WrappedConnection.getWrappedObject(WrappedConnection.java:64)
> at org.jboss.jca.adapters.jdbc.JBossWrapper.isWrapperFor(JBossWrapper.java:68)
> {code}
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
6 years, 5 months
[JBoss JIRA] (JBJCA-1389) NullPointerException raised when calling isWrapperFor(...) on a closed connection
by Stephen Fikes (Jira)
[ https://issues.jboss.org/browse/JBJCA-1389?page=com.atlassian.jira.plugin... ]
Stephen Fikes updated JBJCA-1389:
---------------------------------
Description:
When calling {{Connection.isWrapperFor(...)}} on a connection which has been closed previously, a {{NullPointerException}} is raised. The exception should be "Connection is not associated with a managed connection: ..."
{code}
... java.lang.NullPointerException
at org.jboss.jca.adapters.jdbc.WrappedConnection.getWrappedObject(WrappedConnection.java:1914)
at org.jboss.jca.adapters.jdbc.WrappedConnection.getWrappedObject(WrappedConnection.java:64)
at org.jboss.jca.adapters.jdbc.JBossWrapper.isWrapperFor(JBossWrapper.java:68)
{code}
The NPE obscures the usage issue.
was:
When calling {{Connection.isWrapperFor(...)}} on a connection which has been closed previously, a {{NullPointerException}} is raised. The exception should be "Connection is not associated with a managed connection: ..."
{code}
... java.lang.NullPointerException
at org.jboss.jca.adapters.jdbc.WrappedConnection.getWrappedObject(WrappedConnection.java:1914)
at org.jboss.jca.adapters.jdbc.WrappedConnection.getWrappedObject(WrappedConnection.java:64)
at org.jboss.jca.adapters.jdbc.JBossWrapper.isWrapperFor(JBossWrapper.java:68)
{code}
> NullPointerException raised when calling isWrapperFor(...) on a closed connection
> ---------------------------------------------------------------------------------
>
> Key: JBJCA-1389
> URL: https://issues.jboss.org/browse/JBJCA-1389
> Project: IronJacamar
> Issue Type: Bug
> Components: JDBC
> Affects Versions: 1.4.9
> Reporter: Stephen Fikes
> Priority: Major
>
> When calling {{Connection.isWrapperFor(...)}} on a connection which has been closed previously, a {{NullPointerException}} is raised. The exception should be "Connection is not associated with a managed connection: ..."
> {code}
> ... java.lang.NullPointerException
> at org.jboss.jca.adapters.jdbc.WrappedConnection.getWrappedObject(WrappedConnection.java:1914)
> at org.jboss.jca.adapters.jdbc.WrappedConnection.getWrappedObject(WrappedConnection.java:64)
> at org.jboss.jca.adapters.jdbc.JBossWrapper.isWrapperFor(JBossWrapper.java:68)
> {code}
> The NPE obscures the usage issue.
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
6 years, 5 months
[JBoss JIRA] (JBJCA-1389) NullPointerException raised when calling isWrapperFor(...) on a closed connection
by Stephen Fikes (Jira)
[ https://issues.jboss.org/browse/JBJCA-1389?page=com.atlassian.jira.plugin... ]
Stephen Fikes updated JBJCA-1389:
---------------------------------
Description:
When calling {{Connection.isWrapperFor(...)}} on a connection which has been closed (i.e. returned to the pool, managed connection disassociated) previously, a {{NullPointerException}} is raised. The exception should be "Connection is not associated with a managed connection: ..."
{code}
... java.lang.NullPointerException
at org.jboss.jca.adapters.jdbc.WrappedConnection.getWrappedObject(WrappedConnection.java:1914)
at org.jboss.jca.adapters.jdbc.WrappedConnection.getWrappedObject(WrappedConnection.java:64)
at org.jboss.jca.adapters.jdbc.JBossWrapper.isWrapperFor(JBossWrapper.java:68)
{code}
The NPE obscures the usage issue.
was:
When calling {{Connection.isWrapperFor(...)}} on a connection which has been closed previously, a {{NullPointerException}} is raised. The exception should be "Connection is not associated with a managed connection: ..."
{code}
... java.lang.NullPointerException
at org.jboss.jca.adapters.jdbc.WrappedConnection.getWrappedObject(WrappedConnection.java:1914)
at org.jboss.jca.adapters.jdbc.WrappedConnection.getWrappedObject(WrappedConnection.java:64)
at org.jboss.jca.adapters.jdbc.JBossWrapper.isWrapperFor(JBossWrapper.java:68)
{code}
The NPE obscures the usage issue.
> NullPointerException raised when calling isWrapperFor(...) on a closed connection
> ---------------------------------------------------------------------------------
>
> Key: JBJCA-1389
> URL: https://issues.jboss.org/browse/JBJCA-1389
> Project: IronJacamar
> Issue Type: Bug
> Components: JDBC
> Affects Versions: 1.4.9
> Reporter: Stephen Fikes
> Priority: Major
>
> When calling {{Connection.isWrapperFor(...)}} on a connection which has been closed (i.e. returned to the pool, managed connection disassociated) previously, a {{NullPointerException}} is raised. The exception should be "Connection is not associated with a managed connection: ..."
> {code}
> ... java.lang.NullPointerException
> at org.jboss.jca.adapters.jdbc.WrappedConnection.getWrappedObject(WrappedConnection.java:1914)
> at org.jboss.jca.adapters.jdbc.WrappedConnection.getWrappedObject(WrappedConnection.java:64)
> at org.jboss.jca.adapters.jdbc.JBossWrapper.isWrapperFor(JBossWrapper.java:68)
> {code}
> The NPE obscures the usage issue.
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
6 years, 5 months
[JBoss JIRA] (JBJCA-1389) NullPointerException raised when calling isWrapperFor(...) on a closed connection
by Stephen Fikes (Jira)
[ https://issues.jboss.org/browse/JBJCA-1389?page=com.atlassian.jira.plugin... ]
Stephen Fikes updated JBJCA-1389:
---------------------------------
Description:
When calling {{Connection.isWrapperFor(...)}} on a connection which has been closed previously, a {{NullPointerException}} is raised. The exception should be "Connection is not associated with a managed connection: ..."
{code}
... java.lang.NullPointerException
at org.jboss.jca.adapters.jdbc.WrappedConnection.getWrappedObject(WrappedConnection.java:1914)
at org.jboss.jca.adapters.jdbc.WrappedConnection.getWrappedObject(WrappedConnection.java:64)
at org.jboss.jca.adapters.jdbc.JBossWrapper.isWrapperFor(JBossWrapper.java:68)
{code}
was:
When calling {{Connection.isWrapperFor(...)}} on a connection which has been closed previously, a {{NullPointerException }} is raised. The exception should be "Connection is not associated with a managed connection: ..."
{code}
... java.lang.NullPointerException
at org.jboss.jca.adapters.jdbc.WrappedConnection.getWrappedObject(WrappedConnection.java:1914)
at org.jboss.jca.adapters.jdbc.WrappedConnection.getWrappedObject(WrappedConnection.java:64)
at org.jboss.jca.adapters.jdbc.JBossWrapper.isWrapperFor(JBossWrapper.java:68)
{code}
> NullPointerException raised when calling isWrapperFor(...) on a closed connection
> ---------------------------------------------------------------------------------
>
> Key: JBJCA-1389
> URL: https://issues.jboss.org/browse/JBJCA-1389
> Project: IronJacamar
> Issue Type: Bug
> Components: JDBC
> Affects Versions: 1.4.9
> Reporter: Stephen Fikes
> Priority: Major
>
> When calling {{Connection.isWrapperFor(...)}} on a connection which has been closed previously, a {{NullPointerException}} is raised. The exception should be "Connection is not associated with a managed connection: ..."
> {code}
> ... java.lang.NullPointerException
> at org.jboss.jca.adapters.jdbc.WrappedConnection.getWrappedObject(WrappedConnection.java:1914)
> at org.jboss.jca.adapters.jdbc.WrappedConnection.getWrappedObject(WrappedConnection.java:64)
> at org.jboss.jca.adapters.jdbc.JBossWrapper.isWrapperFor(JBossWrapper.java:68)
> {code}
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
6 years, 5 months
[JBoss JIRA] (JBJCA-1389) NullPointerException raised when calling isWrapperFor(...) on a closed connection
by Stephen Fikes (Jira)
Stephen Fikes created JBJCA-1389:
------------------------------------
Summary: NullPointerException raised when calling isWrapperFor(...) on a closed connection
Key: JBJCA-1389
URL: https://issues.jboss.org/browse/JBJCA-1389
Project: IronJacamar
Issue Type: Bug
Components: JDBC
Affects Versions: 1.4.9
Reporter: Stephen Fikes
When calling {{Connection.isWrapperFor(...)}} on a connection which has been closed previously, a {{NullPointerException }} is raised. The exception should be "Connection is not associated with a managed connection: ..."
{code}
... java.lang.NullPointerException
at org.jboss.jca.adapters.jdbc.WrappedConnection.getWrappedObject(WrappedConnection.java:1914)
at org.jboss.jca.adapters.jdbc.WrappedConnection.getWrappedObject(WrappedConnection.java:64)
at org.jboss.jca.adapters.jdbc.JBossWrapper.isWrapperFor(JBossWrapper.java:68)
{code}
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
6 years, 5 months