zed icon indicating copy to clipboard operation
zed copied to clipboard

Crash on click in editor for a JS project

Open calebmeyer opened this issue 8 months ago • 4 comments

Summary

Zed crashes frequently while working on a medium sized (140k LOC) javascript (Next.js and React) project.

Description

Steps to trigger the problem:

  1. Open the repo
  2. Click within an editor

Actual Behavior: Crash Expected Behavior: No crash

Zed Version and System Specs

Zed: v0.180.4 (Zed) OS: macOS 15.2.0 Memory: 32 GiB Architecture: aarch64

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

Partial Zed.log
2025-04-08T14:34:37.004981-05:00 [ERROR] {
  "thread": "main",
  "payload": "not enough space in Arena",
  "location_data": {
    "file": "/Users/administrator/actions-runner/_work/zed/zed/crates/gpui/src/arena.rs",
    "line": 80
  },
  "backtrace": [
    "backtrace::capture::Backtrace::create::h52f9271ec334a762+13575712",
    "backtrace::capture::Backtrace::new::hce8e52c9de3d5882+13575520",
    "zed::reliability::init_panic_hook::{{closure}}::h34d5ac32709d0a47+96460792",
    "std::panicking::rust_panic_with_hook::hc9e2ec2a12b10e12+76316668",
    "std::panicking::begin_panic_handler::{{closure}}::h3b6449e2eb83bf4c+76315456",
    "std::sys::backtrace::__rust_end_short_backtrace::h38d85099ddd107a3+76309864",
    "_rust_begin_unwind+76314668",
    "core::panicking::panic_fmt::hd4003258f6ab7b29+105978816",
    "gpui::element::Element::into_any::h85e47b2a107885ec+51450884",
    "markdown::MarkdownElementBuilder::pop_div::h01a4bdd9bd879f95+51540120",
    "<markdown::MarkdownElement as gpui::element::Element>::request_layout::hd1f874f10f0fd195+51505952",
    "gpui::element::Drawable<E>::request_layout::h1ea631f0321751ca+26810240",
    "gpui::element::Drawable<E>::request_layout::he841328b3dc318ac+26834100",
    "gpui::element::Drawable<E>::request_layout::ha618a9d34c782c7c+26828056",
    "<gpui::elements::div::Div as gpui::element::Element>::request_layout::{{closure}}::{{closure}}::h2d4e6fd0fa1aea7e+40319552",
    "gpui::elements::div::Interactivity::request_layout::{{closure}}::hae75f3fafe3e1e36+40329640",
    "<gpui::elements::div::Div as gpui::element::Element>::request_layout::h1826dfe0ed3d2ab2+40318496",
    "gpui::element::Drawable<E>::request_layout::h79a0009949566101+26824172",
    "<gpui::elements::div::Div as gpui::element::Element>::request_layout::{{closure}}::{{closure}}::h2d4e6fd0fa1aea7e+40319552",
    "gpui::elements::div::Interactivity::request_layout::{{closure}}::hae75f3fafe3e1e36+40329640",
    "<gpui::elements::div::Div as gpui::element::Element>::request_layout::h1826dfe0ed3d2ab2+40318388",
    "gpui::element::Drawable<E>::request_layout::h79a0009949566101+26824172",
    "<gpui::elements::div::Div as gpui::element::Element>::request_layout::{{closure}}::{{closure}}::h2d4e6fd0fa1aea7e+40319552",
    "gpui::elements::div::Interactivity::request_layout::{{closure}}::hae75f3fafe3e1e36+40330420",
    "<gpui::elements::div::Div as gpui::element::Element>::request_layout::h1826dfe0ed3d2ab2+40318388",
    "gpui::element::Drawable<E>::request_layout::h79a0009949566101+26824172",
    "<gpui::elements::div::Div as gpui::element::Element>::request_layout::{{closure}}::{{closure}}::h2d4e6fd0fa1aea7e+40319552",
    "gpui::elements::div::Interactivity::request_layout::{{closure}}::hae75f3fafe3e1e36+40329640",
    "<gpui::elements::div::Div as gpui::element::Element>::request_layout::h1826dfe0ed3d2ab2+40318388",
    "gpui::element::Drawable<E>::request_layout::h79a0009949566101+26824172",
    "<gpui::view::AnyView as gpui::element::Element>::request_layout::hfdab2714ca03fb7c+40764784",
    "gpui::element::Drawable<E>::request_layout::h572eb87a7ffd8268+40296776",
    "<gpui::element::Drawable<E> as gpui::element::ElementObject>::layout_as_root::h9105e8b590c49595+40309948",
    "gpui::window::Window::draw::h1dc05a48807bfe1d+40928152",
    "gpui::window::Window::new::{{closure}}::{{closure}}::h449418c7970f4a9c+40809300",
    "gpui::window::Window::new::{{closure}}::hca87b5271cb69ecb+40800288",
    "gpui::platform::mac::window::step::hf68568e31a006b5c+40658168",
    "<gpui::platform::mac::platform::MacPlatform as gpui::platform::Platform>::run::hf175604a325e58b2+40573772",
    "gpui::app::Application::run::he46d63190b0bf4ce+94340336",
    "zed::main::hc1cbeb19efc8ab65+96484008",
    "std::sys::backtrace::__rust_begin_short_backtrace::h05c3fbea1c2a63c1+96322824",
    "std::rt::lang_start::{{closure}}::h609493b7bfd1ce0e+96915476",
    "std::rt::lang_start_internal::h5f91760815528aa2+76251904",
    "_main+96498080"
  ],
  "app_version": "0.180.4",
  "app_commit_sha": "8b51ebd016552e13ab6ef38b75fe10bc3d5ab175",
  "release_channel": "stable",
  "target": "aarch64-apple-darwin",
  "os_name": "macOS",
  "os_version": "15.2.0",
  "architecture": "aarch64",
  "panicked_on": 1744140877004,
  "system_id": "ef49a4e6-8f93-48b7-8717-698f1bd0874b",
  "installation_id": "ae4673b1-3fde-4a3e-9c8c-12286a69dbef",
  "session_id": "f3e00790-78b7-4684-b287-469da918925e"
}

I didn't include the full log because it has a lot of paths to closed source code. Let me know if there's more information that would be helpful.

calebmeyer avatar Apr 08 '25 19:04 calebmeyer

Hey all! Just bumping this to say it's still a problem for me. Happy to take any troubleshooting steps needed.

calebmeyer avatar May 09 '25 19:05 calebmeyer

From the error log it looks like we're crashing while trying to render a very large markdown document. Is it possible for you to share this document? Or at least give an overview of whats in it (lots of bullet lists? lots of images? etc. as well as file size) I'd like to try and reproduce this as close as possible to your scenario so I can diagnose why so many elements are being created causing us to run out of space

probably-neb avatar May 27 '25 14:05 probably-neb

it looks like we're crashing while trying to render a very large markdown document

There are only these 5 markdown files in the repo:

Image

I can't share their contents (closed source 😢 ), but I can give you some metadata.

Readme is 21kb, 326 lines, and has 36 headings, 4 images, and the longest list inside is an ordered (numbered) list of 9 Contributing is 3.5kb, 65 lines, 10 headings, no images, and the longest list is 6 bullets The rest are even smaller.

Given you're saying it's markdown related, I wonder if it's typescript trying to parse some kind of type documentation from our internal server framework/design system. I wouldn't be surprised if we have a cycle in there. It always crashes when I click on a variable name, so I always assumed it was trying to build documentation.

For what it's worth, VS Code sometimes slows waaaaaaaay down (unusably slow) on this same repo (unless I disable the typescript integration), so it feels like a bug in the typescript compiler (or our javascript code, which is legacy and awful)

calebmeyer avatar Jun 02 '25 18:06 calebmeyer

The documentation is likely the problem, good call there. Is there any way you could find a documentation case that crashes in Zed but not in VSCode, and tell me what you see in VSCode (overview ofc, assuming the documentation is internal and closed source as well). My goal here is to determine whether this is a case we could be handling better in Zed

probably-neb avatar Jun 03 '25 08:06 probably-neb

I'm not certain, but I believe that fix may have fixed my issue. I haven't been able to make a crash happen this morning.

calebmeyer avatar Jun 23 '25 14:06 calebmeyer

Well, the issue is with the number of visual elements on screen and the PR Michael linked to this one was not merged so I don't think the issue is resolved. My guess is that while trying to reproduce there was less visual elements on screen although there may be some other PR that fixed this I'm not aware of. Please let us know if you run into this again and we will re-open

probably-neb avatar Jun 23 '25 18:06 probably-neb