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

Big files without linebreaks should not crash #16120

Open
1 task done
giovannicimolin opened this issue Aug 12, 2024 · 5 comments
Open
1 task done

Big files without linebreaks should not crash #16120

giovannicimolin opened this issue Aug 12, 2024 · 5 comments
Labels
bug [core label] editor Feedback for code editing, formatting, editor iterations, etc json JSON data format support large projects For anything relating to large volumes of files or multiple subprojects in one main project. panic / crash [core label]

Comments

@giovannicimolin
Copy link

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

When trying to open a big JSON file, Zed should not freeze.

To reproduce:

Trying to open a 120MB GeoJSON file freezes the app, while VSCode loads the file quickly without any issues (with highlighting disabled).

Note: I can't upload files bigger than 25MB here, but I think any big JSON will cause this issue.

Environment

Zed: v0.146.5 (Zed)
OS: Linux Wayland manjaro unknown
Memory: 15.3 GiB
Architecture: x86_64
GPU: Intel(R) Xe Graphics (TGL GT2) || Intel open-source Mesa driver || Mesa 24.1.5-manjaro1.1

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

Zed.log
No logs, it just freezes.
@giovannicimolin giovannicimolin added admin read Pending admin review bug [core label] panic / crash [core label] triage Maintainer needs to classify the issue labels Aug 12, 2024
@failable
Copy link

(with highlighting disabled).

Have a setting like large-file-warning-threshold in Emacs would be great. If the file is larger than the threshold, the file will be opened literally without any latency and issue.

@notpeter
Copy link
Member

For me Zed is able to open a 1.2GB text file without crashing, so I wonder if this is JSON specific. Does Zed still crash if you rename the file from .json to .txt?

Zed performing poorly with buffers >16M lines long is a known issue:

@notpeter notpeter added editor Feedback for code editing, formatting, editor iterations, etc json JSON data format support large projects For anything relating to large volumes of files or multiple subprojects in one main project. and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Aug 13, 2024
@wlinna
Copy link

wlinna commented Nov 17, 2024

For me Zed freezes and crashes for a 166 MiB JSON file just the same regardless of the file extension, so it's not JSON specific. But all that text is on one line, so it might have something to do with that

@kanielrkirby
Copy link

My guess is that this is to do with line length, and (unless one already exists), I think it simply needs a cap (like VSCode's editor.stopRenderingLineAt, and potentially editor.maxTokenizationLineLength).


I have a .log (20MB) file, and around 200-300 lines down, there's a very long line (1,541,369 characters long), so as soon as I open the file it hangs and usually crashes outright (no extensions or custom settings).

I've done a couple tests in some other editors I frequently use:

  • Helix Editor handles this by not rendering anything outside the visible part of the buffer (i.e., it runs fine until you reach that line and chugs along until it's back out of view).
  • VSCode handles this with a default editor.stopRenderingLineAt and editor.maxTokenizationLineLength (and line wrapping by default).
  • Both NeoVim and Vim do the same as Helix, but also implement wrapping by default.

Enabling line wrapping in Zed also does not seem to help the issue.

@wlinna
Copy link

wlinna commented Nov 24, 2024

I used jq to pre-format JSON, then I added .txt extension to prevent JSON parsing, and now I'm able to open the file in Zed.

It's not perfect though. Often Zed will crash at some point in time, and then there's the aforementioned rendering problem.

@notpeter notpeter changed the title Big files should not crash the app Big files without linebreaks should not crash Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [core label] editor Feedback for code editing, formatting, editor iterations, etc json JSON data format support large projects For anything relating to large volumes of files or multiple subprojects in one main project. panic / crash [core label]
Projects
None yet
Development

No branches or pull requests

5 participants