Skip to content

Conversation

AronNovak
Copy link

@AronNovak AronNovak commented Sep 12, 2025

Status

image
  • Add maxDepth parameter to Body constructor
  • Update Body::serialize() to use maxDepth when calling serializeForRollbar
  • Update DataBuilder to pass maxNestingDepth config to Body constructor
  • Add test to verify deep nesting is properly truncated

This fixes memory exhaustion issues when logging errors with complex nested data structures (like Drupal form arrays) by respecting the configured max_nesting_depth limit during Body serialization.

Previously, Body::serialize() always used unlimited depth (-1) via serializeForRollbarInternal(), ignoring the max_nesting_depth config.

Fixes memory issues similar to those described in issue reports about Rollbar consuming excessive memory with deeply nested context data.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Maintenance
  • New release

Checklists

Development

  • Lint rules pass locally
  • The code changed/added as part of this pull request has been covered with tests
  • All tests related to the changed code pass in development

Code review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
  • "Ready for review" label attached to the PR and reviewers assigned
  • Issue from task tracker has a link to this pull request
  • Changes have been reviewed by at least one other engineer

- Add maxDepth parameter to Body constructor
- Update Body::serialize() to use maxDepth when calling serializeForRollbar
- Update DataBuilder to pass maxNestingDepth config to Body constructor
- Add test to verify deep nesting is properly truncated

This fixes memory exhaustion issues when logging errors with complex
nested data structures (like Drupal form arrays) by respecting the
configured max_nesting_depth limit during Body serialization.

Previously, Body::serialize() always used unlimited depth (-1) via
serializeForRollbarInternal(), ignoring the max_nesting_depth config.

Fixes memory issues similar to those described in issue reports about
Rollbar consuming excessive memory with deeply nested context data.
@danielmorell danielmorell self-requested a review September 12, 2025 22:28
@danielmorell danielmorell self-assigned this Sep 12, 2025
danielmorell
danielmorell previously approved these changes Sep 12, 2025
Copy link
Collaborator

@danielmorell danielmorell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Thank you for the work on this @AronNovak!

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.

2 participants