Using the following code in NodeJs:
const { fork } = require('child_process');
const thread = fork(path.join(__dirname, '/thread.js'));
thread.on('message', (results) => {
console.log('RES', results.length);
if (results.error) {
res.send({ error: true, message: results.message });
return;
}
res.send(results.data);
});
thread.on('error', (err) => {
console.log(err);
});
thread.send({ data: JSON.stringify(dataToProcess) });
thread.on('exit', () => {
if (thread) {
thread.kill();
return;
}
});
When sending larger (1.5mb) messages from child to parent, it doesn't send anything. Smaller messages are sent without issue. Is there some hard limit? If so, can it be increased?
Testing different payload sizes now:
1mb - fails to send
0.5mb - fails
0.2mb - fails
0.15mb - ok
0.1mb - ok
On windows its OK....linux seems to have a limit