Commit a1755792 authored by Wandenberg Peixoto's avatar Wandenberg Peixoto

fix memory leak when recovering channel from trash, wrongly reinitializing...

fix memory leak when recovering channel from trash, wrongly reinitializing workers_with_subscribers queue
parent 1745a5e6
h1(#changelog). Changelog
* Fixing memory leak when recovering channel from trash, the workers_with_subscribers queue was wrongly reinitialized without free the memory on it
* Changed default value of push_stream_message_ttl to 30 minutes to avoid memory leak of a message which is never discarded
h2. Version 0.3.3
......
......@@ -27,6 +27,6 @@
#define NGX_HTTP_PUSH_STREAM_MODULE_VERSION_H_
static const ngx_str_t NGX_HTTP_PUSH_STREAM_TAG = ngx_string("0.3.3");
static const ngx_str_t NGX_HTTP_PUSH_STREAM_COMMIT = ngx_string("851615d53faea9628d2125cf1f52c6e8455a3970");
static const ngx_str_t NGX_HTTP_PUSH_STREAM_COMMIT = ngx_string("1745a5e65a0c1a6b53cfab1ace68911c6031b778");
#endif /* NGX_HTTP_PUSH_STREAM_MODULE_VERSION_H_ */
......@@ -85,10 +85,7 @@ ngx_http_push_stream_initialize_channel(ngx_http_push_stream_channel_t *channel)
channel->deleted = 0;
channel->expires = 0;
// initialize queues
ngx_queue_init(&channel->message_queue.queue);
ngx_queue_init(&channel->workers_with_subscribers.queue);
channel->message_queue.deleted = 0;
channel->node.key = ngx_crc32_short(channel->id.data, channel->id.len);
......@@ -218,6 +215,9 @@ ngx_http_push_stream_get_channel(ngx_str_t *id, ngx_log_t *log, ngx_http_push_st
ngx_http_push_stream_initialize_channel(channel);
// initialize workers_with_subscribers queues only when a channel is created
ngx_queue_init(&channel->workers_with_subscribers.queue);
ngx_shmtx_unlock(&shpool->mutex);
return channel;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment