From f3167964f48d76e65994f61d1d4e2460e0bf8621 Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Tue, 16 Jan 2018 11:51:09 +0100 Subject: [PATCH 1/3] In case there is an error parsing one of the messages in a file, catch rather than blowing up --- storage/file.js | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/storage/file.js b/storage/file.js index 46f8a83f5..5d5d8c3db 100644 --- a/storage/file.js +++ b/storage/file.js @@ -257,24 +257,23 @@ var getMessages = function (env, chanName, handler, cb) { return; } var errorState = false; - try { - readMessages(chan.path, function (msg) { - if (!msg || errorState) { return; } - //console.log(msg); + readMessages(chan.path, function (msg) { + if (!msg || errorState) { return; } + //console.log(msg); + try { handler(msg); - }, function (err) { - if (err) { - errorState = true; - return void cb(err); - } - chan.atime = +new Date(); - cb(); - }); - } catch (err2) { - console.error(err2); - cb(err2); - return; - } + } catch (e) { + errorState = true; + return void cb(err); + } + }, function (err) { + if (err) { + errorState = true; + return void cb(err); + } + chan.atime = +new Date(); + cb(); + }); }); }; From 3118dd8312beaa60497c481cbd66c0bfa193a350 Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 16 Jan 2018 11:52:04 +0100 Subject: [PATCH 2/3] set logLevel to 2 by default for sframe apps --- www/common/sframe-chainpad-netflux-inner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/common/sframe-chainpad-netflux-inner.js b/www/common/sframe-chainpad-netflux-inner.js index 71359ba4a..9467d8dae 100644 --- a/www/common/sframe-chainpad-netflux-inner.js +++ b/www/common/sframe-chainpad-netflux-inner.js @@ -40,7 +40,7 @@ define([ var patchTransformer = config.patchTransformer; var validateContent = config.validateContent; var avgSyncMilliseconds = config.avgSyncMilliseconds; - var logLevel = typeof(config.logLevel) !== 'undefined'? config.logLevel : 1; + var logLevel = typeof(config.logLevel) !== 'undefined'? config.logLevel : 2; var readOnly = config.readOnly || false; var sframeChan = config.sframeChan; var metadataMgr = config.metadataMgr; From 137c6428e8b2cc7b55e006909b593ca4bdd564b2 Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Tue, 16 Jan 2018 11:53:23 +0100 Subject: [PATCH 3/3] Introducing heapdump to allow collecting more data from the server --- config.example.js | 7 +++++++ package.json | 1 + 2 files changed, 8 insertions(+) diff --git a/config.example.js b/config.example.js index 6d1104497..bcc7a6773 100644 --- a/config.example.js +++ b/config.example.js @@ -3,6 +3,13 @@ globals module */ var domain = ' http://localhost:3000/'; + +// You can `kill -USR2` the node process and it will write out a heap dump. +// If your system doesn't support dumping, comment this out and install with +// `npm install --production` +// See: https://strongloop.github.io/strongloop.com/strongblog/how-to-heap-snapshots/ +require('heapdump'); + module.exports = { // the address you want to bind to, :: means all ipv4 and ipv6 addresses diff --git a/package.json b/package.json index e6862775b..d3e44d0a7 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ }, "devDependencies": { "flow-bin": "^0.59.0", + "heapdump": "^0.3.9", "jshint": "~2.9.1", "less": "2.7.1", "lesshint": "^4.5.0",