wandenberg / nginx-push-stream-module

A pure stream http push technology for your Nginx setup. Comet made easy and really scalable.
Other
2.22k stars 295 forks source link

Fix reload memory leak #60

Closed ajwans closed 11 years ago

ajwans commented 11 years ago

Each channel structure includes a list of workers to notify (workers_with_subscriptions) when new messages arrive for the channel, the exit of a worker does not remove it's entry from the subscriptions list. This means that a receiving worker copies a new message to a worker which no longer exists and the message is never processed.

If a new worker is occupying the slot where an old one was it will simply discard messages not intended for it. However, when no worker is on a slot for which messages arrive they simply accumulate and leak all our memory away.

wandenberg commented 11 years ago

Hi Andrew,

I updated the code with this change. I only add a case to solve the same problem when a worker die, add some tests and removed the changes on ngx_http_push_stream_register_worker_message_handler function, it isn't needed.

Thanks for your help.

Regards, Wandenberg