Skip to content

Stack overflow when creating a SQL transport monitoring instance using PowerShell #4197

@NChaganlal

Description

@NChaganlal

Symptoms

When creating a SQL transport monitoring instance using PowerShell, the PowerShell instance terminates with a stack overflow.
It is still possible to create monitoring instances using the ServiceControl Management UI).

Who's affected

You are affected if:

Root cause

Details

Description

It is not possible to create a SQL transport monitoring instance using PowerShell

Expected behavior

An SQL transport monitoring instance is created using the Powershell command.

Actual behavior

The PowerShell process terminates with a stack overflow.

Versions

Steps to reproduce

  1. Open Powershell v7.2 window
  2. Enter the following commands
Import-Module Particular.ServiceControl.Management
New-MonitoringInstance -Name particular.monitoring.sql -DisplayName particular.monitoring.sql -InstallPath 'C:\Particular.Monitoring.SQL' -LogPath 'C:\Logs' -HostName localhost -Port 33634 -ErrorQueue error -Transport SQLServer -ConnectionString 'Data Source=sqlinternal.somewhere;Initial Catalog=nservicebussqltransport;User Id=nsbuser;Password=verysecretpwd' -ServiceAccount LocalSystem

Relevant log output

VERBOSE: Installing Monitoring instance...

Stack overflow.

Repeat 1057 times:

--------------------------------
   at System.Reflection.RuntimeAssembly.InternalLoad(System.Reflection.AssemblyName, System.Threading.StackCrawlMark ByRef, System.Runtime.Loader.AssemblyLoadContext, System.Reflection.RuntimeAssembly, Boolean)
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName(System.Reflection.AssemblyName)
   at ServiceControl.Management.PowerShell.ModuleAssemblyInitializer.Resolve(System.Runtime.Loader.AssemblyLoadContext, System.Reflection.AssemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.GetFirstResolvedAssemblyFromResolvingEvent(System.Reflection.AssemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(System.Reflection.AssemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(IntPtr, System.Reflection.AssemblyName)
--------------------------------
   at ServiceControlInstaller.Engine.Validation.ConnectionStringValidator.CheckMsSqlConnectionString()
   at ServiceControlInstaller.Engine.Validation.ConnectionStringValidator.Validate(ServiceControlInstaller.Engine.IMonitoringInstance)
   at ServiceControlInstaller.Engine.Instances.MonitoringNewInstance+<Validate>d__72.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[ServiceControlInstaller.Engine.Instances.MonitoringNewInstance+<Validate>d__72, ServiceControlInstaller.Engine, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null]](<Validate>d__72 ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[[ServiceControlInstaller.Engine.Instances.MonitoringNewInstance+<Validate>d__72, ServiceControlInstaller.Engine, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null]](<Validate>d__72 ByRef)
   at ServiceControlInstaller.Engine.Instances.MonitoringNewInstance.Validate(System.Func`2<ServiceControlInstaller.Engine.Validation.PathInfo,System.Threading.Tasks.Task`1<Boolean>>)
   at ServiceControlInstaller.Engine.Unattended.UnattendMonitoringInstaller+<Add>d__4.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[ServiceControlInstaller.Engine.Unattended.UnattendMonitoringInstaller+<Add>d__4, ServiceControlInstaller.Engine, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null]](<Add>d__4 ByRef)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.Boolean, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Start[[ServiceControlInstaller.Engine.Unattended.UnattendMonitoringInstaller+<Add>d__4, ServiceControlInstaller.Engine, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null]](<Add>d__4 ByRef)
   at ServiceControlInstaller.Engine.Unattended.UnattendMonitoringInstaller.Add(ServiceControlInstaller.Engine.Instances.MonitoringNewInstance, System.Func`2<ServiceControlInstaller.Engine.Validation.PathInfo,System.Threading.Tasks.Task`1<Boolean>>)
   at ServiceControl.Management.PowerShell.NewMonitoringInstance.ProcessRecord()
   at System.Management.Automation.CommandProcessor.ProcessRecord()
   at System.Management.Automation.CommandProcessorBase.DoExecute()
   at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(System.Object)
   at System.Management.Automation.PipelineOps.InvokePipeline(System.Object, Boolean, System.Management.Automation.CommandParameterInternal[][], System.Management.Automation.Language.CommandBaseAst[], System.Management.Automation.CommandRedirection[][], System.Management.Automation.Language.FunctionContext)
   at System.Management.Automation.Interpreter.ActionCallInstruction`6[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Boolean, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Run(System.Management.Automation.Interpreter.InterpretedFrame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(System.Management.Automation.Interpreter.InterpretedFrame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(System.Management.Automation.Interpreter.InterpretedFrame)
   at System.Management.Automation.Interpreter.Interpreter.Run(System.Management.Automation.Interpreter.InterpretedFrame)
   at System.Management.Automation.Interpreter.LightLambda.RunVoid1[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon)
   at System.Management.Automation.DlrScriptCommandProcessor.RunClause(System.Action`1<System.Management.Automation.Language.FunctionContext>, System.Object, System.Object)
   at System.Management.Automation.DlrScriptCommandProcessor.Complete()
   at System.Management.Automation.CommandProcessorBase.DoComplete()
   at System.Management.Automation.Internal.PipelineProcessor.DoCompleteCore(System.Management.Automation.CommandProcessorBase)
   at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(System.Object)
   at System.Management.Automation.Runspaces.LocalPipeline.InvokeHelper()
   at System.Management.Automation.Runspaces.LocalPipeline.InvokeThreadProc()
   at System.Management.Automation.Runspaces.PipelineThread.WorkerProc()
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)

Additional Information

Workarounds

Create the Monitoring instance using the ServiceControl Management UI.

Possible solutions

N/A

Additional information

N/A

Backported to

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions