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

Markdown preview: "not enough space in Arena" #10824

Closed
1 task done
kud1ing opened this issue Apr 21, 2024 · 9 comments
Closed
1 task done

Markdown preview: "not enough space in Arena" #10824

kud1ing opened this issue Apr 21, 2024 · 9 comments
Labels
defect [core label] language An umbrella label for all programming languages syntax behaviors markdown Markdown markup support panic / crash [core label]

Comments

@kud1ing
Copy link

kud1ing commented Apr 21, 2024

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

When i try to open the preview on a Markdown file (2600 lines, 99 kB) it "crashes".

Environment

Zed: v0.131.6 (Zed)
OS: macOS 14.4.1
Memory: 32 GiB
Architecture: aarch64

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

2024-04-21T18:00:49+02:00 [INFO] ========== starting zed ==========
2024-04-21T18:00:49+02:00 [INFO] Opening main db
2024-04-21T18:00:49+02:00 [INFO] Using git binary path: Some("/Applications/Zed.app/Contents/MacOS/git")
2024-04-21T18:00:49+02:00 [INFO] set environment variables from shell:/bin/zsh, [...]
2024-04-21T18:00:49+02:00 [ERROR] crates/zed/src/zed.rs:628: EOF while parsing a value at line 1 column 0
2024-04-21T18:00:49+02:00 [INFO] Opening main db
2024-04-21T18:00:49+02:00 [INFO] building git repository, .git path in the worktree: ".git"
2024-04-21T18:00:49+02:00 [INFO] Opening main db
2024-04-21T18:00:49+02:00 [INFO] Opening main db
2024-04-21T18:00:49+02:00 [INFO] Initializing default prettier with plugins {}
2024-04-21T18:00:49+02:00 [INFO] Initializing default prettier with plugins {}
2024-04-21T18:00:49+02:00 [INFO] starting language server "rust-analyzer", path: "[...]", id: 1
2024-04-21T18:00:49+02:00 [INFO] Initializing default prettier with plugins {}
2024-04-21T18:00:49+02:00 [INFO] fetching latest version of language server "rust-analyzer"
2024-04-21T18:00:50+02:00 [INFO] downloading language server "rust-analyzer"
2024-04-21T18:00:50+02:00 [INFO] starting language server. binary path: "[...]", args: []
2024-04-21T18:01:02+02:00 [ERROR] {
"thread": "main",
"payload": "not enough space in Arena",
"location_data": {
"file": "/Users/administrator/actions-runner-2/_work/zed/zed/crates/gpui/src/arena.rs",
"line": 80
},
"backtrace": [
"backtrace::capture::Backtrace::create",
"backtrace::capture::Backtrace::new",
"Zed::init_panic_hook::{closure#0}",
"std::panicking::rust_panic_with_hook",
"std::panicking::begin_panic_handler::{{closure}}",
"std::sys_common::backtrace::__rust_end_short_backtrace",
"_rust_begin_unwind",
"core::panicking::panic_fmt",
"gpui::element::AnyElement::new::gpui::elements::div::Div",
"<gpui::elements::div::Div as gpui::element::ParentElement>::children::<gpui::elements::div::Div, alloc::vec::Vecgpui::elements::div::Div>",
"markdown_preview::markdown_renderer::render_markdown_block",
"markdown_preview::markdown_renderer::render_markdown_block",
"markdown_preview::markdown_renderer::render_markdown_block",
"<markdown_preview::markdown_preview_view::MarkdownPreviewView>::new::{closure#0}::{closure#0}",
"gpui::elements::list::StateInner::layout_items",
"<gpui::elements::list::List as gpui::element::Element>::after_layout",
"<gpui::element::Drawablegpui::elements::list::List as gpui::element::ElementObject>::after_layout",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}::{closure#1}::{closure#0}",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}::{closure#1}",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}",
"gpui::window::element_cx::ElementContext::with_element_state::<gpui::elements::div::InteractiveElementState, core::option::Optiongpui::window::element_cx::Hitbox, gpui::elements::div::Interactivity::after_layout<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}>::{closure#0}",
"<gpui::elements::div::Div as gpui::element::Element>::after_layout",
"<gpui::element::Drawable<gpui::elements::div::Statefulgpui::elements::div::Div> as gpui::element::ElementObject>::after_layout",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}::{closure#1}::{closure#0}",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}::{closure#1}",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}",
"gpui::window::element_cx::ElementContext::with_element_state::<gpui::elements::div::InteractiveElementState, core::option::Optiongpui::window::element_cx::Hitbox, gpui::elements::div::Interactivity::after_layout<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}>::{closure#0}",
"<gpui::elements::div::Div as gpui::element::Element>::after_layout",
"<gpui::element::Drawable<gpui::elements::div::Statefulgpui::elements::div::Div> as gpui::element::ElementObject>::after_layout",
"<gpui::view::AnyView as gpui::element::Element>::after_layout",
"<gpui::element::Drawablegpui::view::AnyView as gpui::element::ElementObject>::after_layout",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}::{closure#1}::{closure#0}",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}::{closure#1}",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}",
"gpui::window::element_cx::ElementContext::with_element_state::<gpui::elements::div::InteractiveElementState, core::option::Optiongpui::window::element_cx::Hitbox, gpui::elements::div::Interactivity::after_layout<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}>::{closure#0}",
"<gpui::elements::div::Div as gpui::element::Element>::after_layout",
"<gpui::element::Drawable<gpui::elements::div::Statefulgpui::elements::div::Div> as gpui::element::ElementObject>::after_layout",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}::{closure#1}::{closure#0}",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}::{closure#1}",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}",
"gpui::window::element_cx::ElementContext::with_element_state::<gpui::elements::div::InteractiveElementState, core::option::Optiongpui::window::element_cx::Hitbox, gpui::elements::div::Interactivity::after_layout<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}>::{closure#0}",
"<gpui::elements::div::Div as gpui::element::Element>::after_layout",
"<gpui::element::Drawable<gpui::elements::div::Statefulgpui::elements::div::Div> as gpui::element::ElementObject>::after_layout",
"gpui::element::AnyElement::layout",
"<gpui::view::AnyView as gpui::element::Element>::after_layout::{closure#0}",
"<gpui::view::AnyView as gpui::element::Element>::after_layout",
"<gpui::element::Drawablegpui::view::AnyView as gpui::element::ElementObject>::after_layout",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}::{closure#1}::{closure#0}",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}::{closure#1}",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}",
"gpui::window::element_cx::ElementContext::with_element_state::<gpui::elements::div::InteractiveElementState, core::option::Optiongpui::window::element_cx::Hitbox, gpui::elements::div::Interactivity::after_layout<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}>::{closure#0}",
"<gpui::elements::div::Div as gpui::element::Element>::after_layout",
"<gpui::element::Drawable<gpui::elements::div::Statefulgpui::elements::div::Div> as gpui::element::ElementObject>::after_layout",
"<gpui::element::Drawablegpui::element::AnyElement as gpui::element::ElementObject>::after_layout",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}::{closure#1}::{closure#0}",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}::{closure#1}",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}",
"gpui::window::element_cx::ElementContext::with_element_state::<gpui::elements::div::InteractiveElementState, core::option::Optiongpui::window::element_cx::Hitbox, gpui::elements::div::Interactivity::after_layout<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}>::{closure#0}",
"<gpui::elements::div::Div as gpui::element::Element>::after_layout",
"<gpui::element::Drawable<gpui::elements::div::Statefulgpui::elements::div::Div> as gpui::element::ElementObject>::after_layout",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}::{closure#1}::{closure#0}",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}::{closure#1}",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}",
"gpui::window::element_cx::ElementContext::with_element_state::<gpui::elements::div::InteractiveElementState, core::option::Optiongpui::window::element_cx::Hitbox, gpui::elements::div::Interactivity::after_layout<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}>::{closure#0}",
"<gpui::elements::div::Div as gpui::element::Element>::after_layout",
"<gpui::element::Drawable<gpui::elements::div::Statefulgpui::elements::div::Div> as gpui::element::ElementObject>::after_layout",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}::{closure#1}::{closure#0}",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}::{closure#1}",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}",
"gpui::window::element_cx::ElementContext::with_element_state::<gpui::elements::div::InteractiveElementState, core::option::Optiongpui::window::element_cx::Hitbox, gpui::elements::div::Interactivity::after_layout<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}>::{closure#0}",
"<gpui::elements::div::Div as gpui::element::Element>::after_layout",
"<gpui::element::Drawable<gpui::elements::div::Statefulgpui::elements::div::Div> as gpui::element::ElementObject>::after_layout",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}::{closure#1}::{closure#0}",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}::{closure#1}",
"gpui::elements::div::Interactivity::after_layout::<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}",
"gpui::window::element_cx::ElementContext::with_element_state::<gpui::elements::div::InteractiveElementState, core::option::Optiongpui::window::element_cx::Hitbox, gpui::elements::div::Interactivity::after_layout<core::option::Optiongpui::window::element_cx::Hitbox, <gpui::elements::div::Div as gpui::element::Element>::after_layout::{closure#0}>::{closure#0}>::{closure#0}",
"<gpui::elements::div::Div as gpui::element::Element>::after_layout",
"<gpui::element::Drawable<gpui::elements::div::Statefulgpui::elements::div::Div> as gpui::element::ElementObject>::after_layout",
"<gpui::view::AnyView as gpui::element::Element>::after_layout",
"<gpui::element::Drawablegpui::view::AnyView as gpui::element::ElementObject>::after_layout",
"gpui::element::AnyElement::layout",
"gpui::window::WindowContext::draw",
"gpui::window::Window::new::{closure#2}::{closure#1}",
"gpui::window::Window::new::{closure#2}",
"gpui::platform::mac::window::step",
"<gpui::platform::mac::platform::MacPlatform as gpui::platform::Platform>::run",
"gpui::app::App::run::Zed::main::{closure#3}",
"Zed::main",
"std::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>",
"std::rt::lang_start::<()>::{closure#0}",
"std::rt::lang_start_internal",
"_main"
],
"app_version": "0.131.6",
"release_channel": "Zed",
"os_name": "macOS",
"os_version": "14.4.1",
"architecture": "aarch64",
"panicked_on": 1713715262955,
"installation_id": "3327696a-d413-48cd-bda3-89ea824f123c",
"session_id": "d88aae04-421d-4132-8932-70ff4f4f1eb1"
}

@kud1ing kud1ing added admin read Pending admin review defect [core label] panic / crash [core label] triage Maintainer needs to classify the issue labels Apr 21, 2024
@bennetbo
Copy link
Collaborator

Hey,
I cannot reproduce this even with larger markdown documents (> 10000 lines). Is there any possibility that you could share the contents of the file you are trying to preview?

@kud1ing
Copy link
Author

kud1ing commented Apr 22, 2024

Hi Bennet,

the content is unfortunately private. I’ll try to bisect it. For the time being: it’s basically a long nested list with checkboxes.

@bennetbo
Copy link
Collaborator

bennetbo commented Apr 22, 2024

Thanks for the information, I managed to reproduce the panic when a markdown file contains a LOT of checkboxes that are in a single block/list (for me it starts to panic when it has to render ~1100 checkboxes)

@Moshyfawn Moshyfawn added markdown Markdown markup support language An umbrella label for all programming languages syntax behaviors and removed triage Maintainer needs to classify the issue labels Apr 22, 2024
@JosephTLyons JosephTLyons removed the admin read Pending admin review label Apr 22, 2024
@bennetbo
Copy link
Collaborator

bennetbo commented Apr 22, 2024

Hey, just put up #10852 (still WIP, but should already fix your issue). Would be great if you could build from source and try to open your document, so that you can verify that it is actually fixed.

@kud1ing
Copy link
Author

kud1ing commented Apr 22, 2024

Thank you. Yes, that indeed prevents the problem.
I hope the fix is not too exotic.

If you wonder: I have a GTD style tickler file with generated tasks for each year. So that's about 365 * 5 checkboxes.

@bennetbo
Copy link
Collaborator

Thank you. Yes, that indeed prevents the problem. I hope the fix is not too exotic.

If you wonder: I have a GTD style tickler file with generated tasks for each year. So that's about 365 * 5 checkboxes.

Great to hear and thanks for testing 👍

@kud1ing
Copy link
Author

kud1ing commented Apr 24, 2024

Thank you for analysing and fixing this ... especially that quickly, didn't expect that.

bennetbo added a commit that referenced this issue Apr 26, 2024
Fixes a panic related to rendering checkboxes, see #10824.

Currently we are rendering a list into a single block, meaning the whole
block has to be rendered when it is visible on screen. This would lead
to performance problems when a single list block contained a lot of
items (especially if it contained checkboxes). This PR splits up list
items into separate blocks, meaning only the actual visible list items
on screen get rendered, instead of the whole list.
A nice side effect of the refactoring is, that you can actually click on
individual list items now:


https://github.com/zed-industries/zed/assets/53836821/5ef4200c-bd85-4e96-a8bf-e0c8b452f762

Release Notes:

- Improved rendering performance of list elements inside the markdown
preview

---------

Co-authored-by: Remco <djsmits12@gmail.com>
@JosephTLyons
Copy link
Contributor

A fix for this should be availabe in 0.134.0-pre.

@kud1ing
Copy link
Author

kud1ing commented May 2, 2024

Thank you all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect [core label] language An umbrella label for all programming languages syntax behaviors markdown Markdown markup support panic / crash [core label]
Projects
None yet
Development

No branches or pull requests

4 participants