Skip to content

Standardize timeout parsing with correct errors for too small or too large #1262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 23, 2025

Conversation

prvyk
Copy link
Contributor

@prvyk prvyk commented Jun 20, 2025

There are a number of places where Garnet parses timeouts for blocking commands. These did not consistently error on negative values, and none of them errored on too large values (where .NET will raise an ArgumentOutOfRangeException and then Garnet closes the connection). Using a central SessionParseStateExtension for timeouts fixes all these issues neatly.

Note the .NET maximum timeout (int.MaxValue milliseconds) is far lower than the Valkey maximum timeout (63-bit integer seconds). I don't think the complexity justifies supporting this much? However, the .NET runtime maximum can be easily raised to uint32.MaxValue - 1 milliseconds, I'll be opening an issue on their tracker for this.

@prvyk
Copy link
Contributor Author

prvyk commented Jun 20, 2025

See dotnet/runtime#116877 for the dotnet issue.

@TalZaccai TalZaccai self-requested a review June 23, 2025 21:10
Copy link
Contributor

@TalZaccai TalZaccai left a comment

Choose a reason for hiding this comment

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

Very nice clean up! Love it!

@TalZaccai TalZaccai merged commit 3f08fab into microsoft:main Jun 23, 2025
26 checks passed
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.

2 participants