eclipse-ee4j / eclipse-ee4j/jersey

Compression interferes with SSE events

Open
#3,809 2 comments 1 reaction 0 assignees View on GitHub
Config
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

If a compression content encoder (such as GZipEncoder) is registered and the client requests a supported compression when making an SSE GET request then the client (apparently) does not receive events although the server has sent them.

The effect is caused by the compression encoder buffering data before writing output to the client. Although the server issues OutputStream#flush after writing the event, this does _not_ trigger sending the outstanding data.

Note that there is a flag (`syncFlush`) that would support sending outstanding data on flush; however, it is currently not possible to specify this flag. Moreover, setting the flag would affect all responses, including those targeting non-SSE endpoints. The syncFlush flag (potentially) has a detrimental effect on the compression ratio. Therefore, syncFlush should be enabled for SSE responses.

Contributor guide

Open the contributing guide

Research direction

Start by tracing SSE GET response handling alongside GZipEncoder and the OutputStream#flush path, then inspect how the syncFlush option is configured. Done means compressed SSE clients receive events promptly while non-SSE responses retain their existing compression behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.