monocle icon indicating copy to clipboard operation
monocle copied to clipboard

Monocle plugin crash zellij

Open 0inp opened this issue 2 years ago • 15 comments

I just upgrade to monocle version 0.39, and invoking the plugin result in crashing zellij with the message Received empty message from server

I'm using zellij version 0.39.1

0inp avatar Nov 14 '23 20:11 0inp

Sorry for the experience! Could you please attach some logs?

There is a known issue about device files as mentioned in the readme - could this be related?

imsnif avatar Nov 15 '23 07:11 imsnif

Hey ! Thanks for returning back to me ! I'd like to help ! Here's the part of the log file where I launch zellij and the monocle plugin: zellij.log

More information on my system:

➜ uname -av                                                                                                                                                                                                                       
Darwin MacBook-Air-de-Pascal.local 21.6.0 Darwin Kernel Version 21.6.0: Wed Oct  4 23:55:28 PDT 2023; root:xnu-8020.240.18.704.15~1/RELEASE_X86_64 x86_64
➜ alacritty -V                                                                                                                                                                                                                       
alacritty 0.12.3 (5efb069)
➜ zellij -V
zellij 0.39.1

Please don't hesitate if you want more info from me or if I can open a PR.

0inp avatar Nov 15 '23 13:11 0inp

Hum... not a lot of information there unfortunately. Could you share a bit how you loaded the plugin? What are the steps you did? Which folder did you start it in?

imsnif avatar Nov 15 '23 14:11 imsnif

Here are the steps: 1 - Open Alacritty in the root ~ directory 2 - Ensure that there are no sessions with zellij kill-all-sessions and zellij delete-all-sessions 3 - Invoke zellij command 4 - Invoke the monocle plugin command (with one of the zellij plugin commands in the README or with the F1 keybind as stated in the README as well

0inp avatar Nov 15 '23 18:11 0inp

My suspicion is that this happens because of a certain file type we're not reading properly (the "known issue" in the README). Do you have device files in your home folder? Could you maybe try a few different folders (specifically with the F1 or Alt m keybinding) and see if it happens everywhere?

imsnif avatar Nov 15 '23 18:11 imsnif

Yes, this happens in every directories (for example inside my dotfiles directory, in the section related to zellij, with only the config.kdl and other files in layouts, plugins and themes directories cf:

symlinks/config/zellij on  master [!]
➜ ls -T
.
├── config.kdl
├── layouts
│  ├── terminal.kdl
│  └── zjstatus.kdl
├── plugins
│  ├── forgot.wasm
│  ├── monocle.wasm
│  └── zjstatus.wasm
└── themes
   ├── catppuccin.kdl
   └── dracula.kdl

0inp avatar Nov 15 '23 18:11 0inp

Would you be comfortable compiling this plugin on your own and loading the resulting wasm file to see if it happens? This really shouldn't be a thing, but you never know...

Otherwise I'll try to provide you with some debug versions next week to help troubleshoot this. We don't get an error in the logs, so we'll have to do some guesswork before finding out what's wrong here.

imsnif avatar Nov 15 '23 21:11 imsnif

I'm not an expert in Rust, so I don't really know how this work, I'm sorry 😅. Here's what I did:

  • I cloned the repo
  • I run zellij -l dev.kdl like stated in the README.md
  • Unfortunately, the pane supposed to run the command cargo build && zellij action start-or-reload-plugin file:target/wasm32-wasi/debug/monocle.wasm failed with the cargo command not found error. which is weird since I installed rust.
  • I quit that pane and in another one run the two commands separately:
  • First cargo build which runs perfectly
  • Then I load the plugin with zellij action start-or-reload-plugin file:target/wasm32-wasi/debug/monocle.wasm The zellij session crash with the same message. Here are the logs:
INFO   |zellij_client            | 2023-11-17 08:13:55.528 [main      ] [zellij-client/src/lib.rs:159]: Starting Zellij client! 
INFO   |zellij_server            | 2023-11-17 08:13:55.558 [main      ] [zellij-server/src/lib.rs:246]: Starting Zellij server! 
INFO   |zellij_server            | 2023-11-17 08:13:55.624 [main      ] [zellij-server/src/lib.rs:919]: Compiling plugins using Cranelift 
WARN   |zellij_server::route     | 2023-11-17 08:13:55.626 [server_router] [zellij-server/src/route.rs:897]: Server not ready, trying to place instruction in retry queue... 
WARN   |zellij_server::route     | 2023-11-17 08:13:55.626 [server_router] [zellij-server/src/route.rs:998]: Server ready, retrying sending instruction. 
INFO   |zellij_server::plugins   | 2023-11-17 08:13:55.627 [wasm      ] [zellij-server/src/plugins/mod.rs:149]: Wasm main thread starts 
ERROR  |zellij_server::plugins::w| 2023-11-17 08:13:55.633 [async-std/runti] [zellij-server/src/plugins/wasm_bridge.rs:815]: failed to start plugin 1 for client 1

Caused by:
    0: No such file or directory (os error 2): '/Users/oinp/Library/Application Support/org.Zellij-Contributors.Zellij/plugins/target/wasm32-wasi/debug/monocle.wasm'
    1: No such file or directory (os error 2): 'target/wasm32-wasi/debug/monocle.wasm'
    2: failed to load plugin from disk 
ERROR  |zellij_server::background| 2023-11-17 08:13:55.637 [async-std/runti] [zellij-server/src/background_jobs.rs:424]: Failed to read created stamp of resurrection file: Os { code: 2, kind: NotFound, message: "No such file or directory" } 
INFO   |zellij_server::plugins::p| 2023-11-17 08:13:55.661 [async-std/runti] [zellij-server/src/plugins/plugin_loader.rs:495]: Loaded plugin 'tab-bar' from cache folder at '/Users/oinp/Library/Caches/org.Zellij-Contributors.Zellij' in 14.852333ms 
INFO   |zellij_server            | 2023-11-17 08:13:55.661 [async-std/runti] [zellij-server/src/lib.rs:919]: Compiling plugins using Cranelift 
INFO   |zellij_server::plugins::p| 2023-11-17 08:13:55.680 [async-std/runti] [zellij-server/src/plugins/plugin_loader.rs:495]: Loaded plugin 'status-bar' from cache folder at '/Users/oinp/Library/Caches/org.Zellij-Contributors.Zellij' in 31.997438ms 
INFO   |zellij_server            | 2023-11-17 08:13:55.681 [async-std/runti] [zellij-server/src/lib.rs:919]: Compiling plugins using Cranelift 
ERROR  |???                      | 2023-11-17 08:14:09.872 [screen    ] [zellij-server/src/panes/tiled_panes/mod.rs:806]: a non-fatal error occured

Caused by:
    0: failed to resize tab horizontally
    1: Ran out of room for spans 
ERROR  |zellij_server::background| 2023-11-17 08:14:55.644 [async-std/runti] [zellij-server/src/background_jobs.rs:424]: Failed to read created stamp of resurrection file: Os { code: 2, kind: NotFound, message: "No such file or directory" } 
ERROR  |zellij_server::plugins   | 2023-11-17 08:14:55.646 [wasm      ] [zellij-server/src/plugins/mod.rs:432]: Plugin with id: 1 not found 
ERROR  |zellij_server::background| 2023-11-17 08:15:55.664 [async-std/runti] [zellij-server/src/background_jobs.rs:424]: Failed to read created stamp of resurrection file: Os { code: 2, kind: NotFound, message: "No such file or directory" } 
ERROR  |zellij_server::plugins   | 2023-11-17 08:15:55.666 [wasm      ] [zellij-server/src/plugins/mod.rs:432]: Plugin with id: 1 not found 
ERROR  |zellij_server::background| 2023-11-17 08:16:55.675 [async-std/runti] [zellij-server/src/background_jobs.rs:424]: Failed to read created stamp of resurrection file: Os { code: 2, kind: NotFound, message: "No such file or directory" } 
ERROR  |zellij_server::plugins   | 2023-11-17 08:16:55.677 [wasm      ] [zellij-server/src/plugins/mod.rs:432]: Plugin with id: 1 not found 
ERROR  |zellij_server::background| 2023-11-17 08:17:55.683 [async-std/runti] [zellij-server/src/background_jobs.rs:424]: Failed to read created stamp of resurrection file: Os { code: 2, kind: NotFound, message: "No such file or directory" } 
ERROR  |zellij_server::plugins   | 2023-11-17 08:17:55.684 [wasm      ] [zellij-server/src/plugins/mod.rs:432]: Plugin with id: 1 not found 
ERROR  |zellij_server::background| 2023-11-17 08:18:55.690 [async-std/runti] [zellij-server/src/background_jobs.rs:424]: Failed to read created stamp of resurrection file: Os { code: 2, kind: NotFound, message: "No such file or directory" } 
ERROR  |zellij_server::plugins   | 2023-11-17 08:18:55.690 [wasm      ] [zellij-server/src/plugins/mod.rs:432]: Plugin with id: 1 not found 
ERROR  |zellij_server::background| 2023-11-17 08:19:55.696 [async-std/runti] [zellij-server/src/background_jobs.rs:424]: Failed to read created stamp of resurrection file: Os { code: 2, kind: NotFound, message: "No such file or directory" } 
ERROR  |zellij_server::plugins   | 2023-11-17 08:19:55.697 [wasm      ] [zellij-server/src/plugins/mod.rs:432]: Plugin with id: 1 not found 
ERROR  |zellij_server::background| 2023-11-17 08:20:55.703 [async-std/runti] [zellij-server/src/background_jobs.rs:424]: Failed to read created stamp of resurrection file: Os { code: 2, kind: NotFound, message: "No such file or directory" } 
ERROR  |zellij_server::plugins   | 2023-11-17 08:20:55.704 [wasm      ] [zellij-server/src/plugins/mod.rs:432]: Plugin with id: 1 not found 
INFO   |zellij_server::plugins::w| 2023-11-17 08:21:52.596 [wasm      ] [zellij-server/src/plugins/wasm_bridge.rs:231]: Bye from plugin 1 
WARN   |zellij_server::plugins   | 2023-11-17 08:21:55.372 [wasm      ] [zellij-server/src/plugins/mod.rs:221]: Plugin /Users/oinp/dev/monocle/target/wasm32-wasi/debug/monocle.wasm not found, starting it instead 
ERROR  |zellij_server::background| 2023-11-17 08:21:55.725 [async-std/runti] [zellij-server/src/background_jobs.rs:424]: Failed to read created stamp of resurrection file: Os { code: 2, kind: NotFound, message: "No such file or directory" } 
ERROR  |zellij_server::plugins   | 2023-11-17 08:21:55.726 [wasm      ] [zellij-server/src/plugins/mod.rs:432]: Plugin with id: 3 not found 
INFO   |zellij_server::plugins::p| 2023-11-17 08:22:08.146 [async-std/runti] [zellij-server/src/plugins/plugin_loader.rs:536]: Compiled plugin '/Users/oinp/dev/monocle/target/wasm32-wasi/debug/monocle.wasm' in 12.481562077s 
INFO   |zellij_server            | 2023-11-17 08:22:08.165 [async-std/runti] [zellij-server/src/lib.rs:919]: Compiling plugins using Cranelift 
INFO   |zellij_server            | 2023-11-17 08:22:08.328 [async-std/runti] [zellij-server/src/lib.rs:919]: Compiling plugins using Cranelift 
INFO   |zellij_server            | 2023-11-17 08:22:08.393 [async-std/runti] [zellij-server/src/lib.rs:919]: Compiling plugins using Cranelift 
WARN   |zellij_utils::ipc        | 2023-11-17 08:22:08.484 [router    ] [zellij-utils/src/ipc.rs:223]: Error in IpcReceiver.recv(): InvalidMarkerRead(Error { kind: UnexpectedEof, message: "failed to fill whole buffer" }) 
ERROR  |zellij_client            | 2023-11-17 08:22:08.484 [router    ] [zellij-client/src/lib.rs:356]: Received empty message from server 

Well, I really don't know what's wrong with my config...

0inp avatar Nov 17 '23 13:11 0inp

Thank you very much for giving this a try even though you don't know the rust tooling!

I'm going on a conference next week, but the week afterwards I'm going to give you some debug builds for you to run without all this trouble so that we can troubleshoot this and find out what's going on. Thanks for your cooperation and patience!

imsnif avatar Nov 17 '23 15:11 imsnif

For me it's also crashing on startup, also on a mac (m1).

These are the logs when running the dev.kdl:

WARN   |zellij_utils::input::layo| 2023-12-23 12:36:34.495 [main      ] [zellij-utils/src/input/layout.rs:1035]: Failed to read swap layout file: dev.swap.kdl. Error: Os { code: 2, kind: NotFound, message: "No such file or directory" } 
INFO   |zellij_server            | 2023-12-23 12:36:34.496 [async-std/runti] [zellij-server/src/lib.rs:919]: Compiling plugins using Cranelift 
INFO   |zellij_server            | 2023-12-23 12:36:34.496 [async-std/runti] [zellij-server/src/lib.rs:919]: Compiling plugins using Cranelift 
INFO   |zellij_server            | 2023-12-23 12:36:34.502 [async-std/runti] [zellij-server/src/lib.rs:919]: Compiling plugins using Cranelift 
INFO   |zellij_server            | 2023-12-23 12:36:34.505 [async-std/runti] [zellij-server/src/lib.rs:919]: Compiling plugins using Cranelift 
ERROR  |???                      | 2023-12-23 12:36:34.531 [screen    ] [zellij-server/src/panes/grid.rs:2237]: a non-fatal error occured

Caused by:
    Unknown component: z 
INFO   |zellij_server::plugins::p| 2023-12-23 12:36:34.630 [async-std/runti] [zellij-server/src/plugins/plugin_loader.rs:495]: Loaded plugin '/Users/y/Workspace/monocle/target/wasm32-wasi/debug/monocle.wasm' from cache folder at '/Users/y/Library/Caches/org.Zellij-Contributors.Zellij' in 52.335416ms 
INFO   |zellij_server            | 2023-12-23 12:36:34.632 [async-std/runti] [zellij-server/src/lib.rs:919]: Compiling plugins using Cranelift 
INFO   |zellij_server            | 2023-12-23 12:36:34.658 [async-std/runti] [zellij-server/src/lib.rs:919]: Compiling plugins using Cranelift 
INFO   |zellij_server            | 2023-12-23 12:36:34.667 [async-std/runti] [zellij-server/src/lib.rs:919]: Compiling plugins using Cranelift 
ERROR  |zellij_utils::input::perm| 2023-12-23 12:36:34.677 [async-std/runti] [zellij-utils/src/input/permission.rs:51]: Failed to read permission cache file: No such file or directory (os error 2) 
INFO   |zellij_server            | 2023-12-23 12:36:34.678 [async-std/runti] [zellij-server/src/lib.rs:919]: Compiling plugins using Cranelift 
WARN   |zellij_utils::ipc        | 2023-12-23 12:36:34.679 [router    ] [zellij-utils/src/ipc.rs:223]: Error in IpcReceiver.recv(): InvalidMarkerRead(Error { kind: UnexpectedEof, message: "failed to fill whole buffer" }) 
ERROR  |zellij_client            | 2023-12-23 12:36:34.679 [router    ] [zellij-client/src/lib.rs:356]: Received empty message from server 

Yzoni avatar Dec 23 '23 11:12 Yzoni

I manually created a permissions.kdl by copying it from a working setup on linux and put it under /Users/y/Library/Caches/org.Zellij-Contributors.Zellij/permissions.kdl. And edited the path to the wasm binary on the mac.

There is no prompt like it shows in the screenshot of https://github.com/zellij-org/zellij/releases of 0.38.0 (yet before it crashes?).

It now doesn't display the Failed to read permission cache file: No such file or directory (os error 2) anymore. But still crashes zellij.

Yzoni avatar Dec 23 '23 11:12 Yzoni

Strider also crashes btw, so the issue is not limited to this plugin.

Yzoni avatar Dec 25 '23 10:12 Yzoni

image encountered the same crash, I build a debug target and capture the stack when it crashed, hope it would be helpful.

observer17 avatar Jan 26 '24 09:01 observer17

Just tried this out and zellij went to 800% cpu and core dumped when exiting :man_shrugging:

zellij plugin -- https://github.com/imsnif/monocle/releases/latest/download/monocle.wasm

Zellij 0.40.1 on NixOS 24.05.

metaspace avatar Nov 05 '24 10:11 metaspace

I have neglected updating this plugin for a long time. I promise to get back to it soon!!

imsnif avatar Nov 05 '24 10:11 imsnif