Skip to content

[Client] Reject non-positive timeouts in Configuration - #415

Open
chr-hertel wants to merge 2 commits into
modelcontextprotocol:mainfrom
chr-hertel:fix/client-timeout-validation
Open

[Client] Reject non-positive timeouts in Configuration#415
chr-hertel wants to merge 2 commits into
modelcontextprotocol:mainfrom
chr-hertel:fix/client-timeout-validation

Conversation

@chr-hertel

Copy link
Copy Markdown
Member

Client\Configuration accepts any integer for initTimeout and requestTimeout, so setInitTimeout(0) or setRequestTimeout(-5) silently builds a client that can never succeed — the pending-request check is time() - $timestamp >= $timeout, which is true on the first poll, turning every request into an immediate timeout.

Both are now required to be positive, matching how StdioTransport and HttpTransport validate their buffer caps. Zero is rejected along with negatives: it reads like "no timeout" but actually means "expire immediately".

Validation lives in Configuration rather than the builder setters because Configuration is public API and Client accepts one directly, so the builder is not the only way in.

@chr-hertel chr-hertel added Client Issues & PRs related to the Client component enhancement Request for a new feature that's not currently supported labels Aug 10, 2026
@chr-hertel chr-hertel added this to the 0.8.0 milestone Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Client Issues & PRs related to the Client component enhancement Request for a new feature that's not currently supported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant