connect icon indicating copy to clipboard operation
connect copied to clipboard

Corrupt messages on streaming http_client disconnect

Open nicktelford opened this issue 3 years ago • 2 comments

When in streaming mode, a if an http_client input is disconnected prematurely, it's possible that a prematurely truncated message will be processed.

Since in HTTP streams messages are either explicitly delimited by MIME multi-part headers, or by new-lines, it should be possible to detect when a message has been prematurely closed and prevent it from being processed in the downstream pipeline.

nicktelford avatar Oct 20 '21 12:10 nicktelford

Will need a big of digging but this is probably going to need to be an option on the codec type, where on EOF we discard partial data rather than flush it.

Jeffail avatar Oct 20 '21 13:10 Jeffail

We are seeing this again. This time we compared this benthos configuration with curl and curl keeps up while benthos http client stream bails with ERRO Failed to read message: unexpected EOF

Of all the streams we have targeting the same system with the same configuration, the one that is failing is the one with the the lowest volume.

input:
  label: ""
  http_client:
        url: https://hostname
        verb: GET
        headers:
          Content-Type: application/json
        stream:
          enabled: true
        basic_auth:
            enabled: true
            username: ********
            password: ********

garbelini avatar Sep 22 '22 09:09 garbelini