Like many have commented on here it seems that the updateNotification module will often crash and cause the MM to display a black screen and the logs to show an out of memory error. The suggestion by many has been to disable the updateNotification module. I too had this problem and this week went about looking into what was going on. I found a post that indicated the problem could be due to the module firing off update checks for ALL installed modules simultaneously. That intrigued me to think about if it was possible to use the javascript setTimeout() function to add a delay between each modules update check. In updateNotification’s node_helper.js file I added the setTimeout() around the sg.git.fetch() call with a 60sec delay added for each module to be checked:
var i = 1;
simpleGits.forEach(function(sg) {
console.log("scheduling update of " + sg.module);
setTimeout(function(){
var time = new Date();
console.log(time.getHours() + ":" + time.getMinutes() + ":" + time.getSeconds() + "-->" + sg.module);
sg.git.fetch().status(function(err, data) {
.....
}, 60000*i);
i++;
});
This did what I expected in that the modules were updated 1 at a time with a 60sec delay between each. However, as I had the debugging statement to print out when the module was scheduled and when it actually fired I noticed something odd.
On the first updateInterval all modules were updated as expected.
On the 2nd updateInterval each modules was updated 2 times.
On the 3rd updateInterval each modules was updated 3 times.
etc …
It appears that there is a bug in the updateNotification module in that it just keeps appending all of the modules to the end of an array and on the updateInterval it checks all rows in the array. So in my case the first update fires off 6 checks at the same time, the 2nd update 12 checks, the 3rd update 18 checks, …, the 20th check 120 checks. I can see how this could easily run into an out of memory condition if there are many modules to checked and all are fired off at the same time especially on a machine such as a pi with limited memory to start with.
As a test I have taken out my setTimeout code and added in a line to clear the contents of the simpleGits array after each update. For example I now have this:
this.scheduleNextFetch(this.config.updateInterval);
simpleGits.length = 0;
},
scheduleNextFetch: function(delay) {
Has anyone seen this or think this may be the cause of the updateNotification out of memory errors?