Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Massive memory leak when opening projects with symlink loops #15966

Closed

Description

@thetechnick

Prerequisites

Description

Hi!
First of I know this sounds silly, but I experience this problem only when opening one of my projects, so bear with me.
When opening a checkout of my project (https://github.com/thetechnick/nginx-ingress) project folder in the size range of >150MB atoms memory consumption is rising constantly at about ~30 MiB per second until it reaches around 14GB and freezes my system.

First I suspected the golang plugin go-plus and ide-go, but now I have disabled all community packages and the atom-fuzzyfinder and the issue still occurs. (same for --safe and --clear-window-state

I have done a short CPU Profile in Chrome, but it shows nothing I can identify as a Problem:
CPU-20171022T113255.zip

Steps to Reproduce

  1. Open the project
  2. Look at the top/the gnome taks thingy or whatever shows the amount of memory atom uses

Actual behavior: Atom allocates ~30 MiB of memory per second until it crashes the system

Reproduces how often: 15~20 times before opening this issue

Versions

OS: Fedora 26

atom --version
Atom : 1.21.1
Electron: 1.6.15
Chrome : 56.0.2924.87
Node : 7.4.0

apm --version
apm 1.18.5
npm 3.10.10
node 6.9.5 x64
python 2.7.13
git 2.13.6

Additional Information

Activity

  1. winstliu commented on Oct 22, 2017

    @winstliu
    Contributor

    Does anything happen if you disable the github package? It's interesting that clear-window-state didn't fix it, which means Atom is reacting badly to something in the repo itself rather than having some incorrect state stored.

  2. thetechnick commented on Oct 22, 2017

    @thetechnick
    Author

    @50Wliu Hi, great response time!
    I disabled the github package, but its still the same (killed atom at 1GB)

    Edit:
    apm ls

    �[36mBuilt-in Atom Packages�[39m (92)
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected] (disabled)
    ├── [email protected] (disabled)
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    ├── [email protected]
    └── [email protected]
    
    �[36mCommunity Packages (16)�[39m /home/nschieder/.atom/packages
    ├── [email protected] (disabled)
    ├── [email protected] (disabled)
    ├── [email protected] (disabled)
    ├── [email protected] (disabled)
    ├── [email protected] (disabled)
    ├── [email protected] (disabled)
    ├── [email protected] (disabled)
    ├── [email protected] (disabled)
    ├── [email protected] (disabled)
    ├── [email protected] (disabled)
    ├── [email protected] (disabled)
    ├── [email protected] (disabled)
    ├── [email protected] (disabled)
    ├── [email protected] (disabled)
    ├── [email protected] (disabled)
    └── [email protected] (disabled)
    
    
    
  3. thetechnick commented on Oct 22, 2017

    @thetechnick
    Author

    Strange, I just cloned a fresh copy of the repo to /tmp/repo and now memory is back to normal...
    @50Wliu Can I upload something to make debugging this easier?

  4. winstliu commented on Oct 22, 2017

    @winstliu
    Contributor

    I don't know much about debugging, but it seems like "Record Allocation Timeline/Profile" are listed as helpful in solving memory leaks?

  5. thetechnick commented on Oct 22, 2017

    @thetechnick
    Author

    I did some more testing, the issue only occurs after installing the project dependencies into the /vendor folder. When deleting the folder atom stays at normal memory usage.

    An example is uploaded here, so it is simpler to reproduce:
    https://drive.google.com/file/d/0ByW_Oz6LLJGWVVAwbUdoS3pwS00/view?usp=sharing

    When opening this folder in atom 1.21.1, it will not stop allocating memory until the system limit is reached.
    I still run atom with the plugins listed above. --safe and --clear-window-state make no difference.

  6. daveshah1 commented on Oct 22, 2017

    @daveshah1

    I am also experiencing this issue in 64-bit Arch Linux. In my case the leak is even faster, about 100MiB/second, and again it is causing a total system crash when it reaches the limit.

    Downgrading from 1.21.1 to 1.20.1 fixes the issue.

  7. joerg-krause commented on Oct 23, 2017

    @joerg-krause

    Same here on 64-bit Arch Linux with version 1.21.1.

  8. winstliu commented on Oct 23, 2017

    @winstliu
    Contributor

    @daveshah1 @joerg-krause are you two using the same project that @thetechnick is? If not, are there any similarities?

  9. joerg-krause commented on Oct 23, 2017

    @joerg-krause

    @50Wliu No, I am not using the same project. I am using a quite large project with several of thousands files. Furthermore, it is a git project.

  10. maxbrunsfeld commented on Oct 23, 2017

    @maxbrunsfeld
    Contributor

    @thetechnick I can't reproduce this (just cloned your project, opened it in Atom and opened a couple of files). Are there some other steps you can provide? Do I need to install dependencies or something?

    Sorry, just saw your later comment about the vendor folder. Testing with your .zip file now....

    EDIT - I still can't reproduce it on macOS, even with the vendor folder from your test.zip file copied into the repository. Maybe it's linux-specific somehow?

  11. thetechnick commented on Oct 24, 2017

    @thetechnick
    Author
  12. changed the title [-]Massive memory leak when opening my project[/-] [+]Massive memory leak when opening large projects[/+] on Oct 24, 2017
  13. dbstraffin commented on Oct 24, 2017

    @dbstraffin

    I'm having the same issue with Atom 1.21.1, but not 1.21.0. It consumes ~200% cpu and memory until the system locks up and the OOM killer kicks in. It still happens when running atom --safe. All my loaded projects are proprietary, so I doubt it's a specific project.

    Versions

    OS: Ubuntu 17.04/17.10 (occurred before and after upgrade)

    atom --version
    Atom : 1.21.1
    Electron: 1.6.15
    Chrome : 56.0.2924.87
    Node : 7.4.0

    apm --version
    apm 1.18.5
    npm 3.10.10
    node 6.9.5 x64
    python 2.7.14
    git 2.14.1

  14. dbstraffin commented on Oct 24, 2017

    @dbstraffin

    The issue stops when i change the filesystem watcher from native to emulated. It starts back up when i switch back to native.

  15. 25 remaining items

  16. nathansobo commented on Nov 1, 2017

    @nathansobo
    Contributor

    @stefanb2 That is disconcerting. Can you distill a simple example of the symlink structure that is causing your problem. @ungb @Ben3eeE Could you help trying to reproduce this issue on Linux?

  17. Ben3eeE commented on Nov 1, 2017

    @Ben3eeE
    Contributor

    @nathansobo We have some information from @stefanb2 through the duplicate issue already /cc: #16011 (comment)

  18. nathansobo commented on Nov 1, 2017

    @nathansobo
    Contributor

    @Ben3eeE Thanks for that information. So @stefanb2 is the problem only happening when recursive links are created while Atom is already running? Perhaps my fix missed the case where new links are introduced, though I'm not sure how yet.

  19. stefanb2 commented on Nov 1, 2017

    @stefanb2

    No, the file system structure already exists when I start atom.

    Maybe this will help you to reproduce the issue:

    • close all files in atom
    • remove all project folders from atom
    • switch watcher back to native API
    • close atom
    $ find -L -type l 2>&1 >/dev/null | perl -ne 'print "$1\n" if m,detected;\s+[^.]+([\w/.-]+),' | xargs ls -l
    lrwxrwxrwx. 1 stefanb stefanb 1 Oct 30 09:17 ./output/build/attr-2.4.47/include/attr -> .
    lrwxrwxrwx. 1 stefanb stefanb 1 Oct 30 10:45 ./output/build/host-acl-2.2.52/include/acl -> .
    lrwxrwxrwx. 1 stefanb stefanb 1 Oct 30 10:45 ./output/build/host-acl-2.2.52/include/sys -> .
    lrwxrwxrwx. 1 stefanb stefanb 1 Oct 30 10:44 ./output/build/host-attr-2.4.47/include/attr -> .
    lrwxrwxrwx. 1 stefanb stefanb 1 Oct 30 09:00 ./output/host/usr -> .
    
    # script to simulate "buildroot" type of project directory
    $ cat create-file-system-loops.sh 
    #!/bin/bash
    set -x
    for _l in \
            build/attr-2.4.47/include/attr \
            build/host-acl-2.2.52/include/acl \
            build/host-acl-2.2.52/include/sys \
            build/host-attr-2.4.47/include/attr \
            host/usr \
    ; do
            mkdir -p $(dirname ${_l})
            ln -s . ${_l}
    done
    
    1. atom --safe --clear-window-state: everything is fine
    2. add existing buildroot directory as project folder: CPU jumps to 100%
    3. remove buildroot project folder: CPU stays at 100%
    4. close atom
    5. atom --safe --clear-window-state: everything is fine
    6. run create-file-system-loops.sh in an empty directory
    7. add that directory as project folder in atom: CPU jumps to 100%

    It may be that it is possible to recreate the issue with only one link loop, as all of them look the same i.e. xyz -> .

  20. stefanb2 commented on Nov 1, 2017

    @stefanb2

    I simplified the reproducer to two symbolic links:

    $ ln -s . abc
    $ ln -s . def
    $ ls -l
    lrwxrwxrwx. 1 stefanb stefanb   1 Nov  1 22:02 abc -> .
    lrwxrwxrwx. 1 stefanb stefanb   1 Nov  1 22:02 def -> .
    

    When I add that directory as project folder to atom, the CPU usage jumps to 100%. Actually Atom UI freezes and doesn't even show the project folder in the pane. After restarting Atom the folder shows up in the project pane.

  21. nathansobo commented on Nov 1, 2017

    @nathansobo
    Contributor

    @stefanb2 I'm having a hard time reproducing the issue. I recorded a screen capture of me following what I think are your described reproduction steps. Is there something I'm missing? Sorry this is such a hassle.

    cant-reproduce-cpu-bug-linux

  22. nathansobo commented on Nov 1, 2017

    @nathansobo
    Contributor

    Apparently @Ben3eeE can reproduce the issue so I'll work with him to straighten myself out.

  23. nathansobo commented on Nov 1, 2017

    @nathansobo
    Contributor

    Okay, I'm reproducing it now. Not sure hat was going on before.

  24. stefanb2 commented on Nov 1, 2017

    @stefanb2

    @nathansobo you need to create the symbolic links before starting atom. But I guess you already figured that out by yourself :-)

  25. nathansobo commented on Nov 1, 2017

    @nathansobo
    Contributor

    @stefanb2 Ugh. I made a stupid mistake that caused us not to require the fixed version of our path watching library. Extremely sorry for the noise everyone. I tested the library itself on the VM but not the final packaged version of Atom. This will have to go out as another fix. I'll be sure to test the full bundle this time and also ask @Ben3eeE verify it as well.

  26. Ben3eeE commented on Nov 1, 2017

    @Ben3eeE
    Contributor

    ✨

  27. stefanb2 commented on Nov 8, 2017

    @stefanb2

    I can no longer reproduce the issue with 1.22.0. Thanks.

  28. lock commented on May 7, 2018

    @lock

    This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!

  29. locked as resolved and limited conversation to collaborators on May 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

buglinuxregression

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions