I have an exception occurring only after some time.
I have a thread excecuted every 300 milliseconds (only for test purpose) that read from database as:
Code: Select all
TestDataContext context = new TestDataContext (PgConnectionString);
List<Command> commands = (from o in context.Commands
where
..
select o
).OrderBy(o=>o.Id).Take(10).ToList();
...
Code: Select all
2018-04-27 11:24:35,951 [18] ERROR .. Message: Error on opening DbConnection.
StackTrace: at Devart.Data.Linq.LinqCommandExecutionException.CanThrowLinqCommandExecutionException(String message, Exception e)
at Devart.Data.Linq.Engine.cg.g()
at Devart.Data.Linq.Engine.cg.b(IConnectionUser A_0)
at Devart.Data.Linq.DataProvider.a(br A_0, Object[] A_1)
at Devart.Data.Linq.Engine.DataQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
...
Source: Devart.Data.Linq
TargetSite: Boolean CanThrowLinqCommandExecutionException(System.String, System.Exception)
- "User Id=postgres;Password=xxx;Host=127.0.0.1;Database=xxx;Unicode=True;Port=5432;Pooling = True; Min Pool Size = 0; Max Pool Size = 100; Connection Lifetime = 0;" -> with this configuration in 4-5 days it stop work.
- "User Id=postgres;Password=xxx;Host=127.0.0.1;Database=xxx;Unicode=True;Port=5432;Pooling = True; Min Pool Size = 0; Max Pool Size = 25; Connection Lifetime = 300;Validate Connection=True;" -> with this configuration in a day it stop work.
- "User Id=postgres;Password=xxx;Host=127.0.0.1;Database=xxx;Unicode=True;Port=5432;Pooling = False; Min Pool Size = 0; Max Pool Size = 25; Connection Lifetime = 300;Validate Connection=True;" -> with Pooling=False.
How can i resolve it?
Thanks for your reply.