Microsoft KB Archive/884266

= FIX: A Notification Services application may not deliver all notifications or may deliver notifications with a significant delay =

Article ID: 884266

Article Last Modified on 2/13/2007

-

APPLIES TO


 * Microsoft SQL Server Notification Services 2.0 Service Pack 1

-



Bug#: 296287 (SQL BU Defect Tracking)



SYMPTOMS
When you use a Microsoft SQL Server 2000 Notification Services application to generate and send notifications to delivery services, you may notice that the Notification Services application does not deliver all the notifications or the Notification Services application delivers the notifications with a significant delay.

For example, this problem may occur when you configure lots of delivery channels and you use only some of the delivery channels to send notifications.



RESOLUTION
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that this article describes. Apply it only to systems that are experiencing this specific problem.

To resolve this problem, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English version of this fix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel. Date        Time   Version     Size       File name

30-Jun-2004 16:33  2.0.3008.2  2,101,248  Microsoft.sqlserver.notificationservices.dll 30-Jun-2004 16:33  2.0.3008.2     36,864  Nscontrol.exe

This issue is fixed in SQL Server 2005 Notification Services. You can upgrade to SQL Server 2005 Notification Services to resolve this issue.



WORKAROUND
To work around this problem, follow these steps:  Stop your event provider, the Notification Services generator service, and all the Notification Services distributor services on all your computers.  Mark the unprocessed work items that are associated with the delivery channels that you want to remove as expired. After you do this, the distributor does not try to process the work items after the delivery channels are removed. To do this, run the following Transact-SQL command in SQL Query Analyzer against your Notification Services application database: UPDATE NSDistributorWorkItems SET DistributorWorkItemStatusCode = 5 --Expired WHERE DistributorWorkItemStatusCode = 0 --Distribution never attempted AND AssignmentStatusCode = 0   --Unassigned AND DeliveryChannelName NOT IN (ListOfUsedDeliveryChannelNames)

Note  is a placeholder for the list of used delivery channels, separated by commas. For example, N'DeliveryChannelName1', N'DeliveryChannelName2', N'DeliveryChannelName3'   To improve performance, create an additional index on the NSDistributorWorkItems table in the Notification Services application database. To do this, run the following Transact-SQL statement in SQL Query Analyzer: CREATE INDEX NSDistributorWorkItemsASCDWISCNextRetryTimeIndex ON NSDistributorWorkItems(AssignmentStatusCode, DistributorWorkItemStatusCode, NextRetryTime)  Start the Notification Services distributor services on all the computers. Start the Notification Services generator. Start the event providers.</li></ol>

<div class="status_section">

STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.

<div class="moreinformation_section">

MORE INFORMATION
Notification Services generates notifications in batches. Based on the delivery channel that each notification targets, the distributor components in a Notification Services application break the batches into smaller units that are referred to as work items. To perform delivery operations, each distributor can process multiple work items in parallel by using worker threads. When the processing of one work item is completed, a scheduling algorithm looks for additional work items that the distributor can process by using the worker thread that becomes free. However, when the distributor finishes processing a work item, the distributor may pick up additional work items that use additional work threads even when the thread count limit that you specified has been reached.

You notice this problem in a scenario when you configure a lot of delivery channels and use only some of the delivery channels to send notifications. When you have lots of delivery channels that are not used, many work items are created that are empty. Because the work items are empty, the time that is taken to process these work items is the same and the distributor finishes processing more than one work item at the same time. This causes more than one thread to be scheduled at the same time. Therefore, you notice the behavior that is mentioned in the &quot;Symptoms&quot; section.

After you apply the hotfix
To improve performance after you apply the hotfix, create an index on the NSDistributorWorkItems table that is specified in step 3 of the &quot;Workaround&quot; section. The hotfix does not create this index. You must manually create this index in your Notification Services application database.

<div class="references_section">