Fixed webnn test crash issue#34708
Open
sgbihu wants to merge 3 commits intoopenvinotoolkit:masterfrom
Open
Conversation
Contributor
Author
|
Who can help take a look at the CI issue? It success at Jekins CI . But it failed in github workflow. |
Contributor
There was a problem hiding this comment.
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&) constwith a newvirtual 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_fromoverride to construct/assignstd::stringin 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); |
praasz
approved these changes
Mar 16, 2026
Co-authored-by: Pawel Raasz <pawel.raasz@intel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Details:
read_tolocated atopenvino.dll. All other plugin call theread_tomethod to construct a string will allocate the memory inopenvino.dllonnxruntime_providers_openvino_plugin_impl.dll's new feature will convertfloatmap tostd::string. ThefloatmapAnyobject was created atopenvino_intel_npu_plugin.dll. So the_implinAnyisopenvino_intel_npu_plugin's type._tempisonnxruntime_providers_openvino_plugin_impl'sstringtype. Then theAny's dtor will call theonnxruntime_providers_openvino_plugin_impl'sstringdtor. That caused the memory issue.Solution:
read_fromand let the copy call the real type's method. In this way, it can call theonnxruntime_providers_openvino_plugin_impl's ctor and dtor.Tickets:
AI Assistance: