Background process hangs when logging a lot
I am facing a strange issue.
I start java process using grunt-run plugin putting it into background ({wait: true}) passing control to another task which talks to the first one over http. The first one starts logging lots of messages after a while, which causes everything to hang.
If I decrease logging level, then everything works fine.
It seems like a bug to me.
Thanks, Marcin
@marcingrabda yeah, the stdout queues can fill up after a while. If you're using the latest version it definitely is a bug
Is there any workaround?
Can you answer these please?
- What version of grunt-run are you using?
- What version of node are you using?
- What is the exact configuration you are using for grunt run?
- grunt-run 0.3.0
- node 0.10.35 (tried also with 0.12.3)
- My configuration:
var grunt = require('grunt');
module.exports = {
backend: {
cmd: 'java',
args: [
'-jar',
grunt.file.expand('../build/libs/*.jar')
],
options: {
wait: false,
ready: /Tomcat started on port\(s\): 9000 \(http\)/
}
}
};
Adding {quiet: true} does not help.
I'm starting this process as a first task in a series of tasks in grunt:
grunt.task.run(['run:backend', '...']);
I was investigating the issue, when I realized that once the run:backend task passes control to a next task, it stops logging (somehow it loses its ability to log) to stdout and this must be why it fills up its stdout buffer.
I'm not so familiar with streams in node.js, but it seems that in order to fix the issue, we need to redirect the stream somewhere. Additional piping, however, does not work.