Skip to content

Conversation

@GregoryComer
Copy link
Member

Summary: This is an attempt to partially mitigate use after free crashes when a module is unloaded during inference. This is not a supported use pattern, but it doesn't to sanity check here to avoid a crash.

Differential Revision: D71968421

@pytorch-bot
Copy link

pytorch-bot bot commented Mar 27, 2025

🔗 Helpful Links

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

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

❌ 1 New Failure

As of commit e133b68 with merge base 5098808 (image):

NEW FAILURE - The following job has failed:

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

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 27, 2025
@facebook-github-bot
Copy link
Contributor

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

Summary: This is an attempt to partially mitigate use after free crashes when a module is unloaded during inference. This is not a supported use pattern, but it doesn't to sanity check here to avoid a crash in certain low memory shutdown scenarios.

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

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

auto& method = methods_.at(method_name).method;
auto& inputs = methods_.at(method_name).inputs;

ET_CHECK_OR_RETURN_ERROR(method != nullptr, InvalidArgument, "Method is null");
Copy link
Contributor

Choose a reason for hiding this comment

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

Trying to wrap my head how it could be possible at all that a unique_ptr held in an unordered_map would ever become nullptr after being once initialized in the past?
It's guaranteed the pointer isn't null by the time this code runs due to load_method() calls, then even if the Module used after deallocation, no code (like destructors) ever nullifies its members, so if the method is found in the dict, it wouldn't be nullptr.

@github-actions
Copy link

Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as Stale.
Feel free to remove the Stale label if you feel this was a mistake.
If you are unable to remove the Stale label please contact a maintainer in order to do so.
If you want the bot to never mark this PR stale again, add the no-stale label.
Stale pull requests will automatically be closed after 30 days of inactivity.

@github-actions github-actions bot added the stale PRs inactive for over 60 days label Aug 31, 2025
@github-actions
Copy link

Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as Stale.
Feel free to remove the Stale label if you feel this was a mistake.
If you are unable to remove the Stale label please contact a maintainer in order to do so.
If you want the bot to never mark this PR stale again, add the no-stale label.
Stale pull requests will automatically be closed after 30 days of inactivity.

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 stale PRs inactive for over 60 days topic: not user facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants