From 43ca512ac53d8a7d2a27291cc1457b2677cfc9a1 Mon Sep 17 00:00:00 2001 From: Jan Gutter Date: Wed, 13 Aug 2025 11:45:52 +0100 Subject: [PATCH] Raise connection pool for boto3 in s3 upload role * In our environment we noticed a lot of these kinds of warnings: WARNING:urllib3.connectionpool:Connection pool is full, discarding connection: s3.example.com * The maximum concurrent threads can easily overwhelm the default connection pool limit, leading to discarded connections in boto3. * This scales the connection pool with the threads to avoid the problem. Change-Id: I96db0c5bb0ef49a1ec20f934ae58e7fd6809fc79 --- roles/upload-logs-base/library/zuul_s3_upload.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/roles/upload-logs-base/library/zuul_s3_upload.py b/roles/upload-logs-base/library/zuul_s3_upload.py index 87b57e48d..5f2814941 100755 --- a/roles/upload-logs-base/library/zuul_s3_upload.py +++ b/roles/upload-logs-base/library/zuul_s3_upload.py @@ -38,6 +38,7 @@ import sys import threading import boto3 +import botocore from ansible.module_utils.basic import AnsibleModule try: @@ -81,7 +82,13 @@ class Uploader(): self.url = os.path.join(return_endpoint, self.prefix) + # The default for max_pool_connections is 10, which is easily + # exhausted if the upload threads overwhelm them. + client_config = botocore.config.Config( + max_pool_connections=MAX_UPLOAD_THREADS * 4) + self.s3 = boto3.resource('s3', + config=client_config, endpoint_url=self.endpoint, aws_access_key_id=aws_access_key, aws_secret_access_key=aws_secret_key)