Terminal size incorrect when using remote development via ssh (and not being updated via SIGWINCH)

I'm having problems with the terminal when using remote development via ssh in pycharm, it seems that the terminal size is not being sent to the remote machine, which throws *everything* off, like quick edits via vi or anything else that cares about terminal size.

After opening a new terminal on the remote machine via ssh, `stty size` shows an incorrect size. Resizing the window does not change the size. Splitting to new windows seems to set the *columns* correctly but not the rows. After splitting, resizes do not affect `stty size`. When I try to trap SIGWINCH (which should change the tty size settings), it seems that signal is never sent from the pycharm terminal to the remote.

Win10, and if it matters, SIGWINCH *is* sent by powershell on resize when i ssh from there, so maybe it's a problem in pycharm's ssh terminal?

Has anyone seen anything like this or does anyone have a quick fix?


Interestingly, if I use the FTerminal (Friendly Terminal) plugin, the sizing issue goes away (though this plugin seems to have some problems with dropped keystrokes possibly due to high latency).

Note that using TRAPWINCH with FTerminal clearly shows the SIGWINCH signals being sent...


Hi, you're talking about the terminal opened from [Tools | Start SSH Session], right? 

If so, the issue doesn't seem to reproduce for me with PyCharm 2022.1.2 -- resizing the terminal changes the `stty size` correctly.

Please update if you're not using the latest version and try again.


1 - I am on PyCharm 2022.1.2

2 - i have already set up the remote development by SSH, this all seems to work -- i can access my project &c. on the remote machine. the remote server is SUSE 12. My machine (where I run the thin client) is Win10 Enterprise

3 - when using the terminal button in the bottom toolbar, I am having the terminal resize problem -- it seems no resize/size events are going through to the remote SUSE machine

4 - when using tools/start ssh session, I enter the hostname/uname/auth stuff and ... nothing seems to happen except a temporary increase in reported ping time. after using this, no new terminal window opens, and repeated attempts with the terminal in the bottom toolbar still exhibit the no-resize problem.


Maybe interesting? This seems to happen when I use the tools/start ssh session thing to connect:

2022-06-13 08:50:02,290 [ 933393]   INFO - #o.j.p.t.TerminalView - Activating Terminal tool window
2022-06-13 08:50:34,387 [ 965490] SEVERE -  - Illegal scheduler for current action, must be: com.jetbrains.rd.platform.protocol.EdtScheduler@6b7a56d7, current thread: 117:DefaultDispatcher-worker-2
    at com.jetbrains.rd.platform.util.IdeaRdLoggerFactor$getLogger$1.log(IdeaRdLoggerFactor.kt:28)
    at com.jetbrains.rd.util.SwitchLogger.log(Logger.kt:47)
    at com.jetbrains.rd.util.reactive.IScheduler$DefaultImpls.assertThread(Scheduler.kt:20)
    at com.jetbrains.rd.util.reactive.ISchedulerWithBackground$DefaultImpls.assertThread(Scheduler.kt)
    at com.jetbrains.rd.platform.protocol.IRdDispatcher$DefaultImpls.assertThread(IRdDispatcher.kt)
    at com.jetbrains.rd.platform.protocol.EdtScheduler.assertThread(EdtScheduler.kt:13)
    at com.jetbrains.rd.util.reactive.IScheduler$DefaultImpls.assertThread$default(Scheduler.kt:16)
    at com.jetbrains.rd.framework.base.RdReactiveBase.assertThreading(RdReactiveBase.kt:27)
    at com.jetbrains.rd.framework.base.RdReactiveBase.localChange$rd_framework(RdReactiveBase.kt:46)
    at com.jetbrains.rd.framework.impl.RdProperty.setValue(RdProperty.kt:204)
    at com.jetbrains.rd.framework.impl.RdProperty.set(RdProperty.kt:210)
    at com.jetbrains.rdserver.unattendedHost.customization.controlCenter.OutputGatewayTab$getControl$1$$special$$inlined$apply$lambda$1.invokeSuspend(OutputGatewayTab.kt:27)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
2022-06-13 08:50:34,388 [ 965491] SEVERE -  - PyCharm 2022.1.2  Build #PY-221.5787.24
2022-06-13 08:50:34,388 [ 965491] SEVERE -  - JDK: 11.0.15; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o.
2022-06-13 08:50:34,388 [ 965491] SEVERE -  - OS: Linux

NOTE: the terminal actually seems to *work* i just can't use anything there that needs to have an opinion about the terminal size (which is ... basically everything)

NOTE: still, i have no problem with terminal resizing when using PowerShell/ssh, *or* via the FTerminal (Friendly Terminal) plugin. This *feels like* a terminal emulation problem in the embedded PyCharm terminal itself. 

If I can provide more information, please let me know. I would *very much* like to be using PyCharm as my IDE at work, and this is blocking me.


Some more context, not sure if it's useful. I'm using zsh and oh-my-zsh in my terminal. Perhaps there's some strangeness with the SIGWINCH not being passed through to the shell, analogous to this:



Ok I believe I am making progress. 

I am able to create and test a working ssh config (marked as 'Host' in the settings). It seems, though, that when I try to *use* it via tools/ssh session it does not open the terminal window in the client. 

I see this repeatedly in the 'Host output':

2022-06-13 17:17:45,534 [ 327952]   INFO - #o.j.p.t.TerminalView - Activating Terminal tool window
2022-06-13 17:18:19,856 [ 362274]   INFO - #o.j.p.t.TerminalView - Activating Terminal tool window

But no terminal tool window is activated on my 'thin client', which is, of course what i need in order to use the session.

I assume if we can get this to work everything will be solved. 


Ok I have a solution. I would like some input...

In the thin client, no matter what I do, it opens a Terminal which gets the name "Local: shared". This terminal appears to be broken.

No matter what i set the default terminal to in "Settings" it will always open a "Local: shared".

If I use the drop-down in the "Terminal" pane, I can select `cmd.exe`, `PowerShell`, or my Ubuntu WSL. These work.

I cannot seem to make the "+" to create a new Terminal default to anything other than the broken "Local: shared", which is broken. 

This means I have extra clicks every time I want to open a terminal. Plus I need to ssh into my box by hand every time (I guess I can fix this with some kind of .profile)

Should I open a new bug saying I can't change the default Terminal in the thin client? Or do you have some other input?


Thank you for the investigation. 

Yes, please submit a new bug report to the CWM project https://youtrack.jetbrains.com/issues?q=%23CWM