Skip to content

Fixing connected document parsing in binding queue. #2617

Merged
aasimkhan30 merged 6 commits intomainfrom
aasim/fix/langServiceCrash
Mar 17, 2026
Merged

Fixing connected document parsing in binding queue. #2617
aasimkhan30 merged 6 commits intomainfrom
aasim/fix/langServiceCrash

Conversation

@aasimkhan30
Copy link
Contributor

@aasimkhan30 aasimkhan30 commented Mar 13, 2026

Description

Previously any stack overflow error while parsing a connected script lead to crashing of sts.
This fixes that by making it run on a thread with larger stack size just like offline parsing scenarios.

Example error:

t Microsoft.SqlServer.Management.SqlParser.SqlCodeDom.SqlScalarExpressionError.Unbind()
   at Microsoft.SqlServer.Management.SqlParser.SqlCodeDom.SqlCodeObject.Unbind()
   at Microsoft.SqlServer.Management.SqlParser.SqlCodeDom.SqlCodeObject.Unbind()
   at Microsoft.SqlServer.Management.SqlParser.SqlCodeDom.SqlCodeObject.Unbind()
   at Microsoft.SqlServer.Management.SqlParser.SqlCodeDom.SqlQuerySpecification.Unbind()
   at Microsoft.SqlServer.Management.SqlParser.SqlCodeDom.SqlCodeObject.Unbind()
   at Microsoft.SqlServer.Management.SqlParser.SqlCodeDom.SqlCodeObject.Unbind()
   at Microsoft.SqlServer.Management.SqlParser.SqlCodeDom.SqlStatement.Unbind()
   at Microsoft.SqlServer.Management.SqlParser.SqlCodeDom.SqlSelectStatement.Unbind()
   at Microsoft.SqlServer.Management.SqlParser.SqlCodeDom.SqlCodeObject.Unbind()
   at Microsoft.SqlServer.Management.SqlParser.SqlCodeDom.SqlBatch.Unbind()
   at Microsoft.SqlServer.Management.SqlParser.SqlCodeDom.SqlCodeObject.Unbind()
   at Microsoft.SqlServer.Management.SqlParser.SqlCodeDom.SqlScript.Unbind()
   at Microsoft.SqlServer.Management.SqlParser.Parser.Internals.VersionedParserBase.Parse(Boolean, System.String, Microsoft.SqlServer.Management.SqlParser.SqlCodeDom.SqlScript, Microsoft.SqlServer.Management.SqlParser.Parser.ParseOptions, Microsoft.SqlServer.Management.SqlParser.Parser.ParseOptions ByRef)
   at Microsoft.SqlServer.Management.SqlParser.Parser.Parser.Parse(Boolean, System.String, Microsoft.SqlServer.Management.SqlParser.Parser.ParseResult, Microsoft.SqlServer.Management.SqlParser.Parser.ParseOptions, Microsoft.SqlServer.Management.SqlParser.Parser.ParseOptions ByRef)
   at Microsoft.SqlServer.Management.SqlParser.Parser.Parser.IncrementalParse(System.String, Microsoft.SqlServer.Management.SqlParser.Parser.ParseResult, Microsoft.SqlServer.Management.SqlParser.Parser.ParseOptions, Microsoft.SqlServer.Management.SqlParser.Parser.ParseOptions ByRef)
   at Microsoft.SqlServer.Management.SqlParser.Parser.Parser.IncrementalParse(System.String, Microsoft.SqlServer.Management.SqlParser.Parser.ParseResult, Microsoft.SqlServer.Management.SqlParser.Parser.ParseOptions)
   at Microsoft.SqlTools.ServiceLayer.LanguageServices.LanguageService+<>c__DisplayClass72_0.<ParseAndBind>b__2(Microsoft.SqlTools.ServiceLayer.LanguageServices.IBindingContext, System.Threading.CancellationToken)
   at Microsoft.SqlTools.ServiceLayer.LanguageServices.BindingQueue1+<>c__DisplayClass35_0[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].<DispatchQueueItem>b__0()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()
   at System.Threading.Thread.StartCallback()
[Error - 1:50:58 PM] Connection to server got closed. Server will not be restarted.

Code Changes Checklist

  • New or updated unit tests added
  • All existing tests pass (dotnet test)
  • Code follows contributing guidelines
  • Logging/telemetry updated if relevant
  • No protocol or behavioral regressions

Reviewers: Please read our reviewer guidelines

@aasimkhan30 aasimkhan30 merged commit 7183e2f into main Mar 17, 2026
5 checks passed
@aasimkhan30 aasimkhan30 deleted the aasim/fix/langServiceCrash branch March 17, 2026 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants