FATAL ERROR: v8::FromJust Maybe value is Nothing

People coming here from search engines, read #6899 (comment)


segmentation fault when simple mqtt client tries to send 40kb data to broker.
4.x versions of node crash with "console.log is not a function"
Program does not crash when i remove the // before the first console.log.
Seems to work under 32 bit.

steps to reproduce:

$ npm install mqtt mosca
$ node_modules/.bin/mosca &
...
$ node crash.js 
FATAL ERROR: v8::FromJust Maybe value is Nothing.
Aborted (core dumped)

$ cat crash.js
var mqtt    = require('mqtt');
var client  = mqtt.connect('mqtt://localhost');
var todo=5000;

client.on('connect', function () {
//  console.log("WTF");
  client.subscribe('config/#');
  pubs();
});

function pubs()
{
  if(todo>0)
{
  todo-=1;
 client.publish('c/'+todo, '' ,pubs);
} else
{
  console.log("END");
  client.end();
}
}