Coder Social home page Coder Social logo

Comments (9)

exsilium avatar exsilium commented on May 29, 2024 1

The committed fix to development branch should at least stop from crashing the server side. However, the restore of the terminal doesn't always work because on socket termination node-pty usually does cleanup and kills the pty.

node-pty does have a DESTROY_SOCKET_TIMEOUT_MS = 200; variable, I need to check how this impacts the session restore of the terminals.

from pylon.

exsilium avatar exsilium commented on May 29, 2024

Hi, thanks for reporting - and for trying out cloud9v2 🌟 This is new, I'll take a look. The terminal session restore hasn't properly worked after moving from term.js/pty.js to xterm.js/node-pty. Further more, at least I have an issue as described in #30 where refresh/connection drop causes 100% CPU consumption on the server side when Chrome is used. This has lead me to avoid such scenarios all together but this issue shouldn't happen. Thanks again for reporting.

from pylon.

exsilium avatar exsilium commented on May 29, 2024

Can you please try the following patch and let me know if the terminal window survives a refresh:

diff --git a/plugins-server/cloud9.ide.terminal/tty.js b/plugins-server/cloud9.ide.terminal/tty.js
index fbd0ff6..3cd911d 100644
--- a/plugins-server/cloud9.ide.terminal/tty.js
+++ b/plugins-server/cloud9.ide.terminal/tty.js
@@ -220,7 +220,7 @@ Session.prototype.sync = function() {
     // terminal has actually been resized.
     term.resize(cols + 1, rows + 1);
     queue.push(function() {
-      term.resize(cols, rows);
+      //term.resize(cols, rows);
     });
 
     // Send SIGWINCH to our processes, and hopefully
@@ -329,7 +329,7 @@ Session.prototype.handleMove = function(id, left, top) {
 Session.prototype.handleResize = function(id, cols, rows) {
   var terms = this.terms;
   if (!terms[id]) return;
-  terms[id].resize(cols, rows);
+  //terms[id].resize(cols, rows);
   terms[id].cols = cols;
   terms[id].rows = rows;
 };

from pylon.

2anandkr avatar 2anandkr commented on May 29, 2024

@exsilium thanks for taking the time for the issue.

results after applying the patch

  • after refresh
    • terminals are not lost, but
    • default to the normal size. (does not retain any previous resizes)
    • initially all terminals are blank. I needed to hit enter to see where I was
  • after connection drop
    • terminals stay in place, but
    • when connection is up again, all on screen terminals dissapear.

from pylon.

2anandkr avatar 2anandkr commented on May 29, 2024

@exsilium Thank for the partial fix. Also, you said earlier:

The terminal session restore hasn't properly worked after moving from term.js/pty.js to xterm.js/node-pty.

The reason to switch?
Also, I had used the paid c9.io service in the past. This issue did not occur then.

from pylon.

exsilium avatar exsilium commented on May 29, 2024

term.js/pty.js were no longer maintained which prompted the switch. Not sure which version of c9.io you are referring to but the terminal that was used in the v2 stack (before and around 2013) was never released to the public. The current version that c9.io uses wraps the sessions within tmux automatically, thus retaining the terminal sessions (unless something has changed recently).

from pylon.

2anandkr avatar 2anandkr commented on May 29, 2024

Thanks @exsilium for the info. Hmm! Tmux seems to be a reliable way to persist sessions. Is there something we can do to achieve this reliability?

One of the primary use cases, I see for this IDE is doing coding in remote server & using its terminal interface to run tasks without logging in with ssh to the machine. But loosing onscreen terminal windows due to connection drop out in midst of some work might be a big problem. I'm curious to know if this problem might be specific to windows.

from pylon.

exsilium avatar exsilium commented on May 29, 2024

The scenario you describe is how I also use c9v2. However, i'm not plagued by such frequent disconnections. Couple of things to get around this issue:

  1. You either develop a habit of going into a tmux session whenever using the terminal
  2. You add the following snippet to your ~./bashrc that does it for you:
# TMUX
if which tmux >/dev/null 2>&1; then
    #if not inside a tmux session, and if no session is started, start a new session
    test -z "$TMUX" && (tmux attach || tmux new-session)
fi

NB! Before adding this to your .bashrc file, make sure you do have tmux installed.

But still, you'd need to re-open a terminal window and resize it every time you lose the connection. Not sure how often you have these kind of interruptions and if these workarounds would be sufficient.

As you mentioned that you use nginx https termination, make sure that the session connect timeout settings are long enough so that the forwarding proxy itself wouldn't be the one disconnecting your sockets. 😉 Cheers!

from pylon.

exsilium avatar exsilium commented on May 29, 2024

The original issue submitted is fixed, thus closing.

from pylon.

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.