Description
EventLogService.cs lines 74–99 collect all matching events into a List<EventLogEntry> with no upper bound.
Code
var results = new List<EventLogEntry>();
foreach (var evt in records)
{
token.ThrowIfCancellationRequested();
// ... filtering ...
results.Add(evt); // unbounded
}
return results.OrderByDescending(r => r.Time).ToList();
Scenario
User searches for "Error" on a server with years of event logs → hundreds of thousands of entries loaded into memory → OutOfMemoryException crashes the Manager application.
Suggested Fix
Add a maxResults cap:
const int MaxResults = 10_000;
foreach (var evt in records)
{
token.ThrowIfCancellationRequested();
// ... filtering ...
results.Add(evt);
if (results.Count >= MaxResults)
break;
}
Description
EventLogService.cslines 74–99 collect all matching events into aList<EventLogEntry>with no upper bound.Code
Scenario
User searches for "Error" on a server with years of event logs → hundreds of thousands of entries loaded into memory →
OutOfMemoryExceptioncrashes the Manager application.Suggested Fix
Add a
maxResultscap: