Quantcast
Channel: SQL Service Broker forum
Viewing all 461 articles
Browse latest View live

External Activator not launching application!

$
0
0

Hi,

I am having the exact same problem, I have turned on verbose logging and still no luck.

Error log doesn't appear to be showing much:

6/12/2013 4:37:14 PM	INFO	The External Activator service is starting.
6/12/2013 4:37:14 PM	INFO	Initializing configuration manager ...
6/12/2013 4:37:14 PM	INFO	Reloading configuration file C:\Program Files\Service Broker\External Activator\config\EAService.config ...
6/12/2013 4:37:14 PM	INFO	Reloading configuration file completed.
6/12/2013 4:37:14 PM	VERBOSE	Running recovery using recovery log file C:\Program Files\Service Broker\External Activator\log\EARecovery.rlog ...
6/12/2013 4:37:14 PM	VERBOSE	Checkpointing recovery log C:\Program Files\Service Broker\External Activator\log\EARecovery.rlog ...
6/12/2013 4:37:14 PM	VERBOSE	Checkpointing recovery log completed.
6/12/2013 4:37:14 PM	VERBOSE	Running recovery completed.
6/12/2013 4:37:14 PM	INFO	Initializing configuration manager completed.
6/12/2013 4:37:14 PM	VERBOSE	Starting worker threads...
6/12/2013 4:37:14 PM	VERBOSE	CM-NS-Thread is starting...
6/12/2013 4:37:14 PM	VERBOSE	Worker threads are successfully started.
6/12/2013 4:37:14 PM	INFO	The External Activator service is running.
6/12/2013 4:37:14 PM	VERBOSE	Heartbeat-Thread is starting...

and my queues and services are as follows: 

I assumed I was having issues with "poisoned message" and restarted the entire setup (even dropped the db). I still can't get it to launch my exe.

Any suggestions would be greatly appreciated!

Sam


SqlDependency class throws "The given key was not present in the dictionary." during SqlDependency.Start()

$
0
0

Today I ran into an issue when using the .Net SqlDependency class when calling SqlDependency.Start(connectionName, queueName). The class would throw the exception "KeyNotFound" - "The given key was not present in the dictionary.". After scratching my head for a few moments I found that in the queue there were a number of messages stuck in the queue that did not have conversation handles that did not exist.

It is possible that somewhere in my code it did not call SqlDependency.Stop() when the webserver was recycled or due to an unhandled exception - but could easily have been Service Broker itself.

I found the solution was to clear the queue of any items that had invalid conversation handles (or completely clear the queue).

DECLARE item_cursor CURSOR LOCAL FAST_FORWARD FOR
    SELECT s.conversation_handle FROM clients.dbo.MySBQueueName s LEFT JOIN sys.conversation_endpoints e ON e.conversation_handle=s.conversation_handle WHERE e.conversation_handle IS NULL;
	-- or completely clear it below
	--SELECT s.conversation_handle FROM clients.dbo.MySBQueueName s;
OPEN item_cursor
DECLARE @conversation UNIQUEIDENTIFIER
FETCH NEXT FROM item_cursor INTO @conversation
WHILE @@FETCH_STATUS = 0 
BEGIN
    END CONVERSATION @conversation WITH CLEANUP
    FETCH NEXT FROM item_cursor INTO @conversation
END

There wasn't much on Google about this error (though people are reporting it), I hope this helps someone.


Michael Brown, 360 Replays Ltd. (don't forget that 'Mark As Answer' button!)


An error occurred in Service Broker internal activation while trying to scan the user queue

$
0
0

After Migrating our Production database from sql 2008 to Sql 2012 SPI, our service broker queues are showing errors in the event logs. Prior to the upgrade we were not seeing any errors. We can determine that the queues are working, but are wondering why we are seeing these errors all of a sudden? I have found other postings where people have seen the same problem after the upgrade.

Here is an example of the errors we are seeing.

 

An error occurred in Service Broker internal activation while trying to scan the user queue 'XX' for its status. Error: 1222, State: 51. Lock request time out period exceeded. This is an informational message only. No user action is required.

SQL Service Broker activated proc writes all print messages into SQL Error Log...

$
0
0

If any print message exists in a Service Broker activated proc, it generates a message (9724) : like  

The activated proc '[dbo].[reply_proc]' running on queue 'test.dbo.InitiatorQueue1DB' output the following: '789'

 the message itself has the severity level of 10 and flag not write to log... This gets me to a serious implications like overpouring ErrorLog with insufficient disk space problem, when running a proc likesp_updatestats on a large database... such a proc generates thousands of singe rows and if it runs on a quite regular basis (several times in hour) that problem becomes an a headache... I can wrap it up to CLR proc and suppress those info messages... but , I'm just wondering if it could be done in a simplier way like change a setting in somewhere I'm not aware of place...

Thanks to everybody's attention...

Denis.

SQLQueryNotificationStoredProcedure exception filling up the log

$
0
0

I'm seeing this exception over and over again for different users (exceptions seen via SQL Profiler).  Any idea/clues as to where these are coming from and why?

ExceptionThere is already an object named 'SqlQueryNotificationStoredProcedure-6b3cfc31-1210-44d0-9e9b-b049ec8d54f9' in the database.SqlQueryNotificationService-6b3cfc31-1210-44d0-9e9b-b049ec8d54f9

An error occurred in Service Broker internal activation while trying to scan the user queue 'msdb.dbo.InternalMailQueue' for its status. Error: 1222, State: 51. Lock request time out period exceeded. This is an informational message only. No user action i

$
0
0

Hello!

We recently upgraded some of our servers from SQL Server 2008 R2 to SQL Server 2012.  Since that point, I have noticed the following error repeatedly in the error logs:

Date  6/7/2013 10:22:09 AM
Log  SQL Server (Current - 6/7/2013 5:46:00 AM)

Source  spid44s

Message
An error occurred in Service Broker internal activation while trying to scan the user queue 'msdb.dbo.InternalMailQueue' for its status. Error: 1222, State: 51. Lock request time out period exceeded. This is an informational message only. No user action is required.

I found the following article in the forums:

http://social.msdn.microsoft.com/Forums/en-US/sqlservicebroker/thread/00e70f1e-eede-40f2-9e76-3ac7a9b567b2

but this does not explain the actual course of action.  Should I be setting HONOR_BROKER_PRIORITY to ON to eliminate these error messages? I would love to test this, but it only shows up in our production environment.

Any help would be greatly appreciated!

Thanks!

SQLQueryNotificationService-GUID running on queue databasename.dbo.sqlqueryNotificationService-GUID output the followoing, 'Can not execute as teh database principal because "dbo" does not exits, This type of Principal cannot be impersonated, or you do

$
0
0

I have gone through many threads which advocate the above problem is may be due to insufficient privliges OR a falsy setup of broker service.

I have checked the articles which present solution i.e
http://rusanu.com/2006/06/17/the-mysterious-notification/

AND

http://rusanu.com/2007/11/10/when-it-rains-it-pours/

these are nice article to find the solution but in my case these are not helpfull as i have done what is listed in these articles but the problem remains the same:)

i am frequently observing the following error in my windows Application log

The activated proc [dbo].[SqlQueryNotificationStoredProcedure-f27ecb39-bbaf-4ef7-b9bf-5aa301511d64] running on queue Database.dbo.SqlQueryNotificationService-f27ecb39-bbaf-4ef7-b9bf-5aa301511d64 output the following:  'Cannot execute as the database principal because the principal "dbo" does not exist, this type of principal cannot be impersonated, or you do not have permission.'

i have checked the queues and service and none is available with the name [dbo].[SqlQueryNotificationStoredProcedure-f27ecb39-bbaf-4ef7-b9bf-5aa301511d64], Also no stored procedure is available with this name in the convern database!

Can someone please explain!

1:  How to stop these errors as these are bloating the applicaiton log with event iID 9724
2:  How to reslove the problem :)
3:  Does SQLQueryNotification create problem for IIS as a whole?

4: It Seems the notification brings the website to its knees why ?

I realy appritiate if someone has any clue?

Talib


Talib Butt

Message in transmission_queue with error although security context is right

$
0
0

Hi,

I'm testing the dialog sample from "TSQL Programming" book, sending a message from one db to a target that is on a different db in the same instance. As expected, the transmission_queue shows the error about the security context, so I follow the next steps (users with certificates, grants and remote service binding) to configure the security. When I send another message, everything is fine and the dialog ends successfully. But the initial message is still in the transmission_queue with the same error.

The only way to resolve this situation is setting the TRUSTWORTHY option in the initiator database to ON. Why? It seems that the security dialog that I configure AFTER I sent the initial message don't affect to the retries of this first message, buth the TRUSTWORTHY option yes... Don't understand it.

Thanks in advance.



Error using RECEIVE with xml

$
0
0

I have a Stored procedure that acts upon a queue with the following code:

DECLARE @message_body as XML, @MessageTypeName as varchar(256), @ConversationHandle as UniqueIdentifier

WAITFOR (RECEIVE TOP (1)  @MessageTypeName = message_type_name

,@message_body = message_body

,@ConversationHandle = Conversation_Handle

FROM MyQueue

), TIMEOUT 5000;

This works well for 90% of the messages in the queue, but bugs out the other 10% of the time. The SQL Log error message being:

The activated proc '[dbo].[usp_ReadMyQueue]' running on queue 'DBName.dbo.MyQueue' output the following:  'XML parsing: line 1, character 519, illegal xml character'

When I checked the message_body for the message causing the error, I found that the character position was represented by a character: ã

I therefore changed the code by adding a new variable @message_body2 as varchar(max), and placing that inside the RECEIVE statement, thus:

.....

,@message_body2 = message_body

......

and following this I added the next line after the TIMEOUT being:

SET @message_body = CAST(@message_body2 as XML)

It all works perfectly well.

My question is why would an xml error be raised in the RECEIVE statement when it is not outside of that statement?

I did try using ,@message_body = CAST(message_body as xml) but that also errored out the same as before.

Just being curious as to whether this should be expected behaviour, or a little-known bug.

Thanks, 

External Activator not launching Application

$
0
0

Hello

I am setup an External Activator solution . I think I got everything as it should be, but the application is just not launching on the QUEUE_ACTIVATION event

External Activator service start successfully and its shows a RECEIVES_OCCURRING status in sys.dm_broker_queue_monitors.

The sys.transmission_queue is empty and I can see the messages appearing in sys.conversation_endpoints with a state of CONVERSING

If I run my Application manually it completes the “Receive” command and reply a message without error.

Any ideas?

Regards, WDV

Using SQL Broker Service for One way messaging

$
0
0

Hi All

I am novice to SQL Server Broker Service. I am trying to use the Broker service In one way messaging fashion. That means client application send message to queue and using internal activation on queue, I get the message and process it.

Just wanted to check does anybody sees any issue with this approach.

Step which I have implemented:

1) Create a message type and contract

2) Create a queue and attach a procedure to queue which can recive message from queue and process this.

3) Define a service on queue.

4) Define a store procedure which send a message to queue and called by client,

In this I am using "From Service" And "To Service" as same.

Thanks

Deepak Sanghi


Deepak Sanghi Happy Biztalking.........

Message ordering in load balanced environment

$
0
0

Hello

Is it possible to have message ordering when using load balanced workload.

Simplistic scenario would be:

2 IIS , each server installed with Sql Service Broker

1 common storage could be sql server / hadoop.

Is it possible to have the messages ordered when they are consumed by the common storage?

We are talking around 10000 messages / second, so it is impossible to use a date time.

Service Broker External Activator not functioning

$
0
0

Hi,

I have created an Audit.exe application. This application will poll the data from a table in DatabaseA to another table in DatabaseB. Audit.exe runs successfully on a ServerC.

Now I install the Service Broker External Activator on ServerC. I have everything configured correctly for this windows service to activate the Audit.exe. There is no error return from the log but standard information message. Too bad no data is polling. Any idea what should be missing?

Thanks,

Kenny

External Activator not launching application!

$
0
0

Hi,

I am having the exact same problem, I have turned on verbose logging and still no luck.

Error log doesn't appear to be showing much:

6/12/2013 4:37:14 PM	INFO	The External Activator service is starting.
6/12/2013 4:37:14 PM	INFO	Initializing configuration manager ...
6/12/2013 4:37:14 PM	INFO	Reloading configuration file C:\Program Files\Service Broker\External Activator\config\EAService.config ...
6/12/2013 4:37:14 PM	INFO	Reloading configuration file completed.
6/12/2013 4:37:14 PM	VERBOSE	Running recovery using recovery log file C:\Program Files\Service Broker\External Activator\log\EARecovery.rlog ...
6/12/2013 4:37:14 PM	VERBOSE	Checkpointing recovery log C:\Program Files\Service Broker\External Activator\log\EARecovery.rlog ...
6/12/2013 4:37:14 PM	VERBOSE	Checkpointing recovery log completed.
6/12/2013 4:37:14 PM	VERBOSE	Running recovery completed.
6/12/2013 4:37:14 PM	INFO	Initializing configuration manager completed.
6/12/2013 4:37:14 PM	VERBOSE	Starting worker threads...
6/12/2013 4:37:14 PM	VERBOSE	CM-NS-Thread is starting...
6/12/2013 4:37:14 PM	VERBOSE	Worker threads are successfully started.
6/12/2013 4:37:14 PM	INFO	The External Activator service is running.
6/12/2013 4:37:14 PM	VERBOSE	Heartbeat-Thread is starting...

and my queues and services are as follows: 

I assumed I was having issues with "poisoned message" and restarted the entire setup (even dropped the db). I still can't get it to launch my exe.

Any suggestions would be greatly appreciated!

Sam

Service Broker with WebService (WSDL)

$
0
0

Hello,

We have developed a webservice (WDSL) that creates and manages mailboxes. This webservice (WDSL) works fine from our current ASP.NET website. We now want to avoid that users have to wait on the response of the webservice while managing mailboxes and also have more logging on who creates what, when,.... In a post that I made about a year ago on the ASP.NET forum I found out that I have three options: ASP.NET threading, CLR stored procedure with Service Broker, external activation with Service Broker.

To be honest, the CLR stored procedure with service broker, looks the coolest to me, but I read regularly that this is not the way to go. The most common responses are security concerns and the fact that SQL need to be used as DB server and not an application server. The solution with the external activation is a workaround because you can offload to outside SQL (security). My problem with this solution is that you need to write an application the connects to the SQL server broker queue, get the data and then forward it to the WSDL service. There looks to be no direct solution available to consume the webservice directly with external activation. This is a bit a disappointment to me to be honest. It requires alot of coding for actually doing something very simple. I didn't really look into the ASP.NET threading. The reason is that I don't want the ASP.NET front end application to connect to the webservice. The main reasons are security (I want to run it in the back end without any link to the front end), I want to offload the front end webserver for the best performance and I don't like the idea of threading in ASP.NET.

What is your opinion/suggestions on this?

Thanks


Express Edition as sender and reply to

$
0
0

Hello

Trying to get my head around this Sql Service Broker.

It's called a dialog and I guess that is exactly what I would like, but... 

My scenario:

1 initiator and 1 target, two different servers.

I've tried to built some of the basic examples and this all works fine and dandy, but they are all 1-way, a sort of fire and forget with guaranteed delivery.

What I want is a setup where the initiator start a conversation, sends a message and resume common operation flow. Then the target processes the message and send a reply back to the initiator at the the conversation handle (correct me if I'm wrong) and the initiator then consumes the message and do it's thing.

But as I see it, that requires both the initiator and the target to be standard editions right? Or is it enough if just the receiver is a standard edition or greater?

Something that confuses me.... why is it called a target when SSSB is meant to be a dialog? Imho a target is only a target in a monolog?


Service broker not sending message from target database

$
0
0

Hello all,

i am facing a problem kindly help. the db owner of db1 and db2 is same 'sa'. when i send message from db1 its good but when i send message from db2 it never reaches and says: "An exception occurred while enqueueing a message in the target queue. Error: 916, State: 3. The server principal "sa" is not able to access the database "db1" under the current security context."

I also want to tell that i recently restore new back of db2. and i run following query on db2 as service broker was not enabling. ALTER DATABASE db2 SET  new broker.

I also user this query ALTER AUTHORIZATION ON database:: db2 TO sa;

Dependency Event not firering though queue is created on the SQL server

$
0
0

I am trying to get my VB.net to execute some code when there is changes in a specific table.

Rights on my SQL user should be right, the queue is created on the server when the Dependency.Start is run, but the event is not being caught when I make any kind of changes in the table.

Here are alle the code bits that apply to the problem, I hope someone can see what I am doing wrong before I loose all my hair :-(

    Dim ConnectionString As String = "Data Source=nef-sql.nef.local;User ID=SmileSQL;Password=Password;Initial Catalog=Smile;Network Library=dbmssocn;Application Name=WaooSmile;"
    Dim QueryUpdate As String = "SELECT * FROM SmileDansam WHERE TransactionID = 0"
    Dim QueryDependency As String = "SELECT DansamID FROM dbo.SmileDansam WHERE TransactionID = 0"


    Public Sub StartDependency()
        If Not DoesUserHavePermission() Then
            PrintDebug("Not correct userrights")
        End If
        Dim cn As SqlClient.SqlConnection = Nothing
        cn = New SqlClient.SqlConnection(ConnectionString)
        PrintDebug(SqlClient.SqlDependency.Stop(ConnectionString))
        Dim cmd As SqlCommand = cn.CreateCommand()

        Using cmd
            cmd.CommandType = CommandType.Text
            cmd.CommandText = QueryDependency
            cmd.Notification = Nothing
        End Using
        Dim dependency As New SqlClient.SqlDependency(cmd)
        AddHandler dependency.OnChange, AddressOf Me.OnNotificationChange
        PrintDebug("Starting dependency")
        PrintDebug(SqlClient.SqlDependency.Start(ConnectionString))
        PrintDebug("Dependency startet")

        cn.Open()
        Dim command As New SqlCommand(QueryUpdate, cn)
        Dim reader As SqlDataReader
        reader = command.ExecuteReader()
        If reader.HasRows Then
            While reader.Read()
                PrintDebug(reader("Request").ToString & " - " & reader("DansamID"))
            End While
        End If
    End Sub

  Private Sub OnNotificationChange(ByVal sender As Object, ByVal e As SqlClient.SqlNotificationEventArgs)
        Dim cn As New SqlClient.SqlConnection(ConnectionString)
        Dim command As New SqlCommand(QueryUpdate, cn)
        Dim reader As SqlDataReader
        reader = command.ExecuteReader()
        If reader.HasRows Then
            While reader.Read()
                PrintDebug(reader("Request").ToString & " - " & reader("DansamID"))
            End While
        End If

    End Sub

    Private Function DoesUserHavePermission() As Boolean
        Try
            Dim clientPermission As SqlClientPermission = New SqlClientPermission(Security.Permissions.PermissionState.Unrestricted)
            ' this will throw an error if the user does not have the permissions  
            clientPermission.Demand()
            Return True
        Catch ex As Exception
            Return False
        End Try
        Return True
    End Function

   


Service Broker with ApplicationPoolIdentity user

$
0
0

Hi,

I'm trying to set on IIS 7 an application pool identity to ApplicationPoolIdentity.
SO is Windows 2008 R2. On IIS is hosted a web application that connects to a SQL Server 2008 R2 database
and uses Broker service through SqlDependency.
I've having an error when trying to create a new SqlDepemdency object:

Cannot connect to SQL Server instance. An entity of type service cannot be owned by a role, a group, or by principals mapped to certificates or asymmetric keys.
Invalid object name 'SqlQueryNotificationService-af105e34-a0f8-492f-99c8-55fbba091c13'.

If using NETWORK_SERVICE instead everything is fine. Using ApplicationPoolIdentity from a remote IIS works fine too.
I've tried granting db_owner role to a group to which both NETWORK_SERVICE and IIS AppPool\<PoolName> belong or by
granting db_owner directly to IIS AppPool\<PoolName> but nothing changed.

In Global.asax SqlDependency is started through SqlDependency.Start(Globals.ConnectionString) and then
SqlDependency dependency = new SqlDependency(command) is used.

Am I missing something?

Thank You

Claudio Mellina

Service broker and orphaned connections

$
0
0

I have an application that is using the Service Broker is SQL 2008. About once a day the database's performance starts take a noticeable hit and I have determined that this is because of the Service Broker. If I hard reset all broker connections using the following commands:

ALTERDATABASE [RegencyEnterprise] SETOFFLINEWITHROLLBACKIMMEDIATE

ALTERDATABASE [RegencyEnterprise] SETONLINE

Then the performance returns to normal until about the next day. I have also noticed that when performance is poor, running the following query returns a large number of conversations that are stuck in the STARTED_OUTBOUND state:

SELECT
   conversation_handle,
   is_initiator,
   s.name as 'local service',
   far_service,
   sc.name 'contract',
   state_desc
FROM
   sys.conversation_endpoints ce
   LEFT JOIN sys.services s ON ce.service_id = s.service_id
   LEFT JOIN sys.service_contracts sc ON ce.service_contract_id = sc.service_contract_id;


Performance seems to be alright where there are plenty of items returned by this query. The only time when there are problems are when there are connections that are STARTED_OUTBOUND that stay stuck in this state.

Does anyone know what can cause the broker's connections to get in this state? Or what tools I could use to go about trying to figure out what is causing this? I currently only have a single web server that is registering to its notifications, so my scenario is not overly complex.

Viewing all 461 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>