Skip to content

Status callback for exec is never called when stdin closes #465

Closed

Description

@mochja

Is it possible to close stdin for Exec without closing ws connection?

StatusStream is not received if WS connection is closed as well as additional data on stdout, stderr streams is lost.

Activity

  1. changed the title [-]Status callback never called when stdin closes[/-] [+]Status callback for exec is never called when stdin closes[/+] on Jun 13, 2020
  2. brendandburns commented on Jun 13, 2020

    @brendandburns
    Contributor

    You could try sending an explicit control-D character across the stream. That should close the stream in the application.

  3. mochja commented on Jun 14, 2020

    @mochja
    Author

    @brendandburns neat, that does work indeed, but only when tty is also attached.

    With tty I am not able to correctly receive binary data for exec command.

    tar xf - -C /tmp
    tar: Refusing to read archive contents from terminal (missing -f option?)
    tar: Error is not recoverable: exiting now
    {
      metadata: {},
      status: 'Failure',
      message: 'command terminated with non-zero exit code: Error executing in Docker Container: 2',
      reason: 'NonZeroExitCode',
      details: { causes: [ [Object] ] }
    }
    
  4. brendandburns commented on Jun 17, 2020

    @brendandburns
    Contributor

    Makes sense ctrl-d is a terminal character after all.

    This error is coming from the tar command itself. I'm not sure why that's happening, but I don't think it's related to this library.

  5. mochja commented on Jun 17, 2020

    @mochja
    Author

    @brendandburns you are correct it will be related to tty itself, but the fact with result is as kubectl exec is not behaving like that when stdin is closed. I was digging into kubectl exec and I figured out it's using SPDY and multiple streams for different io instead of single websocket connection.

    I think issue could be solved with #411 or maybe there is way for ws protocol to close streams some other way.

    kubernetes/kubernetes#89899

  6. brendandburns commented on Jun 19, 2020

    @brendandburns
    Contributor

    I'm obviously not certain, but I think tar is giving up before stdin is even considered. I'm uncertain about the difference between tar xf - ... vs tar -x -f - but you may be since that is referenced in the error message.

  7. mochja commented on Jun 19, 2020

    @mochja
    Author

    It does not matter what executable I try to run, even cat breaks up in similiar manner as if you try to paste binary data trough regular terminal. I believe I would have to somehow escape the data so the terminal could recognize 0x04 as a byte and as a ctrl-d. I am not sure if thats possible (I was not able to find anything about that), but could also solve the issue.

  8. bankyadam commented on Aug 6, 2020

    @bankyadam

    Did you find out something @mochja? I'm trying to upload some file with exec to a pod and I experience the same you do.

  9. mochja commented on Aug 6, 2020

    @mochja
    Author

    @bankyadam I did not, I think there are only two proper ways to handle this:

    • Use SPDY protocol instead of WS
    • Implement closing streams into WS protocol itself

    I was experimenting by removing following lines

    stdin.on('end', () => {
    ws.close();
    });

    and if I am remembering correctly it was somewhat working.

  10. fejta-bot commented on Nov 4, 2020

    @fejta-bot

    Issues go stale after 90d of inactivity.
    Mark the issue as fresh with /remove-lifecycle stale.
    Stale issues rot after an additional 30d of inactivity and eventually close.

    If this issue is safe to close now please do so with /close.

    Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
    /lifecycle stale

  11. added
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on Nov 4, 2020
  12. fejta-bot commented on Dec 4, 2020

    @fejta-bot

    Stale issues rot after 30d of inactivity.
    Mark the issue as fresh with /remove-lifecycle rotten.
    Rotten issues close after an additional 30d of inactivity.

    If this issue is safe to close now please do so with /close.

    Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
    /lifecycle rotten

  13. added
    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.
    and removed
    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.
    on Dec 4, 2020
  14. fejta-bot commented on Jan 3, 2021

    @fejta-bot

    Rotten issues close after 30d of inactivity.
    Reopen the issue with /reopen.
    Mark the issue as fresh with /remove-lifecycle rotten.

    Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
    /close

  15. k8s-ci-robot commented on Jan 3, 2021

    @k8s-ci-robot
    Contributor

    @fejta-bot: Closing this issue.

    Details

    In response to this:

    Rotten issues close after 30d of inactivity.
    Reopen the issue with /reopen.
    Mark the issue as fresh with /remove-lifecycle rotten.

    Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
    /close

    Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions