Skip to content

Setting the managerResponseTimeout in the http-client-openssl is ignored #552

@TristanCacqueray

Description

@TristanCacqueray

Hello,

It looks like that setting the response timeout in the openssl manager does not work as expected.
We tried to increase the default timeout to 60 seconds, and we observed that when a server provides the response header, but not the data, then the client gets stuck waiting forever. We reproduced the issue using netcat that way:

  • Run nc -l -p 80 in another terminal
  • Call httpLbs manager =<< parseUrlThrow "http://localhost" in ghci
  • Submit fake response in nc like this:
[tristanc@fedora ~]$ nc -l -p 80                                                                                                                                                                                       
GET / HTTP/1.1                                                                                                                                                                                                       
Host: localhost                                                                                                                                                                                                      
Accept-Encoding: gzip                                                                                                                                                                                                
                                                                                                                                                                                                                     
HTTP/1.1 404 Not Found                                                                                                                                                                                               
Content-Type: text/html; charset=UTF-8                                                                                                                                                                               
Referrer-Policy: no-referrer                                                                                                                                                                                         
Content-Length: 1561                                                                                                                                                                                                 
Date: Fri, 07 Feb 2025 14:12:02 GMT    

When using the default openssl manager, then the httpRequest throws a timeout error after 30 seconds, as expected. But when using {managerResponseTimeout = responseTimeoutMicro 60000000}, then the httpRequest call gets stuck. This issue does not happen with the regular http-client manager.

Thankfully, using System.Timeout.timeout work around the issue. Here is our downstream bug with the details: change-metrics/monocle#1154

Would you know what's going on and where to look for finding this bug in http-client? I couldn't find any reference for "timeout" in http-client-openssl or HsOpenSSL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions