Skip to content

Fix process crash on empty or non-string packet in HTTP onPacketReadySerializeImpl - #4715

Open
gaurav-singh2525 wants to merge 1 commit into
openvinotoolkit:mainfrom
gaurav-singh2525:fix-http-mediapipe-packet-serialization
Open

gaurav-singh2525 wants to merge 1 commit into
openvinotoolkit:mainfrom
gaurav-singh2525:fix-http-mediapipe-packet-serialization

Conversation

@gaurav-singh2525

@gaurav-singh2525 gaurav-singh2525 commented Oct 30, 2026 •

Copy link
Copy Markdown

🛠 Summary

Issue: Fixes #4714

Problem

In src/http_frontend/http_graph_executor_impl.cpp, onPacketReadySerializeImpl() called packet.Get<std::string>() directly without checking !packet.IsEmpty() or validating the stored type. This triggered MediaPipe's internal ABSL_CHECK assertions, resulting in a fatal SIGABRT crash on empty or non-string packets.

Solution

  1. Added packet.IsEmpty() validation: Safely clears the response and returns StatusCode::OK when empty/control packets arrive.
  2. Added packet.ValidateAsType<std::string>().ok() validation: Safely returns StatusCode::MEDIAPIPE_EXECUTION_ERROR on type mismatch instead of triggering an uncatchable assertion abort.
  3. Added #include "../logging.hpp": Provides proper debug and error logging when invalid packets are received.
  4. Added Unit Tests: Added HttpMediapipeSerialization test suite in src/test/mediapipeflow_test.cpp verifying valid string extraction, empty packet handling, and error handling on incompatible types

🧪 Checklist

  • Unit tests added.
  • The documentation updated.
  • Change follows security best practices.

@dtrawins
dtrawins requested review from atobiszei and a balanced review from Copilot October 30, 2026 15:53

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.

🟢 Approval recommended

No active review issues remain for the HTTP packet-serialization safeguards.

No open issues 🎉

What changed in this PR

Addresses #4714 by guarding HTTP MediaPipe packet serialization against empty and non-string payloads, preventing fatal assertions during string extraction.

Changes:

  • Clears the response and returns success for empty packets.
  • Logs type mismatches and returns MEDIAPIPE_EXECUTION_ERROR for non-string packets.
  • Adds unit tests covering valid strings, empty packets, and incompatible payload types.
File Description
src/​test/​mediapipeflow_test.cpp Adds three tests for HTTP packet serialization behavior.
src/​http_frontend/​http_graph_executor_impl.cpp Validates packets before string extraction and adds diagnostic logging.

Review effort: Balanced

@gaurav-singh2525
gaurav-singh2525 force-pushed the fix-http-mediapipe-packet-serialization branch from c243d47 to 8b0ad84 Compare October 30, 2026 17:59
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.

[Bug]: Process crash (SIGABRT) in onPacketReadySerializeImpl when handling empty or non-string MediaPipe packets

2 participants