When you use a file handle for FileStream access in a SQL Server 2008 transaction, the transaction may randomly fail to commit in Windows Server 2003 or in Windows XP Professional x64 Edition

Article translations Article translations
Article ID: 955280 - View products that this article applies to.
Expand all | Collapse all

On This Page

SYMPTOMS

On a computer that is running Windows Server 2003 or Windows XP Professional x64 Edition, when you use the OpenSqlFilestream API or the .NET SqlFilestream class to obtain a file handle for FileStream access in a transaction in Microsoft SQL Server 2008, the transaction may randomly fail to commit. When this problem occurs, one of the following errors is logged in the SQL Server Errorlog file:
  • 3910 (Transaction context in use by another session)
  • 3981 (The transaction operation cannot be performed because there are pending requests working on this transaction)
  • 3922 (Cannot enlist in the transaction because the transaction does not exist)
The cause of this problem is not related to the FILESTREAM feature in SQL Server 2008. However, you typically encounter this problem when you use the FILESTREAM feature in SQL Server 2008.

CAUSE

This problem occurs because of an error in the Server service. The Server service incorrectly delays closing the file handle. Therefore, SQL Server 2008 cannot perform commit operations.

RESOLUTION

Hotfix information

Windows Server 2003

A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.

To resolve this problem immediately, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer 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.
Prerequisites
To apply this hotfix, you must be running Windows Server 2003 Service Pack 1, Windows Server 2003 Service Pack 2, Windows XP Professional x64 Edition or Windows XP Professional x64 Edition Service Pack 2 on the computer.
Restart requirement
You have to restart the computer after you apply this hotfix.
Hotfix replacement information
This hotfix does not replace a previously released hotfix.
File information
The English version of this hotfix 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.

Windows Server 2003 with Service Pack 1, x86-based versions
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Srv.sys5.2.3790.3177361,47218-Jul-200810:15x86

Windows Server 2003 with Service Pack 1, x64-based versions
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Srv.sys5.2.3790.3177674,81621-Jul-200807:32x64
Windows Server 2003 with Service Pack 1, Itanium-based versions
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Srv.sys5.2.3790.31771,110,52821-Jul-200807:32IA-64

Windows Server 2003 with Service Pack 2, x86-based versions
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Srv.sys5.2.3790.4337358,40018-Jul-200812:04x86

Windows Server 2003 with Service Pack 2, x64-based versions
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Srv.sys5.2.3790.4337648,19221-Jul-200814:57x64

Windows Server 2003 with Service Pack 2, Itanium-based versions
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Srv.sys5.2.3790.43371,111,55221-Jul-200814:54IA-64

Windows XP Professional x64 Edition

A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.

To resolve this problem immediately, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer 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.
Prerequisites
To apply this hotfix, you must be running Windows XP Professional x64 Edition or Windows XP Professional x64 Edition Service Pack 2 on the computer.
Restart requirement
You have to restart the computer after you apply this hotfix.
Hotfix replacement information
This hotfix does not replace a previously released hotfix.
File information
The English version of this hotfix 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.

Windows XP Professional x64 Edition
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Srv.sys5.2.3790.3177674,81621-Jul-200807:32x64

Windows XP Professional x64 Edition with Service Pack 2
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
Srv.sys5.2.3790.4337648,19221-Jul-200814:57x64

WORKAROUND

Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
322756 How to back up and restore the registry in Windows
Warning This workaround will cause a performance issue when you operating on shared files in the system.


To work around this problem, set the value of the Cachedopenlimit registry entry to 0, and then restart the Server service. To do this, follow these steps:
  1. In Registry Editor, locate the following registry subkey:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Lanmanserver\Parameters
  2. Under the Parameters registry subkey, click Edit, click New, click DWORD Value, type Cachedopenlimit, and then press ENTER.
  3. Set the decimal value of the Cachedopenlimit registry entry to 0.
  4. Restart the Server service.
Note By default, the value of the Cachedopenlimit registry entry is 5, even though you did not set it.

Warning When you set the value to 0, file handles of all the shared files are not cached by the system. This can cause a performance issue when you are accessing shared files in the system.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

This problem also occurs in Windows Server 2008 and in Windows XP x86-based versions. For more information about this problem in Windows Server 2008, click the following article number to view the article in the Microsoft Knowledge Base:
953263 When you use a Transact-SQL statement to operate on a FILESTREAM column in SQL Server 2008, the statement may randomly fail to commit and cause data corruption in Windows Server 2008
For more information about this problem in Windows XP x86-based versions, click the following article number to view the article in the Microsoft Knowledge Base:
955567 Data corruption may occur when you try to append data to a FILESTREAM varbinary (max) column in SQL Server 2008 on a Windows XP-based computer
For more information about software update terminology, click the following article number to view the article in the Microsoft Knowledge Base: -
824684 Description of the standard terminology that is used to describe Microsoft software updates

When to use the FILESTREAM storage

In SQL Server 2008, binary large object (BLOB) data can be the data of the VARBINARY(MAX) type that stores data in database tables. BLOB data can also be the data of the VARBINARY(MAX) FILESTREAM type that stores the data in the file system. The data size and the data usage determine whether you should use the database storage or the FILESTREAM storage. You should consider using the FILESTREAM storage when the following conditions are true:
  • On average, the BLOB data that you store is larger than 1 megabyte (MB).
  • Fast-read access is important.
  • You are developing applications that use a middle tier for the application logic.
If the BLOB data is less than 1 MB, you should consider using the database storage. The database storage frequently provides better streaming performance.

For more information, visit the following Microsoft Developer Network (MSDN) Web site:
http://msdn.microsoft.com/en-us/library/bb933993.aspx

Properties

Article ID: 955280 - Last Review: October 8, 2011 - Revision: 3.0
APPLIES TO
  • Microsoft Windows Server 2003, Web Edition
  • Microsoft Windows Server 2003, Datacenter Edition (32-bit x86)
  • Microsoft Windows Server 2003, Datacenter Edition for Itanium-Based Systems
  • Microsoft Windows Server 2003, Datacenter x64 Edition
  • Microsoft Windows Server 2003, Enterprise x64 Edition
  • Microsoft Windows Server 2003, Enterprise Edition (32-bit x86)
  • Microsoft Windows Server 2003, Enterprise Edition for Itanium-based Systems
  • Microsoft Windows Server 2003, Standard x64 Edition
  • Microsoft Windows Server 2003, Standard Edition (32-bit x86)
  • Microsoft Windows XP Professional x64 Edition
Keywords: 
kbexpertiseadvanced kbfix kbautohotfix kbsurveynew kbqfe KB955280

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com