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

0.28.1 errors on process exit in treekill #211

Closed
Enubia opened this issue Feb 10, 2024 · 3 comments · Fixed by #212
Closed

0.28.1 errors on process exit in treekill #211

Enubia opened this issue Feb 10, 2024 · 3 comments · Fixed by #212

Comments

@Enubia
Copy link

Enubia commented Feb 10, 2024

When exiting the app via app.quit(); call the application errors out with following message

ERROR: The process "6932" not found.
node:child_process:965
    throw err;
    ^

Error: Command failed: taskkill /pid 6932 /T /F
ERROR: The process "6932" not found.

    at checkExecSyncError (node:child_process:890:11)
    at Object.execSync (node:child_process:962:15)
    at treeKillSync (file:///D:/projects/ghost-chat/node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/vite-plugin-electron/dist/index.mjs:100:8)
    at process.<anonymous> (file:///D:/projects/ghost-chat/node_modules/.pnpm/[email protected][email protected][email protected][email protected]/node_modules/vite-plugin-electron/dist/index.mjs:208:7)
    at Object.onceWrapper (node:events:633:26)
    at process.emit (node:events:518:28)
    at ChildProcess.exit (node:internal/process/per_thread:192:15)
    at Object.onceWrapper (node:events:633:26)
    at ChildProcess.emit (node:events:518:28) {
  status: 128,
  signal: null,
  output: [
    null,
    Buffer(0) [Uint8Array] [],
    Buffer(38) [Uint8Array] [
       69,  82,  82,  79,  82,  58,  32,  84, 104,
      101,  32, 112, 114, 111,  99, 101, 115, 115,
       32,  34,  54,  57,  51,  50,  34,  32, 110,
      111, 116,  32, 102, 111, 117, 110, 100,  46,
       13,  10
    ]
  ],
  pid: 18368,
  stdout: Buffer(0) [Uint8Array] [],
  stderr: Buffer(38) [Uint8Array] [
     69,  82,  82,  79,  82,  58,  32,  84, 104,
    101,  32, 112, 114, 111,  99, 101, 115, 115,
     32,  34,  54,  57,  51,  50,  34,  32, 110,
    111, 116,  32, 102, 111, 117, 110, 100,  46,
     13,  10
  ]
}

Node.js v20.11.0

downgrading to version 0.28.0 fixes the aforementioned issue

the specific line mentioned in the log is this one

function treeKillSync(pid) {
  if (process.platform === "win32") {
    cp.execSync(`taskkill /pid ${pid} /T /F`);
  } else {
    killTree(pidTree());
  }
}
@Enubia Enubia changed the title 0.28.1 errors on process exit in treekill module 0.28.1 errors on process exit in treekill Feb 10, 2024
@ashokgelal
Copy link

Damn! I came here to report the same issue and was pleasantly surprised to see someone literally creating a ticket for it minutes ago. Anyway, I can confirm, I'm running into the same issue on Windows.

Enubia added a commit to Enubia/ghost-chat that referenced this issue Feb 10, 2024
recent version breaks the `app.quit()` process
electron-vite/vite-plugin-electron#211
@caoxiemeihao caoxiemeihao linked a pull request Feb 11, 2024 that will close this issue
@Enubia
Copy link
Author

Enubia commented Feb 11, 2024

@ashokgelal thanks for fixing the error message.
I still get one more error tho

The platform is windows 11

ERROR: The process "4316" not found.

I assume it's from cp.execSync(`taskkill /pid ${pid} /T /F`);. I noticed that in a previous release, you changed this line and

process.once('exit', () => {
 startup.exit()
 // When the process exits, `tree-kill` does not have enough time to complete execution, so `electronApp` needs to be killed immediately.
-	process.electronApp.kill()
+	// process.electronApp.kill()
+	treeKillSync(process.electronApp.pid!);
})

To me, it seems that the cp.execSync call tries to kill a PID that does not exist anymore because electron killed it already.

@caoxiemeihao
Copy link
Member

caoxiemeihao commented Feb 11, 2024

I use Mac OS for work, and if there are still issues on Windows 11 with v0.28.2, I will fix them after work. Now is the Spring Festival in China.

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

Successfully merging a pull request may close this issue.

3 participants