Skip to content

Deadlock when trying to enable data streaming #5117

@daijithegeek

Description

@daijithegeek

Hello,

I'm trying to use the Jersey streaming abilities by leveraging a StreamingOutput within a response.
The goal is to transfer a large file to a client leveraging the existing stack.

I spotted the two following issues while trying to do so:

  1. The JettyConnector readTimeout configuration is misleading. The PR Change JettyConnector 'readTimeout' behavior to match socket read tim… #5114 should fix the problem.
  2. When using async() to consume the streamed data, the Jetty connector buffers every byte in-memory before calling back the Jersey stack.

I need your opinion, especially on the second matter.
I tried to move the callback, and future completion right after the headers are received; that should work in theory, as all the necessary information is available at that point.
It worked well until I spotted an unexpected deadlock while using a regular endpoint (not streaming data) returning a JSON payload.

I provided an example of my use cases in the following PR: #5116
The test class contains both a streaming example and the deadlock example.

I believe that both use cases are valid. Can you help me to sort out this situation?
I was not able to find an escape hatch by myself, unfortunately.

Thanks a lot for your help!
David

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions