# Application (DA) killing connection to database after a few minutes - Devart - PostgreSQL

**URL:** https://talk.remobjects.com/t/application-da-killing-connection-to-database-after-a-few-minutes-devart-postgresql/17756
**Category:** Data Abstract
**Created:** [October 25, 2018, 8:00pm UTC](https://talk.remobjects.com/t/application-da-killing-connection-to-database-after-a-few-minutes-devart-postgresql/17756 "2018-10-25T20:00:58Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![adaptive](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/a/2acd7d/32.png) [@adaptive](https://talk.remobjects.com/u/adaptive)
#### Post date: [October 25, 2018, 8:00pm UTC](https://talk.remobjects.com/t/application-da-killing-connection-to-database-after-a-few-minutes-devart-postgresql/17756/1 "2018-10-25T20:00:58Z")

</div>

After a components upgrade (Devart and RemObject) my application started killing the connection after a few minutes for no apparent reason.  
Tests were done with the old version of Devart, but the same problem is still happening.

There has been no change in the connection settings with the bank, we are suspicious that RemObject is setting some internal timeout setting in Devart.

The settings are the same (connection to the bank, load / volume of data) for the following combinations of components:

======= **Connection Settings** =======

**ConnectionDefinition** conexaoBD = **new ConnectionDefinition()**;  
conexaoBD.Name = “ConexaoBD”;  
conexaoBD.Pool.MaxPoolSize = 10;  
conexaoBD.Pool.WaitTimeOut = 600;

conexaoBD.ConnectionString = “DEVART\_POSTGRESQL.NET?”;  
conexaoBD.ConnectionString += “Host=localhost”;  
conexaoBD.ConnectionString += “;Port=5432”;  
conexaoBD.ConnectionString += ";Database=postgres;  
conexaoBD.ConnectionString += “;User Id=postgres”;  
conexaoBD.ConnectionString += “;Password=postgres”;  
conexaoBD.ConnectionString += “;Unicode=True;Persist Security Info=True;Schema=public;Pooling=false;UnpreparedExecute=true;Max Pool Size=100;Connection Timeout=15;Default Command Timeout=0;”;  
conexaoBD.Default = true;

**connectionManager**.ConnectionDefinitions.Add(conexaoBD);

connectionManager.PoolingBehavior = RemObjects.SDK.Pooling.PoolBehavior.RaiseError;  
connectionManager.PoolTransactionBehaviour = PoolTransactionBehaviour.Rollback;  
connectionManager.WaitIntervalSeconds = 10;  
connectionManager.PoolingEnabled = false;  
connectionManager.MaxPoolSize = 5;  
connectionManager.ConnectionPoolTimeout = 600;

======= **Components** =======

- **Success**

- Devart: 7.7.819.0 or higher

- RemObjects Data Abstract for .NET, Server Edition - 9.1.99.1273

- PostgreSQL 10.3

- **Error**

- Devart: 7.7.819.0 or higher

- RemObjects Data Abstract for .NET, Server Edition - 9.4.109.1377

- PostgreSQL 10.3

- This set of components generate the error described below

======= **Application log** =======

Devart.Data.PostgreSql.PgSqlException (0x80004005): Server did not respond within the specified timeout interval. —\> System.TimeoutException: Server did not respond within the specified timeout interval. —\> System.IO.IOException: Unable to read transport connection data: A connection attempt failed because the connected component did not respond  
correctly after a period of time or the established connection failed  
because the connected host did not respond. —\> System.Net.Sockets.SocketException:A connection attempt failed because the connected component did not respond  
correctly after a period of time or the established connection failed  
because the connected host did not respond  
em System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)  
em System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)  
— Fim do rastreamento de pilha de exceções internas —  
em System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)  
em Devart.Common.z.a(Byte[] A\_0, Int32 A\_1, Int32 A\_2)  
— Fim do rastreamento de pilha de exceções internas —  
em Devart.Common.z.a(Byte[] A\_0, Int32 A\_1, Int32 A\_2)  
em Devart.Common.f.c(Byte[] A\_0, Int32 A\_1, Int32 A\_2)  
em Devart.Common.n.d(Byte[] A\_0, Int32 A\_1, Int32 A\_2)  
em Devart.Data.PostgreSql.PgSqlDataReader.f(Int32 A\_0)  
em Devart.Data.PostgreSql.PgSqlCommand.InternalExecute(CommandBehavior behavior, IDisposable stmt, Int32 startRecord, Int32 maxRecords)  
em Devart.Common.DbCommandBase.InternalExecute(CommandBehavior behavior, IDisposable stmt, Int32 startRecord, Int32 maxRecords, Boolean nonQuery)  
em Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior, Boolean nonQuery)  
em Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior)  
em System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()

======= **PostgreSQL log** =======  
2018-10-25 14:05:58.432 -03 [12688] LOG: could not receive data from client: An existing connection was forcibly closed by the remote host.  
2018-10-25 14:05:58.433 -03 [6604] LOG: could not receive data from client: An existing connection was forcibly closed by the remote host.  
2018-10-25 14:06:26.291 -03 [13196] LOG: could not send data to client: An existing connection was forcibly closed by the remote host.  
2018-10-25 14:06:26.291 -03 [13196] FATAL: connection to client lost

**Is there any configuration of transaction / connection timeout or something of the type that implicitly changed in this new version of RemObjects?**

---

<div class="post-metadata">

### Author: ![antonk](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/a/a5b964/32.png) [@antonk](https://talk.remobjects.com/u/antonk)
#### Post date: [October 26, 2018, 10:52am UTC](https://talk.remobjects.com/t/application-da-killing-connection-to-database-after-a-few-minutes-devart-postgresql/17756/3 "2018-10-26T10:52:19Z")

</div>

Hello

Check the `ConnectionTimeout` property of the Data Service. It behavior has been fixed in one of these builds (before the fix this property’s value has been ignored for some queries)

Hope that helps

---

<div class="post-metadata">

### Author: ![adaptive](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/a/2acd7d/32.png) [@adaptive](https://talk.remobjects.com/u/adaptive)
#### Post date: [October 26, 2018, 12:48pm UTC](https://talk.remobjects.com/t/application-da-killing-connection-to-database-after-a-few-minutes-devart-postgresql/17756/4 "2018-10-26T12:48:57Z")

</div>

Hello,

Thanks for the feedback, we did the reconfiguration of the ConnectionTimeout property and it worked.

Thank you
