DetailPage-MSS-KB

Microsoft small business knowledge base

Article ID: 2671318 - Last Review: November 20, 2012 - Revision: 4.0

On This Page

Microsoft distributes Microsoft SQL Server 2012 fixes in one downloadable file. Because the fixes are cumulative, each new release contains all the hotfixes and all the security updates that were included with the previous SQL Server 2012 update release.

Symptoms

Assume that you run many xp_cmdshell stored procedures at the same time on multiple sessions in Microsoft SQL Server 2012. In this situation, the first execution of the xp_cmdshell stored procedure is not completed until the last execution is complete.

Cause

This issue occurs because a handle is inherited by the processes that are opened when you run xp_cmdshell stored procedures at the same time.

The CreateProcess API requires handle inheritance to redirect the standard output and error message. If multiple executions of the xp_cmdshell stored procedure run at the same time, newly-opened processes can inherit the handle from existing processes. However, the xp_cmdshell stored procedure waits for the handle to be closed by all the open processes. Therefore, when multiple processes inherit the handle, all xp_cmdshell executions must wait until the handle is closed by the longest-running process.

Resolution

To resolve this issue, apply the following cumulative update. This update adds CreateProcess API STARTUPINFOEX options that prevent the handle inheritance for cross process.

Cumulative update information

Cumulative update package 1 for SQL Server 2012 Service Pack 1

The fix for this issue was first released in Cumulative Update 1. For more information about how to obtain this cumulative update package for SQL Server 2012 Service Pack 1, click the following article number to view the article in the Microsoft Knowledge Base:
2765331  (http://support.microsoft.com/kb/2765331/ ) Cumulative update package 1 for SQL Server 2012 Service Pack 1
Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2012 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
2772858  (http://support.microsoft.com/kb/2772858/ ) The SQL Server 2012 builds that were released after SQL Server 2012 Service Pack 1 was released

SQL Server 2012

The fix for this issue was first released in Cumulative Update 4. For more information about how to obtain this cumulative update package for SQL Server 2012, click the following article number to view the article in the Microsoft Knowledge Base:
2758687  (http://support.microsoft.com/kb/2758687/ ) Cumulative update package 4 for SQL Server 2012
Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2012 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
2692828  (http://support.microsoft.com/kb/2692828/ ) The SQL Server 2012 builds that were released after SQL Server 2012 was released

Status

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

References

For more information about the CreateProcess function, go to the following MSDN website:
General information about the CreateProcess function (http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx)
For more information about the xp_cmdshell stored procedure, go to the following MSDN website:
General information about the xp_cmdshell stored procedure (http://msdn.microsoft.com/en-us/library/ms175046.aspx)
For more information about a similar issue, click the following article number to view the article in the Microsoft Knowledge Base:
315939  (http://support.microsoft.com/kb/315939/ ) PRB: Child Inherits Unintended Handles During CreateProcess Call

Applies to
  • Microsoft SQL Server 2012 Standard
  • Microsoft SQL Server 2012 Web
  • Microsoft SQL Server 2012 Developer
  • Microsoft SQL Server 2012 Enterprise
Keywords: 
kbtshoot kbqfe kbfix kbexpertiseadvanced kbsurveynew KB2671318
Share
Additional support options
Ask The Microsoft Small Business Support Community
Contact Microsoft Small Business Support
Find Microsoft Small Business Support Certified Partner
Find a Microsoft Store For In-Person Small Business Support