memory leak fixes

This commit is contained in:
Dave Horton
2022-02-08 20:29:54 -05:00
parent cfe9397502
commit de83f735ea
5 changed files with 37 additions and 31 deletions

View File

@@ -453,7 +453,7 @@ class Conference extends Task {
this._playSession = null; this._playSession = null;
break; break;
} }
} while (!this.killed && !this.conf_hold_status === 'hold'); } while (!this.killed && this.conf_hold_status !== 'hold');
} }
/** /**

View File

@@ -382,7 +382,9 @@ class TaskDial extends Task {
sd sd
.on('callCreateFail', () => { .on('callCreateFail', () => {
clearTimeout(this.timerRing);
this.dials.delete(sd.callSid); this.dials.delete(sd.callSid);
sd.removeAllListeners();
if (this.dials.size === 0 && !this.sd) { if (this.dials.size === 0 && !this.sd) {
this.logger.debug('Dial:_attemptCalls - all calls failed after call create err, ending task'); this.logger.debug('Dial:_attemptCalls - all calls failed after call create err, ending task');
this.kill(cs); this.kill(cs);
@@ -424,6 +426,7 @@ class TaskDial extends Task {
}) })
.on('accept', async() => { .on('accept', async() => {
this.logger.debug(`Dial:_attemptCalls - we have a winner: ${sd.callSid}`); this.logger.debug(`Dial:_attemptCalls - we have a winner: ${sd.callSid}`);
clearTimeout(this.timerRing);
try { try {
await this._connectSingleDial(cs, sd); await this._connectSingleDial(cs, sd);
} catch (err) { } catch (err) {
@@ -432,7 +435,9 @@ class TaskDial extends Task {
}) })
.on('decline', () => { .on('decline', () => {
this.logger.debug(`Dial:_attemptCalls - declined: ${sd.callSid}`); this.logger.debug(`Dial:_attemptCalls - declined: ${sd.callSid}`);
clearTimeout(this.timerRing);
this.dials.delete(sd.callSid); this.dials.delete(sd.callSid);
sd.removeAllListeners();
if (this.dials.size === 0 && !this.sd) { if (this.dials.size === 0 && !this.sd) {
this.logger.debug('Dial:_attemptCalls - all calls failed after decline, ending task'); this.logger.debug('Dial:_attemptCalls - all calls failed after decline, ending task');
this.kill(cs); this.kill(cs);

View File

@@ -215,6 +215,7 @@ class SingleDialer extends Emitter {
if (this.confirmHook) this._executeApp(this.confirmHook); if (this.confirmHook) this._executeApp(this.confirmHook);
else this.emit('accept'); else this.emit('accept');
} catch (err) { } catch (err) {
this.inviteInProgress = null;
const status = {callStatus: CallStatus.Failed}; const status = {callStatus: CallStatus.Failed};
if (err instanceof SipError) { if (err instanceof SipError) {
status.sipStatus = err.status; status.sipStatus = err.status;

58
package-lock.json generated
View File

@@ -13,7 +13,7 @@
"@jambonz/db-helpers": "^0.6.16", "@jambonz/db-helpers": "^0.6.16",
"@jambonz/http-health-check": "^0.0.1", "@jambonz/http-health-check": "^0.0.1",
"@jambonz/mw-registrar": "^0.2.1", "@jambonz/mw-registrar": "^0.2.1",
"@jambonz/realtimedb-helpers": "^0.4.19", "@jambonz/realtimedb-helpers": "^0.4.21",
"@jambonz/stats-collector": "^0.1.6", "@jambonz/stats-collector": "^0.1.6",
"@jambonz/time-series": "^0.1.6", "@jambonz/time-series": "^0.1.6",
"aws-sdk": "^2.1060.0", "aws-sdk": "^2.1060.0",
@@ -546,16 +546,16 @@
} }
}, },
"node_modules/@jambonz/realtimedb-helpers": { "node_modules/@jambonz/realtimedb-helpers": {
"version": "0.4.19", "version": "0.4.21",
"resolved": "https://registry.npmjs.org/@jambonz/realtimedb-helpers/-/realtimedb-helpers-0.4.19.tgz", "resolved": "https://registry.npmjs.org/@jambonz/realtimedb-helpers/-/realtimedb-helpers-0.4.21.tgz",
"integrity": "sha512-wEc7OXogQ5SZ9mgLNxviBNY0WvUKGGztyDzze3oi44edsZp0vNneVHUmdZuDzuDvUMBqsvCa0fvri8LGaxovlw==", "integrity": "sha512-+MlCe+eY0by57CxqSLk03rl0frrJV6J16DErvIxbmkytOUWlEZkBxwxsoPjErWVom7hNyKEnCmZXMIHT2Kfocg==",
"dependencies": { "dependencies": {
"@google-cloud/text-to-speech": "^3.4.0", "@google-cloud/text-to-speech": "^3.4.0",
"@jambonz/promisify-redis": "^0.0.6", "@jambonz/promisify-redis": "^0.0.6",
"aws-sdk": "^2.1060.0", "aws-sdk": "^2.1060.0",
"bent": "^7.3.12", "bent": "^7.3.12",
"debug": "^4.3.3", "debug": "^4.3.3",
"microsoft-cognitiveservices-speech-sdk": "^1.19.0", "microsoft-cognitiveservices-speech-sdk": "^1.20.0",
"redis": "^3.1.2" "redis": "^3.1.2"
} }
}, },
@@ -3506,9 +3506,9 @@
} }
}, },
"node_modules/microsoft-cognitiveservices-speech-sdk": { "node_modules/microsoft-cognitiveservices-speech-sdk": {
"version": "1.19.0", "version": "1.20.0",
"resolved": "https://registry.npmjs.org/microsoft-cognitiveservices-speech-sdk/-/microsoft-cognitiveservices-speech-sdk-1.19.0.tgz", "resolved": "https://registry.npmjs.org/microsoft-cognitiveservices-speech-sdk/-/microsoft-cognitiveservices-speech-sdk-1.20.0.tgz",
"integrity": "sha512-FYyXdJcTLX8Iunnn9XHzTfR+43YdEZn1q89KX6Vzqtaa4hz/LemdC9Zni50VIfkXMNtq2sJFYf5wKXvxm1wQHA==", "integrity": "sha512-/KWNHQb36nhIkBr6HClh+T+gHicgmC5JKJhCnQmL6XGAAndLtew0aRbh7cMK10IFNTgozGKiejhrfnwiYH3IBA==",
"hasInstallScript": true, "hasInstallScript": true,
"dependencies": { "dependencies": {
"agent-base": "^6.0.1", "agent-base": "^6.0.1",
@@ -3520,7 +3520,7 @@
"simple-lru-cache": "0.0.2", "simple-lru-cache": "0.0.2",
"url-parse": "^1.4.7", "url-parse": "^1.4.7",
"uuid": "^8.3.0", "uuid": "^8.3.0",
"ws": "^7.3.1" "ws": "^7.5.6"
} }
}, },
"node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/https-proxy-agent": { "node_modules/microsoft-cognitiveservices-speech-sdk/node_modules/https-proxy-agent": {
@@ -5114,9 +5114,9 @@
} }
}, },
"node_modules/url-parse": { "node_modules/url-parse": {
"version": "1.5.3", "version": "1.5.4",
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.3.tgz", "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.4.tgz",
"integrity": "sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==", "integrity": "sha512-ITeAByWWoqutFClc/lRZnFplgXgEZr3WJ6XngMM/N9DMIm4K8zXPCZ1Jdu0rERwO84w1WC5wkle2ubwTA4NTBg==",
"dependencies": { "dependencies": {
"querystringify": "^2.1.1", "querystringify": "^2.1.1",
"requires-port": "^1.0.0" "requires-port": "^1.0.0"
@@ -5343,9 +5343,9 @@
} }
}, },
"node_modules/ws": { "node_modules/ws": {
"version": "7.5.5", "version": "7.5.7",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.5.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.7.tgz",
"integrity": "sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w==", "integrity": "sha512-KMvVuFzpKBuiIXW3E4u3mySRO2/mCHSyZDJQM5NQ9Q9KHWHWh0NHgfbRMLLrceUK5qAL4ytALJbpRMjixFZh8A==",
"engines": { "engines": {
"node": ">=8.3.0" "node": ">=8.3.0"
}, },
@@ -5876,16 +5876,16 @@
} }
}, },
"@jambonz/realtimedb-helpers": { "@jambonz/realtimedb-helpers": {
"version": "0.4.19", "version": "0.4.21",
"resolved": "https://registry.npmjs.org/@jambonz/realtimedb-helpers/-/realtimedb-helpers-0.4.19.tgz", "resolved": "https://registry.npmjs.org/@jambonz/realtimedb-helpers/-/realtimedb-helpers-0.4.21.tgz",
"integrity": "sha512-wEc7OXogQ5SZ9mgLNxviBNY0WvUKGGztyDzze3oi44edsZp0vNneVHUmdZuDzuDvUMBqsvCa0fvri8LGaxovlw==", "integrity": "sha512-+MlCe+eY0by57CxqSLk03rl0frrJV6J16DErvIxbmkytOUWlEZkBxwxsoPjErWVom7hNyKEnCmZXMIHT2Kfocg==",
"requires": { "requires": {
"@google-cloud/text-to-speech": "^3.4.0", "@google-cloud/text-to-speech": "^3.4.0",
"@jambonz/promisify-redis": "^0.0.6", "@jambonz/promisify-redis": "^0.0.6",
"aws-sdk": "^2.1060.0", "aws-sdk": "^2.1060.0",
"bent": "^7.3.12", "bent": "^7.3.12",
"debug": "^4.3.3", "debug": "^4.3.3",
"microsoft-cognitiveservices-speech-sdk": "^1.19.0", "microsoft-cognitiveservices-speech-sdk": "^1.20.0",
"redis": "^3.1.2" "redis": "^3.1.2"
} }
}, },
@@ -8212,9 +8212,9 @@
"integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
}, },
"microsoft-cognitiveservices-speech-sdk": { "microsoft-cognitiveservices-speech-sdk": {
"version": "1.19.0", "version": "1.20.0",
"resolved": "https://registry.npmjs.org/microsoft-cognitiveservices-speech-sdk/-/microsoft-cognitiveservices-speech-sdk-1.19.0.tgz", "resolved": "https://registry.npmjs.org/microsoft-cognitiveservices-speech-sdk/-/microsoft-cognitiveservices-speech-sdk-1.20.0.tgz",
"integrity": "sha512-FYyXdJcTLX8Iunnn9XHzTfR+43YdEZn1q89KX6Vzqtaa4hz/LemdC9Zni50VIfkXMNtq2sJFYf5wKXvxm1wQHA==", "integrity": "sha512-/KWNHQb36nhIkBr6HClh+T+gHicgmC5JKJhCnQmL6XGAAndLtew0aRbh7cMK10IFNTgozGKiejhrfnwiYH3IBA==",
"requires": { "requires": {
"agent-base": "^6.0.1", "agent-base": "^6.0.1",
"asn1.js-rfc2560": "^5.0.1", "asn1.js-rfc2560": "^5.0.1",
@@ -8225,7 +8225,7 @@
"simple-lru-cache": "0.0.2", "simple-lru-cache": "0.0.2",
"url-parse": "^1.4.7", "url-parse": "^1.4.7",
"uuid": "^8.3.0", "uuid": "^8.3.0",
"ws": "^7.3.1" "ws": "^7.5.6"
}, },
"dependencies": { "dependencies": {
"https-proxy-agent": { "https-proxy-agent": {
@@ -9476,9 +9476,9 @@
} }
}, },
"url-parse": { "url-parse": {
"version": "1.5.3", "version": "1.5.4",
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.3.tgz", "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.4.tgz",
"integrity": "sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ==", "integrity": "sha512-ITeAByWWoqutFClc/lRZnFplgXgEZr3WJ6XngMM/N9DMIm4K8zXPCZ1Jdu0rERwO84w1WC5wkle2ubwTA4NTBg==",
"requires": { "requires": {
"querystringify": "^2.1.1", "querystringify": "^2.1.1",
"requires-port": "^1.0.0" "requires-port": "^1.0.0"
@@ -9662,9 +9662,9 @@
} }
}, },
"ws": { "ws": {
"version": "7.5.5", "version": "7.5.7",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.5.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.7.tgz",
"integrity": "sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w==", "integrity": "sha512-KMvVuFzpKBuiIXW3E4u3mySRO2/mCHSyZDJQM5NQ9Q9KHWHWh0NHgfbRMLLrceUK5qAL4ytALJbpRMjixFZh8A==",
"requires": {} "requires": {}
}, },
"xml2js": { "xml2js": {

View File

@@ -30,7 +30,7 @@
"@jambonz/db-helpers": "^0.6.16", "@jambonz/db-helpers": "^0.6.16",
"@jambonz/http-health-check": "^0.0.1", "@jambonz/http-health-check": "^0.0.1",
"@jambonz/mw-registrar": "^0.2.1", "@jambonz/mw-registrar": "^0.2.1",
"@jambonz/realtimedb-helpers": "^0.4.19", "@jambonz/realtimedb-helpers": "^0.4.21",
"@jambonz/stats-collector": "^0.1.6", "@jambonz/stats-collector": "^0.1.6",
"@jambonz/time-series": "^0.1.6", "@jambonz/time-series": "^0.1.6",
"aws-sdk": "^2.1060.0", "aws-sdk": "^2.1060.0",