500 error on bulk update page when nodes are large; improve handling of AI Alt Text generation

Created on 9 September 2025, 12 days ago

Problem/Motivation

  • When running bulk updates for generating AI-based alt text on media or nodes, the system fails with a 500 error if there are a large number of nodes.
  • This happens because the current implementation tries to load and process too many entities at once, exhausting memory/timeout limits.
  • As a result, users with large content databases cannot use the bulk update functionality reliably.

Steps to reproduce

  • Enable the module and configure AI alt text generation.
  • Go to the bulk update page.
  • When large number of nodes on website not able to access getting HTTP 500 Error.

Proposed resolution

  • Replaces loading all entities at once with a paged entity query that fetches results in smaller batches.
  • Ensures that entities are processed iteratively instead of being held fully in memory.
  • Improves memory usage and execution time by avoiding Entity::loadMultiple() on a very large dataset.
🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇮🇳India yogeshsevak Rajasthan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @yogeshsevak
  • 🇮🇳India yogeshsevak Rajasthan

    The attached patch updates the bulk update process to prevent 500 errors on sites with a large number of nodes:

    • Replaces loading all entities at once with a paged entity query that fetches results in smaller batches.
    • Ensures that entities are processed iteratively instead of being held fully in memory.
    • Improves memory usage and execution time by avoiding Entity::loadMultiple() on a very large dataset.
    • Maintains existing functionality while making the bulk update page stable and scalable for large content sites.

    With this change, bulk alt-text updates now complete successfully even on sites with tens of thousands of nodes, without triggering memory exhaustion or timeouts.

    Please review.

Production build 0.71.5 2024