Skip to content

Avoid accumulating executed search debug traces outside debug mode#418

Open
simon-matt-oetztal wants to merge 1 commit into
pimcore:2026.xfrom
simon-matt-oetztal:2026.x
Open

Avoid accumulating executed search debug traces outside debug mode#418
simon-matt-oetztal wants to merge 1 commit into
pimcore:2026.xfrom
simon-matt-oetztal:2026.x

Conversation

@simon-matt-oetztal
Copy link
Copy Markdown

Changes in this pull request

Resolves #417

Prevent SearchExecutionService debug trace accumulation outside debug mode

What

This PR changes SearchExecutionService so that $executedSearches is populated only when Pimcore debug mode is enabled.

Why

SearchExecutionService currently stores per-query SearchInformation including:

  • full search response
  • debug_backtrace()

In long-running CLI commands this accumulates and causes significant memory growth, although the data is only useful for debugging.

How

In SearchExecutionService::executeSearch():

  • wrap both $this->executedSearches[] = ... writes (success + exception path) in:
    • if (Pimcore::inDebugMode()) { ... }

Impact

  • Debug/dev behavior: unchanged (query debug information still available).
  • Prod/no-debug behavior: avoids unnecessary in-memory accumulation of debug traces.
  • No API change.

Motivation / use case

This was observed during long-running data object update/import commands where memory rose steadily due to query trace collection.

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memory growth in long-running CLI commands

2 participants