fix: guard set_scale against invalid concurrency_modifier returns - #586
Open
Swigler wants to merge 1 commit into
Open
fix: guard set_scale against invalid concurrency_modifier returns#586Swigler wants to merge 1 commit into
Swigler wants to merge 1 commit into
Conversation
…npod#458) If a user-provided concurrency_modifier callback returns None, a non-integer, or a value < 1, the worker crashes with: TypeError: '<' not supported between instances of 'int' and 'NoneType' Validate the return value in set_scale(): reject None, non-int, and values < 1 (default to 1 with a warning). Wrap the callback in try/except so a raising modifier keeps the current concurrency instead of crashing the worker. Closes runpod#458
Swigler
force-pushed
the
fix/concurrency-modifier-none-guard
branch
from
September 3, 2026 17:56
7ec7b56 to
d539dcb
Compare
Author
|
Ping — if concurrency_modifier returns an invalid value, set_scale crashes the worker. This adds a guard. Ready for review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
concurrency_modifierreturn value inset_scale()— rejectNone, non-int, and values < 1 (defaults to 1 with a warning log)Fixes #458
What was wrong
If a user-provided
concurrency_modifiercallback returnsNone(or any non-integer),self.current_concurrencyis set toNone. This later crashes at the job scheduling loop:The crash kills the worker, causing 2-3 minutes of downtime while the Docker container restarts.
What changed
rp_scale.py—set_scale()method:concurrency_modifier()call in try/except — if it raises, log a warning and keep the current valueintand >= 1, otherwise default to 1 with a warningtest_scale.py— 5 new tests:Nonereturn → defaults to 1Test plan
test_scale.pypass (4 existing + 5 new)