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
|
I am getting a strange connection pooling error since adding a LS model to my winforms app: "Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached." Note that this error isn't coming up in my LS related code, but elsewhere in my app (in a background thread that polls the db). However it only occurs when the user has the form that uses LS open and is working in it - so it seems to be somehow related to the operation of LS on my new form. Just wondering what the connection pooling options there are with LS and what things I need to be aware of when working in a winforms app? The current way I am working is that I create my UOW when I open the form in question - and dispose it in the finalize method of the form. Is this correct? Am using SQL Server. |
|
|
As you've identified, this probably means something us using up all the connections in the pool. LightSpeed doesn't do anything specific with the pool -- in SQL Server the pooling behaviour is determined by a connection string option. You mention that you dispose the UOW in the Finalize method of the form. That's probably too late, because the Finalize method doesn't get called until .NET starts running low on memory. You should dispose the UOW no later than the Close/Dispose method of the form. Depending on loading and concurrency requirements, you may even want to create and dispose a short-lived UOW during data load, then create and dispose another short-lived UOW during data save. (JD is working on a Windows Forms sample which we hope to ship this week, and will show suggested lifecycle patterns in more detail.) On the other hand, this shouldn't leak too many connections unless the user is repeatedly opening and closing new instances of the form. You don't say for sure, but I kinda get the impression this is happening even if the user has opened only one instance of the form: is that correct? |
|