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

Zed hangs on large null file #23561

Open
1 task done
onxcy opened this issue Jan 23, 2025 · 2 comments
Open
1 task done

Zed hangs on large null file #23561

onxcy opened this issue Jan 23, 2025 · 2 comments
Labels
bug [core label] editor Feedback for code editing, formatting, editor iterations, etc freeze Editor or OS - freezing / hanging / locking panic / crash [core label] reproducible Verified steps to reproduce included

Comments

@onxcy
Copy link

onxcy commented Jan 23, 2025

Open a file with 10mb of null bytes causes Zed to hang/crash consuming 60+GB of real memory.

Example file:
https://github.com/jamesward/play-load-tests/raw/refs/heads/master/public/10mb.txt

original report

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

Use zed to open the file in the link
Zed gets stuck

https://github.com/jamesward/play-load-tests/blob/master/public/10mb.txt
Image

VS Code opens the file without any lag

Image

Zed Version and System Specs

Zed: v0.170.1 (Zed)
OS: macOS 15.2.0
Memory: 16 GiB
Architecture: aarch64
Darwin 24.2.0 Darwin Kernel Version 24.2.0: Fri Dec  6 19:04:03 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T8132 arm64

If applicable, add screenshots or screencasts of the incorrect state / behavior

No response

If applicable, attach your Zed.log file to this issue.

Zed.log

@onxcy onxcy added admin read Pending admin review bug [core label] triage Maintainer needs to classify the issue labels Jan 23, 2025
@notpeter
Copy link
Member

notpeter commented Jan 23, 2025

I can reproduce. The linked file is just 10MB of null bytes.
Doing it with 1MB makes Zed super slow
Doing it with 10MB makes Zed hang (60GB of ram allocated)

dd if=/dev/zero of=null-file-1mb.txt bs=1M count=1
dd if=/dev/zero of=null-file-10mb.txt bs=10M count=1

Potentially related:

Hang log
2025-01-23T13:33:53.012861-05:00 [ERROR] Suspected hang on main thread:
zed::reliability::monitor_main_thread_hangs::handle_backtrace_signal::handle_sigusr2::h3b6343c323125168
__os_alloc_slow
editor::element::LineWithInvisibles::from_chunks::h1bd92b6cbbeb8ccf
<editor::element::EditorElement as gpui::element::Element>::prepaint::{{closure}}::{{closure}}::{{closure}}::h733f8e120e6284de
<editor::element::EditorElement as gpui::element::Element>::prepaint::{{closure}}::h2d14b1f98888162a
<editor::element::EditorElement as gpui::element::Element>::prepaint::h2aa75c13925ea226
<gpui::element::Drawable<E> as gpui::element::ElementObject>::prepaint::hb74f9915df675607
gpui::element::AnyElement::prepaint::hfb24811c24228f32
<gpui::view::AnyView as gpui::element::Element>::prepaint::hd0c3691899c67481
<gpui::element::Drawable<E> as gpui::element::ElementObject>::prepaint::h8b49ef322b257535
gpui::element::AnyElement::prepaint::hfb24811c24228f32
gpui::elements::div::Interactivity::prepaint::{{closure}}::{{closure}}::{{closure}}::h6e892ad2baee7d60
gpui::elements::div::Interactivity::prepaint::{{closure}}::{{closure}}::ha07cc8ab16d300b5
gpui::elements::div::Interactivity::prepaint::{{closure}}::h4c3f052a0a12fef0
<gpui::elements::div::Div as gpui::element::Element>::prepaint::h2653c0462afde6fe
<gpui::element::Drawable<E> as gpui::element::ElementObject>::prepaint::h23d11cac4536dd3b
gpui::element::AnyElement::prepaint::hfb24811c24228f32
gpui::elements::div::Interactivity::prepaint::{{closure}}::{{closure}}::{{closure}}::h6e892ad2baee7d60
gpui::elements::div::Interactivity::prepaint::{{closure}}::{{closure}}::ha07cc8ab16d300b5
gpui::elements::div::Interactivity::prepaint::{{closure}}::h4c3f052a0a12fef0
<gpui::elements::div::Div as gpui::element::Element>::prepaint::h2653c0462afde6fe
<gpui::element::Drawable<E> as gpui::element::ElementObject>::prepaint::h23d11cac4536dd3b
gpui::element::AnyElement::prepaint::hfb24811c24228f32
<gpui::view::AnyView as gpui::element::Element>::prepaint::{{closure}}::hb05d21acd27882b5
<gpui::view::AnyView as gpui::element::Element>::prepaint::hd0c3691899c67481
<gpui::element::Drawable<E> as gpui::element::ElementObject>::prepaint::h8b49ef322b257535
gpui::element::AnyElement::prepaint::hfb24811c24228f32
gpui::elements::div::Interactivity::prepaint::{{closure}}::{{closure}}::{{closure}}::h6e892ad2baee7d60
gpui::elements::div::Interactivity::prepaint::{{closure}}::{{closure}}::ha07cc8ab16d300b5
gpui::elements::div::Interactivity::prepaint::{{closure}}::h4c3f052a0a12fef0
<gpui::elements::div::Div as gpui::element::Element>::prepaint::h2653c0462afde6fe
<gpui::element::Drawable<E> as gpui::element::ElementObject>::prepaint::h23d11cac4536dd3b
gpui::element::AnyElement::prepaint::hfb24811c24228f32
<gpui::element::Drawable<E> as gpui::element::ElementObject>::prepaint::h77e520462157ae34
gpui::element::AnyElement::prepaint::hfb24811c24228f32
gpui::elements::div::Interactivity::prepaint::{{closure}}::{{closure}}::{{closure}}::h6e892ad2baee7d60
gpui::elements::div::Interactivity::prepaint::{{closure}}::{{closure}}::ha07cc8ab16d300b5
gpui::elements::div::Interactivity::prepaint::{{closure}}::h4c3f052a0a12fef0
<gpui::elements::div::Div as gpui::element::Element>::prepaint::h2653c0462afde6fe
<gpui::element::Drawable<E> as gpui::element::ElementObject>::prepaint::h23d11cac4536dd3b
gpui::element::AnyElement::prepaint::hfb24811c24228f32
gpui::elements::div::Interactivity::prepaint::{{closure}}::{{closure}}::{{closure}}::h6e892ad2baee7d60
gpui::elements::div::Interactivity::prepaint::{{closure}}::{{closure}}::ha07cc8ab16d300b5
gpui::elements::div::Interactivity::prepaint::{{closure}}::h4c3f052a0a12fef0
<gpui::elements::div::Div as gpui::element::Element>::prepaint::h2653c0462afde6fe
<gpui::element::Drawable<E> as gpui::element::ElementObject>::prepaint::h23d11cac4536dd3b
gpui::element::AnyElement::prepaint::hfb24811c24228f32
gpui::elements::div::Interactivity::prepaint::{{closure}}::{{closure}}::{{closure}}::h6e892ad2baee7d60
gpui::elements::div::Interactivity::prepaint::{{closure}}::{{closure}}::ha07cc8ab16d300b5
gpui::elements::div::Interactivity::prepaint::{{closure}}::h4c3f052a0a12fef0
<gpui::elements::div::Div as gpui::element::Element>::prepaint::h2653c0462afde6fe
<gpui::element::Drawable<E> as gpui::element::ElementObject>::prepaint::h23d11cac4536dd3b
gpui::element::AnyElement::prepaint::hfb24811c24228f32
gpui::elements::div::Interactivity::prepaint::{{closure}}::{{closure}}::{{closure}}::h6e892ad2baee7d60
gpui::elements::div::Interactivity::prepaint::{{closure}}::{{closure}}::ha07cc8ab16d300b5
gpui::elements::div::Interactivity::prepaint::{{closure}}::h4c3f052a0a12fef0
<gpui::elements::div::Div as gpui::element::Element>::prepaint::h2653c0462afde6fe
<gpui::element::Drawable<E> as gpui::element::ElementObject>::prepaint::h23d11cac4536dd3b
gpui::element::AnyElement::prepaint::hfb24811c24228f32
gpui::elements::div::Interactivity::prepaint::{{closure}}::{{closure}}::{{closure}}::h6e892ad2baee7d60
gpui::elements::div::Interactivity::prepaint::{{closure}}::{{closure}}::ha07cc8ab16d300b5
gpui::elements::div::Interactivity::prepaint::{{closure}}::h4c3f052a0a12fef0
<gpui::elements::div::Div as gpui::element::Element>::prepaint::h2653c0462afde6fe
<gpui::element::Drawable<E> as gpui::element::ElementObject>::prepaint::h23d11cac4536dd3b
gpui::element::AnyElement::prepaint::hfb24811c24228f32
gpui::elements::div::Interactivity::prepaint::{{closure}}::{{closure}}::{{closure}}::h6e892ad2baee7d60
gpui::elements::div::Interactivity::prepaint::{{closure}}::{{closure}}::ha07cc8ab16d300b5
gpui::elements::div::Interactivity::prepaint::{{closure}}::h4c3f052a0a12fef0
<gpui::elements::div::Div as gpui::element::Element>::prepaint::h2653c0462afde6fe
<gpui::element::Drawable<E> as gpui::element::ElementObject>::prepaint::h23d11cac4536dd3b
gpui::element::AnyElement::prepaint::hfb24811c24228f32
gpui::elements::div::Interactivity::prepaint::{{closure}}::{{closure}}::{{closure}}::h6e892ad2baee7d60
gpui::elements::div::Interactivity::prepaint::{{closure}}::{{closure}}::ha07cc8ab16d300b5
gpui::elements::div::Interactivity::prepaint::{{closure}}::h4c3f052a0a12fef0
<gpui::elements::div::Div as gpui::element::Element>::prepaint::h2653c0462afde6fe
<gpui::element::Drawable<E> as gpui::element::ElementObject>::prepaint::h23d11cac4536dd3b
gpui::element::AnyElement::prepaint::hfb24811c24228f32
gpui::elements::div::Interactivity::prepaint::{{closure}}::{{closure}}::{{closure}}::h6e892ad2baee7d60
gpui::elements::div::Interactivity::prepaint::{{closure}}::{{closure}}::ha07cc8ab16d300b5
gpui::elements::div::Interactivity::prepaint::{{closure}}::h4c3f052a0a12fef0
<gpui::elements::div::Div as gpui::element::Element>::prepaint::h2653c0462afde6fe
<gpui::element::Drawable<E> as gpui::element::ElementObject>::prepaint::h23d11cac4536dd3b
gpui::element::AnyElement::prepaint::hfb24811c24228f32
<gpui::view::AnyView as gpui::element::Element>::prepaint::hd0c3691899c67481
<gpui::element::Drawable<E> as gpui::element::ElementObject>::prepaint::hb4bdce46d0c9f64d
gpui::element::AnyElement::prepaint::hfb24811c24228f32
gpui::window::WindowContext::draw::h23dcd3e09c187f8d
gpui::window::Window::new::{{closure}}::{{closure}}::h5214a420031dabfa
gpui::window::Window::new::{{closure}}::hd357fe3d1909fa8f
gpui::platform::mac::window::step::hd3f5b22f168c2109

@notpeter notpeter changed the title Zed gets stuck when opening a specific file Zed hangs on large null file Jan 23, 2025
@notpeter notpeter added editor Feedback for code editing, formatting, editor iterations, etc reproducible Verified steps to reproduce included panic / crash [core label] freeze Editor or OS - freezing / hanging / locking and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Jan 23, 2025
@osiewicz
Copy link
Contributor

osiewicz commented Jan 24, 2025

This would be just as reproducible with any file with long lines (note that file with only nulls is still a valid, albeit weird, UTF-8 file); the underlying issue is that we always lay out full line, so we have to go through about ~200k text fragments. I wonder why it's not hitting the line cache though, I'd expect that to take effect the first time we lay out the line?

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 freeze Editor or OS - freezing / hanging / locking panic / crash [core label] reproducible Verified steps to reproduce included
Projects
None yet
Development

No branches or pull requests

3 participants