Skip to content

Fix structure of EpLibraryPlugin::Load so that we call Unload on error. - #29634

Merged
Scott McKay (skottmckay) merged 7 commits into
mainfrom
skottmckay/FixCleanupOnPluginEpLibraryLoadFailure
Jul 17, 2026
Merged

Fix structure of EpLibraryPlugin::Load so that we call Unload on error.#29634
Scott McKay (skottmckay) merged 7 commits into
mainfrom
skottmckay/FixCleanupOnPluginEpLibraryLoadFailure

Conversation

@skottmckay

Copy link
Copy Markdown
Contributor

Description

Fix structure of EpLibraryPlugin::Load so that we call Unload on any error and not just an exception.
Currently we directly return on error so the Unload is never hit.

Motivation and Context

Cleanup failed load fully.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR restructures EpLibraryPlugin::Load() to ensure that a partially loaded EP plugin library is cleaned up on any failure (returned error Status as well as exceptions), instead of only on exceptions.

Changes:

  • Wraps the library load sequence in an inner lambda so ORT_RETURN_IF_ERROR produces an error Status without returning from Load().
  • Adds a unified failure-path cleanup block intended to call Unload() on any non-OK status.

Comment thread onnxruntime/core/session/plugin_ep/ep_library_plugin.cc

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@skottmckay
Scott McKay (skottmckay) enabled auto-merge (squash) July 9, 2026 22:00
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.

3 participants