zellij icon indicating copy to clipboard operation
zellij copied to clipboard

[BUG] calling the root session after attaching another one from it makes zellij collapse on itself

Open silicakes opened this issue 2 years ago • 4 comments

Unfortunately zellij --debug didn't create any logs for me at the specified location (i.e in the tmp dir).

Basic information

zellij --version: 0.36.0 stty size: 88 133 uname -av or ver(Windows): Darwin MacBook-Pro.local 21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:23 PDT 2021; root:xnu-8019.41.5~1/RELEASE_X86_64 x86_64

List of programs you interact with as, PROGRAM --version: Irrelevant

Further information Reproduction steps:

  1. Open two separate sessions A and B.
  2. Attach session B from session A zellij attach B
  3. Attach session A from the newly attached session B zellij attach A

Demo video: https://github.com/zellij-org/zellij/assets/1759539/f863002b-e965-43a7-b3ac-c01e9e782741

silicakes avatar Jun 14 '23 21:06 silicakes

Session A and B, Although they are two different sessions, under the hood, they still share the same session metadata, including screen thread.

Also, zellij does not support attach the current session. By doing step 3, it sounds like it tries to attach current session indirectly? the render went wrong at step 3.

Interesting bug, but need some further investigations

Kangaxx-0 avatar Jun 16 '23 01:06 Kangaxx-0

@Kangaxx-0 can you suggest any action items on this?

silicakes avatar Jun 16 '23 22:06 silicakes

@Kangaxx-0 can you suggest any action items on this?

I want to take this back - ~~Session A and B, Although they are two different sessions, under the hood, they still share the same session metadata, including screen thread.~~, This is completely misleading, because you probably had two zellij processes, so A and B are separated, and run by different sockets.

I will run some investigation and hopefully could fix it or give some suggestions

Kangaxx-0 avatar Jun 17 '23 00:06 Kangaxx-0

I think I know what's going on to this issue, whenever we attach a session, the first thing zellij server does is to resize the terminal. But when you have two sessions, and try attaching with each other, zellij will loop below steps:

  1. The server calculates the new Size of the terminal.
  2. It then proceeds to resize the terminal based on this calculation.
  3. The updated tty size triggers a SIGWINCH signal as the size has changed.
  4. Zellij has a dedicated thread to listen for SIGWINCH signals. Upon capturing this signal, Zellij initiates a resize instruction, which loops back to step 1.

This is the reason why the pane has shrunk line by line, while you were not able to send any input.

In which user scenarios you need to inter-attach two different sessions? To fix this issue, it is going to be BIG change

Kangaxx-0 avatar Jun 20 '23 23:06 Kangaxx-0