Skip to content

Cap worker-lock retry interval to fix int-str overflow crash (fixes #19315 #18221)#19726

Open
George3d6 wants to merge 3 commits intoelement-hq:developfrom
George3d6:develop
Open

Cap worker-lock retry interval to fix int-str overflow crash (fixes #19315 #18221)#19726
George3d6 wants to merge 3 commits intoelement-hq:developfrom
George3d6:develop

Conversation

@George3d6
Copy link
Copy Markdown

Cap WaitingLock / WaitingMultiLock retry interval at 10 minutes.

Without a cap, max(5, next * 2) silently promotes self._retry_interval to an int on the second call (Python's max preserves the larger operand's type, and 5 is an int), and it doubles without bound. Once it crosses the existing 10-minute "getting excessive" warning threshold, the warning log line calls str() on the int and eventually trips Python 3.11+'s 4300-digit int_max_str_digits limit (PEP 644), raising ValueError from inside the warning itself. __aenter__'s broad except Exception: pass (intended to absorb TimeoutError from timeout_deferred) swallows the ValueError before the retry loop sleeps, so the loop re-raises as fast as Python can emit tracebacks until the process is restarted.

The cap is hoisted into a module-level _LOCK_RETRY_CAP_SECS so both classes share it, and the excessive-timeout warning is restructured to fire exactly once per waiter (on the iteration that first reaches the cap) instead of either spamming every iteration or being silently suppressed.

Fixes #19315 and #18221.

@George3d6 George3d6 requested a review from a team as a code owner April 24, 2026 10:41
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.



logger = logging.getLogger(__name__)
_LOCK_RETRY_CAP_SECS = Duration(minutes=10).as_secs()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a PR to address this kind of thing: #19394

🤔 I think we can continue with the other PR which is a bit more fleshed out and is currently stuck at the stage of the review being addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

3 participants