Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Fix stop working terminal widgets when user clicks on the exited task widget. #729

Merged
merged 2 commits into from
May 6, 2020

Conversation

AndrienkoAleksandr
Copy link
Contributor

What does this PR do?

Fix stop working terminal widgets when user clicks on the exited task widget.

What issues does this PR fix or reference?

eclipse-che/che#16601

Signed-off-by: Oleksandr Andriienko oandriie@redhat.com

@che-bot
Copy link
Contributor

che-bot commented Apr 29, 2020

✅ E2E Happy path tests succeed 🎉

Try Che-Theia editor only Try Che-Theia with Java/maven example Try Che-Theia with NodeJs example

See Details

name link
che-theia docker.io/maxura/che-theia:729
che-theia-endpoint-runtime-binary docker.io/maxura/che-theia-endpoint-runtime-binary:729

Tested with Eclipse Che Single User on K8S (minikube v1.1.1)

@@ -272,7 +291,11 @@ export class RemoteTerminalWidget extends TerminalWidgetImpl {
}

protected resizeTerminalProcess(): void {
if (typeof this.terminalId !== 'number') {
if (typeof this.terminalId !== 'number' || this.processGone) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like typeof this.terminalId !== 'number' is redundant, because on the next step we have IBaseTerminalServer.validateId(this.terminalId) which does the same
wdyt?

Regarding this.processGone I wonder if we have another indicator to avoid using boolean flag. I'll check and let you know.

Copy link
Member

@RomanNikitenko RomanNikitenko May 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AndrienkoAleksandr
I see that you defined this.processGone = true for:

  • onTerminalExecExit
  • onTerminalExecError

cases.

For these cases do we still have alive this.termServer? Can this.termServer be used like this this.termServer!.check({ id: id } for example
if onTerminalExecExit or onTerminalExecError is happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For these cases do we still have alive this.termServer?

Yes, we do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But, I applied boolean flag, because I don't wan't to make request per each resize. Resize operation is expansive and we could affect performance if we will do to much requests.

Copy link
Member

@RomanNikitenko RomanNikitenko May 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right about performance, I asked because I was looking for a solution without boolean flag.

At the moment we have isOpen flag.
It's switched to true when a socket is open, but is NOT switched to false when:

If I understand correctly this.closeOutputConnectionDisposable.dispose() is executed for onTerminalExecExit and onTerminalExecError events, so next a socket will be closed.

If so, can we:

  • use isOpen flag instead the new flag
    or
  • have socket as field and do this.socket = undefined when a socket is closed. For this case maybe we could remove both boolean flags and use check if socket exist.

I don't know this part of code very well, so sorry if I generate bad ideas :-)
I don't have a goal to avoid using boolean flags at all costs and it's OK to me merge the PR as is if we don't have a better solution at the moment.

Thanks in advance!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @RomanNikitenko, thanks a lot for feedback. I removed flag isOpen it was really confused flag with bad name. About this.socket - I think we should not use it to determine process alive or it is gone, because this socket is responsible to send/receive data to the exec, but it is not responsible to make resize.

… widget.

Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
@che-bot
Copy link
Contributor

che-bot commented May 5, 2020

✅ E2E Happy path tests succeed 🎉

Try Che-Theia editor only Try Che-Theia with Java/maven example Try Che-Theia with NodeJs example

See Details

name link
che-theia docker.io/maxura/che-theia:729
che-theia-endpoint-runtime-binary docker.io/maxura/che-theia-endpoint-runtime-binary:729

Tested with Eclipse Che Single User on K8S (minikube v1.1.1)

@RomanNikitenko RomanNikitenko self-requested a review May 5, 2020 13:45
Copy link
Member

@RomanNikitenko RomanNikitenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested using steps to reproduce.
I can reproduce the issue for a stack without these changes.
These changes fix the issue for me!

Thanks, @AndrienkoAleksandr !

@RomanNikitenko
Copy link
Member

@AndrienkoAleksandr
btw, there is some problem with ci docker build, please take a look.
maybe restart will help...

@AndrienkoAleksandr
Copy link
Contributor Author

crw-ci-test

@che-bot
Copy link
Contributor

che-bot commented May 6, 2020

✅ E2E Happy path tests succeed 🎉

Try Che-Theia editor only Try Che-Theia with Java/maven example Try Che-Theia with NodeJs example

See Details

name link
che-theia docker.io/maxura/che-theia:729
che-theia-endpoint-runtime-binary docker.io/maxura/che-theia-endpoint-runtime-binary:729

Tested with Eclipse Che Single User on K8S (minikube v1.1.1)

@AndrienkoAleksandr
Copy link
Contributor Author

crw-ci-build

@AndrienkoAleksandr AndrienkoAleksandr merged commit 4b6341d into master May 6, 2020
@AndrienkoAleksandr AndrienkoAleksandr deleted the fixStopWorkTerminal branch May 6, 2020 15:09
@tolusha tolusha mentioned this pull request May 7, 2020
56 tasks
@benoitf benoitf added the new&noteworthy For new and/or noteworthy issues that deserve a blog post, new docs, or emphasis in release notes label May 29, 2020
vinokurig pushed a commit that referenced this pull request Apr 6, 2021
Signed-off-by: Mykhailo Kuznietsov <mkuznets@redhat.com>

Co-authored-by: Mykhailo Kuznietsov <mkuznets@redhat.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new&noteworthy For new and/or noteworthy issues that deserve a blog post, new docs, or emphasis in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants