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

Latest version 4.0.0 has a leak somewhere - all NodeJS threads are left opened after stopping Lerna on Windows #2841

Closed
ghiscoding opened this issue Mar 6, 2021 · 13 comments

Comments

@ghiscoding
Copy link

ghiscoding commented Mar 6, 2021

Expected Behavior

I saw the latest version of Lerna got bumped to 4.0.0 and I saw that it was mainly related to updating a whole bunch of dependencies, unfortunately it seems to be leaking somewhere. I tried my project on 3 different computers and they all leak with latest version of Lerna. At first, I thought it was TypeScript but after trying to upgrade/downgrade every npm packages that changed in the last couple days, I found out it's Lerna 4.0.0 causing the leak.

Current Behavior

I run my project in Development mode via lerna run build:demo --parallel and when I stop the execution, all of the NodeJS threads remain open (I didn't count them 1 by 1 but I see a whole lot staying open after stopping the process).

Possible Solution

Downgrading to previous version 3.22.1 does fix the issue in my case, so I know there's something wrong 4.0.0`

Steps to Reproduce (for bugs)

  1. You can git clone my project Slickgrid-Universal
  2. Upgrade to Lerna 4.0.0, on this line
  3. Follow the installation instructions of my project
  4. Start the project via the npm script npm run dev:watch
  5. Stop the process and see it leak (with Task Manager on Windows), it doesn't seem to stop any of my threads. The print screen below was taken after stopping the Lerna command and as you can see it doesn't look like any of the thread are being released.
    image

I then have to go and end all threads manually to get rid of the opened threads, it's painful and for that reason I have to downgrade back to Lerna 3.22.1 and that fixes it. Also note that I tried multiple times, upgrade/downgrade and it's consistently does the same, a downgrade always fixes it while an upgrade consistently breaks and does the behavior described in this issue.

Context

Keeping all my npm packages up to date

Your Environment

Windows 10 environment, ranging from Windows 10 (build 2003) at work to insider builds (20H2) on 2 of my personal computers. So in total I tried on 3 different computers with the same project.

Executable Version
lerna --version 4.0.0
npm --version 7.5.0
yarn --version 1.19.0
node --version 14.15.0
OS Version
NAME VERSION
@ghiscoding ghiscoding changed the title Latest version 4.0.0 has a leak somewhere - all NodeJS threads are left opened after stopping Lerna Latest version 4.0.0 has a leak somewhere - all NodeJS threads are left opened after stopping Lerna on Windows Mar 8, 2021
@dman777
Copy link

dman777 commented Mar 8, 2021

This does not happen in Unix like systems(MAC and Linux). Try doing in this in WSL if you must use Windows. Most development tools are native to Unix like systems.

@cabelitos
Copy link

I can confirm that this problem is also affecting me. Unfortunately I can't change to unix due to contractor restrictions.

@justinbhopper
Copy link

This does not happen in Unix like systems(MAC and Linux). Try doing in this in WSL if you must use Windows. Most development tools are native to Unix like systems.

As far as I know, Lerna is not currently intended to require using WSL to operate properly on Windows OS. I suspect most are more willing to move away from Lerna than to change their entire development environment.

@dman777
Copy link

dman777 commented Mar 14, 2021

It's the developers responsibility to use the appropriate tools. You should be using a unix-like system if you are having memory issues.

If you don't want to use WSL then try git bash. Regardless, this issue does not exist in unix-like systems.

@justinbhopper
Copy link

@dman777 The fact that the memory leak does not appear on unix systems does not make this a non-issue. You are not adding anything helpful to the discussion by suggesting that others stop using tools or environments that are intended to be supported by Lerna and NPM/Yarn.

@dman777
Copy link

dman777 commented Mar 14, 2021

I respectfully disagree. I am offering something helpful with mentioning WSL and git bash. Both are freely available on Windows.

@silltho
Copy link

silltho commented Mar 15, 2021

Hey,
i thought about upgrading to lerna v4 when i stepped over this issue. Since we have devs in out team who are working on windows this is definitely blocking us from moving on.

@dman777 i appreciate your help by mentioning alternatives/workarounds. However for me a workaround is not a fix. If lerna doesn't want support windows natively in the future that's totally fine but it should be discussed in a separate ticket.

@SyedUmerHasan
Copy link

Kindly make this issue generic for Linux and macOS environments.
I am also facing this issue while working on Linux and macOS platforms both @ghiscoding

IMG_20210511_123427

@dman777
Copy link

dman777 commented May 11, 2021

@SyedUmerHasan That does not show orphaned node threads spawned by lerna.

@github-actions
Copy link

github-actions bot commented Jun 3, 2022

Hi Folks 👋

You may or may not know that lerna is now under the stewardship of Nrwl (announcement here #3121), a company with a long history of not just producing valuable open-source software (OSS), but also backing others (at the time of writing, Nrwl has donated over $50,000 to OSS it hasn't created, see https://opencollective.com/nx for full details).

Quite simply, Nrwl ❤️ OSS, and is committed to making lerna the best it can be. We use it ourselves.

In order to take this awesome project forward from its current state, it is important that we focus our finite resources on what is most important to lerna users in 2022.

With that in mind, we have identified this issue as being potentially stale due to its age and/or lack of recent activity.


Next steps:

We want to give you some time to read through this comment and take action per one of the steps outlined below, so for the next 14 days we will not make any further updates to this issue.

@ghiscoding as the original author of this issue, we are looking to you to update us on the latest state of this as it relates to the latest version of lerna.

Please choose one of the steps below, depending on what type of issue this is:

  • A) If this issue relates to a potential BUG in the latest version of lerna:

  • B) If this issue is a FEATURE request to be added to the latest version of lerna:

    • Simply comment back on this thread so that we know you still want us to consider the request for the latest version of lerna.
  • C) If this issue is a QUESTION which is applicable to latest version of lerna:

  • D) If this issue is no longer applicable to the latest version of lerna:

    • Please close the issue.

If we do not hear from @ghiscoding on this thread within the next 14 days, we will automatically close this issue.

If you are another user impacted by this issue but it ends up being closed as part of this process, we still want to hear from you! Please simply head over to our new issue templates and fill out all the requested details on the template which applies to your situation:

https://github.com/lerna/lerna/issues/new/choose

Thank you all for being a part of this awesome community, we could not be more excited to help move things forward from here 🙏 🚀

@ghiscoding
Copy link
Author

ghiscoding commented Jun 3, 2022

@JamesHenry the fix is in PR #2946, which is 1 line code change, it simply needs to be merged. I also validated that the PR fix does work on my Windows machine, so whenever PR #2946 gets merged then this issue can be closed

@JamesHenry
Copy link
Member

@ghiscoding Thanks a lot for confirming that! I've requested an update on the PR, hopefully we can get it out in the 5.1 release next week

@JamesHenry JamesHenry removed the stale label Jun 3, 2022
@JamesHenry
Copy link
Member

@feryardiant change was applied in #3156

Thanks again!

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

No branches or pull requests

7 participants