Skip to content

Guard regression data runner against multiprocessing re-entry - #9195

Draft
youknowdot wants to merge 1 commit into
RustPython:mainfrom
youknowdot:fix/jsontests-main-guard
Draft

youknowdot wants to merge 1 commit into
RustPython:mainfrom
youknowdot:fix/jsontests-main-guard

Conversation

@youknowdot

@youknowdot youknowdot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Put regression-data discovery, suite execution and result-file replacement behind main() and the normal __main__ guard. Keep the existing test order, runner settings, output and helper unchanged.

multiprocessing spawn/forkserver reconstructs the parent script as __mp_main__. The old top-level script therefore starts the entire regression suite again in a worker. Both main's October 17 periodic job and the Python 3.15 mega job show the parallel compileall case followed by a second complete test run and a nested “Done!” before returning to compileall errors.

This removes that confirmed entrypoint defect. It does not establish that the later PTY hang is resolved: the logs contain no blocking stack or SIGUSR1 sender, and the same mega head passes test_pty in ordinary regrtest CI. No skips, test assertions or workflow changes.

Validation

  • Based on main e7e3dfd6; only extra_tests/jsontests.py changes.
  • AST comparison confirms the normal execution statements retain their original order/content, and the helper is unchanged.
  • A bounded host-Python subprocess with fake discovery, loader, runner and file operations confirms identical old/new normal execution, ordering, settings and output. New ordinary import and __mp_main__ perform zero discovery, suite execution or result-file operations. The old __mp_main__ negative control reproduces the recursive execution.
  • Normal repository commit hooks passed.
  • Exact-head hosted CI completed successfully: 13 checks passed and 8 conditional checks were skipped, including successful Ubuntu, macOS and Windows Python jobs.
  • No local native build, real regression suite, multiprocessing/PTY, socket or tracing execution is claimed. Native/Cargo sources are unchanged; main's existing completed CI is historical baseline evidence only.

The periodic workflow's PR trigger is limited to its own workflow path, so ordinary CI on this single-file fix does not validate a complete periodic collection run.

AI assistance

Maintainer-requested Python 3.15/CI maintenance. OpenAI Codex assisted with log/source analysis, this entrypoint change, mocked validation and the description. Model version unavailable; the commit includes the Assisted-by trailer. No additional manual human testing is claimed.

Run discovery and result writing only from the script entrypoint. Spawn and forkserver imports as __mp_main__ must not recursively execute the complete test suite or remove the parent result file.

Assisted-by: OpenAI Codex: model version unavailable
@coderabbitai

coderabbitai Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • 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 @coderabbitai help to get the list of available commands.

@codspeed

codspeed Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing youknowdot:fix/jsontests-main-guard (74f3aaa) with main (e7e3dfd)

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. ↩

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