Skip to content

fix: make inference and PD master recursion limits configurable - #1581

Merged
shihaobai merged 1 commit into
mainfrom
bsh/recursionlimit
Sep 18, 2026
Merged

shihaobai merged 1 commit into
mainfrom
bsh/recursionlimit

Conversation

@shihaobai

@shihaobai shihaobai commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Long contexts can exceed Python's recursion limit during radix-cache insertion and prefix matching. With 512-token small pages, a 1,048,576-token context needs roughly 2,048 recursive calls, exceeding the inference worker's default limit of 1,000.

Add cached readers in envs_utils.py for LIGHTLLM_MODEL_INFER_RECURSION_LIMIT and LIGHTLLM_PD_MASTER_RECURSION_LIMIT, both defaulting to 4,000. Each inference rank applies its limit before starting worker threads, and PD Master's cache-aware configuration reads its independent limit when initialized.

@shihaobai
shihaobai merged commit 89c5b52 into main Sep 18, 2026
1 check passed
@shihaobai
shihaobai deleted the bsh/recursionlimit branch September 18, 2026 14:13
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.

1 participant