Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server cannot handle cluster worker unhandled exception #21

Open
lyonlai opened this issue Sep 2, 2017 · 3 comments
Open

Server cannot handle cluster worker unhandled exception #21

lyonlai opened this issue Sep 2, 2017 · 3 comments

Comments

@lyonlai
Copy link

lyonlai commented Sep 2, 2017

Hi there,

Love the library as it's quite simple to use. Got question about the communication between worker & master

At the moment the communication is from worker reporting to the master via worker's process.send

and the server is listening on 'message' event. But when a process has gone south and new worker spins up. the server will not get the new message as there's no listening in the fork event on the cluster.

I'm hitting this problem right now. and I think there are two ways to solve it.

  1. make the server.cluster.proxy to listen on 'fork' event and make it pick up new workers.

  2. use cluster.worker.send in the client and process.on('message') on the server proxy.

feels to me the second way is more natural. Thought?

I can quickly submit a PR if you want. Let me know if you want to think more about it.

Cheers

@lyonlai
Copy link
Author

lyonlai commented Sep 2, 2017

nvm what I said about No.2, after some reading I'll just put an event handler on fork so that server can handle newly spin up workers.

@dgaubert
Copy link
Owner

dgaubert commented Sep 3, 2017

Thanks for the feedback!

As you said, I'll go for option 1. I'm totally open to contributions, so I encourage you to send a PR. It'd be very nice.

To be honest, currently I don't use this library. I believe a server should not collect, aggregate and expose it own metrics. Said that, under some circumstances express-metrics is still useful.

I'll take a look to the process messaging when a worker disconnects and a new one is forked.

@lyonlai
Copy link
Author

lyonlai commented Sep 3, 2017

Well as long as the stats port is different and not open to public. I'm ok as I'm at the moment try to come up with some stats quick to verify my idea. It's quite useful. Also the stated part is cool too.

Btw what do you use now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants