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

Memory leak when using push-stream-module in Nginx 1.8 #235

Closed qianxinyu closed 7 years ago

qianxinyu commented 8 years ago

When I use push-stream-module in the latest Nginx version (1.8), I set the message shared memory to about 100M and I find there are many error logs in the Nginx error log like "ngx_slab_alloc() failed: no memory". It seems Nginx cannot control the memory usage (even I set the message shared memory to some bigger number). Have I missed any nginx configuration if I want to solve the memory leak problem? Please help, thanks!

wandenberg commented 8 years ago

@qianxinyu first we have to check if the value set for shared memory is enough to your application. The value vary depending on the number of subscribers, the number of channels, the rate of published messages, if the messages are stored or not, the ttl set to discard messages, and so on. To check if you are really having a memory leak or not you can start the server, make requests until the memory goes full, wait some time without restart the server and make requests to it again. You also can follow what is going on the shm making requests to the stats location (configure one if needed). Another point to check is if for some reason your workers are dying (segfault or explicit kill command).