Skip to content

[Bug]: Incorrect _sleep_with_jitter Method Call #822

@crivetimihai

Description

@crivetimihai

Bug: Incorrect _sleep_with_jitter Method Call

Location: mcpgateway/utils/retry_manager.py:599

Issue: The _sleep_with_jitter(backoff) method is called with only one argument, but the method signature requires two arguments:

  • base (float): The base sleep time
  • jitter_range (float): The range for adding jitter

Current Code:

await self._sleep_with_jitter(backoff)  # Line 599

Method Signature:

async def _sleep_with_jitter(self, base: float, jitter_range: float) -> None:

Impact: This bug causes a TypeError when the retry manager attempts to sleep with jitter during HTTP retries, breaking the retry functionality.

Discovery: Found during test coverage improvement while writing comprehensive unit tests for the retry_manager module.

Severity: High - breaks retry functionality which is critical for handling transient network failures.

Suggested Fix: Update the method call to provide both required arguments:

await self._sleep_with_jitter(backoff, self.config.jitter_range)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtriageIssues / Features awaiting triage

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions