I have a script file in Node js with a function that recursively calls 
itself after sometime outs. 

This function sends out a "message" to which parent is listening.

This parent is nothing but a REST api with basic CRUD operations. 

In this file, this is what forking part looks like:

    var myBgTask = 
require('child_process').fork('./server/api/thing/bgTask.js', [], { 
execArgv: ['--debug=5859']});
    myBgTask.on('message', function(data){
      //DO SOMETHING
    })

Now, when from my angular code, I make a request to update the database, 
somehow the child process gets interrupted and throws Channel closed error 
at this line:

    process.send({
        name: randomThing,
        readByUser: false 
       }, function(err){
        console.log("error", err)
        if(!err)
             setTimeout(autoCreate, randomNumb * 1000);
    
       });

and thus my server stops and I never am able to make http `post`/`put` 
calls. 

Strange part is that it throws error only when I am making `post` or `put` 
calls and never with `get` calls. 

I have been trying to debug this but have not been able to find out what 
the problem is. Can I get some help here on this?

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/9e391908-4720-4f8f-a4f3-82fec375604e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to