zellij-org / zellij

A terminal workspace with batteries included
https://zellij.dev
MIT License
22k stars 671 forks source link

wasm crash on startup from $HOME #2123

Closed Lillecarl closed 1 year ago

Lillecarl commented 1 year ago

Basic information

zellij --version: zellij 0.34.4 stty size: 61 238 uname -av : Linux nub 6.1.7-xanmod1 #1-NixOS SMP PREEMPT_DYNAMIC Tue Jan 1 00:00:00 UTC 1980 x86_64 GNU/Linux wezterm --version: wezterm 20221119-145034-49b9839f plasmashell --version: plasmashell 5.26.5 xonsh --version: xonsh/0.13.4

Further information How i reproduce this: start zellij from $HOME, starting it from another directory works fine

Backtrace:

~ 🐚 xonsh
❌1 ❯ $RUST_BACKTRACE = 1; zellij

Error occurred in server:

  × Thread 'wasm' panicked.
  ├─▶ Originating Thread(s)
  │     1. ipc_server: NewClient
  │     2. screen_thread: NewTab
  │     3. plugin_thread: NewTab
  │
  ├─▶ At library/std/src/sys/unix/time.rs:66:9
  ╰─▶ assertion failed: tv_nsec >= 0 && tv_nsec < NSEC_PER_SEC as i64

      Panic backtrace:
         0: <unknown>
         1: <unknown>
         2: <unknown>
         3: <unknown>
         4: <unknown>
         5: <unknown>
         6: <unknown>
         7: <unknown>
         8: <unknown>
         9: <unknown>
        10: <unknown>
        11: <unknown>
        12: <unknown>
        13: <unknown>
        14: <unknown>
        15: <unknown>
        16: <unknown>
        17: start_thread
        18: clone3

  help: If you are seeing this message, it means that something went wrong.
        Please report this error to the github issue.
        (https://github.com/zellij-org/zellij/issues)

        Also, if you want to see the backtrace, you can set the `RUST_BACKTRACE` environment variable to `1`.

zellij.log:

INFO   |zellij_client            | 2023-01-30 12:50:33.006 [main      ] [zellij-client/src/lib.rs:140]: Starting Zellij client! 
INFO   |zellij_server            | 2023-01-30 12:50:33.007 [main      ] [zellij-server/src/lib.rs:213]: Starting Zellij server! 
INFO   |zellij_server::plugins   | 2023-01-30 12:50:33.060 [wasm      ] [zellij-server/src/plugins/mod.rs:61]: Wasm main thread starts 
INFO   |zellij_client::input_hand| 2023-01-30 12:50:33.061 [input_handler] [zellij-client/src/input_handler.rs:151]: sending done loading 
INFO   |zellij_client::input_hand| 2023-01-30 12:50:33.061 [input_handler] [zellij-client/src/input_handler.rs:155]: done sent done loading 
ERROR  |zellij_utils::errors::not| 2023-01-30 12:50:33.064 [wasm      ] [zellij-utils/src/errors.rs:545]: Panic occured:
             thread: wasm
             location: At library/std/src/sys/unix/time.rs:66:9
             message: assertion failed: tv_nsec >= 0 && tv_nsec < NSEC_PER_SEC as i64 
WARN   |zellij_server::route     | 2023-01-30 12:50:33.065 [server_router] [zellij-server/src/route.rs:693]: Server not ready, trying to place instruction in retry queue... 
WARN   |zellij_server::route     | 2023-01-30 12:50:33.065 [server_router] [zellij-server/src/route.rs:780]: Server ready, retrying sending instruction. 
WARN   |zellij_server::route     | 2023-01-30 12:50:33.065 [server_router] [zellij-server/src/route.rs:693]: Server not ready, trying to place instruction in retry queue... 
WARN   |zellij_server::route     | 2023-01-30 12:50:33.065 [server_router] [zellij-server/src/route.rs:693]: Server not ready, trying to place instruction in retry queue... 
WARN   |zellij_server::route     | 2023-01-30 12:50:33.065 [server_router] [zellij-server/src/route.rs:780]: Server ready, retrying sending instruction. 
WARN   |zellij_server::route     | 2023-01-30 12:50:33.065 [server_router] [zellij-server/src/route.rs:693]: Server not ready, trying to place instruction in retry queue... 
WARN   |zellij_server::route     | 2023-01-30 12:50:33.065 [server_router] [zellij-server/src/route.rs:701]: Server not ready, trying to place instruction in retry queue... 
WARN   |zellij_server::route     | 2023-01-30 12:50:33.065 [server_router] [zellij-server/src/route.rs:780]: Server ready, retrying sending instruction. 
WARN   |zellij_server::route     | 2023-01-30 12:50:33.065 [server_router] [zellij-server/src/route.rs:701]: Server not ready, trying to place instruction in retry queue... 
WARN   |zellij_server::route     | 2023-01-30 12:50:33.065 [server_router] [zellij-server/src/route.rs:711]: Server not ready, trying to place instruction in retry queue... 
WARN   |zellij_server::route     | 2023-01-30 12:50:33.065 [server_router] [zellij-server/src/route.rs:780]: Server ready, retrying sending instruction. 
WARN   |zellij_server::route     | 2023-01-30 12:50:33.065 [server_router] [zellij-server/src/route.rs:711]: Server not ready, trying to place instruction in retry queue... 
WARN   |zellij_server::route     | 2023-01-30 12:50:33.065 [server_router] [zellij-server/src/route.rs:721]: Server not ready, trying to place instruction in retry queue... 
WARN   |zellij_server::route     | 2023-01-30 12:50:33.066 [server_router] [zellij-server/src/route.rs:780]: Server ready, retrying sending instruction. 
WARN   |zellij_server::route     | 2023-01-30 12:50:33.066 [server_router] [zellij-server/src/route.rs:721]: Server not ready, trying to place instruction in retry queue... 
WARN   |zellij_server::route     | 2023-01-30 12:50:33.066 [server_router] [zellij-server/src/route.rs:721]: Server not ready, trying to place instruction in retry queue... 
INFO   |zellij_client::input_hand| 2023-01-30 12:50:33.561 [input_handler] [zellij-client/src/input_handler.rs:158]: sending done loading 
INFO   |zellij_client::input_hand| 2023-01-30 12:50:33.561 [input_handler] [zellij-client/src/input_handler.rs:162]: done sent done loading 
WARN   |zellij_server::route     | 2023-01-30 12:50:33.562 [server_router] [zellij-server/src/route.rs:780]: Server ready, retrying sending instruction. 
WARN   |zellij_server::route     | 2023-01-30 12:50:33.562 [server_router] [zellij-server/src/route.rs:721]: Server not ready, trying to place instruction in retry queue... 
imsnif commented 1 year ago

Hey, thanks for the report.

I appreciate the reproduction steps, but this is probably something more particular (eg. I start Zellij from my home folder all the time and do not reproduce this).

Judging by the error, my guess would be that this has to do with some timestamp (maybe of a file?) which we do not handle well. Do you think you might be able to troubleshoot this a little further to help us with more information?

Thanks!

Lillecarl commented 1 year ago

Absolutely. I'm unaware of the startup process. But here's some more information from $HOME.

cd $HOME;exa -lah:

Permissions Size User      Date Modified Name
drwx------     - lillecarl 30 Jan 12:42  .
drwxr-xr-x     - root      18 Aug  2022  ..
drwxr-xr-x     - lillecarl 15 Nov  2022  .ansible
drwxr-xr-x     - lillecarl 22 Aug  2022  .aws
.rw-------  1.4k lillecarl  4 Nov  2022  .bash_history
.rw-r--r--   220 lillecarl  9 Sep  2022  .bash_logout
.rw-r--r--  1.4k lillecarl  5 Sep  2022  .bashrc
drwxr-xr-x     - lillecarl 30 Jan 13:48  .cache
drwxr-xr-x     - lillecarl 25 Jan 09:38  .compose-cache
drwxr-xr-x     - lillecarl 30 Jan 13:47  .config
drwx------     - lillecarl 21 Oct  2022  .dbus
drwxr-xr-x     - lillecarl 27 Oct  2022  .dvdcss
.rw-r--r--   123 lillecarl 20 Dec  2022  .fonts.conf
drwxr-xr-x     - lillecarl 26 Sep  2022  .gephi
.rw-r--r--    82 lillecarl 18 Aug  2022  .gitconfig
drwx------     - lillecarl 17 Jan 00:48  .gnupg
.rw-r--r--   270 lillecarl 30 Jan 12:27  .gtkrc-2.0
.rw-r--r--   377 lillecarl 27 Sep  2022  .inputrc
drwxr-xr-x     - lillecarl 26 Sep  2022  .java
drwx------     - lillecarl 10 Oct  2022  .jitsi
drwx------     - lillecarl 30 Jan 13:47  .keychain
drwxr-x---     - lillecarl 22 Aug  2022  .kube
drwxr-xr-x     - lillecarl 18 Aug  2022  .local
drwx------     - lillecarl 22 Aug  2022  .mongodb
drwx------     - lillecarl 18 Aug  2022  .mozilla
drwxr-xr-x     - lillecarl 12 Sep  2022  .nix-defexpr
lrwxrwxrwx    48 lillecarl 19 Aug  2022  .nix-profile -> /nix/var/nix/profiles/per-user/lillecarl/profile
.rw-r--r--    22 lillecarl 18 Aug  2022  .npmrc
drwx------     - lillecarl 18 Aug  2022  .pki
.rw-r--r--   807 lillecarl  9 Sep  2022  .profile
.rw-------    18 lillecarl 19 Jan 16:47  .python_history
drwx------     - lillecarl 27 Jan 13:04  .ssh
drwxr-xr-x     - lillecarl 25 Jan 13:37  .terraform.d
drwxr-xr-x     - lillecarl 26 Oct  2022  .terraform.versions
drwxr-xr-x     - lillecarl 19 Aug  2022  .tldrc
drwxr-xr-x     - lillecarl  7 Nov  2022  .vagrant.d
drwxr-xr-x     - lillecarl  9 Sep  2022  .var
drwxr-xr-x     - lillecarl 18 Aug  2022  .vim
.rw-------   28k lillecarl 16 Jan 23:51  .viminfo
drwxr-xr-x     - lillecarl 20 Jan 16:43  .virtualenvs
drwxr-xr-x     - lillecarl 18 Aug  2022  .vscode
.rw-r--r--   215 lillecarl 20 Jan 14:57  .wget-hsts
drwxr-xr-x     - lillecarl 25 Jan 09:38  .wine
.rw-------    48 lillecarl 16 Jan 20:14  .Xauthority
.rw-r--r--   65k lillecarl 19 Jan 16:18  .zcompdump
.rw-r--r--   67k lillecarl 19 Jan 16:18  .zcompdump-nub-5.9
.r--r--r--  145k lillecarl 19 Jan 16:18  .zcompdump-nub-5.9.zwc
drwx------     - lillecarl 10 Oct  2022  .zoom
.rw-------   25k lillecarl 17 Jan 01:40  .zsh_history
.rw-r--r--  2.5k lillecarl 21 Oct  2022  .zshrc
.rw-r--r--   65k lillecarl  2 Jan 15:59  analyze.dot
.rw-r--r--     0 lillecarl 16 Jan 21:55  asdf.xsh
drwxr-xr-x     - lillecarl 17 Jan 00:18  Code
drwx------     - lillecarl 18 Aug  2022  Desktop
drwxr-xr-x     - lillecarl 29 Jan 13:39  Downloads
.rw-r--r--   33k lillecarl 12 Dec  2022  helix
.rw-r--r--   189 lillecarl 18 Aug  2022  key.txt
.rw-r--r--   129 lillecarl 28 Oct  2022  lghinfo.txt
drwxr-xr-x     - lillecarl 21 Nov  2022  Library
.rw-r--r--   287 lillecarl 24 Nov  2022  nixtest.nix
.rw-r--r--    45 lillecarl 19 Oct  2022  privatekey
.rw-r--r--    45 lillecarl 19 Oct  2022  publickey
.rw-r--r--   231 lillecarl 30 Aug  2022  scratchpad
.rw-r--r--  764k lillecarl 19 Oct  2022  Student Guide.pdf
.rw-r--r--   114 lillecarl  4 Nov  2022  therese
drwxr-xr-x     - lillecarl  9 Jan 16:43  tmp

As you probably know Nix builds everything in 1970's. This happened after a flake update to my system (i think) but I didn't troubleshoot and have no idea when exactly this was. I've also been running zellij from $HOME before this.

It happens when spawning from both Xonsh and ZSH, my zshrc hasn't been touched in months.

I cleared out .cache/zellij and /tmp/zellij* with no success.

If you've got any suspects you'd like me to help troubleshooting I'm all ears! :)

asciinema output: https://asciinema.org/a/ESBLgLKzVexwObMgWtDmSrjjg

I'm trying to get dwarffs up and running to get debug symbols from the nix build, but for now this strace log is all I've got.

https://gist.github.com/Lillecarl/086386ee32f508c11f86655645267bc1

imsnif commented 1 year ago

I honestly don't know much about Nix...

I'm not sure if this is related, but we recently removed Nix support from the repository. Could this have an effect? If you use eg. cargo to install, does this still happen?

Otherwise, if you temporarily remove aforementioned 1970s files, does the issue still happen? (if this is the case, there's of course also a fix that should come from the Zellij side)

Lillecarl commented 1 year ago

@imsnif It's unrelated. Nixpkgs maintains their own derivation of Zellij builds here: https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/zellij/default.nix

I'll try through both the last 4 revs here https://github.com/NixOS/nixpkgs/commits/master/pkgs/tools/misc/zellij/default.nix and cargo.

The 1970's files can't be changed. The nix builder builds in an isolated environment where it's always 1970/01/01 and some clock. Builds also doesn't have access to the internet (this is to increase reproducibility of packages).

I'll get back to you! :)

raphCode commented 1 year ago

To get a build with debug symbols, have you tried cloning the zellij repo and building+running from there? cargo xtask run should do it if I am not mistaken.

Lillecarl commented 1 year ago

I was testing out riff the other day, but it didn't work out.

I think we can close this for now to not pollute the tracker, if i get a debug version running I'll reopen with more info :)

imsnif commented 1 year ago

Thanks for your vigilance though! Would be happy to take a closer look if you find a reproducer.

Lillecarl commented 1 year ago

https://gist.github.com/Lillecarl/1432d27b913274f90d19c37c5ee0c981

Replicated on 5cd412b

Latest doesn't build for me.

Does this tell you anything of use? I'm able to replicate consistently with both a cargo run and my nix packaged one.

imsnif commented 1 year ago

Unfortunately not.

I can try debugging this this, but it will be an arduous task of guessing at file timestamps and attributes. More arduous than you finding the file/folder causing this. :) If you can help me out with that, it'll be great. If not, I'm sure it'll come up in a clearer way at one time or another.

alerque commented 1 year ago

Just heard of zellij (been using tmux for over two decades) and decided to give it a shot. On Arch Linux here, not nix, and not building in 1970. Until finding this issue all I ever got was the panic shown in the original issue. Seeing this issue I tried it in some other folder, and sure enough it worked. It seems just $HOME is a problem.

Can this be re-opened or should I post a new one? It looks like it was closed without any resolution even knowing there was a problem out there.

imsnif commented 1 year ago

@alerque - best would be to open a new issue. In this case you don't need to add logs or all of the rest mentioned in the issue template, but I really need a way to reproduce this. I'm guessing this is happening due to a specific file in your home folder, but I really can't think of why. If you could do some troubleshooting on it and find the file/folder/link/etc. so we have a bit to go on, that would be great.