Skip to content

Fix NullReferenceException in AutoCheckpointTask when AOF is disabled with AofSizeLimit configured#1742

Open
vazois wants to merge 2 commits intomainfrom
vazois/fix-issue-1696
Open

Fix NullReferenceException in AutoCheckpointTask when AOF is disabled with AofSizeLimit configured#1742
vazois wants to merge 2 commits intomainfrom
vazois/fix-issue-1696

Conversation

@vazois
Copy link
Copy Markdown
Contributor

@vazois vazois commented Apr 27, 2026

Summary

Reject invalid configuration at startup where AofSizeLimit is set but AOF is disabled (EnableAOF = false). This prevents a NullReferenceException in AutoCheckpointTask that occurs because AOF-related objects are never initialized when AOF is off.

Changes

  • libs/host/Configuration/Options.cs – Added a validation check that throws a GarnetException when AofSizeLimit is specified without enabling AOF.
  • test/Garnet.test/GarnetServerConfigTests.cs – Added test AofSizeLimitWithoutAofEnabled to verify the new validation rejects the invalid config and accepts the valid one.

Fixes #1696

@vazois vazois marked this pull request as ready for review April 27, 2026 20:06
Copilot AI review requested due to automatic review settings April 27, 2026 20:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prevents a startup-time misconfiguration (AofSizeLimit set while AOF is disabled) that can otherwise lead to runtime NullReferenceException failures in the AOF-size-limit auto-checkpoint background task.

Changes:

  • Add startup validation that rejects AofSizeLimit when EnableAOF is not enabled.
  • Add a configuration parsing test to ensure the invalid combination is rejected and the valid combination succeeds.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
libs/host/Configuration/Options.cs Adds config validation to fail fast when AofSizeLimit is configured but AOF is disabled.
test/Garnet.test/GarnetServerConfigTests.cs Adds a test covering the new invalid/valid configuration behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread libs/host/Configuration/Options.cs
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.

NullReferenceException during Auto Checkpoint when AOF is Disabled with AOF Size Limit Configured

3 participants