Skip to content

Align faulthandler watchdog timeouts with CPython - #9775

Merged
youknowone merged 3 commits into
RustPython:mainfrom
youknowdot:fix/watchdog-timeouts-20261110
Nov 12, 2026
Merged

youknowone merged 3 commits into
RustPython:mainfrom
youknowdot:fix/watchdog-timeouts-20261110

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Summary

  • Accept timeout= in dump_traceback_later and signum= in register, matching CPython 3.15.
  • Convert watchdog timeouts through the existing signed pytime helper after repeat/exit truth conversion. Preserve integer-protocol precedence, float-subclass handling, exception order, microsecond rounding, and native/C-long limits before file lookup.
  • Keep the watchdog's original deadline across condition-variable notifications instead of treating any wake as an expired timeout.
  • Add deterministic conversion probes and a notification regression test. Tiny positive timeout probes use an invalid descriptor and never start a watchdog; the successful keyword probe uses a long, immediately cancelled timeout.

This patch does not change signal callbacks or frame traversal. Existing watchdog max_threads, file-retention, and cancellation-joining gaps remain outside its scope. It adds no work to the VM execution loop.

Validation

  • Fresh Linux release build passed.
  • Affected time/signal snippets pass under both RustPython and CPython 3.15.1. The previous RustPython binary fails the new timeout-keyword regression.
  • Workspace Rust tests: 1,535 passed, 20 ignored. C-API tests: 149 passed, 2 ignored. Both strict all-target Clippy runs passed.
  • Full test_faulthandler, test_time, and test_signal passed: respectively 51/65/57 tests run and 11/19/25 skipped. The affected pytest snippet cases passed.
  • Full native snippet run: 242 passed, 6 failed. The same six failures reproduce with the previous binary: four AF_UNIX restrictions, one chown EINVAL in this executor, and the default build's missing SQLite feature. CPython 3.15.1 also reproduces the AF_UNIX and chown restrictions. This is not a full snippet pass.
  • Independent read-only review and normal commit hooks passed.
  • The final commit has the tested source tree. Windows and 32-bit runtime validation remain for hosted CI; no cross-platform runtime pass is claimed.

Reference

CPython 3.15.1 faulthandler implementation and Clinic wrappers.

AI assistance: OpenAI Codex assisted implementation, review, and validation. Both commits include an Assisted-by trailer.

@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Comment thread extra_tests/snippets/stdlib_time.py Outdated


# Faulthandler watchdogs use the same signed-nanosecond conversion as sleep.
import faulthandler

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is improper. do not add import faulthandler in stdlib_time. separate stdlib_faulthandler for this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Moved the timeout and register regression tests into stdlib_faulthandler.py in f88bd7d, leaving stdlib_time.py and stdlib_signal.py unchanged. The dedicated snippet passes on RustPython and CPython 3.15.1.

Use the shared signed PyTime conversion and platform bounds, accept timeout/signum keywords, and preserve the watchdog deadline across notifications. Add safe numeric-conversion and notification regression coverage.

Assisted-by: OpenAI Codex:model version not exposed
Keep the native-platform guard separate so the tests_outside_test_module Clippy lint recognizes the cfg(test) module.

Assisted-by: OpenAI Codex:model version not exposed
Move watchdog timeout and signal-registration probes into stdlib_faulthandler.py, preserving their assertions and guards. Keep the time and signal snippets focused on their own modules.

Assisted-by: OpenAI Codex:model version not exposed
@youknowdot
youknowdot force-pushed the fix/watchdog-timeouts-20261110 branch from 4669cb0 to 261911f Compare November 12, 2026 09:19
@codspeed

codspeed Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing youknowdot:fix/watchdog-timeouts-20261110 (261911f) with main (586d38a)

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@youknowone
youknowone marked this pull request as ready for review November 12, 2026 10:53
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-12T10:53:50.455389Z
We couldn’t complete this review. Comment @codex review to try again.
261911f Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@youknowone
youknowone merged commit e2abc4c into RustPython:main Nov 12, 2026
28 checks passed
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.

2 participants