marcingminski / sqlwatch

SQL Server Performance Monitor
https://docs.sqlwatch.io
Other
424 stars 168 forks source link

Unhandled Exception -> System indexOutOfRangeException every now and then #438

Open pluim003 opened 2 years ago

pluim003 commented 2 years ago

Describe the bug Every now and then the SQL-IMPORTER-job fails, although (most of) the data has been captured. Errormessage:

Date 8-2-2022 09:05:00 Log Job History (SQLWATCH-IMPORTER)

Step ID 1 Server WPZKH1879 Job Name SQLWATCH-IMPORTER Step Name SQLWatch - import Duration 00:00:01 Sql Severity 0 Sql Message ID 0 Operator Emailed
Operator Net sent
Operator Paged
Retries Attempted 0

Message Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array. at System.Collections.Generic.List1.Add(T item) at SqlWatchImport.Program.<>c__DisplayClass0_2.<Main>b__0(RemoteInstance RemoteInstance) in C:\projects\sqlwatch\SqlWatch.Monitor\Project.SqlWatchImport\Program.cs:line 154 at System.Threading.Tasks.Parallel.<>c__DisplayClass31_02.b0(Int32 i) at System.Threading.Tasks.Parallel.<>cDisplayClass17_01.<ForWorker>b__1() at System.Threading.Tasks.Task.InnerInvoke() at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask) at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object <p0>) --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait() at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action1 body, Action2 bodyWithState, Func4 bodyWithLocal, Func1 localInit, Action1 localFinally) at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IList1 list, ParallelOptions parallelOptions, Action1 body, Action2 bodyWithState, Action3 bodyWithStateAndIndex, Func4 bodyWithStateAndLocal, Func5 bodyWithEverything, Func1 localInit, Action1 localFinally) at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable1 source, ParallelOptions parallelOptions, Action1 body, Action2 bodyWithState, Action3 bodyWithStateAndIndex, Func4 bodyWithStateAndLocal, Func5 bodyWithEverything, Func1 localInit, Action1 localFinally) at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable1 source, Action1 body) at SqlWatchImport.Program.Main(String[] args) in C:\projects\sqlwatch\SqlWatch.Monitor\Project.SqlWatchImport\Program.cs:line 125

Unclear which of the 30 instances to be monitored throws this...

To Reproduce Happens randomly. Next run as it runs every 5 minutes might succeed without errors and then after a while the same error occurs.

Expected behavior No error

Screenshots If applicable, add screenshots to help explain your problem.

Windows Server (please complete the following information):

SQL Server (please complete the following information):

SQL Server Management Studio (SSMS -> about -> copy info):

SQLWATCH version (from DACPAC or from sysinstances)

Additional context Add any other context about the problem here.

marcingminski commented 1 year ago

Hi, is this still an issue or has it been fixed since you raised the bug?

pluim003 commented 1 year ago

Well, it's been almost 8 months since I logged the issue. About 6 months or so we switched from Sqlwatch to Zabbix. So unfortunately we don't use sqlwatch anymore and I can't tell if the same problem still is present.

marcingminski commented 1 year ago

Zabbix is good! I used to use it extensively and will be happy to help you with SQL templates (if you need any help!)

pluim003 commented 1 year ago

Thanx @marcingminski , always handy, to compare with ours at the company.