共用方式為


Why does PREEMPTIVE_OS_GETPROCADDRESS Show a Large Accumulation?

There is a bug in SQL Server 2008 that causes PREEMPTIVE_OS_GETPROCADDRESS to include and accumulate the execution time of the extended stored procedure (XPROC). The following is an example showing the increase in the GetProcAddress wait time.

select * from sys.dm_os_wait_stats where wait_type = 'PREEMPTIVE_OS_GETPROCADDRESS' or wait_type = 'MSQL_XP'
exec master..xp_dirtree 'f:'
select * from sys.dm_os_wait_stats where wait_type = 'PREEMPTIVE_OS_GETPROCADDRESS' or wait_type = 'MSQL_XP'

GetProcAddress is used to load the entrypoint in the DLL (XPROC) and should complete quickly but due to the accumulation bug the wait time is inflated. To get a better idea (ballpark) of how long GetProcAddress really takes you can using the following query.

declare @WaitTime bigint
select @WaitTime = wait_time_ms from sys.dm_os_wait_stats where wait_type = 'MSQL_XP'
select @WaitTime - wait_time_ms from sys.dm_os_wait_stats where wait_type = 'PREEMPTIVE_OS_GETPROCADDRESS'

Bob Dorr - Principal SQL Server Escalation Engineer

Comments

  • Anonymous
    July 22, 2010
    Hi, Is there a fix for this problem ? Thank you, Victor S. DBA

  • Anonymous
    August 10, 2010
    Hi Bob, Do you know of any documentation on what PREEMPTIVE_OS_GETPROCADDRESS is and what it means?  I have an SQL Server backup through a third party tool that uses extended procs to do the backup.  The backups was killed, however it has been in a killed/rollback state for 3 hours and lists it's wait type as PREEMPTIVE_OS_GETPROCADDRESS. Thanks, Charley

  • Anonymous
    February 07, 2011
    I am seeing this wait in relation to the Quest LiteSpeed extended procedures. Is there a fix for this yet or plans for one?

  • Anonymous
    April 02, 2012
    The comment has been removed

  • Anonymous
    May 30, 2012
    I have a process with a long waittime (around 4 days) of PREEMPTIVE_OS_GETPROCADDRESS, I am running SQL Server 2008 R2 SP1, the only solution is to restart the sql server service? Microsoft: We need urgent and update of this bug.

  • Anonymous
    November 25, 2012
    Would be nice to know if this is documented in a KB article and/or has been fixed in subsequent service packs or releases.

  • Anonymous
    January 22, 2013
    We are experiencing issues repeatedly with xp_sysmail_format_query waiting on preemptive_os_getprocaddress. The process has to be killed and it is an important production procedure. 10.50.4260 Any updates ?

  • Anonymous
    September 20, 2017
    The comment has been removed