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

fix(router): retry messages when server is not ready #1651

Merged
merged 2 commits into from
Aug 11, 2022
Merged

Conversation

imsnif
Copy link
Member

@imsnif imsnif commented Aug 11, 2022

This fixes a crash introduced in the latest release where Zellij would sometimes crash on startup with this error:

Error occurred in server:

  × Thread 'server_router' panicked.
  ├─▶ Originating Thread(s)
  │     1. stdin_handler_thread: AcceptInput
  │   
  ├─▶ At zellij-server/src/route.rs:503:30
  ╰─▶ called `Option::unwrap()` on a `None` value
  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`.

This was a race condition that happened when the Zellij client sent a message to the server before it was ready. This was exposed in the latest release because we broke down the queries we make to the terminal emulator (for stuff like pixel-to-cell dimensions and the terminal color palette) into several different messages. This caused them to be sent faster and hit the issue.

This fix involves adding a retry queue for these kinds of messages, placing instructions there when the server is not ready, and retrying them again along with the next messages when they come.

Right now I only implemented this for this one particular message that was causing the issue as an experiment. Care should be taken before duplicating this logic to other instructions.

@imsnif imsnif temporarily deployed to cachix August 11, 2022 10:18 Inactive
@imsnif imsnif temporarily deployed to cachix August 11, 2022 10:19 Inactive
@imsnif imsnif merged commit e910db9 into main Aug 11, 2022
@har7an har7an deleted the fix-router-crash branch October 23, 2022 15:09
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 this pull request may close these issues.

1 participant