Skip to content

VSCode 1.54.1 breaks spawned processes with cwd option #118267

Closed

Description

  • VS Code Version: 1.54.1
  • OS Version: macOS 10.15.17

Steps to Reproduce:

  1. Upgrade to VSCode 1.54.1 from 1.53
  2. A few of our extensions are failing to start because spawned shell script processes do not work

Does this issue occur when all extensions are disabled?: No

We run a few extensions (including an LSP server) which essentially spawn an external process executing shell wrapper scripts and attempts to manipulate its standard IO.

Since upgrading to 1.54.1 we have noticed a strange behavior where when writing to the external process stdin we get EBADF error. This seems specifically to only occur when attempting to execute shell script directly as when we modify the spawn (or similar functions) to invoke the script via bash directly it works fine.

This is illustrated by the following test cases executed while debugging VSCode:

> cp.execFile("cat", ['-'], options, cb).stdin.write("foo\n")
true
> cp.execFile("scripts/bin/wrapper.sh", ["cat", "-"], options, cb).stdin.write("foo\n")
Uncaught Error: write EBADF
> cp.execFile("bash", ["scripts/bin/wrapper.sh", "cat", "-"], options, cb).stdin.write("foo\n")
true

Where wrapper.sh ultimately will exec the rest of the command line.

Activity

  1. added
    bugIssue identified by VS Code Team member as probable bug
    confirmedIssue has been confirmed by VS Code Team member
    on Mar 10, 2021
  2. added
    candidateIssue identified as probable candidate for fixing in the next release
    on Mar 10, 2021
  3. added a commit that references this issue on Mar 11, 2021
  4. deepak1556 commented on Mar 11, 2021

    @deepak1556
    Collaborator

    We just released an update to VS Code Insiders that has a fix for this issue. Please try it out and let us know.

  5. 35 remaining items

  6. deepak1556 commented on May 12, 2021

    @deepak1556
    Collaborator

    This turned out to be a bug in the posix_spawnp implementation where a relative executable path will cause it to successfully launch the program, but erroneously return ENOENT when used with posix_spawn_file_actions_addchdir_np because of the stat call performed on the executable path after the child process is launched. Ref: https://opensource.apple.com/source/Libc/Libc-1439.40.11/sys/posix_spawn.c.auto.html

    Have resorted to use pthread_chdir_np instead to respect the cwd option, will update here once the updated runtime is available.

  7. added
    unreleasedPatch has not yet been released in VS Code Insiders
    insiders-releasedPatch has been released in VS Code Insiders
    and removed
    unreleasedPatch has not yet been released in VS Code Insiders
    on May 14, 2021
  8. jeremie-stripe commented on May 14, 2021

    @jeremie-stripe
    Author

    Robo (@deepak1556) thanks for figuring it out! I just tested with the latest insiders version (version info below) and I can confirm that our workloads are now properly working again!

    Version: 1.57.0-insider (Universal)
    Commit: 5246162662ffa9f16a70dc2b94f13b0d15511e64
    Date: 2021-05-14T08:49:16.464Z
    Electron: 12.0.7
    Chrome: 89.0.4389.128
    Node.js: 14.16.0
    V8: 8.9.255.25-electron.0
    OS: Darwin x64 20.4.0
    
  9. locked and limited conversation to collaborators on Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bugconfirmedIssue has been confirmed by VS Code Team memberinsiders-releasedPatch has been released in VS Code Insidersmacos-big-surverifiedVerification succeeded

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions