Developer forum

Forum » Development » sql connection leak in: ExtendSaveProductCatedories

sql connection leak in: ExtendSaveProductCatedories

Remi Muller
Reply

Today i found out there is a sql connection leak in ExtendSaveProductCatedories.

This caused by creating a loop over all products and calling Product.Save()

Please have a look at the following dw source:

--------------------------------------------------------------
Dynamicweb.eCommerce.Products.Product
private void ExtendSaveProductCatedories(bool skipExtendedSave)

.....

if (!skipExtendedSave)
    {
        Hashtable productCategoriesLanguageControl = this.GetProductCategoriesLanguageControl();
        IDbConnection connection = Database.CreateConnection();

....

--------------------------------------------------------------

The var connection is never closed, disposed or in a using statement.
The previous connection dbConnection is in a nice using statement. Can't you reuse that one?
Can you fix this please?

Workaround:
Call Product.Save(false); If you do not need updating of EcomProductCategoryFieldValue

Some background info. During development this was not noticed because some how the number of cpu's is also affecting the number of leaking sql connections. The server which i was rolling out today has 24 cores and the number of sql connections jumped to the limit of 200.
Why is the pool so large. Shouldn't this be configurable?

 

 


Replies

 
Nicolai Høeg Pedersen
Reply

Hi Remi

I'll have a dev look into this and make the required changes. Putting it into a using statement should be sufficient - no need to reuse connection because of the connection pool handling it.

We could consider making the connection pool configurable.

Thanks for letting us know!

BR Nicolai

 
Christian Rud Skovgaard
Reply

Hi Remi,

These not clsoed connections have now been registered as a bug in our software and will be fixed in the upcomming service release 8.5.1.

 

Kind regards

Christian

 

You must be logged in to post in the forum