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 I am using VS2008, linq, mvc, mindsscape and mysql 5.1. It seems that a new connection is made to the db every time I refresh my index page. Which basically consist of the following public ActionResult Index(){ using (LightSpeedModelFaraosUnitOfWork uow = Repository.Context.CreateUnitOfWork()){ "Menu"] = generateTopMenu(uow);ViewData[ return View(); } The uow is created in a style of the intro webcast, and it is only querying. What am I doing wrong, and can you give me a hint of how to control the connection pooling? regards |
|
|
Every time you create a unit of work, we create a new connection (that is, a new MySqlConnection object). So you are right that every visit to the Index page creates a new connection. But disposing the unit of work disposes that connection, so you shouldn't be seeing any leakage. Could you say a bit more about what you're seeing? This may be a matter of the MySQL driver keeping connections around longer than it should, perhaps with a view to pooling them as you suggest, and perhaps failing to reuse pooled connections efficiently (but I'm speculating here -- not trying to point fingers at the MySQL driver!). I believe pooling is controlled using the connection string but you would need to check the MySQL docs for details. |
|
|
I have done some my research taking your information concerning the uow into a acount. The simple scenario is to run regular debug mode, VS2008 starts a ASP.NET server. I go to the index page once. Now I can see one connection in the MySQL administrator. I stop the IE and stop the VS2008 debug, the ASP.NET server still running, and the connection remains. Shutting down the ASP.NET server cleans up the connection. This indicates that the connection is somehow hold by a ressource that is not disposed, can I somhow explicit close the connection a disposal of the uow. |
|
|
We don't provide a means for explicitly closing the connection but that should happen when the UOW is disposed (which from your code sample you are clearly doing). Could you try making multiple requests within the same ASP.NET server session and see if all the connections are held open (and the number of connections therefore mounts up over time) or whether they are recycled as new requests come in (which would imply a benign pooling scenario)? Thanks! |
|
|
Guys,
Was this fixed somehow, or is there some workaround? I'm stuck with the same issue. I have a simple query on my page IQueryable<Category> res = null; var ctx = AdminDAC.CreateContext(); using (var db = ctx.CreateUnitOfWork()) { res = db.Categories.OrderBy(p => p.CategoryName).ToList().AsQueryable(); } return res; and every time I reload my page, SHOW PROCESSLIST shows new connection has been created, until connection count reaches 100 and then I just get "Too many connections" exception |
|
|
I am still working on it, however it seems that an explicit call to db.Dispose() as the last statment within the using context do some help. As understand is the .NET engine using a similar GC(garbage collect) as Java so no objects gets cleaned, and no calls to dispose, before the macheine is almost out of virtual memory. Machines has lot of memory today, mine 4GB and I am mereyly using 1,4GB, so GC will sort of never run. Also try-catch-finally around the whole bloddy thing to ensure that dispose will be called no matter that. So even using LINQ and you still have to remember your got old coding paradigms |
|
|
Is this a MySQL Driver issue or is this a issue with LS ? does the same happens with MS SQL Server for example ?. |
|
|
We believe it is an issue with the MySQL driver. Both of you are experiencing problems with MySQL ballooning connections, and we haven't (as far as I know) received similar reports against other databases. A google for "mysql .net connection pooling" throws up a number of MySQL forums posts reporting what appear to be similar problems. That said, a lot of the posts I found on the MySQL forums were fairly old. So maybe this has been fixed in a more recent version of the MySQL driver. We're planning an update as part of 3.0 but I'll see if we can get that brought forward into a 2.2 nightly to see if resolves the issues you're seeing. |
|
|
Ivan The mySQL driver you guys are shipping is few years old. If you want us to be beta tester on 2.2 with the new driver we will be happy to do it. We love your product but we had to pull the app out of production because of this issue
Jay
|
|
|
Hello Jay and Max, We are upgrading the MySql.Data.dll build to 5.2.5 as of the 21 Mar 2009 nightly build, which will be available from the downloads page or the store after about 1430 GMT. Please note that we are not claiming this will resolve the problem you are seeing. However, bringing us up to the current version should at least eliminate "bug in old version of driver" as a possible cause, and enable us to work with the MySQL community to resolve the problem if it still manifests. So we would very much appreciate it if you could download this version and let us know whether it improves matters. If you are using stored procedures then please see http://www.mindscape.co.nz/forums/Thread.aspx?ThreadID=1779 for information about a potential compatibility issue with the move to 5.2.5. Thanks for your patience and for helping us with the testing. |
|
|
Hi Ivan, I've downloaded Nightly Build for 23 Mar 2009 - LightSpeedProfessional-20090323.msi from my account page, But it gives me {"This edition supports a maximum of 8 types."} exception So your nightly builds do not support "more than 8 types"? |
|
|
Hi, Are you use you are using the store version? Only the express edition includes the 8 model limit. You can check this by right-clicking your LightSpeed assembly and bringing up the properties. Checking the version information should state the edition of assembly. Is it possible you have referenced an old Express edition LightSpeed assembly in your project? Kind regards, John-Daniel Trask |
|
|
Hello Jay, Just following up on this to see if you got the nightly build working and whether the switch to 5.2.5 resolved the connection leak problem. |
|
|
Hi! If you wish to test a newer version of the MySql provider you can redirect requests for mysql.data. See the following: <!-- Redirect requests for MySQL.Data.dll v. 5.1.4.0 to MySQL.Data.dll v. 5.2.3.0 --> Best regards Björn Andersson Admeta AB |
|
|
Hi, Yes the problem is resolved with new 5.2.5 driver |
|