Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: kill EPERM #384

Open
MeirionHughes opened this issue Jun 28, 2024 · 12 comments
Open

Error: kill EPERM #384

MeirionHughes opened this issue Jun 28, 2024 · 12 comments

Comments

@MeirionHughes
Copy link

MeirionHughes commented Jun 28, 2024

Bug

There seems to have been a change in node > 20 that is causing start-server-and-test to error due to child processes (cypress + electron) closing.

Child process 24584 exited before trying to stop it
Error: kill EPERM
    at process.kill (node:internal/process/per_thread:228:13)
    at D:\testing\vue-project\node_modules\start-server-and-test\src\index.js:62:23
    at Array.forEach (<anonymous>)
    at D:\testing\vue-project\node_modules\start-server-and-test\src\index.js:60:20
    at tryCatcher (D:\testing\vue-project\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (D:\testing\vue-project\node_modules\bluebird\js\release\promise.js:547:31)
    at Promise._settlePromise (D:\testing\vue-project\node_modules\bluebird\js\release\promise.js:604:18)
    at Promise._settlePromise0 (D:\testing\vue-project\node_modules\bluebird\js\release\promise.js:649:10)
    at Promise._settlePromises (D:\testing\vue-project\node_modules\bluebird\js\release\promise.js:729:18)
    at Promise._fulfill (D:\testing\vue-project\node_modules\bluebird\js\release\promise.js:673:18)
    at D:\testing\vue-project\node_modules\bluebird\js\release\nodeback.js:42:21
    at D:\testing\vue-project\node_modules\ps-tree\index.js:87:7
    at a.end (D:\testing\vue-project\node_modules\event-stream\index.js:87:5)
    at Stream.onend (node:internal/streams/legacy:48:10)
    at Stream.emit (node:events:531:35)
    at end (D:\testing\vue-project\node_modules\map-stream\index.js:116:39) {
  errno: -4048,
  code: 'EPERM',
  syscall: 'kill'
}

I'm not sure what the root cause is, or even which library is causing the error. But as the overall runner, it seems like its start-server-and-test not liking child processes closing or closing in an irregular way.

Reproduce - leverage vue to create a project scaffold of start-server-and-test + server + cypress runner:

  • npm create vue@latest
  • No for everything - choose cypress.
  • npm install
  • npm run build
  • npm run test:e2e

run the test:e2e a few times as it can be a race-condition.

shell: windows 11, cmd or ps
node -v : 21.7.3 and 22.3.0
npm why start-server-and-test : [email protected]
npm why cypress: [email protected]

This specifically seems to be an issue on node > 20, as in node 20 you only get the messages "Child process [number] exited before trying to stop it", but it doesn't Error.

If you swap out vite for http-server ( "preview": "http-server ./dist -p 4173", ) you still get the Error: kill EPERM.
If you remove start-server-and-test, add and run "cypress": "cypress run --e2e", along with separate term for preview it exits without error.

@BePo65
Copy link

BePo65 commented Nov 10, 2024

Do you have a line saying Error: spawn wmic.exe ENOENT in the error message like I do?

For me it looks like this is caused by windows 11 deprecating wmic.

start-server-and-run uses the package ps-tree for finding out, which processes to terminate to stop the server on cleanup. On windows systems this library uses wmic to enumerate the processes to terminate.

Unluckily this library is no longer part of a current windows 11 system. And even worse, the workaround in how-to-install-wmic-feature-on-demand-on-windows (activating the Featore-on-Demand) does not exist any more in Win11pro.

So I am waiting for a fix to ps-tree.

@MikeMcC399
Copy link

@BePo65

So I am waiting for a fix to ps-tree.

I don't see any issue open for this on https://github.com/indexzero/ps-tree/issues and the last release was https://www.npmjs.com/package/ps-tree/v/1.2.0 released 6 years ago.

@BePo65
Copy link

BePo65 commented Nov 10, 2024

@MikeMcC399
Currently I am trying to find a solution for this problem. Perhaps it would make sense that I create (and maintain) a fork as this package has over 1mio downloads per week (perhaps only unix users 😄).

Or do you have a better idea.

@MikeMcC399
Copy link

@BePo65

I would raise the issue in https://github.com/indexzero/ps-tree/issues first. This repo (start-server-and-test) is not the best place to be discussing it.

@MikeMcC399
Copy link

@BePo65

I see that you have raised

and that you are not getting any response in that repo.

@MikeMcC399
Copy link

@BePo65

Do you have a link to any Microsoft document which says that the deprecated Windows Management Instrumentation command-line (WMIC) utility has already been removed? I can only find information which says it has been disabled by default. See indexzero/ps-tree#58 (comment) for more details.

@BePo65
Copy link

BePo65 commented Nov 29, 2024

Sorry, but as you mentioned in your comment, I simply did not find the buttons to add WMIC as a FoD.

@MikeMcC399
Copy link

This issue should be resolved by following the instructions in How to install WMIC Feature on Demand on Windows 11 if WMIC is missing from your system.

@BePo65
Copy link

BePo65 commented Nov 30, 2024

Just 2 more remarks:

  1. ps-tree has a lot of vulnerabilities reported by npm audit and the last version is 6 years old (the package is probably abandoned and no one will fix these problems)
  2. should we require an optional windows feature for a function like start-server-and-test?

@MikeMcC399
Copy link

@BePo65

  1. ps-tree has a lot of vulnerabilities reported by npm audit

and the last version is 6 years old (the package is probably abandoned and no one will fix these problems)

  • It remains to be seen if there is any maintainer reaction to your PRs in ps-tree. Hopefully your PRs will be considered. Microsoft has not yet announced any firm date for the removal of WMIC, so there is still time to consider any alternate mitigation plans.
  1. should we require an optional windows feature for a function like start-server-and-test?
  • I don't understand what you mean by this. If you are proposing something new then you should probably submit a new issue in the repo where you would like the change to take place.

@MikeMcC399
Copy link

@BePo65
Copy link

BePo65 commented Nov 30, 2024

@MikeMcC399

  1. should we require an optional windows feature for a function like start-server-and-test?

I agree that this is not a real solid argument - more of a personal preference 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants