The Curious Case of… resolving call stack symbols on SQL Server 2019

(The Curious Case of… used to be part of our bi-weekly newsletter but we decided to make it a regular blog post instead so it can sometimes be more frequent. It covers something interesting one of us encountered when working with a client, doing some testing, or were asked in a random question from the community.)

I haven’t had a need to resolve call stack symbols (see my post here for an explanation) on a SQL Server 2019 instance until last weekend, when I was prepping my demos for the IEPTO2 class that’s running at the moment. I downloaded the symbols (see this post), ran my demo to determine the code paths generating SOS_SCHEDULER_YIELD waits, and it didn’t work. I got this:

sqldk.dll+0x000000000005CE41
sqldk.dll+0x0000000000002EC6
sqldk.dll+0x00000000000016C4
sqlmin.dll+0x0000000000001101
sqlmin.dll+0x0000000000081214

<snip for brevity>

sqllang.dll+0x000000000001352F
sqllang.dll+0x0000000000015427
sqllang.dll+0x0000000000015609
sqllang.dll+0x0000000000014D65
sqllang.dll+0x00000000000147A8

After beating my head against the proverbial wall for an hour, I wondered if I had the wrong symbols somehow. I checked with the excellent SQLCallStackResolver tool from GitHub (authored by Arvind Shyamsundar from the Product Group) and that worked fine with the symbols I had, so it had to be something within SQL Server.

I finally resorted to pinging Jonathan and after some digging he found that SQL Server 2019 requires an additional trace flag (2592) to be enabled as well as the traditional 3656. As soon as I enabled that, everything worked and I got this:

sqldk.dll!XeSosPkg::wait_info::Publish+0x1b2
sqldk.dll!SOS_Scheduler::UpdateWaitTimeStats+0x2f0
sqldk.dll!SOS_Task::PostWait+0x6f
sqlmin.dll!SOS_Task::Sleep+0x14e
sqlmin.dll!BTreeMgr::HandleRoot+0x420
sqlmin.dll!BTreeMgr::Seek+0x240
sqlmin.dll!BTreeMgr::GetHPageIdWithKey+0x7ce
sqlmin.dll!IndexPageManager::GetPageWithKey+0x119
sqlmin.dll!GetRowForKeyValue+0x203
sqlmin.dll!IndexRowScanner::EstablishInitialKeyOrderPosition+0x1bf
sqlmin.dll!IndexDataSetSession::GetNextRowValuesInternal+0x1df
sqlmin.dll!RowsetNewSS::GetNextRowValues+0x18d
sqlmin.dll!RowsetNewSS::FetchNextRow+0x82
sqlmin.dll!CQScanRangeNew::GetRow+0x1ce
sqlmin.dll!CQScanLightProfileNew::GetRow+0x19
sqlmin.dll!CQScanCountStarNew::GetRowHelper+0x3d
sqlmin.dll!CQScanStreamAggregateNew::GetCalculatedRow+0x21
sqlmin.dll!CQueryScan::UncacheQuery+0x60f
sqllang.dll!CXStmtQuery::SetupQueryScanAndExpression+0x47b
sqllang.dll!CXStmtQuery::InitForExecute+0x2f
sqllang.dll!CXStmtQuery::ErsqExecuteQuery+0x3d8
sqllang.dll!CXStmtSelect::XretExecute+0x372
sqllang.dll!CMsqlExecContext::ExecuteStmts<1,1>+0x8f2
sqllang.dll!CMsqlExecContext::FExecute+0x936

Bottom line: all releases require trace flag 3656 to be enabled for symbol resolution, and SQL Server 2019 also requires 2592.

Leave a Reply

Your email address will not be published. Required fields are marked *

Other articles

Imagine feeling confident enough to handle whatever your database throws at you.

With training and consulting from SQLskills, you’ll be able to solve big problems, elevate your team’s capacity, and take control of your data career.