zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
50.9k stars 3.15k forks source link

Image preview causes crash instead of failure state #14895

Closed iLynxcat closed 3 months ago

iLynxcat commented 4 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Dragging-and-dropping the below image into Zed caused it to crash immediately. Further attempts to open Zed resulted in a crash. Mitigation steps are detailed below, but if you try to open the same image in Zed again it will continue crashing.

View image on GitHub (for reproduction and analysis)

Other image viewers successfully show the file, so a bug in the responsible parsing library is probably the root cause — however, I would still expect Zed to handle the error and show a failure state rather than crashing outright.

Mitigation steps Surely similar mitigations will work (such as opening Zed via the `zed` CLI, but this was my workaround. - Control-click Zed in the Dock - Click "Show Recents" - Select another recently opened project - Reopen the affected directory in Zed _This works because Zed will not attempt to load the most recently opened file this time._

Environment

Zed: v0.144.4 (Zed) OS: macOS 15.0.0 (Sequoia public beta 1) Memory: 8 GiB Architecture: aarch64

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

Zed.log


2024-07-21T06:00:15
.507917Z [INFO] ========== starting zed ==========
2024-07-21T06:00:15.511329Z [INFO] Opening main db
2024-07-21T06:00:15.515557Z [INFO] Using git binary path: Some("/Applications/Zed.app/Contents/MacOS/git")
2024-07-21T06:00:15.657532Z [INFO] set environment variables from shell:/bin/zsh, path:/Users/lynx/.bun/bin:/Users/lynx/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/lynx/.cargo/bin:/Users/lynx/.local/state/fnm_multishells/7900_1721541615533/bin
2024-07-21T06:00:15.659343Z [ERROR] theme not found: Catppuccin Mocha
2024-07-21T06:00:15.663466Z [INFO] extensions updated. loading 6, reloading 0, unloading 0
2024-07-21T06:00:15.704201Z [INFO] Opening main db
2024-07-21T06:00:15.708738Z [INFO] building git repository, `.git` path in the worktree: ".git"
2024-07-21T06:00:15.735128Z [WARN] Theme "Catppuccin Latte" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-07-21T06:00:15.735327Z [WARN] Theme "Catppuccin Frappé" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-07-21T06:00:15.735545Z [WARN] Theme "Catppuccin Macchiato" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-07-21T06:00:15.735783Z [WARN] Theme "Catppuccin Mocha" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-07-21T06:00:15.753965Z [INFO] set status on client 0: Authenticating
2024-07-21T06:00:15.757142Z [INFO] set status on client 81940: Connecting
2024-07-21T06:00:15.770994Z [WARN] Theme "Catppuccin Latte - No Italics" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-07-21T06:00:15.771091Z [WARN] Theme "Catppuccin Frappé - No Italics" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-07-21T06:00:15.771206Z [WARN] Theme "Catppuccin Macchiato - No Italics" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-07-21T06:00:15.771393Z [WARN] Theme "Catppuccin Mocha - No Italics" is using a deprecated style property: scrollbar_thumb.background. Use `scrollbar.thumb.background` instead.
2024-07-21T06:00:16.104411Z [INFO] connected to rpc endpoint https://collab.zed.dev/rpc
2024-07-21T06:00:16.383372Z [INFO] add connection to peer
2024-07-21T06:00:16.383662Z [INFO] add_connection;
2024-07-21T06:00:16.383877Z [INFO] waiting for server hello
2024-07-21T06:00:16.384252Z [INFO] got server hello
2024-07-21T06:00:16.384472Z [INFO] set status to connected (connection id: ConnectionId { owner_id: 0, id: 0 }, peer id: PeerId { owner_id: 453, id: 3533118 })
2024-07-21T06:00:16.384855Z [INFO] set status on client 81940: Connected { peer_id: PeerId { owner_id: 453, id: 3533118 }, connection_id: ConnectionId { owner_id: 0, id: 0 } }
2024-07-21T06:
00:23.778069Z [INFO] Opening main db
2024-07-21T06:00:23.924798Z [ERROR] {
  "thread": "",
  "payload": "assertion `left == right` failed\n  left: 14592\n right: 7296",
  "location_data": {
    "file": "/Users/administrator/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zune-jpeg-0.4.11/src/worker.rs",
    "line": 411
  },
  "backtrace": [
    "::create",
    "::new",
    "zed::reliability::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",
    "core::panicking::assert_failed_inner",
    "core::panicking::assert_failed::",
    "zune_jpeg::worker::upsample",
    ">::post_process",
    ">::finish_progressive_decoding",
    ">::decode_mcu_ycbcr_progressive",
    "> as image::image::ImageDecoder>::read_image_boxed",
    "image::image::decoder_to_vec::>",
    "::load::{closure#0}",
    ", gpui::elements::img::ImageCacheError>> + core::marker::Send>>, core::result::Result, gpui::elements::img::ImageCacheError>, ::spawn_internal, gpui::elements::img::ImageCacheError>>::{closure#0}, ()>>::run",
    "_pthread_mach_thread_np"
  ],
  "app_version": "0.144.4",
  "release_channel": "Zed",
  "os_name": "macOS",
  "os_version": "15.0.0",
  "architecture": "aarch64",
  "panicked_on": 1721541623924,
  "installation_id": "12d12e0c-0016-43ab-8d43-f1d18ec5894b",
  "session_id": "81dfd611-6de1-4e2d-a9f2-12d50bf63bb1"
}

macOS crash report via pastes.sh

notpeter commented 3 months ago

I am able to open the image without crashing on Zed 0.149.0. Can you update Zed and confirm this is still happening? (We did improve image support in the past few weeks)

iLynxcat commented 3 months ago

no issue with this now! thank you!