neutralinojs / neutralinojs

Portable and lightweight cross-platform desktop application development framework

Home Page:https://neutralino.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extension process remains running when parent process terminates

AddictArts opened this issue · comments

Describe the bug
The docs indicate here https://neutralino.js.org/docs/how-to/extensions-overview/ to exit the process when the socket is closed; However, adding or ensuring process.exit() is called does not change the child process behavior. The child extension process remains running, orphaned.

To Reproduce
Steps to reproduce the behavior:

  1. Run the sample extension with fix to path \\ double backslash.
  2. Close the webview2 window.
  3. Node process still running.

Expected behavior
Child dies

Specifications
Windows 11
Neu 5.1.0

FYI: Procs below is a rust replacement for ps

The node.exe process does linger and is orphaned. See the proc output below. You can see neutralino-win_x64.exe spawns the process 33620, then I kill / exit / close, the neutralino-win_x64.exe process and the node process remains running. And I know it is the child by pid and cli args.

❯ procs -t -i ppid node
             PID   User   │ CPU MEM CPU Time Parent PID │ Command
                          │ [%] [%]                     │
 └┬───────── 16312 E26368 │ 0.0 0.1 00:02:06       6912 │ sihost.exe
  └┬──────── 26096 E26368 │ 0.0 0.2 00:04:19      16312 │ WindowsTerminal.exe
   └┬─────── 72960 E26368 │ 0.0 0.2 00:00:15      26096 │ pwsh.exe
    └┬────── 69136 E26368 │ 0.0 0.1 00:00:00      72960 │ node.exe
     └┬───── 58072 E26368 │ 0.0 0.0 00:00:00      69136 │ neutralino-win_x64.exe
      ├┬──── 11908 E26368 │ 0.0 0.2 00:00:00      58072 │ msedgewebview2.exe
      │├──── 43892 E26368 │ 0.0 0.0 00:00:00      11908 │ msedgewebview2.exe
      │├──── 71760 E26368 │ 0.0 0.1 00:00:00      11908 │ msedgewebview2.exe
      │├──── 76568 E26368 │ 0.0 0.2 00:00:00      11908 │ msedgewebview2.exe
      │├──── 78764 E26368 │ 0.0 0.0 00:00:00      11908 │ msedgewebview2.exe
      │├──── 80080 E26368 │ 0.0 0.0 00:00:00      11908 │ msedgewebview2.exe
      │├──── 81032 E26368 │ 0.0 0.2 00:00:00      11908 │ msedgewebview2.exe
      │└──── 84316 E26368 │ 0.0 0.0 00:00:00      11908 │ msedgewebview2.exe
      └┬──── 33620 E26368 │ 0.0 0.0 00:00:00      58072 │ cmd.exe
       ├──── 24616 E26368 │ 0.0 0.1 00:00:00      33620 │ node.exe
       └──── 38032 E26368 │ 0.0 0.0 00:00:00      33620 │ conhost.exe

# Close the app, kill it, node proc still remains

❯ procs -t -i ppid node
        PID   User   │ CPU MEM CPU Time Parent PID │ Command
                     │ [%] [%]                     │
 └┬──── 33620 E26368 │ 0.0 0.0 00:00:00      58072 │ cmd.exe
  └──── 24616 E26368 │ 0.0 0.1 00:00:00      33620 │ node.exe