You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to nod...@googlegroups.com
Hello,
my node.js application uses the cluster module for forking workers and I want to use the new domain module to catch all uncaught exceptions.
Is there a way to fork each worker in an own domain? I tried to wrap the whole application in an domain, but then the error handler is called for each worker.
Thank you
Torben
Dan Milon
unread,
Aug 10, 2012, 8:32:03 AM8/10/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to nod...@googlegroups.com
How did you implement this exactly? (gist?)
You should be able to create a domain inside the slave code that will
fire whenever this specific slave throws.
Or is it a problem that I assign ever domain to the same var?
Torben
Dan Milon
unread,
Aug 10, 2012, 9:40:04 AM8/10/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to nod...@googlegroups.com
That is wrong.
The domain creation should be at the code of the slave.
the slaves are the actual servers that share the port. Thats where the
errors occur.
master is a mere coordinator.
Slave code is at the else part of cluster.isMaster.
Also you create the server without regard of weather the process is
master / slave. Functionally its the same (since you only listen for the
slave) but i consider it bad practice.
So the server creation code should go at the else part also.
>
> > You received this message because you are subscribed to the Google
> > Groups "nodejs" group.
> > To post to this group, send email to nod...@googlegroups.com
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to nod...@googlegroups.com
Almost correct.
But you have to add the 'error' listener before the .run call.
.run will immediately call the provided function, so if an error happens
immediately, you wont catch it.
bind here refers to the documented domain#bind method.
Good luck.
danmilon.
Message has been deleted
Honigbaum
unread,
Aug 10, 2012, 11:43:43 AM8/10/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to nod...@googlegroups.com
Thank you!
I've refactored my code.
Does anyone know if it is possible to render an error page with express, when an uncaught error is catched by the error listener of the domain? Or is it necessary to create a separate domain for ever request?