Skip to content

Commit

Permalink
fixed memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
acarioni committed Oct 14, 2022
1 parent a0e1aa1 commit bdd9dda
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 29 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG_Nodejs.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# SDK for Node.js Clients CHANGELOG

## 8.0.5 build 1791

<i>Compatible with Lightstreamer Server since 7.0.</i><br/>
<i>Compatible with code developed with the previous version.</i><br/>
<i>Released on 14 Oct 2022</i>

<!--10/10/2022-->
Fixed a bug that, upon a session recovery, could have caused a memory leak.


## 8.0.4 build 1790

<i>Compatible with Lightstreamer Server since 7.0.</i><br/>
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG_Web.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# SDK for Web Clients CHANGELOG

## 8.0.7 build 1808

<i>Compatible with Lightstreamer Server since 7.1.</i><br/>
<i>Compatible with code developed with the previous version.</i><br/>
<i>Released on 14 Oct 2022</i>

<!--10/10/2022-->
Fixed a bug that, upon a session recovery, could have caused a memory leak.


## 8.0.6 build 1807

<i>Compatible with Lightstreamer Server since 7.1.</i><br/>
Expand Down
14 changes: 1 addition & 13 deletions source/engine/EvalQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ import EncodingUtils from "./EncodingUtils";
this.LS_MPNOK = this.LS_window['LS_MPNOK'];
this.LS_MPNDEL = this.LS_window['LS_MPNDEL'];
this.dequeueAction = this.generateClosure(this["lsc"]);
/*
* If the server sends PROGs, the client captures messages between two consecutive PROGs
* to ease debugging in case of mismatch between the server and the client counters.
*/
this.messageCaptureEnabled = false;
this.capturedMessages = [];
};

EvalQueue.prototype = {
Expand Down Expand Up @@ -134,9 +128,6 @@ import EncodingUtils from "./EncodingUtils";
}
try {
var msg = new TlcpServerMessage(line);
if (this.messageCaptureEnabled) {
this.capturedMessages.push(msg.getRawMsg());
}
switch (msg.getField(0)) {

case "U":
Expand Down Expand Up @@ -459,10 +450,7 @@ import EncodingUtils from "./EncodingUtils";
// PROG,<number>
var phase = null
var prog = msg.getFieldAsInt(1);
this.LS_e(7, phase, prog, this.capturedMessages);
/* */
this.messageCaptureEnabled = true;
this.capturedMessages = [];
this.LS_e(7, phase, prog);
},

processPROBE: function(msg) {
Expand Down
13 changes: 5 additions & 8 deletions source/engine/PushEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,17 +226,14 @@ import Constants from "../Constants";
this.sessionHandler.onSyncReceived(arg3);

} else if (flag == 7) {
// NB when PROG, the fourth argument is not the control link but an array with the messages
// received between the previous and the current PROG
var capturedMessages = controlLink;
this.onProg(arg3, capturedMessages);
this.onProg(arg3);

} else {
this.sessionHandler.onEnd("Unsupported Server version");
}
},

onProg: function(prog, capturedMessages) {
onProg: function(prog) {
if (this.sessionHandler.getSessionId() != this.currentIdForProg) {
// the associated sessionHandler object can be reused without notice
this.currentProg = null;
Expand All @@ -249,7 +246,7 @@ import Constants from "../Constants";
//>>excludeStart("debugExclude", pragmas.debugExclude);
ASSERT.fail();
//>>excludeEnd("debugExclude");
protocolLogger.logError("Received event prog higher than expected",prog,sessionProg,capturedMessages);
protocolLogger.logError("Received event prog higher than expected",prog,sessionProg);
this.sessionHandler.onPROGCounterMismatch();
}
} else {
Expand All @@ -260,13 +257,13 @@ import Constants from "../Constants";
//>>excludeStart("debugExclude", pragmas.debugExclude);
ASSERT.fail();
//>>excludeEnd("debugExclude");
protocolLogger.logError("Received event prog different than expected",prog,this.currentProg,capturedMessages);
protocolLogger.logError("Received event prog different than expected",prog,this.currentProg);
this.sessionHandler.onPROGCounterMismatch();
} else if (prog != sessionProg) {
//>>excludeStart("debugExclude", pragmas.debugExclude);
ASSERT.fail();
//>>excludeEnd("debugExclude");
protocolLogger.logError("Received event prog different than actual",prog,sessionProg,capturedMessages);
protocolLogger.logError("Received event prog different than actual",prog,sessionProg);
this.sessionHandler.onPROGCounterMismatch();
}
}
Expand Down
12 changes: 6 additions & 6 deletions tools/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ const argv = require('minimist')(process.argv.slice(2), {
'format': ['esm', 'cjs', 'cjs_min', 'umd', 'umd_min'],
'config': 'build.config.js'}});

const defaultWebVersion = '8.0.6';
const defaultWebBuild = '1807';
const defaultNodeVersion = '8.0.4';
const defaultNodeBuild = '1790';
const defaultWebVersion = '8.0.7';
const defaultWebBuild = '1808';
const defaultNodeVersion = '8.0.5';
const defaultNodeBuild = '1791';

const config = require(path.resolve(argv.config));
config.webVersion = argv.version ? argv.version : defaultWebVersion;
config.webBuild = argv.build ? argv.build : defaultWebBuild;
config.nodeVersion = argv.version ? argv.version : defaultNodeVersion;
config.nodeBuild = argv.build ? argv.build : defaultNodeBuild;

const defaultWebCid = 'pcYgxn8m8%20feOojyA1U661l3g2.pz47AfD3nBwCvsh'
const defaultNodeCid = 'tqGko0tg4pkpW3DAK3Q4hwLri8LBV74eXyyz3u'
const defaultWebCid = 'pcYgxn8m8%20feOojyA1U661m3g2.pz47AfE3nBwCvsj'
const defaultNodeCid = 'tqGko0tg4pkpW3DAK3R4hwLri8LBV84eXyyz3w'
const webCid = argv.LS_web_cid ? argv.LS_web_cid : defaultWebCid
const nodeCid = argv.LS_node_cid ? argv.LS_node_cid : defaultNodeCid

Expand Down
2 changes: 1 addition & 1 deletion tools/dist-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lightstreamer-client-node",
"version": "8.0.4",
"version": "8.0.5",
"description": "This package includes the resources needed to write a Lightstreamer client.",
"license": "Apache-2.0",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion tools/dist/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lightstreamer-client-web",
"version": "8.0.6",
"version": "8.0.7",
"description": "This package includes the resources needed to write a Lightstreamer client.",
"license": "Apache-2.0",
"keywords": [
Expand Down

0 comments on commit bdd9dda

Please sign in to comment.