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

ST hangs during file search - Discord Rich Presence #6459

Closed
jaraco opened this issue Aug 18, 2024 · 7 comments
Closed

ST hangs during file search - Discord Rich Presence #6459

jaraco opened this issue Aug 18, 2024 · 7 comments

Comments

@jaraco
Copy link

jaraco commented Aug 18, 2024

Description of the bug

As reported in tech support 73201, ST hangs when preview-opening files during a file search.

I'm reporting the issue here also, as it now appears to be more of a bug than a support issue.

Steps to reproduce

  1. Install Sublime Text 4180
  2. Install Package Control
  3. Install LSP-ruff
  4. Copy some non-trivial Python files to a directory (something like http --follow https://github.com/python/cpython/archive/refs/tags/v3.12.5.zip | bsdtar -x cpython-3.12.5/Lib/*.py)
  5. Open that directory (subl cpython-3.12.5/Lib)
  6. Use Cmd+P and scroll up and down the list until the application hangs

Expected behavior

Sublime Text should avoid race conditions and be resilient to race conditions in plugins.

Actual behavior

The app hangs.

Sublime Text build number

4180

Operating system & version

macOS 14.6.1

(Linux) Desktop environment and/or window manager

No response

Additional information

No response

OpenGL context information

No response

@rchl
Copy link

rchl commented Aug 21, 2024

Following up in sublimelsp/LSP-ruff#75 since this is likely not an ST issue.

@jaraco
Copy link
Author

jaraco commented Aug 23, 2024

I've since found that the issue indeed replicates with all plugins disabled (and ST restarted):

https://dl.dropboxusercontent.com/scl/fi/yntlej07oz1x7w3tqanbb/Screen-Recording-2024-08-23-at-15.02.56.mov?rlkey=b4i8vydpso4q321uxfjo1ra0r

So LSP-ruff is no longer implicated.

Yet, if I start in safe mode, I can scroll up and down all day long with no hangs.

I'm now beginning to think the issue might be related to how I have the User directory stored in Dropbox:

 Sublime Text 🐚 pwd
/Users/jaraco/Library/Application Support/Sublime Text
 Sublime Text 🐚 ls -la Packages
total 0
drwx------   5 jaraco  staff  160 Aug 21 10:44 .
drwx------  10 jaraco  staff  320 Mar 14 16:52 ..
drwxr-xr-x  12 jaraco  staff  384 Mar 25 20:51 AutoSpell
drwxr-xr-x   3 jaraco  staff   96 Aug 21 10:44 SublimeLinter-mypy
lrwxr-xr-x@  1 jaraco  staff   57 Feb  9  2024 User -> /Users/jaraco/Dropbox/AppData/Sublime Text/Packages/User/

I do that so I can take my settings with me and don't have to maintain configurations on machines separately.

@jaraco
Copy link
Author

jaraco commented Aug 23, 2024

I'm now beginning to think the issue might be related to how I have the User directory stored in Dropbox:

No, it's not that. I removed the symlink and replaced it with a copy of the files, but the issue still occurs.

@jaraco
Copy link
Author

jaraco commented Aug 23, 2024

At this stage, I think I'm going to rebuild my profile from scratch incrementally and check the issue periodically through the process. Still, I'd appreciate any insight on what sorts of things might cause ST to hang when scanning through files when all plugins are disabled.

@BenjaminSchaaf
Copy link
Member

Closing this according to the comment in sublimelsp/LSP-ruff#75

@jaraco
Copy link
Author

jaraco commented Aug 28, 2024

Please re-open. The issue persists. I've excluded LSP-ruff as the cause, but the issue still exists and I'm still investigating the cause. I'm hoping to rebuild my profile from scratch, but it takes time and I haven't had the time yet. I'm still getting crashes several times a day (on my original profile).

@jaraco jaraco changed the title ST 4180 hangs during file search with LSP-ruff installed ST hangs during file search Aug 30, 2024
@jaraco
Copy link
Author

jaraco commented Aug 30, 2024

Okay. I think I've solved the problem.

First, it helped to have a reliable reproducer. Trying to type and delete characters until the issue occurred was tedious and error-prone. Once I found that simply holding the down button to scroll through hundreds of files would readily reproduce the issue, it became easier to diagnose.

Second, I thought I was disabling packages when I wasn't. I had added a ignore_packages field to my Package Control.sublime-settings, but it was having no effect, because the setting needs to be in Preferences.sublime-settings (possibly because there's already an ignore_packages settings in that file). I was able to find the correct file by using the "Disable Package" action and seeing what file it changed.

I was then able to bisect the packages once again and using the reliable reproducer determine which subsets of packages triggered the issue.

It turns out the offending package is Discord Rich Presence, which I'd installed recently (around the same time as I upgraded to Sublime Text 4080). That explains why I thought it was the upgrade and why downgrading did not help (although I thought at first it did). When I installed that package, I didn't think too much about it.

Disabling that package, I can scroll up and down any project without any hangs.

I'll report the issue with that project.

@jaraco jaraco closed this as completed Aug 30, 2024
@jaraco jaraco changed the title ST hangs during file search ST hangs during file search - Discord Rich Presence Aug 30, 2024
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

3 participants