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 keyCQRules:ConnectionTimeoutMechanism
Adobe's rule nameHTTP requests should always have socket and connect timeouts
TypeBug
SeverityCritical
Since2018.6.0
Checked bySonarQube 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 typeConnect timeoutSocket (read) timeout
Page render calls an API1–2 s2–5 s, with a cached fallback
Background job or import5 s30–60 s
Health check of a dependency1 s2 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

  1. List every place that builds an HTTP client: HttpClientBuilderFactory, HttpClients.custom(), URL.openConnection(), and wrappers in shared libraries.
  2. Put the timeouts in an OSGi configuration so each environment can tune them without a code change.
  3. Build the client once and reuse it (see AEMSRE-870) so the timeout configuration lives in one place.
  4. 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

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.

Scan, Convert, Verify, Install

How Surge Migrate helps with a move to AEM as a Cloud Service

Surge Migrate moves a website from any CMS to any CMS, and AEM as a Cloud Service is one of the systems it writes. Pages are converted automatically, and you check the result before you install anything.

  1. 1

    Scan

    Names the system behind your site, counts pages and templates, lists the blocks to build and the work no tool does, and gives an effort range with its working.

    Scan a site →
  2. 2

    Convert

    Each page becomes an Edge Delivery document, an AEM Core Component page and import files for 7 other systems. 10 pages free; 500 or 2,000 pages in one paid run.

    Convert your pages →
  3. 3

    Verify

    A download is offered only when its own format check passes. The report lists every field not found and every component kept as plain content. Compare old and new pages side by side.

    Parity check →
  4. 4

    Install

    You import with the target system's own tool, on your own environment. Each download's README gives the command. Your system changes only when you run it.

    How each import was tested →

Content packages installed on a local AEM as a Cloud Service SDK. See the worked examples.

On AEM 6.5 code: Scan AEM 6.5 code free. The scan reads a repository zip or a Best Practices Analyzer CSV in your browser and lists Cloud Service blockers with file, fix and effort. Nothing is uploaded.