fix: ensure workers are unreferenced at termination
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 11 Feb 2024 16:07:35 +0000 (17:07 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 11 Feb 2024 16:07:35 +0000 (17:07 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
package.json
pnpm-lock.yaml
src/worker/WorkerSet.ts
ui/web/pnpm-lock.yaml

index 40521799522e03958f9c8446b8e1ae41bc4a01bb..e2de0727871ca807f9efd3874ac5305f9f051e37 100644 (file)
     "logform": "^2.6.0",
     "mnemonist": "0.40.0-rc1",
     "mongodb": "^6.3.0",
-    "poolifier": "^3.1.19",
+    "poolifier": "^3.1.20",
     "tar": "^6.2.0",
     "winston": "^3.11.0",
     "winston-daily-rotate-file": "^5.0.0",
index be83ed4b0d13a3b5ecd36f9fd024a06609f815db..0558941a24107ad869276c0960fc2c0d59e6d663 100644 (file)
@@ -57,8 +57,8 @@ dependencies:
     specifier: ^6.3.0
     version: 6.3.0
   poolifier:
-    specifier: ^3.1.19
-    version: 3.1.19
+    specifier: ^3.1.20
+    version: 3.1.20
   tar:
     specifier: ^6.2.0
     version: 6.2.0
@@ -1621,8 +1621,8 @@ packages:
     resolution: {integrity: sha512-ytDiArvrn/3Xk6/vtylys5tlY6eo7Ane0hvcx++TKo6RxQXuVfW0AF/oeWqAj9dN29SyhtawuXstgmPlwNcv/A==}
     dev: true
 
-  /@types/semver@7.5.6:
-    resolution: {integrity: sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==}
+  /@types/semver@7.5.7:
+    resolution: {integrity: sha512-/wdoPq1QqkSj9/QOeKkFquEuPzQbHTWAMPH/PaUMB+JuR31lXhlWXRZ52IpfDYVlDOUBvX09uBrPwxGT1hjNBg==}
     dev: true
 
   /@types/stack-utils@2.0.3:
@@ -1783,7 +1783,7 @@ packages:
     dependencies:
       '@eslint-community/eslint-utils': 4.4.0(eslint@8.56.0)
       '@types/json-schema': 7.0.15
-      '@types/semver': 7.5.6
+      '@types/semver': 7.5.7
       '@typescript-eslint/scope-manager': 6.21.0
       '@typescript-eslint/types': 6.21.0
       '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.3.3)
@@ -7715,8 +7715,8 @@ packages:
       semver-compare: 1.0.0
     dev: false
 
-  /poolifier@3.1.19:
-    resolution: {integrity: sha512-H/tg/7FNLdZvL0vkJLy2hkjVQWp7QYaDJ0/lJbb4m1ZDtEhOQ4sKsQLlGGI4+jjyWqFlfieqP7FmJC98r4wWyw==}
+  /poolifier@3.1.20:
+    resolution: {integrity: sha512-UmT6eHbCwb22J+8cDtcjPJaDc7CMpNaTtJ+7QArTOo6F1DMApXBJny8qGllhwYpAscJT6VoMVoQlN1EHksdQOw==}
     engines: {node: '>=18.0.0', pnpm: '>=8.6.0'}
     requiresBuild: true
     dev: false
index f10ca9c8ce0f4fbfbd58a10faf0f44ab6073b20a..f22f195379616c32494623668030a7c8d32de2bd 100644 (file)
@@ -92,6 +92,7 @@ export class WorkerSet extends WorkerAbstract<WorkerData> {
           resolve()
         })
       })
+      worker.unref()
       await worker.terminate()
       await waitWorkerExit
     }
@@ -147,6 +148,8 @@ export class WorkerSet extends WorkerAbstract<WorkerData> {
       ) {
         this.addWorkerSetElement()
       }
+      worker.unref()
+      worker.terminate().catch(error => this.emitter?.emit(WorkerSetEvents.error, error))
     })
     worker.on('online', this.workerOptions.poolOptions?.onlineHandler ?? EMPTY_FUNCTION)
     worker.on('exit', this.workerOptions.poolOptions?.exitHandler ?? EMPTY_FUNCTION)
index 0fc52763ca1f6568b90f21944be6e668bf9ea784..91b94991ff9015cb853d282ac21ca44ce216c5d5 100644 (file)
@@ -900,8 +900,8 @@ packages:
       undici-types: 5.26.5
     dev: true
 
-  /@types/semver@7.5.6:
-    resolution: {integrity: sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==}
+  /@types/semver@7.5.7:
+    resolution: {integrity: sha512-/wdoPq1QqkSj9/QOeKkFquEuPzQbHTWAMPH/PaUMB+JuR31lXhlWXRZ52IpfDYVlDOUBvX09uBrPwxGT1hjNBg==}
     dev: true
 
   /@types/tough-cookie@4.0.5:
@@ -1021,7 +1021,7 @@ packages:
     dependencies:
       '@eslint-community/eslint-utils': 4.4.0(eslint@8.56.0)
       '@types/json-schema': 7.0.15
-      '@types/semver': 7.5.6
+      '@types/semver': 7.5.7
       '@typescript-eslint/scope-manager': 6.21.0
       '@typescript-eslint/types': 6.21.0
       '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.3.3)