Jump to content

Database session is not getting closed


Mani rathnam

Recommended Posts

Hi All,

 

I have copied one of the existing Stats report module and created a new one. Modified the sql query inside the stat module. It is working fine.

 

But it is taking too much resource and bringing the site down. When we asked the Prestashop support team, they said, it is because the query in the new stat module is not closing the database session after running the sql query.

 

I am not sure how to resolve this and i am having doubt that why the same issue in not there in the existing modules.

 

Can anyone please guide me on this ?

 

It is happening in PROD and as of now we disabled the newly created modules.

 

Thanks in Advance.

Mani

Link to comment
Share on other sites

Database session should be automatically closed when PHP ends. So I doubt that.

 

In your config directory in the file defines.inc.php you will find the following line:

define('_PS_DEBUG_PROFILING_', false);

 

If you put that to true you will see at the bottom of each page a list of the mysql commands that have been run by that page - and how long they took. 

Link to comment
Share on other sites

Thanks musicmaster.  Before I realize that the server is using more resources, the page is going down. 

 

I will try this option and update you.

 

Meanwhile, can i use explicit code to close the connection. example: Db::getInstance()->disconnect();

 

is that right way to do ?

 

Thanks in Advance.

Mani

Link to comment
Share on other sites

Thanks musicmaster.  Before I realize that the server is using more resources, the page is going down. 

 

I will try this option and update you.

 

Meanwhile, can i use explicit code to close the connection. example: Db::getInstance()->disconnect();

 

is that right way to do ?

 

Thanks in Advance.

Mani

 

I am not sure about that. Maybe someone else knows.

Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...