Skip to content

fix: validate MaxEntries to prevent infinite loop in DebugEntryStore#119

Merged
georgidhristov merged 1 commit into
DebugProbe:mainfrom
viogustian:fix/validate-max-entries
Jun 12, 2026
Merged

fix: validate MaxEntries to prevent infinite loop in DebugEntryStore#119
georgidhristov merged 1 commit into
DebugProbe:mainfrom
viogustian:fix/validate-max-entries

Conversation

@viogustian

Copy link
Copy Markdown
Contributor

Closes #112

Problem

Setting MaxEntries to a negative value or zero causes an infinite loop
in DebugEntryStore.Add(), because the while condition is always true.

Solution

Added DebugProbeOptionsValidator that validates MaxEntries >= 1
during startup. If the value is invalid, an InvalidOperationException
is thrown immediately with a clear error message.

Testing

  • Reproduced the bug with MaxEntries = -1 (app hangs on first request)
  • Added two unit tests for zero and negative values
  • All 51 tests pass

@georgidhristov georgidhristov merged commit bf6f710 into DebugProbe:main Jun 12, 2026
1 check passed
@georgidhristov

Copy link
Copy Markdown
Collaborator

Tested locally with MaxEntries = 0 and MaxEntries = -1.

The application now fails fast during startup with a clear validation error instead of hanging on the first request.

Thanks for the contribution.

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.

Validate MaxEntries to Prevent Infinite Loop in DebugEntryStore

2 participants