Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix][tests] Fix resource leak in tests. Call cleanup before setup #17743

Merged
merged 1 commit into from
Sep 21, 2022

Conversation

lhotari
Copy link
Member

@lhotari lhotari commented Sep 20, 2022

Fixes #17714

Motivation

There are a few resource leaks in tests where setup (or internalSetup) is called explicitly without first calling cleanup.
This causes a thread and memory leak in tests which slows down test execution.

Modifications

  • when setup is called explicitly, cleanup should be issued before it
  • remove unnecessary "resetConfig" method calls
    • resetConfig gets called as part of internalCleanup
    • when resetConfig is in cleanup, it's possible to override config before calling setup
      • this allows using setup & cleanup methods instead of using error prone internalSetup and internalCleanup methods which might leave something behind
    • make getDefaultConf a non-static protected method so that it can be overridden to provide the config to use in resetConfig

Documentation

  • doc-required
    (Your PR needs to update docs and you will update later)

  • doc-not-needed
    (Please explain why)

  • doc
    (Your PR contains doc changes)

  • doc-complete
    (Docs have been already added)

Matching PR in forked repository

PR in forked repository: lhotari#88

@lhotari lhotari added this to the 2.12.0 milestone Sep 20, 2022
@lhotari lhotari self-assigned this Sep 20, 2022
@lhotari lhotari force-pushed the lh-fix-resourceleak-in-tests branch from 23aab00 to 4896661 Compare September 20, 2022 12:36
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Sep 20, 2022
@lhotari lhotari force-pushed the lh-fix-resourceleak-in-tests branch from 4896661 to 3f034cf Compare September 20, 2022 12:57
Technoboy-
Technoboy- previously approved these changes Sep 20, 2022
@lhotari lhotari marked this pull request as draft September 20, 2022 13:51
@lhotari lhotari force-pushed the lh-fix-resourceleak-in-tests branch from 3f034cf to 60968e1 Compare September 20, 2022 15:56
@lhotari lhotari marked this pull request as ready for review September 20, 2022 15:57
@lhotari lhotari dismissed Technoboy-’s stale review September 20, 2022 15:57

The PR isn't yet ready.

@lhotari lhotari marked this pull request as draft September 20, 2022 15:57
@lhotari lhotari force-pushed the lh-fix-resourceleak-in-tests branch from 60968e1 to 13bdf51 Compare September 20, 2022 15:59
- when setup is called explicitly, cleanup should be issued before it
- remove unnecessary "resetConfig" method calls
  - resetConfig gets called as part of internalCleanup
  - when resetConfig is in cleanup, it's possible to override config before calling setup
    - this allows using setup & cleanup methods instead of using
      error prone internalSetup and internalCleanup methods which might leave something behind
@lhotari lhotari force-pushed the lh-fix-resourceleak-in-tests branch from 13bdf51 to 486c670 Compare September 20, 2022 20:19
@lhotari lhotari marked this pull request as ready for review September 21, 2022 05:09
@lhotari lhotari requested a review from Technoboy- September 21, 2022 05:10
@lhotari
Copy link
Member Author

lhotari commented Sep 21, 2022

@Technoboy- this is now ready for review. Please review

@lhotari
Copy link
Member Author

lhotari commented Sep 21, 2022

/pulsarbot rerun-failure-checks

Copy link
Contributor

@nicoloboschi nicoloboschi left a comment

Choose a reason for hiding this comment

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

Nice work! @lhotari

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-not-needed Your PR changes do not impact docs ready-to-test type/flaky-tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flaky-test: Out-of-memory error in Broker Group 3 unit tests
3 participants