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.

chore(mysql): guard that 1135 thread-exhaustion stays retryable (#63780)

Tom Owersbefe17e6651a
diff --git a/posthog/temporal/data_imports/sources/mysql/tests/test_mysql.py b/posthog/temporal/data_imports/sources/mysql/tests/test_mysql.py
index c05354445bf1..dd7f1f3ba77a 100644
--- a/posthog/temporal/data_imports/sources/mysql/tests/test_mysql.py
+++ b/posthog/temporal/data_imports/sources/mysql/tests/test_mysql.py
@@ -806,3 +806,21 @@ class TestMySQLSourceNonRetryableErrors:
non_retryable = source.get_non_retryable_errors()
is_non_retryable = any(pattern in error_msg for pattern in non_retryable.keys())
assert not is_non_retryable, f"Transient lost-connection error should remain retryable: {error_msg}"
+
+ @pytest.mark.parametrize(
+ "error_msg",
+ [
+ # MySQL error 1135: the server reached the connection but couldn't spawn an OS thread
+ # to service it (errno 11 EAGAIN). This is a transient, server-side resource exhaustion
+ # — it clears as concurrent connections close — so it must keep retrying, just like
+ # Postgres's "too many connections" / "max clients reached" capacity errors.
+ "OperationalError: (1135, 'Can't create a new thread (errno 11 \"Resource temporarily "
+ 'unavailable"); if you are not out of available memory, you can consult the manual for '
+ "a possible OS-dependent bug')",
+ 'Can\'t create a new thread (errno 11 "Resource temporarily unavailable")',
+ ],
+ )
+ def test_cant_create_new_thread_stays_retryable(self, source, error_msg):
+ non_retryable = source.get_non_retryable_errors()
+ is_non_retryable = any(pattern in error_msg for pattern in non_retryable.keys())
+ assert not is_non_retryable, f"Transient thread-exhaustion error should remain retryable: {error_msg}"