Skip to content

Conversation

@xuhancn
Copy link
Collaborator

@xuhancn xuhancn commented Sep 12, 2025

When I debug AOTI UT: TestAOTInductorPackage_cpu::test_add. I found it didn't output the verbose error code, when PyTorchStreamWriter open failed.

This PR add the verbose error code output for debug. Local test shows as below:
image

The error code is 32, we can check the Windows error code 32 at https://learn.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-

ERROR_SHARING_VIOLATION
32 (0x20)
The process cannot access the file because it is being used by another process.

This issue is caused by the file is opened by another process. I fixed same issue in zip open as PR: #162617 But still no idea how to open file with shared access in std::ofstream. I will continue to researching it.

cc @peterjc123 @mszhanyi @skyline75489 @nbcsm @iremyux @Blackhex @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10

@xuhancn xuhancn added module: windows Windows support for PyTorch ciflow/trunk Trigger trunk jobs on your pull request topic: not user facing topic category intel This tag is for PR from Intel labels Sep 12, 2025
@pytorch-bot
Copy link

pytorch-bot bot commented Sep 12, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/162799

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit d6f4d81 with merge base 75de5b6 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@xuhancn
Copy link
Collaborator Author

xuhancn commented Sep 12, 2025

@pytorchbot rebase

@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot
Copy link
Collaborator

Successfully rebased xu_fix_PyTorchStreamWriter_open_failed_on_Windows onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout xu_fix_PyTorchStreamWriter_open_failed_on_Windows && git pull --rebase)

@pytorchmergebot pytorchmergebot force-pushed the xu_fix_PyTorchStreamWriter_open_failed_on_Windows branch from 2602650 to 7f8c31d Compare September 12, 2025 11:45
@xuhancn xuhancn marked this pull request as ready for review September 12, 2025 12:15
struct stat st;
bool dir_exists =
(stat(dir_name.c_str(), &st) == 0 && (st.st_mode & S_IFDIR));
TORCH_CHECK(
Copy link
Collaborator

Choose a reason for hiding this comment

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

We have to have a TORCH_CHECK_IO wrapper or wrapper for file not found error. Should be pretty easy to bind to exception type too

Copy link
Collaborator Author

@xuhancn xuhancn Sep 12, 2025

Choose a reason for hiding this comment

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

Hi @Skylion007 these code is existing code, I just move its place to pass the failed UTs: https://github.com/pytorch/pytorch/actions/runs/17673500150/job/50232301673

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fair, we should fix in subsequent PR

@xuhancn xuhancn requested a review from Skylion007 September 12, 2025 16:37
@mikaylagawarecki mikaylagawarecki removed their request for review September 12, 2025 22:51
@xuhancn
Copy link
Collaborator Author

xuhancn commented Sep 13, 2025

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@xuhancn xuhancn deleted the xu_fix_PyTorchStreamWriter_open_failed_on_Windows branch September 13, 2025 01:42
markc-614 pushed a commit to markc-614/pytorch that referenced this pull request Sep 17, 2025
…ytorch#162799)

When I debug AOTI UT: `TestAOTInductorPackage_cpu::test_add`.  I found it didn't output the verbose error code, when PyTorchStreamWriter open failed.

This PR add the verbose error code output for debug. Local test shows as below:
<img width="1124" height="653" alt="image" src="https://github.com/user-attachments/assets/01cb1a51-2982-4106-8b5b-c608ac26a075" />

The error code is 32, we can check the Windows error code 32 at https://learn.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-
```
ERROR_SHARING_VIOLATION
32 (0x20)
The process cannot access the file because it is being used by another process.
```

This issue is caused by the file is opened by another process. I fixed same issue in zip open as PR: pytorch#162617 But still no idea how to open file with shared access in `std::ofstream`. I will continue to researching it.

Pull Request resolved: pytorch#162799
Approved by: https://github.com/jansel
mansiag05 pushed a commit to mansiag05/pytorch that referenced this pull request Sep 22, 2025
…ytorch#162799)

When I debug AOTI UT: `TestAOTInductorPackage_cpu::test_add`.  I found it didn't output the verbose error code, when PyTorchStreamWriter open failed.

This PR add the verbose error code output for debug. Local test shows as below:
<img width="1124" height="653" alt="image" src="https://github.com/user-attachments/assets/01cb1a51-2982-4106-8b5b-c608ac26a075" />

The error code is 32, we can check the Windows error code 32 at https://learn.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-
```
ERROR_SHARING_VIOLATION
32 (0x20)
The process cannot access the file because it is being used by another process.
```

This issue is caused by the file is opened by another process. I fixed same issue in zip open as PR: pytorch#162617 But still no idea how to open file with shared access in `std::ofstream`. I will continue to researching it.

Pull Request resolved: pytorch#162799
Approved by: https://github.com/jansel
cleonard530 pushed a commit to cleonard530/pytorch that referenced this pull request Sep 22, 2025
…ytorch#162799)

When I debug AOTI UT: `TestAOTInductorPackage_cpu::test_add`.  I found it didn't output the verbose error code, when PyTorchStreamWriter open failed.

This PR add the verbose error code output for debug. Local test shows as below:
<img width="1124" height="653" alt="image" src="https://github.com/user-attachments/assets/01cb1a51-2982-4106-8b5b-c608ac26a075" />

The error code is 32, we can check the Windows error code 32 at https://learn.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-
```
ERROR_SHARING_VIOLATION
32 (0x20)
The process cannot access the file because it is being used by another process.
```

This issue is caused by the file is opened by another process. I fixed same issue in zip open as PR: pytorch#162617 But still no idea how to open file with shared access in `std::ofstream`. I will continue to researching it.

Pull Request resolved: pytorch#162799
Approved by: https://github.com/jansel
dsashidh pushed a commit to dsashidh/pytorch that referenced this pull request Sep 26, 2025
…ytorch#162799)

When I debug AOTI UT: `TestAOTInductorPackage_cpu::test_add`.  I found it didn't output the verbose error code, when PyTorchStreamWriter open failed.

This PR add the verbose error code output for debug. Local test shows as below:
<img width="1124" height="653" alt="image" src="https://github.com/user-attachments/assets/01cb1a51-2982-4106-8b5b-c608ac26a075" />

The error code is 32, we can check the Windows error code 32 at https://learn.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-
```
ERROR_SHARING_VIOLATION
32 (0x20)
The process cannot access the file because it is being used by another process.
```

This issue is caused by the file is opened by another process. I fixed same issue in zip open as PR: pytorch#162617 But still no idea how to open file with shared access in `std::ofstream`. I will continue to researching it.

Pull Request resolved: pytorch#162799
Approved by: https://github.com/jansel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request intel This tag is for PR from Intel Merged module: windows Windows support for PyTorch open source topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants