Resolving HTTP 504 errors during bulk Content Fragment replication in Adobe Experience Manager

This article explains how to resolve HTTP 504 errors that occur when replicating or updating large numbers of Content Fragments via a webhook in Adobe Experience Manager by optimizing commit operations and repository structure.

Description description

When using a custom webhook to create or update a large number of Content Fragments in Adobe Experience Manager (AEM), HTTP 504 errors occur during the commit process. This typically happens when the webhook attempts to commit all fragments in a single operation, exceeding the repository’s allowed write timeout. The repository and environment remain healthy, and there’s no evidence of data corruption or platform outage. The issue is reproducible when thousands of Content Fragments are committed in a single session.save() operation.

Environment

Adobe Experience Manager (all versions)

Symptoms

  • HTTP 504 errors during webhook-driven Content Fragment replication or update
  • Errors such as Failed to replicate…: RepositoryException: ServiceUnreachableIOException: Got response status 504, but expected [ 200]
  • Occasional SocketTimeoutException: Read timed out errors during large commit operations

Cause

A single oversized commit containing thousands of Content Fragments exceeds the allowed repository write timeout, resulting in HTTP 504 errors. This is a timeout on the commit operation, not a repository fault or data corruption.

Resolution resolution

Follow the steps below to resolve the issue:

  1. Modify your webhook or integration logic to commit Content Fragments in smaller batches, such as 20–50 fragments per session.save() operation, instead of committing all fragments at once.
  2. Implement retry logic for transient repository errors. If a commit fails, call session.refresh(true), and retry the operation a limited number of times.
  3. Organize Content Fragments into a partitioned folder structure (For example: by date or category) to avoid having thousands of direct children under a single folder. This reduces the complexity and duration of each commit.
  4. After making these changes, monitor webhook runs and repository logs to ensure that HTTP 504 errors no longer occur.
  5. Verify that all intended Content Fragments are created or updated successfully and that no further 504 errors occur in the logs.
recommendation-more-help
experience-cloud-kcs-help-kbarticles