(Republishing, or using this info in a commercial product/website, is prohibited without permission. All other uses are permitted. If in doubt, please ask.)

PREEMPTIVE_OS_FINDFILE

(Back to main page…)

Description:

This wait type is a generic wait for when a thread is calling one of several Windows functions related to finding files.

(Books Online description: N/A)

Questions/comments on this wait type? Click here to send Paul an email, especially if you have any information to add to this topic.

Added in SQL Server version:

2008

Removed in SQL Server version:

N/A

Extended Events wait_type value:

The map_key value in sys.dm_xe_map_values is 449 in 2008 and 2008 R2, 497 in 2012, and 513 in 2014 RTM. After 2014 RTM, you must check the DMV to get the latest value as some map_key values have changed in later builds.

Other information:

I have not seen this wait type be a noticeable contention point.

Note that when a thread calls out to Windows, the thread changes from non-preemptive (SQL Server controls the thread) to preemptive (Windows controls the thread) mode. The thread’s state will be listed as RUNNING, as SQL Server doesn’t know what Windows is doing with the thread.

Known occurrences in SQL Server (list number matches call stack list):

  1. Finding a file (in this case, while running the FILESTREAM consistency-checking portion of the allocation checks in DBCC CHECKDB)
  2. Finding a file (in this case, while running the FILESTREAM consistency-checking portion of the logical checks in DBCC CHECKDB)
  3. finding a file (in this case, while truncating the FILESTREAM ‘log’ as part of running a checkpoint operation)

And other similar call stacks.

Abbreviated call stacks (list number matches known occurrences list):

  1. SOS_Task::PopWait+b1
    AutoSwitchPreemptive::~AutoSwitchPreemptive+95
    FsLogIter::MoveNext+2db
    STREAMFCB::FindNextDeletedRowset+27f
    StreamFileMgr::DbccCheckForRowsetDirs+1a6
    CheckAllocations::ExtractRowsetDirFactsFromFSManager+8b
    CheckAllocations::ExtractFactsFromSEMetadata+142b
    CheckAllocations::ProcessNextData+1fe
    CheckAggregateSingleInstance::GetNextFact+28e
    CTRowsetInstance::FGetNextRow+3c
    CUtRowset::GetNextRows+a0
    CQScanRmtScanNew::GetRowHelper+3b5
    CQScanSortNew::BuildSortTable+246
    CQScanSortNew::OpenHelper+c0
    CQScanNew::OpenHelper+41
    CQScanStreamAggregateNew::Open+30
    CQueryScan::StartupQuery+23c
    CXStmtQuery::SetupQueryScanAndExpression+2e5
    CXStmtQuery::InitForExecute+34
    CXStmtQuery::ErsqExecuteQuery+36d
    CXStmtSelect::XretExecute+2e7
    CMsqlExecContext::ExecuteStmts<1,1>+427
  2. SOS_Task::PopWait+b1
    AutoSwitchPreemptive::~AutoSwitchPreemptive+95
    TreeScan::FetchNext+3d8
    CFsFileRowset::FindNextFileW+10a
    CFsRowset::FindNextFileW+76
    CheckTables::CollectFSFileFactsFromFSManager+51a
    CheckTables::ProcessPage+588
    CheckTables::ProcessNextData+34f
    CheckAggregateSingleInstance::GetNextFact+28e
    CTRowsetInstance::FGetNextRow+3c
    CUtRowset::GetNextRows+a0
    CQScanRmtScanNew::GetRowHelper+3b5
    CQScanSortNew::BuildSortTable+246
    CQScanSortNew::OpenHelper+c0
    CQScanNew::OpenHelper+41
    CQScanStreamAggregateNew::Open+30
    CQueryScan::StartupQuery+23c
    CXStmtQuery::SetupQueryScanAndExpression+2e5
    CXStmtQuery::InitForExecute+34
    CXStmtQuery::ErsqExecuteQuery+36d
    CXStmtSelect::XretExecute+2e7
    CMsqlExecContext::ExecuteStmts<1,1>+427
  3. SOS_Task::PopWait+b1
    AutoSwitchPreemptive::~AutoSwitchPreemptive+95
    FsLogIter::MoveNext+f7
    STREAMFCB::TruncatepH6FsLog+15c
    FsLogTruncMgr::TruncateLog+261
    FsLogTruncMgr::ProcessFsLogTruncationForDB+116
    RecoveryUnit::ProcessCheckpointEnd+6af
    HardenAndLogCheckpoint+e3d
    CheckpointRU2+278
    AsynchronousDiskAction::DoFlushCache+98
    AsynchronousDiskAction::ExecuteDeferredAction+246
    AsynchronousDiskPool::PerformActionsSerially+61
    AsynchronousDiskPool::WaitUntilDoneOrTimeout+71
    CheckpointDB2+2eb
    CheckpointWithOptionalTruncate+c5
    DBOpAgent::CheckpointDBHandler+1e
    CStmtCheckpoint::XretExecute+e7
    CMsqlExecContext::ExecuteStmts<1,1>+427
    CMsqlExecContext::FExecute+a43
    CSQLSource::Execute+86c