Cloud Manager code quality · Java code rules (SonarQube) · updated
CQRules:ConnectionTimeoutMechanism: HTTP requests should always have socket and connect timeouts
CQRules:ConnectionTimeoutMechanism flags outbound HTTP calls from AEM that have no connect or socket timeout. Set both, for example 5,000 ms each as in Adobe's compliant example, on every HttpClient or URLConnection you create.
| Rule key | CQRules:ConnectionTimeoutMechanism |
|---|---|
| Adobe's rule name | HTTP requests should always have socket and connect timeouts |
| Type | Bug |
| Severity | Critical |
| Since | 2018.6.0 |
| Checked by | SonarQube analysis of your Java code |
Why Cloud Manager flags it
Without a timeout, a request to a slow or dead backend waits forever. In AEM that request usually runs on a Sling request thread or a job thread, so a single stuck API can exhaust the thread pool and take the publish tier down while CPU looks idle. On AEM as a Cloud Service the risk is higher because egress often goes through advanced networking (a dedicated egress IP or VPN), where dropped connections are more common than on a LAN.
Adobe's non-compliant example builds a client from HttpClientBuilderFactory and opens a URLConnection with no limits. The compliant version sets a 5,000 ms connect and socket timeout through RequestConfig and calls setConnectTimeout and setReadTimeout on the URLConnection.
Choosing the numbers
| Call type | Connect timeout | Socket (read) timeout |
|---|---|---|
| Page render calls an API | 1–2 s | 2–5 s, with a cached fallback |
| Background job or import | 5 s | 30–60 s |
| Health check of a dependency | 1 s | 2 s |
These are starting points from our own projects, not Adobe values. What matters for the rule is that both timeouts are set explicitly.
Example
Non-compliant
CloseableHttpClient client = httpClientBuilderFactory.newBuilder().build();
HttpURLConnection conn = (HttpURLConnection) new URL(endpoint).openConnection();Compliant (as in Adobe's example)
RequestConfig cfg = RequestConfig.custom()
.setConnectTimeout(5000)
.setSocketTimeout(5000)
.build();
CloseableHttpClient client = httpClientBuilderFactory.newBuilder()
.setDefaultRequestConfig(cfg).build();
URLConnection conn = new URL(endpoint).openConnection();
conn.setConnectTimeout(5000);
conn.setReadTimeout(5000);How to fix it
- List every place that builds an HTTP client: HttpClientBuilderFactory, HttpClients.custom(), URL.openConnection(), and wrappers in shared libraries.
- Put the timeouts in an OSGi configuration so each environment can tune them without a code change.
- Build the client once and reuse it (see AEMSRE-870) so the timeout configuration lives in one place.
- Add a fallback for page-rendering calls: show cached data or hide the component instead of failing the page.
Does it stop the pipeline?
A critical bug lowers the Reliability Rating to D. Adobe's critical gate only trips below D, so on its own it does not stop the pipeline, but it is one step away and it shows as an open issue in the report.
If a finding is a genuine false positive, Adobe's code quality page lets you annotate the code with @SuppressWarnings and the rule ID. In a full-stack pipeline, important failures can be overridden by a deployment manager, project manager or business lead; in a code-quality-only pipeline they cannot.
Questions
Does a timeout in the Dispatcher or CDN cover this?
No. Those limit the visitor's request to AEM. This rule is about AEM's own outbound calls to other systems.
Does Java 11's HttpClient count?
Adobe's examples use Apache HttpClient and URLConnection. If you use java.net.http.HttpClient, set connectTimeout on the builder and timeout on each request for the same reason.
Will a critical bug stop my pipeline?
A critical bug lowers the Reliability Rating to D, which is the last passing grade on Adobe's gate. It does not stop the pipeline by itself, but one blocker bug elsewhere would.
See the Cloud Service blockers in your code before Cloud Manager shows them. The free Surge Migrate readiness scan reads a repository zip or a Best Practices Analyzer CSV in your browser and lists them with file, fix and effort. Nothing is uploaded.
Sources
- Adobe: Custom code quality rules (checked 10 Nov 2026)
- Adobe: Code quality testing in Cloud Manager (checked 10 Nov 2026)
Rule key, type, severity and version are as listed on Adobe's page, checked 10 Nov 2026. Explanations and examples are ours unless marked as Adobe's.