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

ci: Fix a couple of memory leaks in test setups #16655

Merged
merged 1 commit into from Dec 7, 2022
Merged

Conversation

SevInf
Copy link
Contributor

@SevInf SevInf commented Dec 6, 2022

This fixes 2 memory leaks in our test setup:

  1. Jest passes every file through transform and caches the results
    on disk and in memory. That included every generated client as well, so
    they were kept in memory from the time they were first loaded until
    process finishes, even though they are needed only for 1 test suite.
    Fixed by using transformIgnorePatterns options in jest config.

  2. debug library keeps a list of last 100 logs that would be used for
    panic error messages later. If error object gets into this list, it will
    keep whole jest sandbox alive until process finishes. Fixed by clearing
    logs on $disconnect

Fix #16594

@SevInf SevInf requested a review from a team December 6, 2022 17:23
@SevInf SevInf added this to the 4.8.0 milestone Dec 6, 2022
@SevInf SevInf requested review from danstarns and aqrln and removed request for a team and danstarns December 6, 2022 17:23
@Jolg42
Copy link
Member

Jolg42 commented Dec 6, 2022

Looks good to me, let's make it obvious with code comments why these new lines are important 👍🏼

This fixes 2 memory leaks in our test setup:

1. Jest passes every file through transform and caches the results
on disk and in memory. That included every generated client as well, so
they were kept in memory from the time they were first loaded until
process finishes, even though they are needed only for 1 test suite.
Fixed by using `transformIgnorePatterns` options in jest config.

2. `debug` library keeps a list of last 100 logs that would be used for
panic error messages later. If error object gets into this list, it will
keep whole jest sandbox alive until process finishes. Fixed by clearing
logs on `$disconnect`

Fix #16594
@SevInf SevInf merged commit b0a3e71 into main Dec 7, 2022
@SevInf SevInf deleted the fix/memory-ci-again branch December 7, 2022 09:39
jkomyno pushed a commit that referenced this pull request Dec 21, 2022
This fixes 2 memory leaks in our test setup:

1. Jest passes every file through transform and caches the results
on disk and in memory. That included every generated client as well, so
they were kept in memory from the time they were first loaded until
process finishes, even though they are needed only for 1 test suite.
Fixed by using `transformIgnorePatterns` options in jest config.

2. `debug` library keeps a list of last 100 logs that would be used for
panic error messages later. If error object gets into this list, it will
keep whole jest sandbox alive until process finishes. Fixed by clearing
logs on `$disconnect`

Fix #16594
jkomyno pushed a commit that referenced this pull request Dec 21, 2022
This fixes 2 memory leaks in our test setup:

1. Jest passes every file through transform and caches the results
on disk and in memory. That included every generated client as well, so
they were kept in memory from the time they were first loaded until
process finishes, even though they are needed only for 1 test suite.
Fixed by using `transformIgnorePatterns` options in jest config.

2. `debug` library keeps a list of last 100 logs that would be used for
panic error messages later. If error object gets into this list, it will
keep whole jest sandbox alive until process finishes. Fixed by clearing
logs on `$disconnect`

Fix #16594
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.

Investigate memory issues on Windows
4 participants