This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, My LightSpeed DD website requires that I restart the server every few minutes because the MySQL server refuses connections after a short while and shutting down the ASP.NET development server frees up the required connection resources. After clicking around the site for a little while, the MySQL "Threads_connected" server status variable is 102. This only seems to drop if I stop the development server. It drops down to 2, which I presume are two connections required for SQLyog to view the MySQL server variables. I register my meta model as per the instructions in the help file, using a LightSpeedContext that is declared as a static readonly field in Global.asax.cs. I suspect I've missed a really obvious resource disposal call but I'm not clear where I could put such a call (or the LightSpeed recommended syntax). Any ideas how I can prevent the number of database connections from ballooning upwards like this? Thanks, Chris |
|
|
Dynamic Data should be disposing the unit of work objects as it goes. I have found a bug in LightSpeed where an edit, create or delete operation would leak a unit of work, and this will be fixed in the 14 Aug nightly, but I don't think this is what's causing your problem since you're just "clicking around." However, I have also found what I consider to be a bug in Dynamic Data where, if a page contains a drop-down for filtering on associations, it creates a "data context" (in LightSpeed, a UOW) to load the contents of the filter box, but appears never to dispose that context. This appears to be what's causing your problem, and unfortunately it's outside our control. I am investigating workarounds and will let you know. |
|
|
Hello Chris, Okay, I have put in a workaround for the Dynamic Data framework issue. It is a bit of a kludge though so I would advise thorough testing (I know you do that anyway!) including in IIS as well as Cassini. Be warned that, if your environment is like mine, you will still see MySQL connections being held beyond the lifetime of the page. The number of connections does not, however, grow out of control -- instead MySQL appears to hang onto the maximum number of connections it has ever needed: because the workaround involves disposing the leaked UOWs at page unload, this will be 1 + the number of filter boxes on the most filter-heavy page you have visited (we have not attempted to optimise reuse of UOWs within the page lifecycle so each filter box filling query still incurs a new UOW). I believe this is due to connection pooling within the MySQL driver. Please let us know if you still see connection leakage / starvation with these fixes. |
|