Skip to content

Explicitly removal of all invisible actions when a pipeline finishes.#228

Merged
drodriguezhdez merged 3 commits into
masterfrom
drodriguezhdez/stepdataaction_mem_leak
Jul 6, 2021
Merged

Explicitly removal of all invisible actions when a pipeline finishes.#228
drodriguezhdez merged 3 commits into
masterfrom
drodriguezhdez/stepdataaction_mem_leak

Conversation

@drodriguezhdez

@drodriguezhdez drodriguezhdez commented Jul 5, 2021

Copy link
Copy Markdown
Collaborator

Requirements for Contributing to this repository

  • Fill out the template below. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • The pull request must only fix one issue at the time.
  • The pull request must update the test suite to demonstrate the changed functionality.
  • After you create the pull request, all status checks must be pass before a maintainer reviews your contribution. For more details, please see CONTRIBUTING.

What does this PR do?

This PR removes explicitly all the InvisibleAction instances from the WorkflowRun instance used by CI Visibility. This is required to avoid memory leaks due to the action instances are not garbage collected, even if the run has finished.

As the onFinalized method is executed before processing the last FlowNode, we synchronize the clean-up using the IsPipelineAction.

Before the fix -> After executing 20 pipelines

image

After the fix -> After executing 20 pipelines

image

Related to #227

Description of the Change

Alternate Designs

Possible Drawbacks

Verification Process

Additional Notes

Release Notes

Review checklist (to be filled by reviewers)

  • Feature or bug fix MUST have appropriate tests (unit, integration, etc...)
  • PR title must be written as a CHANGELOG entry (see why)
  • Files changes must correspond to the primary purpose of the PR as described in the title (small unrelated changes should have their own PR)
  • PR must have one changelog/ label attached. If applicable it should have the backward-incompatible label attached.
  • PR should not have do-not-merge/ label attached.
  • If Applicable, issue must have kind/ and severity/ labels attached at least.

@drodriguezhdez drodriguezhdez changed the title Explicitly Remove invisible actions Explicitly removal of all invisible actions when a pipeline finishes. Jul 5, 2021
@drodriguezhdez drodriguezhdez added the changelog/Fixed Fixed features results into a bug fix version bump label Jul 5, 2021
AdrianLC
AdrianLC previously approved these changes Jul 5, 2021

@AdrianLC AdrianLC left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It'd be great to have a test checking this

buildData = new BuildData(run, null);
} catch (IOException | InterruptedException e) {
DatadogUtilities.severe(logger, e, "Failed to parse finalized build data");
cleanUpTraceActions(run);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Isn't the finally below called regardless of the return in this block? That would mean cleaning twice unnecessarily

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Totally correct. I'll remove this.

// APM Traces
client.finishBuildTrace(buildData, run);
logger.fine("End DatadogBuildListener#onFinalized");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change

@drodriguezhdez
drodriguezhdez marked this pull request as draft July 6, 2021 07:46
@drodriguezhdez

Copy link
Copy Markdown
Collaborator Author

It'd be great to have a test checking this

I added assertions for this behavior.

@drodriguezhdez
drodriguezhdez marked this pull request as ready for review July 6, 2021 08:32
@drodriguezhdez
drodriguezhdez merged commit 6081d92 into master Jul 6, 2021
@drodriguezhdez
drodriguezhdez deleted the drodriguezhdez/stepdataaction_mem_leak branch July 6, 2021 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/Fixed Fixed features results into a bug fix version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants