Skip to content

Forked processes throwing exceptions on app exit #599

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

Open
nicoecheza opened this issue May 8, 2025 · 0 comments
Open

Forked processes throwing exceptions on app exit #599

nicoecheza opened this issue May 8, 2025 · 0 comments
Labels
3-low Low importance / Nice to have bug Something isn't working

Comments

@nicoecheza
Copy link
Contributor

nicoecheza commented May 8, 2025

When forking the main process to execute a deploy, the inspector or whatever other processes we have in the CH and then closing the app using cmd+q for example, some forked processes are not finishing correctly and throwing an exception.

This is where the error is being thrown.

While this is not priority since it's not critical from the user perspective, it will be good if we fix it.

There are a couple of possible fixes:

  1. Closing the app shouldn't trigger errors in the forked processes because the OS sends a proper sigterm and the process should get killed gracefully, but since that's not happening, we might have some bad cleanup steps in some of our sdk-commands. We should check them and see if we can fix this from that side.
  2. Another option is to just map all the forked processes on creation, and when the app gets closed, iterate over those processes and kill them manually one by one. Here is a rough idea of this:
const processes: Map<string, Electron.UtilityProcess> = new Map();

export function forkUtilityProcess(id: string, modulePath: string, args: string[] = []) {
  const proc = utilityProcess.fork(modulePath, args);
  processes.set(id, proc);

  proc.once('exit', () => {
    processes.delete(id);
  });

  return proc;
}
@nicoecheza nicoecheza added the bug Something isn't working label May 8, 2025
@nachomazzara nachomazzara added the 3-low Low importance / Nice to have label May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3-low Low importance / Nice to have bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

2 participants