From 9bf222780f89611e2e5dd621404eef36c3352f7d Mon Sep 17 00:00:00 2001 From: Massimo Candela Date: Mon, 20 Jul 2020 19:07:45 +0200 Subject: [PATCH] hotfix vrps file reloading memory leak --- package-lock.json | 6 +++--- package.json | 2 +- src/monitors/monitorRPKI.js | 11 ++++++++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 63db89e0..e5e42338 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5939,9 +5939,9 @@ } }, "rpki-validator": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/rpki-validator/-/rpki-validator-2.1.5.tgz", - "integrity": "sha512-Ox8HTJ6IfChDY4g5vhRKfuqFU5gxaOni9kUHAJk+wAveG0cHZ7EPqEqWYa+UBHZP59ug3Ept6SdklUC/gM1Rvw==", + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/rpki-validator/-/rpki-validator-2.1.6.tgz", + "integrity": "sha512-ofSeS+1uqCgBjxfjfr5FDuvRZKDglzZvltKMERvfKD6NSC5klBp1R5iNIfI/yxC1Z7Ezb/sOoxomMO/s8PgnRA==", "requires": { "axios": "^0.19.2", "brembo": "^2.0.4", diff --git a/package.json b/package.json index 5f260b9b..5a5d45c9 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "nodemailer": "^6.4.10", "path": "^0.12.7", "restify": "^8.5.1", - "rpki-validator": "^2.1.5", + "rpki-validator": "^2.1.6", "semver": "^7.3.2", "syslog-client": "^1.1.1", "ws": "^7.3.1", diff --git a/src/monitors/monitorRPKI.js b/src/monitors/monitorRPKI.js index 8f9843eb..a55aff8d 100644 --- a/src/monitors/monitorRPKI.js +++ b/src/monitors/monitorRPKI.js @@ -110,16 +110,21 @@ export default class MonitorRPKI extends Monitor { clearInterval(this.validationTimer); // Stop validation cycle } + if (this.rpki) { + this.rpki.destroy(); + } + this.rpki = new rpki({ connector: "external", - clientId: env.clientId, - vrps + clientId: env.clientId }); + this.rpki.setVRPs(vrps); + this.rpki .preCache() .then(() => { - this.validationTimer = setInterval(this.validateBatch, 100); // If already cached, we can validate more often + this.validationTimer = setInterval(this.validateBatch, 50); // If already cached, we can validate more often }) .catch(() => { this.logger.log({