Skip to content

Fixed webnn test crash issue#34708

Open
sgbihu wants to merge 3 commits intoopenvinotoolkit:masterfrom
sgbihu:webnn_crashed
Open

Fixed webnn test crash issue#34708
sgbihu wants to merge 3 commits intoopenvinotoolkit:masterfrom
sgbihu:webnn_crashed

Conversation

@sgbihu
Copy link
Contributor

@sgbihu sgbihu commented Mar 15, 2026

Details:

  • In the debugger, I found the read_to located at openvino.dll. All other plugin call the read_to method to construct a string will allocate the memory in openvino.dll
  • The onnxruntime_providers_openvino_plugin_impl.dll's new feature will convert float map to std::string. The float map Any object was created at openvino_intel_npu_plugin.dll. So the _impl in Any is openvino_intel_npu_plugin's type. _temp is onnxruntime_providers_openvino_plugin_impl's string type. Then the Any's dtor will call the onnxruntime_providers_openvino_plugin_impl's string dtor. That caused the memory issue.

Solution:

  • Create a virtual method read_from and let the copy call the real type's method. In this way, it can call the onnxruntime_providers_openvino_plugin_impl's ctor and dtor.

Tickets:

AI Assistance:

  • AI assistance used: no / yes
  • If yes, summarize how AI was used and what human validation was performed (build/tests/manual checks).

@sgbihu sgbihu requested a review from a team as a code owner March 15, 2026 15:29
@github-actions github-actions bot added category: Core OpenVINO Core (aka ngraph) category: CPP API OpenVINO CPP API bindings labels Mar 15, 2026
@sgbihu
Copy link
Contributor Author

sgbihu commented Mar 16, 2026

Who can help take a look at the CI issue? It success at Jekins CI . But it failed in github workflow.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a cross-DLL lifetime/memory issue triggered by ov::Any string conversions (observed as a WebNN test crash), by ensuring the “convert-to-string via stream” path runs in the destination module rather than inside openvino.dll.

Changes:

  • Replaces Any::Base::read_to(Base&) const with a new virtual Base::read_from(const Base&) direction (destination reads from source).
  • Updates Any::as<>() conversion paths to call _temp->read_from(*_impl) so the destination type’s implementation is used.
  • Adds a Impl<std::string>::read_from override to construct/assign std::string in the destination module.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/core/src/any.cpp Implements Any::Base::read_from to stream-print from the source and read into the destination.
src/core/include/openvino/core/any.hpp Exposes new virtual read_from, overrides it for std::string, and updates as<>() conversion call sites.

virtual void print(std::ostream& os) const = 0;
virtual void read(std::istream& os) = 0;
void read_to(Base& other) const;
virtual void read_from(const Base& other);
sgbihu and others added 3 commits March 16, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: Core OpenVINO Core (aka ngraph) category: CPP API OpenVINO CPP API bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants