why am i getting this error?!!

I have an application which monitors a database table and it works fine for more than 48hours sometime but then I will get this error on my desktop..

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader()
at _Connect_Gadget.frmMain.calls_timer_Tick(Object sender, EventArgs e) in C:\Documents and Settings\jassim\My Documents\Visual Studio 2005\Projects\2Connect Gadget\2Connect Gadget\main_form.cs:line 53
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
2connect_gadget
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Documents%20and%20Settings/jassim/My%20Documents/Visual%20Studio%202005/Projects/2Connect%20Gadget/2Connect%20Gadget/bin/Debug/2connect_gadget.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Data
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.DirectoryServices
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.DirectoryServices/2.0.0.0__b03f5f7f11d50a3a/System.DirectoryServices.dll
----------------------------------------
System.Transactions
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.





Answer this question

why am i getting this error?!!

  • Tyrael117

    If you can't live with a button "Refresh" that will call sql command to return current active lines number, then you should search for good example of using Notification services or some other way. Is it possible to have an API access to IVR system and maybe it's capable of raising events on new call or hang up.



  • Tom_Liu

    It seems like your query is taking more than its defualt Query Execution time out, Try to increase it to 1 minute and sure see Stack trace to know at which line the error is originating from.

    Best Regards,



  • SDavis7813

    still, you are connecting to a database every second and executing a query... Why do you have to do this every second Perhaps there is another way we can do this

  • Jimmy.Lin

    it's an IVR database and I want to know what is the maximum number of calls at a time. The query is just SELECT COUNT..



  • Scott Simms

    the interval is every 1 second

    The progam runs without any problem for long long time but (sometimes) I get that error..

    and sometime the program runs for the whole day without showing that error..



  • software_writer_nyc

    The name of that service is Notfication services and beside is part of SQL 2k5 it is also usefull for SQL 2k .
    About the problem, I woudn't do anything every second even if that was minor task in windows application , and can't even imagine to execute a command every second and expect that comment to commit every time. Just imagine what will happend if SQL do some hard job and it's slow for part of time, or machine is hanging for with some task, your command will fail. Even if you increase that period to 5 seconds or more there will be cases when command will not execute, and maybe in your scenario that will not cause big problem because you will get changes on next request.

    If you describe your scenario a little more, not just that you have problem with executing command, maybe you will receive answers that are in completely different direction.

  • Greg Van Mullem

    so interval is for 1 second and you are connecting to the database and executing queries etc... That's bad. This could be one reason why you are getting errors even though it may not happen on some occasions.

    Doing such an operation every second on a timer event is not good at all - its bad practice. It's expensive connecting to/reading/writing to databases....you should use it more efficiently :-) Really if I were you, I would rethink how you are doing this altogether :-)

    SQL has a limit on number of connections also, so when the pool of connections has ran out, it waits for the other connections to close/clear up but it may not be doing so - the next time you try to connect, app hangs/sql connection times out and causing this error.



  • _jade_

    Hi Jassim,

    Looking at the Stack trace of the error, I assume you are querying the database in the Tick() event of the timer. You are probably getting this error because a command times out. By default, the timeout of an SQLCommand is 30 seconds. When you are running a command that usually takes about 25 seconds, other programs on the server (e.g a backup operation) may the cause the command to run for more than 30 seconds and time-out. You can increase the timeout by setting the CommandTimeOut property of the Command Object.

    For more info see: http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.commandtimeout.aspx

    Hope this helps,



  • maxshop

    ok...

    I have an IVR system where every call will be added as a record in a table called INUSE and it will be deleted when the client hungs up.. so if there are 4 customers using my IVR system I should have 4 records in the table and if i have 100 customers using the IVR i will have 100 records and i want to know what's the maximum number of call at a time..



  • AlexUC

    question is....how long is the interval for the timer

  • FreddyHalim

    Not sure if this will work (never actually done it myself... but I've read about it). You could register an event in sql server that will fire when something changes in the DB... Wish I knew more about it but...

    http://msdn2.microsoft.com/de-de/library/ms162170.aspx

  • why am i getting this error?!!