Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(data-imports): classify a bare botocore connection error as transient (#102596)

Tom Owers6c2362c0d54f
diff --git a/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/delta/errors.py b/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/delta/errors.py
index 8d4f8944904e..c16ca57c62a3 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/delta/errors.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/delta/errors.py
@@ -50,6 +50,13 @@ def is_transient_object_store_error(error: BaseException) -> bool:
match), but hitting our own instance-role-authenticated bucket always means the same transient
resolution hiccup, so it's recognized by type rather than by message.
+ `boto3`'s own client calls (e.g. `ensure_bucket_exists`'s `head_bucket`) can likewise raise a bare
+ `botocore.exceptions.ConnectionError` — `EndpointConnectionError` (DNS not resolvable yet, or the
+ endpoint refusing connections) and its siblings — when our own bucket endpoint isn't reachable
+ yet, most commonly a local/self-hosted object store still bootstrapping. Never an `OSError`
+ subclass, so the message-matched branch below never sees it; recognized by type for the same
+ reason as `NoCredentialsError`.
+
A bare `OSError` with errno `EMFILE`/`ENFILE` means this worker's (or the system's) file
descriptor table is full — e.g. `aget_s3_client`'s aiobotocore session bootstrap opening
botocore's own bundled `endpoints.json` fails with this errno before any network call is even
@@ -57,7 +64,9 @@ def is_transient_object_store_error(error: BaseException) -> bool:
(`_is_too_many_open_files_error`): a descriptor frees the moment another connection/client in
this worker closes, so it's fd pressure on our side, never an object-store or customer problem.
"""
- if isinstance(error, TransientObjectStoreError | botocore.exceptions.NoCredentialsError):
+ if isinstance(
+ error, TransientObjectStoreError | botocore.exceptions.NoCredentialsError | botocore.exceptions.ConnectionError
+ ):
# Already classified and wrapped by a prior call to this same function (see
# `_capture_unless_transient`) — a caller further up the stack that catches broadly and
# re-runs this classifier on the wrapper, rather than the original OSError/DeltaError it
diff --git a/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/delta/test/test_delta_errors.py b/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/delta/test/test_delta_errors.py
index 0df65763835b..ef11f0dc66fa 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/delta/test/test_delta_errors.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/pipelines/core/delta/test/test_delta_errors.py
@@ -51,6 +51,14 @@ class TestIsTransientObjectStoreError:
botocore.exceptions.NoCredentialsError(),
True,
),
+ (
+ # A bare botocore connection failure reaching our own bucket endpoint (e.g.
+ # `ensure_bucket_exists`'s `head_bucket` hitting a still-booting local object store) —
+ # never an OSError subclass, so only the type check catches it.
+ "bare_endpoint_connection_error",
+ botocore.exceptions.EndpointConnectionError(endpoint_url="http://objectstorage:19000/data-warehouse"),
+ True,
+ ),
(
# aiobotocore's session bootstrap (e.g. inside `aget_s3_client`) opens botocore's own
# bundled endpoints.json before any network call is made - a full fd table fails that