Skip to content

Validate MaxEntries to Prevent Infinite Loop in DebugEntryStore #112

Description

@georgidhristov

Description

DebugProbe currently allows MaxEntries to be configured with negative values.

When MaxEntries <= -1, DebugEntryStore.Add can enter an infinite loop while attempting to trim stored entries.

Current Behavior

MaxEntries can currently be set to invalid values such as:

builder.Services.AddDebugProbe(options =>
{
    options.MaxEntries = -1;
});

This can cause DebugEntryStore.Add to loop indefinitely while processing new entries.

Expected Behavior

DebugProbe should validate MaxEntries and reject invalid values before the application starts processing requests.

Suggested Fix

Validate MaxEntries during options configuration or initialization.

Recommended validation:

MaxEntries >= 1

If an invalid value is provided, throw a clear configuration exception explaining the required range.

Result

After this change:

  • Invalid configuration is detected early.
  • DebugEntryStore cannot enter an infinite loop.
  • Users receive a clear error message instead of unexpected runtime behavior.
  • Configuration becomes more predictable and robust.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions