Skip to content

Stream result is broken. #994

@phadej

Description

@phadej

Because of the way things are engineered now, the connection is closed to early:

% cabal new-run servant-machines:example client 10 -- +RTS -s
Up to date
example: HttpExceptionRequest Request {
  host                 = "localhost"
  port                 = 8000
  secure               = False
  requestHeaders       = [("Accept","application/json;charset=utf-8")]
  path                 = "/get/10"
  queryString          = ""
  method               = "GET"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
}
 ConnectionClosed
       1,096,000 bytes allocated in the heap
           5,376 bytes copied during GC
          75,048 bytes maximum residency (1 sample(s))
          19,160 bytes maximum slop
               2 MB total memory in use (0 MB lost due to fragmentation)

See #991 for PoC.


My first thought is to re-engineer stream clients so it's user responsibility to remember to perform cleanup. Maybe we can add a finalizer on the response body stream to make it less error-prone. My logic: if you need more power (streaming), you'll have more responsibilities too.


EDIT: I run into various issues while working on #841 related to streaming, I'd try to tackle them separately, but there might be a big knot to untie.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions