A connection timeout error occurs when attempting to make an outbound request (e.g., via an HTTP Requestor) from a Mule application. This error can manifest in several ways:
The underlying behavior observed at the network level is that the three-way TCP handshake completes successfully, but the client application (Mule) fails to send the next expected data packet, such as the ClientHello to initiate the TLS handshake. Due to this delay, the remote server or an intermediary network device closes the idle connection, resulting in a timeout.
This issue is most common when processing large payloads.
The primary cause of this delay is the use of deferred execution in a DataWeave transformation (deferred=true) immediately before the connector making the network call (e.g., HTTP Requestor).
When deferred=true is used, the execution of the DataWeave script is postponed until the payload is actively consumed by the subsequent component. The process is as follows:
This latency between the TCP connection establishment and the sending of the first application data bytes can exceed the remote server's timeout threshold, causing it to close the connection prematurely.
There are two main solutions to resolve this issue. The choice depends on your application's requirements and memory handling capabilities.
This forces the DataWeave transformation to complete before the HTTP Requestor begins its execution. This ensures the payload is fully ready at the moment the connection is established.
Configure the HTTP Requestor to not use streaming transfer mode. This causes the connector to wait for the entire payload to become available and load it into memory before sending the request. Like the first option, this resolves the latency.
005135165