Pivotal Cloud Foundry® (PCF) all versions
Pushing an app fails with the following error when an external
Load Balancer is in use:
Error uploading application.
Error performing request: Put /v2/resource_match: net/http: request canceled
This can be caused by an external
Load Balancer having a short
TCP Idle Timeout and timing out the TCP connection between
CF CLI and the
When pushing an app, the
CF CLI has a mechanism to avoid uploading files which already exists in the
The follow steps are performed:
- Generated SHA1 hash for every file in the app directory.
- Sent the list of SHA1 hashes to the
/v2/resource_matchin a single HTTP request.
Example with 3 files:
Cloud Controllerthen checks if each of the files exist in the
Cloud Controllerthen returns a list of existing files to the
CF CLIwill only push the files which do not exist already.
If for example, the app contains 1000 files, then the
Cloud Controller must make 1000 requests to the
blobstore to check if each of the files exists. If the combined time for these requests is longer than the
TCP Idle Timeout, then the HTTP request to
/v2/resource_match will timeout and the
net/http: request canceled error will occur.
The Load Balancer should be reconfigured to increase the
TCP Idle Timeout. There is no recommended value. Each environment will be different depending on the size (number of files) of the apps and the response time of the blobstore. F5 Load Balancers, for example, have a default of
TCP Idle Timeout 300 seconds (5 minutes). So increasing it to 600 seconds (10 minutes) may be a good first step.
This parameter may have a different name and value in different load balancers. Please see the Load Balancer vendor's documentation for the specific parameters.
If reconfiguring the Load Balancer is not possible, then another option is to reduce the number of files in the app. For example, with a Java app, it may be possible to set up a local maven repository to store all the application dependencies and exclude dependencies from the JAR file.