Server did not respond within the specified timeout interval

Server did not respond within the specified timeout interval

Postby jruder » Thu 09 Feb 2017 23:17

Hello;

No matter what I do I keep getting this, the project was working fine -- I made no changes.
It is running from a Azure server, I have also tested it from my development workstation.
I can connect using pgAdminIII and run queries with no problem.

Inside of VS 2013 I can connect using the server explorer and run queries with no problems either.

I have tried both my licensed 7.3 version and a trial of 7.7
My connection string (sensitive data removed)
<add name="CopsReportingConnectionString" connectionString="metadata=res://*/ReportingDataModel1.csdl|res://*/ReportingDataModel1.ssdl|res://*/ReportingDataModel1.msl;provider=Devart.Data.PostgreSql;provider connection string=&quot;User Id=cops_report;Password=xxxxx;Host=12.xxx.xxx.20;Database=cops_reporting;Connection Timeout=90;Default Command Timeout = 0;Persist Security Info=True;Initial Schema=cops_reporting&quot;" providerName="System.Data.EntityClient" />

A basic query I am trying to run that works outside of the program:
Code: Select all
var testStops = (from test in rDb.DistributionStopInformations
                             where test.CustomerNo == 91000 && test.ActualServiceDate == dateToCheck
                             select test).ToArray();


I have beat my head against this for *hours*....any help would be awesome!

Joe
jruder
 
Posts: 3
Joined: Mon 24 Nov 2014 13:46

Re: Server did not respond within the specified timeout interval

Postby Shalex » Fri 10 Feb 2017 13:56

1. Please specify the full stack trace of the error with all inner exceptions.

2. Please try to open an ADO.NET connection. Does it work? If not, is the error the same?
Code: Select all
    using (var conn = new PgSqlConnection()) {
        conn.ConnectionString = "...";
        conn.Open();
    }
Shalex
Devart Team
 
Posts: 7654
Joined: Thu 14 Aug 2008 12:44

Re: Server did not respond within the specified timeout interval

Postby jruder » Fri 10 Feb 2017 16:05

Thank you for the reply;

The problem has been traced down to a query that is taking too long to run.

For some reason the timeout values seem to be being ignored however, even if I set them to 0 it still times out at the same time.

The query will complete inside of pgAdminIII but not inside of VS.

I have changed both of these:
Connection Timeout=90;Default Command Timeout = 0;
in the connection string and in the "Modify Connection" under the Server Explorer.

Any reason these are not working?

Here is the full stack trace just in case that helps:

System.Data.Entity.Core.EntityCommandExecutionException was unhandled
_HResult=-2146232004
_message=An error occurred while executing the command definition. See the inner exception for details.
HResult=-2146232004
IsTransient=false
Message=An error occurred while executing the command definition. See the inner exception for details.
Source=EntityFramework
StackTrace:
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
at System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__6()
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()
at System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult](Func`1 operation)
at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at TNG_Monitor.Program.checkForNewPODs() in e:\Local Source Control\TNG Monitor\TNG Monitor\Program.cs:line 420
at TNG_Monitor.Program.Main(String[] args) in e:\Local Source Control\TNG Monitor\TNG Monitor\Program.cs:line 87
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
at System.Activator.CreateInstance(ActivationContext activationContext)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: Devart.Data.PostgreSql.PgSqlException
_HResult=-2147467259
_message=Server did not respond within the specified timeout interval.
HResult=-2147467259
IsTransient=false
Message=Server did not respond within the specified timeout interval.
Source=Devart.Data.PostgreSql
ErrorCode=-2147467259
CallStack=""
ColumnName=""
ConstraintName=""
DataTypeName=""
DetailMessage=""
ErrorSql=""
FileName=""
Hint=""
InternalPosition=""
InternalQuery=""
LineNumber=0
Position=0
ProcedureName=""
SchemaName=""
TableName=""
StackTrace:
at Devart.Data.PostgreSql.PgSqlDataReader.f(Int32 A_0)
at Devart.Data.PostgreSql.PgSqlCommand.InternalExecute(CommandBehavior behavior, IDisposable stmt, Int32 startRecord, Int32 maxRecords)
at Devart.Common.DbCommandBase.InternalExecute(CommandBehavior behavior, IDisposable stmt, Int32 startRecord, Int32 maxRecords, Boolean nonQuery)
at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior, Boolean nonQuery)
at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at Devart.Data.PostgreSql.Entity.m.a(CommandBehavior A_0)
at Devart.Data.PostgreSql.Entity.m.b(CommandBehavior A_0)
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<Reader>b__c(DbCommand t, DbCommandInterceptionContext`1 c)
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
at System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
InnerException: System.TimeoutException
_HResult=-2146233083
_message=Server did not respond within the specified timeout interval.
HResult=-2146233083
IsTransient=false
Message=Server did not respond within the specified timeout interval.
Source=Devart.Data.PostgreSql
StackTrace:
at Devart.Common.x.a(Byte[] A_0, Int32 A_1, Int32 A_2)
at Devart.Common.f.c(Byte[] A_0, Int32 A_1, Int32 A_2)
at Devart.Common.l.d(Byte[] A_0, Int32 A_1, Int32 A_2)
InnerException: System.IO.IOException
_HResult=-2146232800
_message=Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
HResult=-2146232800
IsTransient=false
Message=Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Source=System
StackTrace:
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at Devart.Common.x.a(Byte[] A_0, Int32 A_1, Int32 A_2)
InnerException: System.Net.Sockets.SocketException
_HResult=-2147467259
_message=A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
HResult=-2147467259
IsTransient=false
Message=A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Source=System
ErrorCode=10060
NativeErrorCode=10060
StackTrace:
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
InnerException:



Joe
jruder
 
Posts: 3
Joined: Mon 24 Nov 2014 13:46

Re: Server did not respond within the specified timeout interval

Postby Shalex » Mon 13 Feb 2017 18:59

1. When exception is thrown in the debug mode, check current conneciton string via myDbContext.Database.Connection.ConnectionString property. Does it include "Default Command Timeout=0;"?

2. Please enable the dbMonitor tool (http://www.devart.com/dotconnect/postgresql/docs/?dbmonitor.html) and find out the exact SQL statement which takes much time to execute. Then try to execute the same SQL statement via plain ADO.NET (PgSqlCommand). Does the issue persist?

3. Specify the time it is executing before throwing the exception.
Shalex
Devart Team
 
Posts: 7654
Joined: Thu 14 Aug 2008 12:44

Re: Server did not respond within the specified timeout interval

Postby jruder » Mon 13 Feb 2017 19:23

Thank you for the reply and suggestions.

After adding some new indexes the problem is not longer there and I cannot test your suggestions out.

I will keep them handy in the event that something pops up again in the future.

Thank you,
Joe
jruder
 
Posts: 3
Joined: Mon 24 Nov 2014 13:46

Re: Server did not respond within the specified timeout interval

Postby ccampbell » Thu 24 Aug 2017 16:02

Hello,

I'm resurrecting this issue because there was never a resolution posted about the error message itself.

Devart.Data version 5.0.1750.0
Devart.Data.PostgreSQL version 7.9.958.0

Here is the code:

mPgCn = New PgSqlConnection
mPgCn.Name = "dt4"
mPgCn.Host = gstrpg_HostName
mPgCn.Port = gstrpg_Port
mPgCn.Database = gstrpg_DatabaseName
mPgCn.UserId = gstrpg_Userid
mPgCn.Schema = IIf(blnPublic = False, gstrpg_Schema, "public")
mPgCn.Password = gstrpg_PW
mPgCn.ConnectionTimeout = 0
mPgCn.Unicode = True
mPgCn.Open()

cmdRunPG = mPgCn.CreateCommand
cmdRunPG.CommandTimeout = 0
cmdRunPG.CommandText = "set application_name = '" & gclsSession.App_ApplicationName & "'"
cmdRunPG.ExecuteNonQuery()
dAdaptPG = New PgSqlDataAdapter(strSQL, mPgCn)
dAdaptPG.Fill(dSet) ' (Boom Line)

Error Message:
Server did not respond within the specified timeout interval.

Connection String:
User Id=postgres;Host=localhost;Database=dt4_0000;Unicode=True;Connection Timeout=0;Initial Schema=ds0837;"

Stack Trace:
at Devart.Data.PostgreSql.PgSqlDataReader.f(Int32 A_0)
at Devart.Data.PostgreSql.PgSqlCommand.InternalExecute(CommandBehavior behavior, IDisposable stmt, Int32 startRecord, Int32 maxRecords)
at Devart.Common.DbCommandBase.InternalExecute(CommandBehavior behavior, IDisposable stmt, Int32 startRecord, Int32 maxRecords, Boolean nonQuery)
at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior, Boolean nonQuery)
at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at Donation_Tracker.clsData.GetDatasetTable(String strSQL, String strNodeName, Boolean blnPublic) in C:\DevNet\Donation Tracker\Main\clsData.vb:line 9946


Postgres Server Log of Event:
2017-08-24 08:37:59 PDT LOG could not send data to client: An established connection was aborted by the software in your host machine.

2017-08-24 08:37:59 PDT STATEMENT Select contact.contactkey, contact.accountname, contact.title, contact.firstname, contact.middlename, contact.lastname, contact.suffix, CASE WHEN contact.searchname = '' THEN contact.accountname ELSE contact.searchname END as searchname, contacttype.descript as contacttype, contact.fk_contacttype, contact.notes as accountnotes, contact.dob_day, contact.dob_month, contact.dob_year, CASE WHEN contact.accountcode<>'' THEN 'Contact ID: ' || contact.contactkey || ' Code: ' || contact.accountcode ELSE 'Contact I

2017-08-24 08:37:59 PDT FATAL connection to client lost

2017-08-24 08:37:59 PDT STATEMENT Select contact.contactkey, contact.accountname, contact.title, contact.firstname, contact.middlename, contact.lastname, contact.suffix, CASE WHEN contact.searchname = '' THEN contact.accountname ELSE contact.searchname END as searchname, contacttype.descript as contacttype, contact.fk_contacttype, contact.notes as accountnotes, contact.dob_day, contact.dob_month, contact.dob_year, CASE WHEN contact.accountcode<>'' THEN 'Contact ID: ' || contact.contactkey || ' Code: ' || contact.accountcode ELSE 'Contact I

Running the query itself in pgAdmin III takes about five minutes. When executed through the data connection it times-out after 60 seconds.

I searched for a "DefaultConnectionTimeout" property on the data connection object and could not find it.

Any tips would be most appreciated.

Chris Campbell
ccampbell
 
Posts: 29
Joined: Tue 01 Jun 2010 17:31
Location: Oregon

Re: Server did not respond within the specified timeout interval

Postby LucidCoder » Thu 24 Aug 2017 16:25

I am not sure if it will help you but this is what I use in my connection string:

Default Command Timeout = 0
LucidCoder
 
Posts: 11
Joined: Thu 05 Feb 2015 19:24

Re: Server did not respond within the specified timeout interval

Postby ccampbell » Thu 24 Aug 2017 16:46

So after resurrecting this issue I’m happy to report that we can again let it rest in peace.

As I said earlier, the pgConnection object does not have a property for Default Command Timeout. However, I was able to insert it during the connection initialization.

Code: Select all
mPgCn = New PgSqlConnection("Default Command Timeout=0")


Once I did this it worked fine.

Sorry for the noise.
ccampbell
 
Posts: 29
Joined: Tue 01 Jun 2010 17:31
Location: Oregon

Re: Server did not respond within the specified timeout interval

Postby Shalex » Fri 25 Aug 2017 15:43

Thank you for confirming a solution.

JIC: Default Command Timeout can be set either via connection string (like you did) or via property of PgSqlConnectionStringBuilder.
Shalex
Devart Team
 
Posts: 7654
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for PostgreSQL