Skip to content

Fix: Prevent unhandled exceptions when processing empty SSE event payloads#214

Open
vazarkevych wants to merge 2 commits into
mainfrom
fix/empty-sse-event-payloads
Open

Fix: Prevent unhandled exceptions when processing empty SSE event payloads#214
vazarkevych wants to merge 2 commits into
mainfrom
fix/empty-sse-event-payloads

Conversation

@vazarkevych

Copy link
Copy Markdown
Collaborator

Fix: Empty SSE Event Payload Handling

Overview

This PR prevents unhandled exceptions when SSE events contain an empty or heartbeat payload.

Some SSE servers may send keepalive, heartbeat, ping, or empty data events. Previously, those payloads could still reach feature JSON parsing and fail when the payload was blank or invalid.

What Changed

  • Added SSE payload validation before feature payload processing.
  • Ignored empty and whitespace-only SSE payloads.
  • Ignored heartbeat-style SSE events: heartbeat, keepalive, and ping.
  • Caught parsing/runtime errors inside the async SSE listener so they do not escape as unhandled exceptions.
  • Updated native Java SSE handling to skip whitespace-only payloads.
  • Added tests for empty payloads, valid payloads, invalid payload handling, and heartbeat events.

@madhuchavva madhuchavva 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.

Native SSE validation path issue found.

@madhuchavva madhuchavva 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.

Requesting changes for the native SSE validation gap noted inline.

@vazarkevych vazarkevych requested a review from madhuchavva June 25, 2026 09:11
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.

2 participants