atom / fuzzy-finder

Find and open files quickly
MIT License
275 stars 138 forks source link

Atom crashes with directory loop #306

Open Arcanemagus opened 7 years ago

Arcanemagus commented 7 years ago

Prerequisites

Description

When the directory structure of the open project has a "loop", fuzzy-finder will forever keep trying to reach the bottom of the tree till Atom runs out of memory and crashes. When it reloads the process starts over again.

Note that this can only happen when it can't recognize that the folder is a symlink.

Steps to Reproduce

  1. Have a network shared folder so symlink status is hidden from client.
  2. Create a folder that contains a symlink to itself: Z:\foo containing a link bar that links to Z:\foo
  3. Open this folder in Atom
  4. Watch a Task spawned with load-paths-handler.coffee use a lot of CPU, and Atom's memory continuously climb till it crashes.

Expected behavior:

Loop is detected or limit is hit and path searching stops.

Actual behavior:

Loop is never detected, path searching continues till Atom runs out of memory and crashes.

Reproduces how often:

100% of the time.

Versions

Atom : 1.19.0-beta3 x64 Electron: 1.6.9 Chrome : 56.0.2924.87 Node : 7.4.0

OS: Windows 10 Enterprise x64

Additional Information

Killing the Task's process lets Atom work with the project folder open.

If attempted locally Atom detects that the folders are linked and stops the scan, thus accessing over a network share is necessary to hide the fact that it is a link from Atom.

Arcanemagus commented 6 years ago

This is somewhat related to https://github.com/atom/fuzzy-finder/issues/216 for reference, but isn't identical as it's impossible to detect that a symlink is being traversed.

ungb commented 6 years ago

@smashwilson do you know if this is something that might be solved with the new watcher things that you were working on?

Arcanemagus commented 6 years ago

Just to confirm, this is still an issue on Atom v1.25.0-beta3, although you are now required to hit Ctrl+P in order to trigger fuzzy-finder indexing the project.

Arcanemagus commented 6 years ago

Interesting new bit of information: My home network (samba running on FreeBSD) seems to cap the loop 32 directories deep, showing an empty folder at the bottom most level.

The "enterprise" file system at work apparently never thought of adding that limitation, and lets you go as deep as you want till something crashes.

This means that you would only be able to see the infinitely expanding memory on a system that is equally broken, otherwise you would need to hook into the internals of fuzzy-finder and watch the loop go till it hits the limits of whatever system you have in place.

lee-dohm commented 5 years ago

So it appears this was addressed on macOS and Linux by #331 but not on Windows? @Arcanemagus can you confirm?

Arcanemagus commented 5 years ago

I'm still seeing this on v1.34.0-nightly4 in safe mode: 2018-10-26_11-15-48 Note the task with constant CPU and network activity, with increasing RAM usage.