Skip to content

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

Merged
lhotari merged 1 commit into
apache:masterfrom
lhotari:lh-fix-resourceleak-in-tests
Sep 21, 2022
Merged

[fix][tests] Fix resource leak in tests. Call cleanup before setup#17743
lhotari merged 1 commit into
apache:masterfrom
lhotari:lh-fix-resourceleak-in-tests

Conversation

@lhotari

@lhotari lhotari commented Sep 20, 2022

Copy link
Copy Markdown
Member

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

lhotari commented Sep 21, 2022

Copy link
Copy Markdown
Member Author

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

@lhotari

lhotari commented Sep 21, 2022

Copy link
Copy Markdown
Member Author

/pulsarbot rerun-failure-checks

@nicoloboschi nicoloboschi left a comment

Copy link
Copy Markdown
Contributor

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