Skip to content

Faulty request HttpContent might causes a hang in expect 100 Continue scenario #36717

@ManickaP

Description

@ManickaP

Concerns only HTTP/1.1, both sync and async scenarios and only if the server does not reply with 100 Continue status line.

The client sends headers with Expect: 100-continue and starts a expect100Timer. Because the server doesn't send 100 Continue, the timer expires and starts sending the request content. If the content is faulty (e.g. throwing NSE in sync scenario due to missing sync override), no request body is sent and the server might never reply. As a result, HttpConnection keeps waiting for the status line indefinitely. If there's a request timeout and the connection gets torn down, the original exception from the faulty HttpContent gets lost. This might cause serious issues while trying to troubleshoot this problem.

Note that this is rather corner case scenario: faulty custom HttpContent + Expect: 100-continue + server not replying at all without a request body.

Possible fixes:

  • Similar to HTTP/2 behavior, i.e.: using WaitAny. Although this might prove challenging in the sync scenario where the status line parsing is synchronous. It would have to be reverted back to async for the Expect: 100 case.
  • Similar to cancellation, i.e.: tearing down the connection if the expect100Timer expired and HttpContent sending failed. However the exception from the sendRequestContentTask should be picked up in the final exception handling.

cc: @scalablecory @stephentoub

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions