[GLASSFISH-19427] connection leak reclaim does not work Created: 11/Dec/12  Updated: 04/Jun/14

Status: Open
Project: glassfish
Component/s: jdbc
Affects Version/s: 3.1
Fix Version/s: None

Type: Bug Priority: Major
Reporter: jifeng Assignee: Jagadish
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File LeakTimeout.war    
Tags: 4_0_1-reviewed

 Description   

I execute under three commands:

1.resources.jdbc-connection-pool.oracle_pool.pooling=false
2.set resources.jdbc-connection-pool.oracle_pool.connection-leak-timeout-in-seconds=10
3.set resources.jdbc-connection-pool.oracle_pool.connection-leak-reclaim=true

then I get jdbc connection from "oracle_pool" by my application,the connection that is not return back to the pool by my application within the specified period(leak-timeout), after 10 second, the function of connection-leak-reclaim does not work ,it is a pattern or a bug ?



 Comments   
Comment by jifeng [ 11/Dec/12 ]

test guide

1. create jdbc resource

asadmin start-database
asadmin create-jdbc-connection-pool --datasourceclassname org.apache.derby.jdbc.ClientDataSource --restype javax.sql.DataSource --isconnectvalidatereq=false --property User=APP:Password=APP:DatabaseName=EJB:PortNumber=1527:serverName=localhost:connectionAttributes=\\;create\\=true oracle_pool
asadmin set resources.jdbc-connection-pool.oracle_pool.pooling=false
asadmin set resources.jdbc-connection-pool.oracle_pool.connection-leak-timeout-in-seconds=10
asadmin set resources.jdbc-connection-pool.oracle_pool.connection-leak-reclaim=true
asadmin create-jdbc-resource  --target server --connectionpoolid oracle_pool jdbc/oracle

2.please download the attachment and deploy it

 
asadmin deploy --target server ./LeakTimeout.war

3.call:http://localhost:28282/LeakTimeout/UseConnection?sleepTime=20000

Comment by jifeng [ 04/Jan/13 ]

I think it is a bug:

com.sun.enterprise.resource.pool.datastructure.RWLockDataStructure
public void removeResource(ResourceHandle resource) {
    boolean removed = false;
    writeLock.lock();
    try {
        removed = resources.remove(resource); "★"
    } finally {
        writeLock.unlock();
    }
    if(removed) {
       handler.deleteResource(resource);//not execute when the state of pool is unpooling

    }
}

the code which is marked as "★" has problem,because there is no connection in the pool when the state of pool is unpooling, so "handler.deleteResource(resource)" does not execute

I changed the code and it works fine

com.sun.enterprise.resource.pool.datastructure.RWLockDataStructure
public void removeResource(ResourceHandle resource) {
    writeLock.lock();
    try {
        resources.remove(resource); 
    } finally {
        writeLock.unlock();
    }
    handler.deleteResource(resource)  
 }
}
Comment by jifeng [ 01/Aug/13 ]

Hi:
sfelts

This phenomenon also occurs in glassfish v4 .

when i used the way as above, it works fine

could you please confirm it and give me some suggestions?

Generated at Tue Jul 07 04:47:59 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.