Git Product home page Git Product logo

Comments (5)

mweinelt avatar mweinelt commented on September 13, 2024 4

Okay, to clarify, I was in a read-only session. So I'd still call this unexpected.

upterm host --read-only zsh

from upterm.

m0sth8 avatar m0sth8 commented on September 13, 2024 1

I think I get what is the issue here. It works only when --force-command isn't used. It also works for --read-only sessions.

How to reproduce:

  1. Run a host terminal upterm host --read-only in a terminal window.
  2. Run a client terminal ssh [email protected] in another terminal window.
  3. Terminate (close) the client terminal.
    Expected: The host terminal do nothing dramatic (triggers ClientLeftCallback callback)
    Actual: The host terminal exited with EOF error.

The reason for this behavior is the next few issues:

  1. Write and Read-only client terminals affects host terminal dimensions. issue #138
  2. When client terminal is terminated, it sends an event with width=0 and height=0 to host terminal. (https://github.com/owenthereal/upterm/blob/master/host/internal/server.go#L253).
  3. That cause host terminal to redraw.
  4. Redraw triggers a write operation to writers https://github.com/owenthereal/upterm/blob/master/host/internal/command.go#L127. It has 3 writers at this point (MultiWriter internal cache, host terminal stdout, remote session).
  5. Because remote session is already terminated that causes EOF error.

Possible ways to fix:

  1. Don't redraw the host terminal when the client terminal gets killed.
  2. Check session.Context().Done() somewhere (e.g. https://github.com/owenthereal/upterm/blob/master/host/internal/server.go#L195 ) that would trigger a dead writer to be removed here https://github.com/owenthereal/upterm/blob/master/host/internal/server.go#L242
  3. Handle writes to clients differently and ignore if they're broken/unstable. I believe that might also fix #134 but I didn't investigate that case.

from upterm.

owenthereal avatar owenthereal commented on September 13, 2024

@mweinelt:

What command did you run? For example, if you run bash (e.g., upterm host -- bash) and the client types exit, the exit is sent to the bash command, and it will exit the bash process on the host. If you want that quitting client doesn't exit your host's running process, you would need a terminal multiplexer like tmux. tmux runs a server on the host, and quitting clients won't exit the tmux server on the host. For example, the following creates a tmux session on the host and forces clients to join by attaching to the tmux server: upterm host --force-command 'tmux attach -t pair-programming' -- tmux new -t pair-programming (Ref: https://github.com/owenthereal/upterm#quick-reference)

from upterm.

mweinelt avatar mweinelt commented on September 13, 2024

Right, i was running just plain zsh. Somewhat unexpected but understandable.

from upterm.

horazont avatar horazont commented on September 13, 2024

This seems to not only happen when the last client leaves.

We can reproducibly bring upterm to terminate when any client of a read-only session closes (either with the SSH sequence [enter] ~ ., or by closing the terminal window).

from upterm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.