Skip to content

Native Exception in winpty #29540

Closed
Closed

Description

  • VSCode Version: 1.14 test pas
  • OS Version: Windows

Executed a task in the terminal and got:

capture

Activity

  1. added
    terminal
    on Jun 27, 2017
  2. changed the title [-]Exception in winpty-agent[/-] [+]Native Exception in winpty[/+] on Jun 27, 2017
  3. Tyriar commented on Jun 27, 2017

    @Tyriar
    Contributor

    Dirk Bäumer (@dbaeumer) what was the state of the terminal at the time? Hidden, uninitialised, visible?

    Related: #27534

  4. added
    info-needed
    and removed on Jun 27, 2017
  5. dbaeumer commented on Jun 27, 2017

    @dbaeumer
    MemberAuthor

    It was not visible. And I saw it again today when starting VS Code out of dev and it tried to restore a terminal (no task runner). But I have no reliable steps to reproduce.

  6. vscodebot commented on Jul 4, 2017

    @vscodebot

    This issue has been closed automatically because it needs more information and has not had recent activity. Please refer to our guidelines for filing issues. Thank you for your contributions.

  7. dbaeumer commented on Jul 5, 2017

    @dbaeumer
    MemberAuthor

    Reopening the issue since it has all information I have.

  8. added
    bug
    and removed
    info-needed
    on Jul 5, 2017
  9. dbaeumer commented on Jul 5, 2017

    @dbaeumer
    MemberAuthor

    I see that now very frequently. Once or twice a day.

  10. Tyriar commented on Jul 5, 2017

    @Tyriar
    Contributor

    It's failing here https://github.com/rprichard/winpty/blob/ce9239af5d751195ea6982a41c7d71356ac9201c/src/libwinpty/winpty.cc#L852, meaning either winpty_t or winpty_spawn_config_t wasn't initialized correctly.

    I'm guessing it was related to the config as an exception should have been thrown earlier if winpty_t
    wasn't initialized correctly https://github.com/Tyriar/node-pty/blob/085f1b180f7cfbb66e6656dd8dc95dbde685351f/src/win/pty.cc#L211

    Dirk Bäumer (@dbaeumer) does your terminal config (shell, args, env, cwd) have any special characteristics? Unicode in one of them for example?

  11. dbaeumer commented on Jul 6, 2017

    @dbaeumer
    MemberAuthor

    I saw it just failing with the following command line under Windows:

    C:\WINDOWS\sysnative\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass Write-Host 'Invoking Pester...'; Invoke-Pester -PesterOption @{IncludeVSCodeMarker=$true}; Invoke-Command { Write-Host 'Completed Test task in task runner.' }
    

    However I see the same exception when open a single terminal inside VS Code and even in Hyper.js from time to time.

  12. dbaeumer commented on Jul 6, 2017

    @dbaeumer
    MemberAuthor

    Invoking the above command a second time worked. So might be a timing problem.

  13. Tyriar commented on Jul 6, 2017

    @Tyriar
    Contributor

    Ryan Prichard (@rprichard) can you think of any reason winpty_spawn_config_new might fail and return nullptr?

    It seems to be happening sometimes for Dirk Bäumer (@dbaeumer) and I verify the winpty_t so it much be the config failing https://github.com/Tyriar/node-pty/blob/085f1b180f7cfbb66e6656dd8dc95dbde685351f/src/win/pty.cc#L211

  14. rprichard commented on Jul 6, 2017

    @rprichard

    Daniel Imms (@Tyriar)

    can you think of any reason winpty_spawn_config_new might fail and return nullptr?

    AFAICT, out-of-memory is the only way it would return nullptr.

    I'm guessing it was related to the config as an exception should have been thrown earlier if winpty_t
    wasn't initialized correctly https://github.com/Tyriar/node-pty/blob/085f1b180f7cfbb66e6656dd8dc95dbde685351f/src/win/pty.cc#L211

    I had noticed earlier that the call sites to Nan::ThrowError in pty.cc are inconsistent. Of the 7 calls, 3 of them return the value returned by Nan::ThrowError, 1 of them discards the return value but somewhat assumes that the function returns (i.e. it's followed by goto cleanup), and 3 of them assume the function doesn't return (implying setjmp or C++ exceptions).

    I'm unfamiliar with the nodejs nan module, but my guess is that Nan::ThrowError does return.
    I'm guessing it records the exception object somewhere so that a JavaScript object is thrown once the native function completes. ThrowError's return type is void, FWIW, but that doesn't really answer the question:

    inline void ThrowError(v8::Local<v8::Value> error) {
        v8::Isolate::GetCurrent()->ThrowException(error);
    }

    I commented on this previously; maybe you didn't see it? It's here: #28593 (comment). "Aside: the control flow with Nan::ThrowError in node-pty is suspicious looking".

  15. dbaeumer commented on Jul 7, 2017

    @dbaeumer
    MemberAuthor

    Got it today with Hyper.js. Here the screen shot.

    capture

  16. Tyriar commented on Jul 7, 2017

    @Tyriar
    Contributor

    Ryan Prichard (@rprichard) yeah I haven't touched that stuff since I forked it https://github.com/chjj/pty.js/blob/master/src/win/pty.cc, can have a look at that in microsoft/node-pty#102. We've actually been seeing more out of memory crashes on Windows than other platforms recently so maybe that's related to this.

  17. added
    windows
    on Jan 19, 2018
  18. Tyriar commented on Jun 21, 2018

    @Tyriar
    Contributor

    This is likely related to winpty, tracking in #45693

  19. added
    *duplicate
    on Jun 21, 2018
  20. locked and limited conversation to collaborators on Aug 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

*duplicatebugterminalwindows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions