Hibernate Oracle DB Sessions Stays Idle Forever

39 Views Asked by At

In our Java Spring application we are using hibernate to connect with the oracle 12c database and the application makes the idle db sessions which stays forever and eventually crash the application. We are using BoneCP connection pooling and max life of a connection is the default value of the BoneCP (60 minutes) but even after that period, connection won't be closed and stays as an idle session in the oracle db, and eventually more idle connections are getting pile up and app is going to crash within few hours. We also tried replacing the BoneCP with the Hikari and result is the same.

We used Oracle Enterprise Manager to examine these idle connections and it shows an update query, which is created by the following hibernate code snippet

public CustomerMobileProfile update(CustomerMobileProfile customerMobileProfile) {
    return entityManager.merge(customerMobileProfile);
}

we even try to flush the updated entity by using the following flush method and result is the same

entityManager.flush();

Anyone has any idea or experience related with this? I found this Connection not closed after MaxLifeTime thread in the internet.

This application works fine until few days back without such case and now it can not surview if we didn't close the idle connections manually

0

There are 0 best solutions below