Skip to content

Serialize destruction of the delegate #5996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

digantdesai
Copy link
Contributor

Summary:
When workspace sharing is enabled, if we call destroy() from multiple threads it is possible that we enter in xnn_delete_runtime from multiple threads. It is not safe to do so, and can cause double free. This serializes the destroy calls for the singleton backend object if/when called multiple times.

Not locking in the failure case because we may not have a real memory to free i.e. empty workspace?

Differential Revision: D63917052

Copy link

pytorch-bot bot commented Oct 8, 2024

🔗 Helpful Links

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

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

✅ No Failures

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

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

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported labels Oct 8, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D63917052

digantdesai added a commit to digantdesai/executorch-1 that referenced this pull request Oct 8, 2024
Summary:

When workspace sharing is enabled, if we call `destroy()` from multiple threads it is possible that we enter in `xnn_delete_runtime` from multiple threads. It is not safe to do so, and can cause double free. This serializes the destroy calls for the singleton backend object if/when called multiple times.

Not locking in the failure case because we may not have a real memory to free i.e. empty workspace?

Differential Revision: D63917052
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D63917052

digantdesai added a commit to digantdesai/executorch-1 that referenced this pull request Oct 8, 2024
Summary:

When workspace sharing is enabled, if we call `destroy()` from multiple threads it is possible that we enter in `xnn_delete_runtime` from multiple threads. It is not safe to do so, and can cause double free. This serializes the destroy calls for the singleton backend object if/when called multiple times.

Not locking in the failure case because we may not have a real memory to free i.e. empty workspace?

Differential Revision: D63917052
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D63917052

Summary:

When workspace sharing is enabled, if we call `destroy()` from multiple threads it is possible that we enter in `xnn_delete_runtime` from multiple threads. It is not safe to do so, and can cause double free. This serializes the destroy calls for the singleton backend object if/when called multiple times.

Not locking in the failure case because we may not have a real memory to free i.e. empty workspace?

Differential Revision: D63917052
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D63917052

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 566902b.

@digantdesai
Copy link
Contributor Author

@pytorchbot cherry-pick --onto release/0.4 -c regression

pytorchbot pushed a commit that referenced this pull request Oct 10, 2024
Summary:
Pull Request resolved: #5996

When workspace sharing is enabled, if we call `destroy()` from multiple threads it is possible that we enter in `xnn_delete_runtime` from multiple threads. It is not safe to do so, and can cause double free. This serializes the destroy calls for the singleton backend object if/when called multiple times.

Not locking in the failure case because we may not have a real memory to free i.e. empty workspace?

Reviewed By: digantdesai

Differential Revision: D63917052

fbshipit-source-id: 61e6b1c54f887a54501a4fd3433f8470e74dbca3
(cherry picked from commit 566902b)
@pytorchbot
Copy link
Collaborator

Cherry picking #5996

The cherry pick PR is at #6111 and it is recommended to link a regression cherry pick PR with an issue. The following tracker issues are updated:

Details for Dev Infra team Raised by workflow job

jackzhxng pushed a commit that referenced this pull request Oct 10, 2024
Serialize destruction of the delegate (#5996)

Summary:
Pull Request resolved: #5996

When workspace sharing is enabled, if we call `destroy()` from multiple threads it is possible that we enter in `xnn_delete_runtime` from multiple threads. It is not safe to do so, and can cause double free. This serializes the destroy calls for the singleton backend object if/when called multiple times.

Not locking in the failure case because we may not have a real memory to free i.e. empty workspace?

Reviewed By: digantdesai

Differential Revision: D63917052

fbshipit-source-id: 61e6b1c54f887a54501a4fd3433f8470e74dbca3
(cherry picked from commit 566902b)

Co-authored-by: Gregory Comer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants