Skip to content

🪲 BUG-#245: Fix TimeoutError not caught on Python 3.9/3.10#253

Merged
FernandoCelmer merged 3 commits intodevelopfrom
feature/245
Apr 12, 2026
Merged

🪲 BUG-#245: Fix TimeoutError not caught on Python 3.9/3.10#253
FernandoCelmer merged 3 commits intodevelopfrom
feature/245

Conversation

@FernandoCelmer
Copy link
Copy Markdown
Member

Summary

  • Import concurrent.futures.TimeoutError as FuturesTimeoutError
  • Catch both TimeoutError and FuturesTimeoutError in execute_with_retry (line 136) and _execute_with_timeout (line 181)
  • Re-raise as TimeoutError() from None for clean traceback

Problem

On Python 3.9/3.10, concurrent.futures.TimeoutError is a separate class that does not inherit from builtins.TimeoutError. The code only caught TimeoutError (builtin), so future.result(timeout=N) raised an uncaught exception that bypassed retry logic.

On Python 3.11+, they unified the classes so the bug was invisible.

Tests

  • test_timeout_expired_marks_task_failed — real timeout with sleep(5) and timeout=1
  • test_futures_timeout_error_is_caught — mocks _execute_with_timeout to raise FuturesTimeoutError directly

Test plan

  • All 3 timeout tests pass
  • ruff lint + format pass with .code_quality/ruff.toml

Closes #245

@FernandoCelmer FernandoCelmer added bug Something isn't working 0.15.0 Introduced in v0.15.0 labels Apr 12, 2026
Comment thread tests/core/test_engine.py
@FernandoCelmer FernandoCelmer merged commit d3ee31f into develop Apr 12, 2026
10 checks passed
@FernandoCelmer FernandoCelmer deleted the feature/245 branch April 12, 2026 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0.15.0 Introduced in v0.15.0 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant