Skip to content

Fix MacOS torch multiprocessing permission issue#13709

Merged
glenn-jocher merged 3 commits intomasterfrom
torch-macos-ci
Apr 16, 2026
Merged

Fix MacOS torch multiprocessing permission issue#13709
glenn-jocher merged 3 commits intomasterfrom
torch-macos-ci

Conversation

@Y-T-G
Copy link
Copy Markdown
Contributor

@Y-T-G Y-T-G commented Feb 10, 2026

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

This PR improves macOS CI reliability in ultralytics/yolov5 by adding a security-policy workaround for PyTorch multiprocessing ✅🍎

📊 Key Changes

  • Added a new macOS-only step in the GitHub Actions workflow .github/workflows/ci-testing.yml.
  • The new step removes the Apple quarantine attribute from the installed PyTorch package using xattr.
  • It also makes PyTorch’s torch_shm_manager helper binary executable with chmod +x.
  • The change is placed before the existing environment check step, so CI runs with the fix already applied.

🎯 Purpose & Impact

  • Helps prevent intermittent PyTorch multiprocessing failures on macOS in CI 🛠️
  • Makes automated testing more stable and consistent for contributors using macOS runners.
  • Reduces flaky test failures that are caused by OS security restrictions rather than actual code issues.
  • Improves confidence in CI results, making it easier to catch real bugs and avoid wasted debugging time 🚀

Signed-off-by: Mohammed Yasin <32206511+Y-T-G@users.noreply.github.com>
@UltralyticsAssistant UltralyticsAssistant added bug Something isn't working devops GitHub Devops or MLops fixed Bug has been resolved labels Feb 10, 2026
@UltralyticsAssistant
Copy link
Copy Markdown
Member

👋 Hello @Y-T-G, thank you for submitting a ultralytics/yolov5 🚀 PR! This is an automated message, and an Ultralytics engineer will assist you shortly. 🧪🍎

-✅ Define a Purpose: Clearly explain the purpose of your fix or feature in your PR description, and link to any relevant issues. Ensure your commit messages are clear, concise, and adhere to the project's conventions.
-✅ Synchronize with Source: Confirm your PR is synchronized with the ultralytics/yolov5 main branch. If it's behind, update it by clicking the 'Update branch' button or by running git pull and git merge main locally.
-✅ Ensure CI Checks Pass: Verify all Ultralytics Continuous Integration (CI) checks are passing. If any checks fail, please address the issues.
-✅ Update Documentation: Update the relevant documentation for any new or modified features.
-✅ Add Tests: If applicable, include or update tests to cover your changes, and confirm that all tests are passing.
-✅ Sign the CLA: Please ensure you have signed our Contributor License Agreement if this is your first Ultralytics PR by writing "I have read the CLA Document and I sign the CLA" in a new message.
-✅ Minimize Changes: Limit your changes to the minimum necessary for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." — Bruce Lee

For more guidance, please refer to our Contributing Guide. Don't hesitate to leave a comment if you have any questions. Thank you for contributing to Ultralytics! 🚀

Copy link
Copy Markdown
Member

@UltralyticsAssistant UltralyticsAssistant left a comment

Choose a reason for hiding this comment

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

🔍 PR Review

Made with ❤️ by Ultralytics Actions

Overall clean change and well-scoped to macOS CI. One potential robustness issue: the new chmod (and import) can fail when torch_shm_manager isn’t present, which could break macOS runs.

💬 Posted 1 inline comment

Signed-off-by: Mohammed Yasin <32206511+Y-T-G@users.noreply.github.com>
Copy link
Copy Markdown
Member

@UltralyticsAssistant UltralyticsAssistant left a comment

Choose a reason for hiding this comment

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

🔍 PR Review 2

Made with ❤️ by Ultralytics Actions

Overall looks good and targeted to macOS CI stability. Only concern is making the chmod step resilient to torch builds that don’t include torch_shm_manager.

💬 Posted 1 inline comment

Comment thread .github/workflows/ci-testing.yml
@Y-T-G
Copy link
Copy Markdown
Contributor Author

Y-T-G commented Feb 10, 2026

@Laughing-q MacOS security blocks torch for some reason.

@glenn-jocher glenn-jocher merged commit 2f359bb into master Apr 16, 2026
6 of 8 checks passed
@glenn-jocher glenn-jocher deleted the torch-macos-ci branch April 16, 2026 13:49
@glenn-jocher
Copy link
Copy Markdown
Member

@Y-T-G just saw this one, merged!

@UltralyticsAssistant
Copy link
Copy Markdown
Member

🎉 Huge thanks to @Y-T-G for this excellent contribution, with support from @glenn-jocher on getting it across the finish line!

By adding this thoughtful macOS CI workaround for PyTorch multiprocessing, you’ve helped make testing in ultralytics/yolov5 more stable, more trustworthy, and a lot less frustrating for contributors. As Thomas Edison said, “Opportunity is missed by most people because it is dressed in overalls and looks like work.” This PR is a great example of the kind of behind-the-scenes improvement that may look small at first glance, but has a big impact on reliability and developer confidence.

Really appreciate the care and practical problem-solving here — merged improvements like this make the whole project stronger 🚀

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

Labels

bug Something isn't working devops GitHub Devops or MLops fixed Bug has been resolved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants