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

Improve startup error handling and reporting for plugins #2092

Closed
har7an opened this issue Jan 14, 2023 · 2 comments · Fixed by #2093
Closed

Improve startup error handling and reporting for plugins #2092

har7an opened this issue Jan 14, 2023 · 2 comments · Fixed by #2093

Comments

@har7an
Copy link
Contributor

har7an commented Jan 14, 2023

Moved from #1753:

I'd like to call out an example of how error handling could be improved that is easily reproduced.

I recently messed with my filesystem with specific goals in mind and a side effect that I missed was my user's .cache directory getting owned by root. Everything I previously used could still function since those .cache artifacts already existed and were still owned by me. zellij was the first new thing I tried since this mistake.

When starting zellij for the first time it crashed with a pretty verbose file not found and permission denied error but no specifics as to the file. I then tried the recommended RUST env var to get more info, but the backtrace was unusable as it was all <unknown> entries.

The only reason I found /tmp/zellij-1000/zellig-log was because I also tried strace against zellij. That log is the only place I got usable info to solve my problem as it specifically stated failed to create datadir in ".../.cache/...". So the quick and easy improvement is to mention the log file in the error messages. The other improvement would be getting the same information that's in the log file into the error message that's displayed to the user.

Originally posted by @alaricljs in #1753 (comment)

har7an added a commit to har7an/zellij that referenced this issue Jan 14, 2023
in case they aren't existent and don't mark errors to do so as
non-fatal. The latter masks the underlying cause when e.g. the `.cache`
folder is, for some reason, not writable by zellij (See zellij-org#2092), whereas
the former fixes problems arising from the user having purged their
.cache/zellij folder entirely.
@har7an
Copy link
Contributor Author

har7an commented Jan 14, 2023

@alaricljs I'm moving your comment over here so we can discuss your suggestions better.

First: Thanks for raising this issue!

I had a look at the code and you're totally right. The error is being recognized, but the wrong error is reported to the user. I've already changed that in my development version so the situation will now be much clearer to begin with.

About the logfile: I have rewritten the panic message to include this bit of information, it now looks like this:

  × Thread 'wasm' panicked.
  ├─▶ Originating Thread(s)
  │   	1. ipc_server: NewClient
  │   	2. screen_thread: NewTab
  │   	3. plugin_thread: NewTab
  │   
  ├─▶ At zellij-server/src/lib.rs:745:18
  ╰─▶ Program terminates: a fatal error occured
      
      Caused by:
          0: failed to load plugin for client 1
          1: failed to start plugin PluginConfig {
               [ ... ]
          2: failed to create datadir in "/var/home/hartan/.cache/zellij/zellij:tab-bar"
          3: Permission denied (os error 13)
  help: If you are seeing this message, it means that something went wrong.
        
        -> To get additional information, check the log at: /tmp/zellij-1000/zellij-log/zellij.log
        -> To see a backtrace next time, reproduce the error with: RUST_BACKTRACE=1 zellij [...]
        -> To help us fix this, please open an issue: https://github.com/zellij-org/zellij/issues

Do you think this is an improvement over the previous situation? Would you like to see something else as part of the panic message, any additional information we may give to users?

About the backtrace: We are aware of this problem and looking for a way to fix it.

@alaricljs
Copy link

Hey @har7an, looks good and I can't think of anything else that would have been helpful.

har7an added a commit to har7an/zellij that referenced this issue Jan 19, 2023
in case they aren't existent and don't mark errors to do so as
non-fatal. The latter masks the underlying cause when e.g. the `.cache`
folder is, for some reason, not writable by zellij (See zellij-org#2092), whereas
the former fixes problems arising from the user having purged their
.cache/zellij folder entirely.
har7an added a commit that referenced this issue Jan 19, 2023
* server/plugins: Always recreate plugin folders

in case they aren't existent and don't mark errors to do so as
non-fatal. The latter masks the underlying cause when e.g. the `.cache`
folder is, for some reason, not writable by zellij (See #2092), whereas
the former fixes problems arising from the user having purged their
.cache/zellij folder entirely.

* utils/errors: Rewrite panic message

* changelog: Add PR #2093
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants