jenkinsci / datadog-plugin

A Jenkins plugin used to forward metrics, events, and service checks to an account at Datadog, automatically.
https://plugins.jenkins.io/datadog/
MIT License
30 stars 48 forks source link

Unbounded memory usage in generating traces from stage data #429

Closed msbit01 closed 2 months ago

msbit01 commented 2 months ago

Describe the bug When creating StageData objects for trace generation, there is no limit on the number of objects created, which can result in unbounded memory consumption.

Label the issue properly.

To Reproduce Steps to reproduce the behavior:

  1. Create a pipeline that produces thousands of stages.
  2. Run the pipeline.
  3. Check heap usage data, e.g. by hitting the /monitoring endpoint if using the monitoring plugin.
  4. Observe large number of StageData objects.

Expected behavior The code already throws out stage data when the size of the associated json object exceeds 5000 characters, so we should be short-circuiting StageData creation as well.

Screenshots If applicable, add screenshots to help explain your problem.

Environment and Versions (please complete the following information): I'm using Jenkins 6.0.3 and believe the issue was introduced in 6.0.0, in this change https://github.com/jenkinsci/datadog-plugin/pull/381

Additional context Add any other context about the problem here.

nikita-tkachenko-datadog commented 2 months ago

The new release v7.1.0 includes the fix.

tsmsbit commented 2 months ago

Thank you!