Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Exception on SQLDependency background thread

30 views
Skip to first unread message

Andrew Teece

unread,
Feb 13, 2009, 7:15:00 AM2/13/09
to
We have a problem with our Windows Service that uses SQLDependency. It has
been crashing and not going through any of my exception management code.

The following is logged in the Windows Application Event log;
EventType clr20r3, P1 enate.mi.serverservice.exe, P2 1.0.0.6, P3
4991797a, P4 system.data, P5 2.0.0.0, P6 4889deaf, P7 2753, P8 29, P9
system.data.sqlclient.sql, P10 NIL.

For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.

After a crash-course in WinDBG and DebugDiag I have managed to get a memory
dump of the situation. By examining the thread with the error I found the
following exception;
Exception object: 0f66cde8
Exception type: System.Data.SqlClient.SqlException
Message: The conversation handle "68F91595-7EF7-DD11-A7C3-0011432742A1"
is not found.
Invalid object name
'SqlQueryNotificationService-5166b3f6-1909-464b-b1f9-f1fd264bb0c9'.
InnerException: <none>
StackTrace (generated):
SP IP Function
0677EFF4 656D286B
System_Data_ni!System.Data.SqlClient.SqlConnection.OnError(System.Data.SqlClient.SqlException,
Boolean)+0x1dc4ab
0677F008 656C8DEC
System_Data_ni!System.Data.SqlClient.SqlInternalConnection.OnError(System.Data.SqlClient.SqlException,
Boolean)+0x49f51c
0677F020 652294F3
System_Data_ni!System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(System.Data.SqlClient.TdsParserStateObject)+0xc3
0677F050 6560A8D5
System_Data_ni!System.Data.SqlClient.TdsParser.Run(System.Data.SqlClient.RunBehavior,
System.Data.SqlClient.SqlCommand, System.Data.SqlClient.SqlDataReader,
System.Data.SqlClient.BulkCopySimpleResultSet,
System.Data.SqlClient.TdsParserStateObject)+0x959
0677F0BC 65220F12
System_Data_ni!System.Data.SqlClient.SqlDataReader.ConsumeMetaData()+0x22
0677F0D0 65220A34
System_Data_ni!System.Data.SqlClient.SqlDataReader.get_MetaData()+0x54
0677F0FC 6521F3EA
System_Data_ni!System.Data.SqlClient.SqlCommand.FinishExecuteReader(System.Data.SqlClient.SqlDataReader,
System.Data.SqlClient.RunBehavior, System.String)+0x12a
0677F134 654F2DC0
System_Data_ni!System.Data.SqlClient.SqlCommand.CompleteAsyncExecuteReader()+0x6c
0677F168 654F43D0
System_Data_ni!System.Data.SqlClient.SqlCommand.InternalEndExecuteReader(System.IAsyncResult,
System.String)+0x7c
0677F19C 654F45C9
System_Data_ni!System.Data.SqlClient.SqlCommand.EndExecuteReader(System.IAsyncResult)+0x49
0677F1CC 6562EE89
System_Data_ni!SqlDependencyProcessDispatcher+SqlConnectionContainer.AsyncResultCallback(System.IAsyncResult)+0x45
StackTraceString: <none>
HResult: 80131904


My understanding from the stack-trace is that this is not an error in my
code? It is an error in the Microsoft SQLDependency class, but because that
is running on a background thread any exceptions thrown cannot be caught by
my application. Is this correct? What can I do to handle such eventualities?

Regards

Andrew Teece
Technical Architect, eNate

Miha Markic

unread,
Feb 14, 2009, 1:41:14 PM2/14/09
to
Hi Andrew,

Do you have any idea what triggers this error? What code?
If not, some sort of loggin might help.
Is it possible that this is a cross thread issue?

Miha

"Andrew Teece" <en...@nospam.nospam> wrote in message
news:u4#LaTdjJ...@TK2MSFTNGP02.phx.gbl...

Cor Ligthert[MVP]

unread,
Feb 15, 2009, 9:15:30 AM2/15/09
to
System.Data.SqlClient is the part of the Net namespace that does everything
around SQL server.

As far as I see that dump I only see information about that, therefore your
problem is likely in your program.

As Miha wrote, give us more information about your application.

However much better is probably as you follow the proces in SQL profiler.

Cor


"Andrew Teece" <en...@nospam.nospam> wrote in message

news:u4%23LaTdj...@TK2MSFTNGP02.phx.gbl...

Andrew Teece

unread,
Feb 17, 2009, 9:36:01 AM2/17/09
to
Cor,
You only see information about the system.data.sqlclient because that is
in control of the thread that the exception occured on.

My code is running fine. The problem is that if an exception is thrown
in this part of MS code there is nothing I can do to capture/handle the
error because it is thrown on a thread that I didnt start!


Andrew


"Cor Ligthert[MVP]" <Notmyfi...@planet.nl> wrote in message
news:eIClff3j...@TK2MSFTNGP06.phx.gbl...

Andrew Teece

unread,
Feb 17, 2009, 9:38:19 AM2/17/09
to
Miha,
I have been running though my code a lot recently with regards this
issue.

This could be a cross thread issue; and I think I know what is going on.
I will post in my reply to Steven below.


Andrew

"Miha Markic" <miha at rthand dot com> wrote in message
news:ek38cPtj...@TK2MSFTNGP04.phx.gbl...

Nguyen@discussions.microsoft.com Kenny Nguyen

unread,
Apr 20, 2009, 1:08:01 PM4/20/09
to
So does anyone have any solution to this error? My service crashes like crazy
with the same error and I have no idea why?!

Thanks,
Kenny.

0 new messages