Issue Details (XML | Word | Printable)

Key: GLASSFISH-19427
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Jagadish
Reporter: jifeng
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
glassfish

connection leak reclaim does not work

Created: 11/Dec/12 08:20 AM   Updated: Yesterday 04:47 PM
Component/s: jdbc
Affects Version/s: 3.1
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. File LeakTimeout.war (3 kB) 11/Dec/12 09:31 AM - jifeng


Tags: 4_0_1-review
Participants: Jagadish and jifeng


 Description  « Hide

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 ?



jifeng added a comment - 01/Aug/13 03:33 AM

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?


jifeng added a comment - 04/Jan/13 09:07 AM - edited

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)  
 }
}

jifeng added a comment - 11/Dec/12 09:31 AM

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