Skip to content

Parallel API processor can hang with non-positive limits #3012

Description

@sylvesterkaczmarek

Problem

examples/api_request_parallel_processor.py accepts non-positive values for max_requests_per_minute, max_tokens_per_minute, and max_attempts.

These values can make the processor fail to terminate:

  • max_requests_per_minute <= 0: request capacity never reaches 1, so a pending request is never scheduled.
  • max_tokens_per_minute <= 0: token capacity never reaches a positive request cost, so a pending request can wait forever.
  • max_attempts == 0: the processor decrements attempts_left before the request call, making it -1; on failure, if self.attempts_left: remains truthy for negative values, so the request is requeued indefinitely.

Expected behavior

Reject invalid non-positive limits at the processor boundary before opening the request file or entering the scheduling loop.

Suggested fix

Validate:

  • max_requests_per_minute > 0
  • max_tokens_per_minute > 0
  • max_attempts >= 1

with clear ValueError messages, leaving all valid inputs unchanged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions