Thursday, March 22, 2012

Connection pool leak in production machine (in other machine it runs well)

Hi to everyone,

I'm facing a problem that drives me crazy. I've a web application that has the following problem. When I test the application on my developement machine all runs fine, but when I put into production server there is a problem in connection pooling. Look at the following image, the blue line is the number of connection in the pool and the violet line is the number of connection reclaimed. From the image it is clear that connection are returned on the pool only in block, maybe when the garbage collection pass and reclaim the object. The strange thing is that on my developement machine all is good, and also I'm using Enterprise Library and the connection are managed internally.-

Thanks to everyone for any help.


How do you access DB? If you use some IDataReader, though they will be GC sooner or later, still remember to close them as soon as they are not used~|||

My big mistake is to misunderstood the meaning of the numberOfReclaimedConnection counter, that indicates the number of connections that are reclaimed by a garbage collector and indicate a leak. For some reason in my developement machine garbage collector does a more aggressive job in reclaiming connection while in the production server, maybe due to the large amount of ram garbage collection happens less frequently.

You're right about the datareder, one of the function in Data Access Layer forget to close a datareader in some situation, and it's called from a webModule that runs at every request for the page. The result is awful, when a lot of user access to the site the pool often become empty. I enclose the datareader in using block and all goes well again. From now on I will use perfmon.exe at every run of the site.

Alk.

No comments:

Post a Comment